diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-12 13:05:32 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-12 13:05:32 +0100 |
| commit | f1f143775245695a0aaa8cd2538d3b3382f9ea56 (patch) | |
| tree | 0f6ef2fef06cc3254dd0c3b32af38fab8a2e0087 /src/GraphicObjects | |
| parent | a823099f5db40fb8b2cbe79179185db5266e01e3 (diff) | |
testing clipping rect registration, clear and clip, not working
Diffstat (limited to 'src/GraphicObjects')
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 16 | ||||
| -rw-r--r-- | src/GraphicObjects/Group.cs | 1 | ||||
| -rw-r--r-- | src/GraphicObjects/IGOLibHost.cs | 1 | ||||
| -rw-r--r-- | src/GraphicObjects/PrivateContainer.cs | 7 |
4 files changed, 14 insertions, 11 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 87ac0eef..97e4eccf 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -31,8 +31,8 @@ namespace Crow internal List<Binding> Bindings = new List<Binding> (); internal int layoutingTries = 0; - Rectangles _clipping = new Rectangles(); - public Rectangles Clipping { get { return _clipping; }} + Rectangles clipping = new Rectangles(); + public Rectangles Clipping { get { return clipping; }} #region IValueChange implementation public event EventHandler<ValueChangeEventArgs> ValueChanged; @@ -471,11 +471,10 @@ namespace Crow public virtual bool Contains(GraphicObject goToFind){ return false; } - public void RegisterClip(Rectangle clip){ - Rectangle r = Slot + Parent.ClientRectangle; + public void RegisterClip(Rectangle clip){ if (CacheEnabled && bmp != null) - Clipping.AddRectangle (r); - Parent.RegisterClip (r); + Clipping.AddRectangle (clip); + Parent.RegisterClip (clip + Slot.Position + Parent.ClientRectangle.Position); } // public virtual void registerClipRect(Rectangle clip) // { @@ -768,7 +767,9 @@ namespace Crow // } ctx.SetSourceSurface (cache, rb.X, rb.Y); ctx.Paint (); - } + } + //Clipping.clearAndClip (ctx); + Clipping.Reset(); } /// <summary> Chained painting routine on the parent context of the actual cached version /// of the widget </summary> @@ -793,7 +794,6 @@ namespace Crow Rectangle rb = Slot + Parent.ClientRectangle.Position; ctx.Save (); - //Clipping.clearAndClip (ctx); ctx.Translate (rb.X, rb.Y); onDraw (ctx); diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index 4305a665..efc5240b 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -238,6 +238,7 @@ namespace Crow ctx.SetSourceSurface (cache, rb.X, rb.Y); ctx.Paint (); } + Clipping.Reset(); } #endregion diff --git a/src/GraphicObjects/IGOLibHost.cs b/src/GraphicObjects/IGOLibHost.cs index 1c50d558..1cf6978c 100644 --- a/src/GraphicObjects/IGOLibHost.cs +++ b/src/GraphicObjects/IGOLibHost.cs @@ -5,7 +5,6 @@ namespace Crow { public interface IGOLibHost { - Rectangles redrawClip { get; set; } List<GraphicObject> gobjsToRedraw { get; } GraphicObject activeWidget { get; set; } GraphicObject hoverWidget { get; set; } diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs index 0a87d03c..4012a7af 100644 --- a/src/GraphicObjects/PrivateContainer.cs +++ b/src/GraphicObjects/PrivateContainer.cs @@ -146,11 +146,13 @@ namespace Crow using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) { Context gr = new Context (cache); - //Clipping.clearAndClip (gr); - base.onDraw (gr); + //Clipping.clearAndClip (ctx); if (Clipping.count > 0) { if (child != null) { + + base.onDraw (gr); + child.Paint (ref gr); } } @@ -160,6 +162,7 @@ namespace Crow ctx.SetSourceSurface (cache, rb.X, rb.Y); ctx.Paint (); } + Clipping.Reset(); } // public override Rectangle ContextCoordinates (Rectangle r) // { |