enable the upload region map texture asset for large regions for large regions that i had disabled, but with max size reduced to 512pixels. New viewers don't use this, but osGetRegionMapTexture needs it ( mantis 7787 )

LSLKeyTest
UbitUmarov 2015-12-24 11:20:46 +00:00
parent 37cb24da60
commit 7430c629aa
1 changed files with 26 additions and 5 deletions

View File

@ -1544,16 +1544,37 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
needRegionSave = true;
}
// bypass terrain image for large regions
if (m_scene.RegionInfo.RegionSizeX <= Constants.RegionSize &&
m_scene.RegionInfo.RegionSizeY <= Constants.RegionSize
&& mapbmp != null)
if(mapbmp != null)
{
try
{
byte[] data;
data = OpenJPEG.EncodeFromImage(mapbmp, true);
// if large region limit its size since new viewers will not use it
// but it is still usable for ossl
if(m_scene.RegionInfo.RegionSizeX > Constants.RegionSize ||
m_scene.RegionInfo.RegionSizeY > Constants.RegionSize)
{
int bx = mapbmp.Width;
int by = mapbmp.Height;
int mb = bx;
if(mb < by)
mb = by;
if(mb > 2 * Constants.RegionSize && mb > 0)
{
float scale = 2.0f * (float)Constants.RegionSize/(float)mb;
Size newsize = new Size();
newsize.Width = (int)(bx * scale);
newsize.Height = (int)(by * scale);
using(Bitmap scaledbmp = new Bitmap(mapbmp,newsize))
data = OpenJPEG.EncodeFromImage(scaledbmp, true);
}
else
data = OpenJPEG.EncodeFromImage(mapbmp, true);
}
else
data = OpenJPEG.EncodeFromImage(mapbmp, true);
if (data != null && data.Length > 0)
{