]> O.S.I.I.S - jp/crow.git/commitdiff
save bmpSize and bmpStride
authorjpbruyere <jp.bruyere@hotmail.com>
Thu, 5 Jan 2017 13:46:09 +0000 (14:46 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 5 Jan 2017 13:46:09 +0000 (14:46 +0100)
src/Interface.cs

index 6fefaa6763d8cb3516e94c74eeacdfa02c97699b..54a50588d77b90ba0a63d1764f2c88c030607148 100644 (file)
@@ -248,7 +248,8 @@ namespace Crow
                Surface surf;
                public byte[] bmp;
                public byte[] dirtyBmp;
-               public bool IsDirty = false;
+               public int bmpSize, bmpStride;
+               public volatile bool IsDirty = false;
                public Rectangle DirtyRect;
                public object LayoutMutex = new object();
                public object RenderMutex = new object();
@@ -415,7 +416,7 @@ namespace Crow
                        drawingMeasure.StartCycle ();
                        #endif
                        if (clipping.count > 0) {
-                               using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) {
+                               using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, bmpStride)) {
                                        using (ctx = new Context (surf)) {
                                                clipping.clearAndClip (ctx);
 
@@ -441,6 +442,7 @@ namespace Crow
                                                                DirtyRect += clipping.Bounds;
                                                        else
                                                                DirtyRect = clipping.Bounds;
+                                                       
                                                        if (DirtyRect.Width > 0 && DirtyRect.Height > 0) {
                                                                DirtyRect.Left = Math.Max (0, DirtyRect.Left);
                                                                DirtyRect.Top = Math.Max (0, DirtyRect.Top);
@@ -541,8 +543,8 @@ namespace Crow
                        lock (UpdateMutex) {
                                clientRectangle = bounds;
 
-                               int stride = 4 * ClientRectangle.Width;
-                               int bmpSize = Math.Abs (stride) * ClientRectangle.Height;
+                               bmpStride = 4 * ClientRectangle.Width;
+                               bmpSize = Math.Abs (bmpStride) * ClientRectangle.Height;
                                bmp = new byte[bmpSize];
 
                                foreach (GraphicObject g in GraphicTree)