<?xml version="1.0"?>
-<Group Fit="true" Margin="50" Background="LimeGreen" CacheEnabled="true"
+<Group Fit="true" Margin="50" Background="Yellow" CacheEnabled="true"
+ HorizontalAlignment="Right" VerticalAlignment="Bottom"
+ MouseEnter="{Background=DimGray}"
+ MouseLeave="{Background=Yellow}">
+<Group 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"/>
+ </Group>
</Group>
\ No newline at end of file
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;
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)
// {
// }
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>
Rectangle rb = Slot + Parent.ClientRectangle.Position;
ctx.Save ();
- //Clipping.clearAndClip (ctx);
ctx.Translate (rb.X, rb.Y);
onDraw (ctx);
List<GraphicObject> _gobjsToRedraw = new List<GraphicObject>();
#region IGOLibHost implementation
- public Rectangles redrawClip {
+ public Rectangles clipping {
get {
return _redrawClip;
}
shader.ProjectionMatrix = Matrix4.CreateOrthographicOffCenter
(0, ClientRectangle.Width, ClientRectangle.Height, 0, 0, 1);
- redrawClip.AddRectangle (ClientRectangle);
+ clipping.AddRectangle (ClientRectangle);
}
void createOpenGLSurface()
{
updateTime.Restart ();
#endif
- using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) {
- using (ctx = new Context (surf)){
+ GraphicObject[] invGOList = new GraphicObject[GraphicObjects.Count];
+ GraphicObjects.CopyTo (invGOList, 0);
+ invGOList = invGOList.Reverse ().ToArray ();
- GraphicObject[] invGOList = new GraphicObject[GraphicObjects.Count];
- GraphicObjects.CopyTo (invGOList, 0);
- invGOList = invGOList.Reverse ().ToArray ();
+ #if MEASURE_TIME
+ layoutTime.Start ();
+ #endif
+ //Debug.WriteLine ("======= Layouting queue start =======");
- #if MEASURE_TIME
- layoutTime.Start ();
- #endif
- //Debug.WriteLine ("======= Layouting queue start =======");
+ while (Interface.LayoutingQueue.Count > 0) {
+ LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue ();
+ lqi.ProcessLayouting ();
+ }
- while (Interface.LayoutingQueue.Count > 0) {
- LayoutingQueueItem lqi = Interface.LayoutingQueue.Dequeue ();
- lqi.ProcessLayouting ();
- }
+ #if MEASURE_TIME
+ layoutTime.Stop ();
+ #endif
- #if MEASURE_TIME
- layoutTime.Stop ();
- #endif
+ //Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-");
+ //final redraw clips should be added only when layout is completed among parents,
+ //that's why it take place in a second pass
+ GraphicObject[] gotr = new GraphicObject[gobjsToRedraw.Count];
+ gobjsToRedraw.CopyTo (gotr);
+ gobjsToRedraw.Clear ();
+ foreach (GraphicObject p in gotr) {
+ p.IsQueuedForRedraw = false;
+ p.RegisterClip (p.LastPaintedSlot);
+ p.RegisterClip (p.getSlot());
+ }
- //Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-");
- //final redraw clips should be added only when layout is completed among parents,
- //that's why it take place in a second pass
- GraphicObject[] gotr = new GraphicObject[gobjsToRedraw.Count];
- gobjsToRedraw.CopyTo (gotr);
- gobjsToRedraw.Clear ();
- foreach (GraphicObject p in gotr) {
- p.IsQueuedForRedraw = false;
- p.RegisterClip (p.LastPaintedSlot);
- p.RegisterClip (p.getSlot());
- }
+ #if MEASURE_TIME
+ updateTime.Stop ();
+ drawingTime.Start ();
+ #endif
+
+ using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) {
+ using (ctx = new Context (surf)){
- #if MEASURE_TIME
- updateTime.Stop ();
- drawingTime.Start ();
- #endif
+ if (clipping.count > 0) {
+ //Link.draw (ctx);
+ clipping.clearAndClip(ctx);
- //Link.draw (ctx);
- foreach (GraphicObject p in invGOList) {
- if (!p.Visible)
- continue;
+ foreach (GraphicObject p in invGOList) {
+ if (!p.Visible)
+ continue;
- ctx.Save ();
+ ctx.Save ();
- p.Paint (ref ctx);
+ p.Paint (ref ctx);
- ctx.Restore ();
+ ctx.Restore ();
+ }
+
+ #if DEBUG_CLIP_RECTANGLE
+ clipping.stroke (ctx, Color.Red.AdjustAlpha(0.5));
+ #endif
+
+ clipping.Reset ();
}
#if MEASURE_TIME
#region ILayoutable implementation
public void RegisterClip(Rectangle r){
- redrawClip.AddRectangle (r);
+ clipping.AddRectangle (r);
}
public int LayoutingTries {
get { throw new NotImplementedException (); }