diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-11 17:01:00 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-12 10:33:24 +0100 |
| commit | 0f813f1c3d1bc3e4deeee089d771eb0443949e3f (patch) | |
| tree | edd60eedf4e78439bb04bd906f5bc5f2ca46f99f /src/GraphicObjects/Group.cs | |
| parent | 44caf51048bde7e9daf78acc779278642c798748 (diff) | |
temp save to make test in master
Diffstat (limited to 'src/GraphicObjects/Group.cs')
| -rw-r--r-- | src/GraphicObjects/Group.cs | 65 |
1 files changed, 27 insertions, 38 deletions
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index 9d9abbc6..33fe006d 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -217,53 +217,42 @@ namespace Crow } } - public override void Paint(ref Context ctx, Rectangles clip = null) + public override void Paint(ref Context ctx) { if ( !Visible ) return; - if (bmp == null) - UpdateGraphic (); - else { - if (clip != null) - clip.Rebase (this); - else { - clip = new Rectangles (); - //TODO:added lately slot to empty clip, - //should rework this precise case causing expandable not - //to show image changes - clip.AddRectangle (ContextCoordinates (Slot.Size)); - } - - if (!DrawingIsValid || clip != null) {//false when 1 child has changed - //child having their content changed has to be repainted - //and those with slot intersecting clip rectangle have also to be repainted + if (CacheEnabled) { + if (bmp == null) + RecreateCache (); + } - using (ImageSurface cache = - new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, Slot.Width * 4)) { - Context gr = new Context (cache); - clip.clearAndClip (gr); + if (Clipping.count > 0) { + using (ImageSurface cache = + new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, Slot.Width * 4)) { + Context gr = new Context (cache); - Rectangle rBack = Slot.Size; - Background.SetAsSource (gr, rBack); - CairoHelpers.CairoRectangle(gr, rBack, CornerRadius); - gr.Fill (); + Clipping.clearAndClip (gr); + Rectangle rBack = Slot.Size; + Background.SetAsSource (gr, rBack); + CairoHelpers.CairoRectangle (gr, rBack, CornerRadius); + gr.Fill (); - #if DEBUG_CLIP_RECTANGLE - clip.stroke (gr, Color.Amaranth.AdjustAlpha (0.8)); - #endif - foreach (GraphicObject c in children.Where(ch=>ch.Visible)) { - Rectangles childClip = clip.intersectingRects (ContextCoordinates(c.Slot)); - if (!c.DrawingIsValid || childClip.count > 0) - c.Paint (ref gr, childClip);//, localClip); - } - - gr.Dispose (); + foreach (GraphicObject c in children) { + if (!c.Visible) + continue; + Rectangles childClip = Clipping.intersectingRects (ContextCoordinates (c.Slot)); + if (childClip.count > 0) + c.Paint (ref ctx); } + #if DEBUG_CLIP_RECTANGLE + Clipping.stroke (gr, Color.Amaranth.AdjustAlpha (0.8)); + #endif + + gr.Dispose (); } - } - - base.Paint (ref ctx, clip); + } + base.Paint (ref ctx); } #endregion |