aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-12 11:52:50 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-12 11:52:50 +0100
commita823099f5db40fb8b2cbe79179185db5266e01e3 (patch)
tree43d01d1725726fd93613ef5bb3dbfa6714ef616b /src/GraphicObjects
parent83c588a624723742e77db3914259ee37c530bca2 (diff)
separate RecreateCache and UpdateCache
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/GraphicObject.cs2
-rw-r--r--src/GraphicObjects/Group.cs53
-rw-r--r--src/GraphicObjects/PrivateContainer.cs2
3 files changed, 21 insertions, 36 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 763d1277..87ac0eef 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -793,7 +793,7 @@ namespace Crow
Rectangle rb = Slot + Parent.ClientRectangle.Position;
ctx.Save ();
- Clipping.clearAndClip (ctx);
+ //Clipping.clearAndClip (ctx);
ctx.Translate (rb.X, rb.Y);
onDraw (ctx);
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs
index 33fe006d..4305a665 100644
--- a/src/GraphicObjects/Group.cs
+++ b/src/GraphicObjects/Group.cs
@@ -204,9 +204,6 @@ namespace Crow
break;
}
}
- public override Rectangle ContextCoordinates(Rectangle r){
- return r + ClientRectangle.Position;
- }
protected override void onDraw (Context gr)
{
@@ -216,43 +213,31 @@ namespace Crow
g.Paint (ref gr);
}
}
-
- public override void Paint(ref Context ctx)
+ protected override void UpdateCache (Context ctx)
{
- if ( !Visible )
- return;
+ Rectangle rb = Slot + Parent.ClientRectangle.Position;
- if (CacheEnabled) {
- if (bmp == null)
- RecreateCache ();
- }
+ 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);
- if (Clipping.count > 0) {
- using (ImageSurface cache =
- new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, Slot.Width * 4)) {
- Context gr = new Context (cache);
+ foreach (GraphicObject c in children) {
+ if (!c.Visible)
+ continue;
+ c.Paint (ref gr);
+ }
- Clipping.clearAndClip (gr);
- Rectangle rBack = Slot.Size;
- Background.SetAsSource (gr, rBack);
- CairoHelpers.CairoRectangle (gr, rBack, CornerRadius);
- gr.Fill ();
+ #if DEBUG_CLIP_RECTANGLE
+ Clipping.stroke (gr, Color.Amaranth.AdjustAlpha (0.8));
+ #endif
- 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 ();
- gr.Dispose ();
- }
- }
- base.Paint (ref ctx);
+ ctx.SetSourceSurface (cache, rb.X, rb.Y);
+ ctx.Paint ();
+ }
}
#endregion
diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs
index f3a512d0..0a87d03c 100644
--- a/src/GraphicObjects/PrivateContainer.cs
+++ b/src/GraphicObjects/PrivateContainer.cs
@@ -146,7 +146,7 @@ namespace Crow
using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) {
Context gr = new Context (cache);
- child.Clipping.clearAndClip (gr);
+ //Clipping.clearAndClip (gr);
base.onDraw (gr);
if (Clipping.count > 0) {