aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/GraphicObject.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-05 10:17:21 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-05 10:17:21 +0100
commit7d507f3dc431e1a052f28cfb935ffad7afc7f074 (patch)
tree8bf2a26e33ed6303d0d12924fc0fd0a1240a8e19 /src/GraphicObjects/GraphicObject.cs
parent2d20e043e62bd075b3f5f6c4e4bedb2ab7d910f8 (diff)
add Caching property to Group, to allow disabling caching for very often updated surface
Diffstat (limited to 'src/GraphicObjects/GraphicObject.cs')
-rw-r--r--src/GraphicObjects/GraphicObject.cs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index b9b142c0..140e5917 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -79,6 +79,7 @@ namespace Crow
HorizontalAlignment _horizontalAlignment = HorizontalAlignment.Center;
Size _maximumSize = "0;0";
Size _minimumSize = "0;0";
+ bool isRegisteredForRepaint = false;
#endregion
#region public fields
@@ -459,11 +460,16 @@ namespace Crow
//test if this speed up a lot to cancel clipping for an uncached group
Group p = Parent as Group;
if (p != null) {
- if (p.bmp == null)
+ if (p.bmp == null || !p.Caching) {
+ p.RegisterForRedraw ();
return;
+ }
}
- if (HostContainer != null)
- HostContainer.gobjsToRedraw.Add (this);
+ if (HostContainer == null || isRegisteredForRepaint)
+ return;
+
+ HostContainer.gobjsToRedraw.Add (this);
+ isRegisteredForRepaint = true;
}
/// <summary>
@@ -485,6 +491,7 @@ namespace Crow
//this clipping should take only last painted slots in ancestor tree which
//is not the case for now.
HostContainer.redrawClip.AddRectangle (ScreenCoordinates(LastPaintedSlot));
+ isRegisteredForRepaint = false;
}
/// <summary> return size of content + margins </summary>
protected virtual Size measureRawSize ()