diff options
Diffstat (limited to 'src/OpenTKGameWindow.cs')
| -rw-r--r-- | src/OpenTKGameWindow.cs | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs index 12099e48..2083346c 100644 --- a/src/OpenTKGameWindow.cs +++ b/src/OpenTKGameWindow.cs @@ -249,76 +249,76 @@ namespace Crow updateTime.Restart (); #endif - surf = new ImageSurface(bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height,ClientRectangle.Width*4); - ctx = new Context(surf); + using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) { + using (ctx = new Context (surf)){ - GraphicObject[] invGOList = new GraphicObject[GraphicObjects.Count]; - GraphicObjects.CopyTo (invGOList,0); - invGOList = invGOList.Reverse ().ToArray (); + GraphicObject[] invGOList = new GraphicObject[GraphicObjects.Count]; + GraphicObjects.CopyTo (invGOList, 0); + invGOList = invGOList.Reverse ().ToArray (); - #if MEASURE_TIME - layoutTime.Start (); - #endif - //Debug.WriteLine ("======= Layouting queue start ======="); - - while (Interface.LayoutingQueue.Count > 0) { - LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue (); - lqi.ProcessLayouting (); - } + #if MEASURE_TIME + layoutTime.Start (); + #endif + //Debug.WriteLine ("======= Layouting queue start ======="); - #if MEASURE_TIME - layoutTime.Stop (); - #endif + while (Interface.LayoutingQueue.Count > 0) { + LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue (); + lqi.ProcessLayouting (); + } - //Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-"); - //final redraw clips should be added only when layout is completed among parents, - //that's why it take place in a second pass - GraphicObject[] gotr = new GraphicObject[gobjsToRedraw.Count]; - gobjsToRedraw.CopyTo (gotr); - gobjsToRedraw.Clear (); - foreach (GraphicObject p in gotr) { - p.registerClipRect (); - } + #if MEASURE_TIME + layoutTime.Stop (); + #endif - #if MEASURE_TIME - updateTime.Stop (); - drawingTime.Start (); - #endif + //Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-"); + //final redraw clips should be added only when layout is completed among parents, + //that's why it take place in a second pass + GraphicObject[] gotr = new GraphicObject[gobjsToRedraw.Count]; + gobjsToRedraw.CopyTo (gotr); + gobjsToRedraw.Clear (); + foreach (GraphicObject p in gotr) { + p.registerClipRect (); + } - lock (redrawClip) { - if (redrawClip.count > 0) { - #if DEBUG_CLIP_RECTANGLE - redrawClip.stroke (ctx, new Color(1.0,0,0,0.3)); + #if MEASURE_TIME + updateTime.Stop (); + drawingTime.Start (); #endif - redrawClip.clearAndClip (ctx); - //Link.draw (ctx); - foreach (GraphicObject p in invGOList) { - if (p.Visible) { + lock (redrawClip) { + if (redrawClip.count > 0) { + #if DEBUG_CLIP_RECTANGLE + redrawClip.stroke (ctx, new Color(1.0,0,0,0.3)); + #endif + redrawClip.clearAndClip (ctx); + + //Link.draw (ctx); + foreach (GraphicObject p in invGOList) { + if (p.Visible) { - ctx.Save (); - if (redrawClip.count > 0) { - Rectangles clip = redrawClip.intersectingRects (p.Slot); + ctx.Save (); + if (redrawClip.count > 0) { + Rectangles clip = redrawClip.intersectingRects (p.Slot); - if (clip.count > 0) - p.Paint (ref ctx, clip); + if (clip.count > 0) + p.Paint (ref ctx, clip); + } + ctx.Restore (); + } } - ctx.Restore (); + ctx.ResetClip (); + #if DEBUG_CLIP_RECTANGLE + redrawClip.stroke (ctx, Color.Red.AdjustAlpha(0.1)); + #endif + redrawClip.Reset (); } } - ctx.ResetClip (); - #if DEBUG_CLIP_RECTANGLE - redrawClip.stroke (ctx, Color.Red.AdjustAlpha(0.1)); + #if MEASURE_TIME + drawingTime.Stop (); #endif - redrawClip.Reset (); + //surf.WriteToPng (@"/mnt/data/test.png"); } } - #if MEASURE_TIME - drawingTime.Stop (); - #endif - //surf.WriteToPng (@"/mnt/data/test.png"); - ctx.Dispose (); - surf.Dispose (); // if (ToolTip.isVisible) { // ToolTip.panel.processkLayouting(); // if (ToolTip.panel.layoutIsValid) |