From: Jean-Philippe Bruyère Date: Sun, 17 Jan 2021 19:24:09 +0000 (+0100) Subject: remove save/restore in Interface and Widget.Paint, clip and clean before Cairo.PushTo... X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=refs%2Fheads%2FRemovedSomeSaveRestore;p=jp%2Fcrow.git remove save/restore in Interface and Widget.Paint, clip and clean before Cairo.PushToGoup(temp surf size depend on clipping) --- diff --git a/Crow/src/Interface.cs b/Crow/src/Interface.cs index 11417dec..f329f517 100644 --- a/Crow/src/Interface.cs +++ b/Crow/src/Interface.cs @@ -816,6 +816,13 @@ namespace Crow PerformanceMeasure.Begin (PerformanceMeasure.Kind.Drawing); IsDirty = true; + for (int i = 0; i < clipping.NumRectangles; i++) + ctx.Rectangle (clipping.GetRectangle (i)); + ctx.ClipPreserve (); + ctx.Operator = Operator.Clear; + ctx.Fill (); + ctx.Operator = Operator.Over; + ctx.PushGroup (); for (int i = GraphicTree.Count -1; i >= 0 ; i--){ @@ -825,9 +832,9 @@ namespace Crow if (clipping.Contains (p.Slot) == RegionOverlap.Out) continue; - ctx.Save (); + //ctx.Save (); p.Paint (ref ctx); - ctx.Restore (); + //ctx.Restore (); } if (DragAndDropOperation != null) { @@ -856,13 +863,10 @@ namespace Crow ctx.PopGroupToSource (); - for (int i = 0; i < clipping.NumRectangles; i++) - ctx.Rectangle (clipping.GetRectangle (i)); +/* for (int i = 0; i < clipping.NumRectangles; i++) + ctx.Rectangle (clipping.GetRectangle (i));*/ + - ctx.ClipPreserve (); - ctx.Operator = Operator.Clear; - ctx.Fill (); - ctx.Operator = Operator.Over; ctx.Paint (); diff --git a/Crow/src/Widgets/Widget.cs b/Crow/src/Widgets/Widget.cs index e76c807f..ecb3267f 100644 --- a/Crow/src/Widgets/Widget.cs +++ b/Crow/src/Widgets/Widget.cs @@ -1838,7 +1838,7 @@ namespace Crow paintDisabled (ctx, Slot + Parent.ClientRectangle.Position); } else { Rectangle rb = Slot + Parent.ClientRectangle.Position; - ctx.Save (); + //ctx.Save (); ctx.Translate (rb.X, rb.Y); @@ -1846,7 +1846,8 @@ namespace Crow if (!IsEnabled) paintDisabled (ctx, Slot); - ctx.Restore (); + ctx.Translate (-rb.X, -rb.Y); + //ctx.Restore (); } LastPaintedSlot = Slot; }