int frameCpt = 0;
int idx = 0;
string[] testFiles = {
+ "clip2.crow",
"clip0.crow",
"clip1.crow",
- "clip2.crow",
"0.crow",
"5.crow",
"testCombobox.goml",
<?xml version="1.0"?>
-<Container Fit="true" Margin="50" Background="LimeGreen" CacheEnabled="true"
+<Container Fit="true" Margin="50" Background="LimeGreen" CacheEnabled="false"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
MouseEnter="{Background=Gray}"
MouseLeave="{Background=LimeGreen}">
- <Label HorizontalAlignment="Center" VerticalAlignment="Center" CacheEnabled="true"
+ <Label HorizontalAlignment="Center" VerticalAlignment="Center" CacheEnabled="false"
MouseEnter="{Background=DimGray}" Width="100"
MouseLeave="{Background=BlueCrayola}"
Margin="10" Text="{drawing}" Background="BlueCrayola"/>
<?xml version="1.0"?>
-<Container Fit="true" Margin="20" Background="SkyBlue" CacheEnabled="true"
+<Container Fit="true" Margin="20" Background="SkyBlue" CacheEnabled="false"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
MouseEnter="{Background=LightGray}"
MouseLeave="{Background=SkyBlue}">
- <Container Fit="true" Margin="20" Background="Red" CacheEnabled="false"
+ <Container Fit="true" Margin="20" Background="Red" CacheEnabled="true"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
MouseEnter="{Background=White}"
MouseLeave="{Background=Red}">
HorizontalAlignment="Right" VerticalAlignment="Bottom"
MouseEnter="{Background=Gray}"
MouseLeave="{Background=LimeGreen}">
- <Label HorizontalAlignment="Center" VerticalAlignment="Center" CacheEnabled="false"
+ <Label HorizontalAlignment="Center" VerticalAlignment="Center" CacheEnabled="true"
MouseEnter="{Background=DimGray}" Width="100"
MouseLeave="{Background=BlueCrayola}"
Margin="10" Text="{drawing}" Background="BlueCrayola"/>
}
public void RegisterClip(Rectangle clip){
if (CacheEnabled && bmp != null)
- Clipping.AddRectangle (clip);
- Parent.RegisterClip (clip + Slot.Position + Parent.ClientRectangle.Position);
+ Clipping.AddRectangle (clip + ClientRectangle.Position);
+ Parent.RegisterClip (clip + Slot.Position + ClientRectangle.Position);
}
// public virtual void registerClipRect(Rectangle clip)
// {
{
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)
return;
HostContainer.gobjsToRedraw.Add (this);
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) {
+ Clipping.clearAndClip (gr);
+ base.onDraw (gr);
- foreach (GraphicObject c in children) {
- if (!c.Visible)
- continue;
- c.Paint (ref gr);
- }
-
- #if DEBUG_CLIP_RECTANGLE
- Clipping.stroke (gr, Color.Amaranth.AdjustAlpha (0.8));
- #endif
+ foreach (GraphicObject c in children) {
+ if (!c.Visible)
+ continue;
+ c.Paint (ref gr);
+ }
+ #if DEBUG_CLIP_RECTANGLE
+ Clipping.stroke (gr, Color.Amaranth.AdjustAlpha (0.8));
+ #endif
+ }
gr.Dispose ();
ctx.SetSourceSurface (cache, rb.X, rb.Y);
}
protected override void UpdateCache (Context ctx)
{
+ //ctx.Save ();
+
Rectangle rb = Slot + Parent.ClientRectangle.Position;
using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) {
Context gr = new Context (cache);
- //Clipping.clearAndClip (ctx);
if (Clipping.count > 0) {
+
+ Clipping.clearAndClip (gr);
+
if (child != null) {
base.onDraw (gr);
ctx.Paint ();
}
Clipping.Reset();
+
+ //ctx.Restore ();
}
// public override Rectangle ContextCoordinates (Rectangle r)
// {
NotifyValueChanged ("TemplatedHeight", 0);
}
}
-
- protected override void loadDefaultValues ()
- {
- base.loadDefaultValues ();
- }
public override GraphicObject FindByName (string nameToFind)
{
//prevent name searching in template
gobjsToRedraw.Clear ();
foreach (GraphicObject p in gotr) {
p.IsQueuedForRedraw = false;
- p.RegisterClip (p.LastPaintedSlot);
- p.RegisterClip (p.getSlot());
+ p.Parent.RegisterClip (p.LastPaintedSlot);
+ p.Parent.RegisterClip (p.getSlot());
}
#if MEASURE_TIME
ctx.Restore ();
}
- #if DEBUG_CLIP_RECTANGLE
- clipping.stroke (ctx, Color.Red.AdjustAlpha(0.5));
- #endif
+// #if DEBUG_CLIP_RECTANGLE
+// clipping.stroke (ctx, Color.Red.AdjustAlpha(0.5));
+// #endif
clipping.Reset ();
}