From 8d1dd44edb187429b5a26ca56fc2d53766f710c7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 24 Jun 2017 07:39:22 +0100 Subject: [PATCH] simplify vectorrender background draw --- .../VectorRender/VectorRenderModule.cs | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 5d4d0f5359..a3b53becf0 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -355,30 +355,22 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender lock (this) { if (alpha == 256) - bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb); - else - bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); - - graph = Graphics.FromImage(bitmap); - - // this is really just to save people filling the - // background color in their scripts, only do when fully opaque - if (alpha >= 255) { + bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb); + graph = Graphics.FromImage(bitmap); using (SolidBrush bgFillBrush = new SolidBrush(bgColor)) { graph.FillRectangle(bgFillBrush, 0, 0, width, height); } - } - - for (int w = 0; w < bitmap.Width; w++) + } + else { - if (alpha <= 255) + bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); + graph = Graphics.FromImage(bitmap); + Color newbg = Color.FromArgb(alpha,bgColor); + using (SolidBrush bgFillBrush = new SolidBrush(newbg)) { - for (int h = 0; h < bitmap.Height; h++) - { - bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h))); - } + graph.FillRectangle(bgFillBrush, 0, 0, width, height); } }