aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-11 12:50:46 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-11 12:50:46 +0100
commit0f8a64797810a03d036d7c9fcfddc5e11733f719 (patch)
treec2f072afc57f15800c0871e32760f5eb340dc656 /src
parentf2ceefa2a288ef3477a995e0f7f223c62bb3d6ad (diff)
IsQueuedForRedraw boolean in each GO, to prevent searching in object list
Move lastPaintedSlot update to Paint instead of UpdateGraphic which is not called if GO isn't cached
Diffstat (limited to 'src')
-rw-r--r--src/GraphicObjects/GraphicObject.cs16
-rw-r--r--src/OpenTKGameWindow.cs1
2 files changed, 11 insertions, 6 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index e3780845..14516dba 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -83,6 +83,7 @@ namespace Crow
Size _maximumSize = "0;0";
Size _minimumSize = "0;0";
bool cacheEnabled = false;
+ object dataSource;
#endregion
#region public fields
@@ -406,8 +407,6 @@ namespace Crow
get { return _minimumSize; }
set { _minimumSize = value; }
}
- object dataSource;
-
[XmlIgnore]public virtual object DataSource {
set {
if (dataSource == value)
@@ -495,19 +494,24 @@ namespace Crow
bmp = null;
RegisterForRedraw ();
}
+ public bool IsQueuedForRedraw = false;
/// <summary>
/// Add clipping region in redraw list of interface, dont update cached object content
/// </summary>
public virtual void RegisterForRedraw ()
{
+ if (IsQueuedForRedraw)
+ return;
//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)
return;
}
- if (HostContainer != null)
- HostContainer.gobjsToRedraw.Add (this);
+ if (HostContainer == null)
+ return;
+ HostContainer.gobjsToRedraw.Add (this);
+ IsQueuedForRedraw = true;
}
#region Layouting
@@ -734,8 +738,6 @@ namespace Crow
/// this trigger the effective drawing routine </summary>
protected virtual void UpdateGraphic ()
{
- LastPaintedSlot = Slot;
-
int stride = 4 * Slot.Width;
int bmpSize = Math.Abs (stride) * Slot.Height;
@@ -757,6 +759,8 @@ namespace Crow
if (!Visible)
return;
+ LastPaintedSlot = Slot;
+
Rectangle rb = Parent.ContextCoordinates (Slot);
if (cacheEnabled) {
diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs
index ac3cd75c..16362c6c 100644
--- a/src/OpenTKGameWindow.cs
+++ b/src/OpenTKGameWindow.cs
@@ -281,6 +281,7 @@ namespace Crow
gobjsToRedraw.CopyTo (gotr);
gobjsToRedraw.Clear ();
foreach (GraphicObject p in gotr) {
+ p.IsQueuedForRedraw = false;
p.registerClipRect ();
}