diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-12 17:47:36 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-12 17:47:36 +0100 |
| commit | 970a3f7239d5e57eb011295cda9eee015bbe97f4 (patch) | |
| tree | 7d09918825c72a7e0f58b5d8b174f27805cdfcc5 /src/GraphicObjects/PrivateContainer.cs | |
| parent | 44caf51048bde7e9daf78acc779278642c798748 (diff) | |
| parent | d1e33e2f2212e2f9a60caebd3eb839b36357b2c6 (diff) | |
Merge branch 'NewClipping'
Diffstat (limited to 'src/GraphicObjects/PrivateContainer.cs')
| -rw-r--r-- | src/GraphicObjects/PrivateContainer.cs | 78 |
1 files changed, 61 insertions, 17 deletions
diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs index 9f787eac..77bf655f 100644 --- a/src/GraphicObjects/PrivateContainer.cs +++ b/src/GraphicObjects/PrivateContainer.cs @@ -133,33 +133,77 @@ namespace Crow break; } } - - public override Rectangle ContextCoordinates (Rectangle r) + protected override void onDraw (Context gr) { - return - Parent.ContextCoordinates(r) + Slot.Position + ClientRectangle.Position; + base.onDraw (gr); + + gr.Save (); + //clip to client zone + CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius); + gr.Clip (); + + if (child != null) + child.Paint (ref gr); + gr.Restore (); } - public override void Paint(ref Cairo.Context ctx, Rectangles clip = null) + protected override void UpdateCache (Context ctx) { - if (!Visible)//check if necessary?? - return; + //ctx.Save (); - ctx.Save(); + Rectangle rb = Slot + Parent.ClientRectangle.Position; - if (clip != null) - clip.clip(ctx); + using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) { + Context gr = new Context (cache); - base.Paint(ref ctx, clip); + //clip to client zone + CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius); + gr.Clip (); - //clip to client zone - CairoHelpers.CairoRectangle (ctx, Parent.ContextCoordinates(ClientRectangle + Slot.Position), CornerRadius); - ctx.Clip(); + if (Clipping.count > 0) { + + Clipping.clearAndClip (gr); + + if (child != null) { + + base.onDraw (gr); - if (child != null) - child.Paint(ref ctx, clip); - ctx.Restore(); + child.Paint (ref gr); + } + } + + gr.Dispose (); + + ctx.SetSourceSurface (cache, rb.X, rb.Y); + ctx.Paint (); + } + Clipping.Reset(); + + //ctx.Restore (); } +// public override Rectangle ContextCoordinates (Rectangle r) +// { +// return +// Parent.ContextCoordinates(r) + Slot.Position + ClientRectangle.Position; +// } +// public override void Paint(ref Cairo.Context ctx) +// { +// if (!Visible)//check if necessary?? +// return; +// +// ctx.Save(); +// +// base.Paint(ref ctx); +// +// //clip to client zone +// CairoHelpers.CairoRectangle (ctx, Parent.ContextCoordinates(ClientRectangle + Slot.Position), CornerRadius); +// ctx.Clip(); +// +// if (child != null) +// child.Paint(ref ctx); +// +// ctx.Restore(); +// } #endregion |