diff options
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index b8645e2..6f10f51 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1544,16 +1544,37 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1544 | needRegionSave = true; | 1544 | needRegionSave = true; |
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | // bypass terrain image for large regions | 1547 | if(mapbmp != null) |
1548 | if (m_scene.RegionInfo.RegionSizeX <= Constants.RegionSize && | ||
1549 | m_scene.RegionInfo.RegionSizeY <= Constants.RegionSize | ||
1550 | && mapbmp != null) | ||
1551 | { | 1548 | { |
1552 | try | 1549 | try |
1553 | { | 1550 | { |
1554 | byte[] data; | 1551 | byte[] data; |
1555 | 1552 | ||
1556 | data = OpenJPEG.EncodeFromImage(mapbmp, true); | 1553 | // if large region limit its size since new viewers will not use it |
1554 | // but it is still usable for ossl | ||
1555 | if(m_scene.RegionInfo.RegionSizeX > Constants.RegionSize || | ||
1556 | m_scene.RegionInfo.RegionSizeY > Constants.RegionSize) | ||
1557 | { | ||
1558 | int bx = mapbmp.Width; | ||
1559 | int by = mapbmp.Height; | ||
1560 | int mb = bx; | ||
1561 | if(mb < by) | ||
1562 | mb = by; | ||
1563 | if(mb > 2 * Constants.RegionSize && mb > 0) | ||
1564 | { | ||
1565 | float scale = 2.0f * (float)Constants.RegionSize/(float)mb; | ||
1566 | Size newsize = new Size(); | ||
1567 | newsize.Width = (int)(bx * scale); | ||
1568 | newsize.Height = (int)(by * scale); | ||
1569 | |||
1570 | using(Bitmap scaledbmp = new Bitmap(mapbmp,newsize)) | ||
1571 | data = OpenJPEG.EncodeFromImage(scaledbmp, true); | ||
1572 | } | ||
1573 | else | ||
1574 | data = OpenJPEG.EncodeFromImage(mapbmp, true); | ||
1575 | } | ||
1576 | else | ||
1577 | data = OpenJPEG.EncodeFromImage(mapbmp, true); | ||
1557 | 1578 | ||
1558 | if (data != null && data.Length > 0) | 1579 | if (data != null && data.Length > 0) |
1559 | { | 1580 | { |