Skip to content
Browse files

Add dirty rect argument to Canvas.OnDraw

  • Loading branch information...
1 parent a638752 commit 8c1d88b215a3c93edb213af6efa3769b3905dcf0 @slluis slluis committed Apr 18, 2012
View
2 Samples/MonoDevelop.Components.Chart/BasicChart.cs
@@ -328,7 +328,7 @@ public void Clear ()
return (((double) minTickStep) * (GetEnd (ad) - GetStart (ad))) / (double) GetAreaSize (ad);
}
- protected override void OnDraw (Context ctx)
+ protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
double rwidth = Bounds.Width, rheight = Bounds.Height;
View
2 Samples/Samples/Boxes.cs
@@ -98,7 +98,7 @@ protected override void OnMouseExited (EventArgs args)
highlight = false;
}
- protected override void OnDraw (Context ctx)
+ protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
ctx.SetColor (new Color (0.5, 0.5, 0.5));
ctx.Rectangle (Bounds);
View
2 Samples/Samples/CanvasWithWidget.cs
@@ -53,7 +53,7 @@ public MyCanvas ()
AddChild (box, new Rectangle (30, 70, 100, 30));
}
- protected override void OnDraw (Xwt.Drawing.Context ctx)
+ protected override void OnDraw (Xwt.Drawing.Context ctx, Rectangle dirtyRect)
{
ctx.Rectangle (0, 0, Bounds.Width, Bounds.Height);
var g = new LinearGradient (0, 0, Bounds.Width, Bounds.Height);
View
4 Samples/Samples/DrawingFigures.cs
@@ -32,9 +32,9 @@ namespace Samples
{
public class DrawingFigures: Drawings
{
- protected override void OnDraw (Context ctx)
+ protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
- base.OnDraw (ctx);
+ base.OnDraw (ctx, dirtyRect);
Figures (ctx, 5, 5);
}
View
14 Samples/Samples/DrawingPatternsAndImages.cs
@@ -32,9 +32,9 @@ namespace Samples
{
public class DrawingPatternsAndImages: Drawings
{
- protected override void OnDraw (Context ctx)
+ protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
- base.OnDraw (ctx);
+ base.OnDraw (ctx, dirtyRect);
PatternsAndImages (ctx, 5, 5);
}
@@ -83,15 +83,15 @@ public void PatternsAndImages (Context ctx, double x, double y)
// Setting pixels
- ib = new ImageBuilder (50, 50);
- img = ib.ToImage ();
+ ctx.SetLineWidth (1);
for (int i=0; i<50;i++) {
for (var j=0; j<50;j++) {
- img.SetPixel (i,j, Color.FromHsl (0.5, (double)i / 50d, (double)j / 50d));
+ Color c = Color.FromHsl (0.5, (double)i / 50d, (double)j / 50d);
+ ctx.Rectangle (i, j, 1, 1);
+ ctx.SetColor (c);
+ ctx.Fill ();
}
}
-
- ctx.DrawImage (img, 0, y + 110);
}
}
}
View
4 Samples/Samples/DrawingText.cs
@@ -32,9 +32,9 @@ namespace Samples
{
public class DrawingText: Drawings
{
- protected override void OnDraw (Context ctx)
+ protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
- base.OnDraw (ctx);
+ base.OnDraw (ctx, dirtyRect);
Texts (ctx, 5, 5);
}
View
4 Samples/Samples/DrawingTransforms.cs
@@ -40,9 +40,9 @@ public Drawings ()
public class DrawingTransforms: Canvas
{
- protected override void OnDraw (Context ctx)
+ protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
- base.OnDraw (ctx);
+ base.OnDraw (ctx, dirtyRect);
Transforms (ctx, 5, 5);
}
View
2 Samples/Samples/NotebookSample.cs
@@ -17,7 +17,7 @@ public NotebookSample ()
class MyWidget: Canvas
{
- protected override void OnDraw (Context ctx)
+ protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
ctx.SetLineWidth (5);
ctx.SetColor (new Color (1.0f, 0f, 0.5f));
View
4 Samples/Samples/PartialImages.cs
@@ -47,9 +47,9 @@ public PartialImageCanvas ()
img = Image.FromResource (GetType (), "cow.jpg");
}
- protected override void OnDraw (Context ctx)
+ protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
- base.OnDraw (ctx);
+ base.OnDraw (ctx, dirtyRect);
for (int y = 0; y < img.Size.Height / 50; ++y) {
for (int x = 0; x < img.Size.Width / 50; ++x) {
View
2 Samples/Samples/ScrollWindowSample.cs
@@ -88,7 +88,7 @@ public ScrollableCanvas ()
MinHeight = 100;
}
- protected override void OnDraw (Context ctx)
+ protected override void OnDraw (Context ctx, Rectangle dirtyRect)
{
ctx.Translate (-hscroll.Value, -vscroll.Value);
ctx.Rectangle (new Rectangle (0, 0, imageSize, imageSize));
View
4 Xwt/Xwt/Canvas.cs
@@ -70,7 +70,7 @@ public void OnDraw (object context, Rectangle dirtyRect)
Context ctx = null;
try {
ctx = new Context (context);
- ((Canvas)Parent).OnDraw (ctx);
+ ((Canvas)Parent).OnDraw (ctx, dirtyRect);
}
finally {
ctx.Dispose ();
@@ -246,7 +246,7 @@ public void QueueDraw (Rectangle rect)
/// <param name='ctx'>
/// Drawing context
/// </param>
- protected virtual void OnDraw (Context ctx)
+ protected virtual void OnDraw (Context ctx, Rectangle dirtyRect)
{
}

0 comments on commit 8c1d88b

Please sign in to comment.
Something went wrong with that request. Please try again.