From 0f813f1c3d1bc3e4deeee089d771eb0443949e3f Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Thu, 11 Feb 2016 17:01:00 +0100 Subject: temp save to make test in master --- src/OpenTKGameWindow.cs | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) (limited to 'src/OpenTKGameWindow.cs') diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs index 16362c6c..e6fc9681 100644 --- a/src/OpenTKGameWindow.cs +++ b/src/OpenTKGameWindow.cs @@ -90,7 +90,7 @@ namespace Crow { GraphicObjects.Remove(g); GraphicObjects.Insert(0, g); - g.registerClipRect (); + //g.registerClipRect (); } } public void Quit () @@ -282,14 +282,15 @@ namespace Crow gobjsToRedraw.Clear (); foreach (GraphicObject p in gotr) { p.IsQueuedForRedraw = false; - p.registerClipRect (); + p.RegisterClip (p.LastPaintedSlot); + p.RegisterClip (p.getSlot()); } #if MEASURE_TIME updateTime.Stop (); drawingTime.Start (); #endif - + Debug.WriteLine (redrawClip.ToString ()); lock (redrawClip) { if (redrawClip.count > 0) { #if DEBUG_CLIP_RECTANGLE @@ -299,17 +300,18 @@ namespace Crow //Link.draw (ctx); foreach (GraphicObject p in invGOList) { - if (p.Visible) { + if (!p.Visible) + continue; + + ctx.Save (); + + 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); + + ctx.Restore (); - if (clip.count > 0) - p.Paint (ref ctx, clip); - } - ctx.Restore (); - } } ctx.ResetClip (); #if DEBUG_CLIP_RECTANGLE @@ -549,6 +551,9 @@ namespace Crow #endregion #region ILayoutable implementation + public void RegisterClip(Rectangle r){ + redrawClip.AddRectangle (r); + } public int LayoutingTries { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } @@ -559,17 +564,13 @@ namespace Crow } public void RegisterForLayouting (LayoutingType layoutType) { throw new NotImplementedException (); } public bool UpdateLayout (LayoutingType layoutType) { throw new NotImplementedException (); } - public Rectangle ContextCoordinates (Rectangle r) - { - return r; - } + public Rectangle ContextCoordinates (Rectangle r) => r; public Rectangle ScreenCoordinates (Rectangle r) => r; public ILayoutable Parent { get { return null; } set { throw new NotImplementedException (); } } - public ILayoutable LogicalParent { get { return null; } set { throw new NotImplementedException (); } @@ -581,15 +582,8 @@ namespace Crow public IGOLibHost HostContainer { get { return this; } } - - public Rectangle getSlot () - { - return ClientRectangle; - } - public Rectangle getBounds ()//redundant but fill ILayoutable implementation - { - return ClientRectangle; - } + public Rectangle getSlot () => ClientRectangle; + public Rectangle getBounds () => ClientRectangle; #endregion } } \ No newline at end of file -- cgit v1.3.1-4-g156e From a823099f5db40fb8b2cbe79179185db5266e01e3 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Fri, 12 Feb 2016 11:52:50 +0100 Subject: separate RecreateCache and UpdateCache --- Tests/GOLIBTests.cs | 1 + Tests/Interfaces/clip1.crow | 6 ++-- Tests/Interfaces/clip2.crow | 10 +++++++ Tests/Tests.csproj | 3 ++ src/GraphicObjects/GraphicObject.cs | 2 +- src/GraphicObjects/Group.cs | 53 ++++++++++++---------------------- src/GraphicObjects/PrivateContainer.cs | 2 +- src/OpenTKGameWindow.cs | 34 ++++++---------------- 8 files changed, 47 insertions(+), 64 deletions(-) create mode 100755 Tests/Interfaces/clip2.crow (limited to 'src/OpenTKGameWindow.cs') diff --git a/Tests/GOLIBTests.cs b/Tests/GOLIBTests.cs index adc61818..622d1ce7 100644 --- a/Tests/GOLIBTests.cs +++ b/Tests/GOLIBTests.cs @@ -37,6 +37,7 @@ namespace test int frameCpt = 0; int idx = 0; string[] testFiles = { + "clip2.crow", "clip0.crow", "clip1.crow", "0.crow", diff --git a/Tests/Interfaces/clip1.crow b/Tests/Interfaces/clip1.crow index 957080b9..d5fcf79b 100755 --- a/Tests/Interfaces/clip1.crow +++ b/Tests/Interfaces/clip1.crow @@ -1,5 +1,5 @@  - @@ -11,11 +11,11 @@ HorizontalAlignment="Right" VerticalAlignment="Bottom" MouseEnter="{Background=Blue}" MouseLeave="{Background=Yellow}"> - -