Skip to content

Commit

Permalink
[Fixes bug #702156] Store the old cursor bounds so we can invalidate …
Browse files Browse the repository at this point in the history
…them on the next pass.
  • Loading branch information
jpobst committed Feb 21, 2011
1 parent 8a1c69b commit 29738af
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Pinta.Tools/TextTool/TextTool.cs
Expand Up @@ -29,6 +29,7 @@ public class TextTool : BaseTool
private Point clickPoint;
private bool is_editing;
private Rectangle old_bounds = Rectangle.Zero;
private Rectangle old_cursor_bounds = Rectangle.Zero;

private TextEngine engine;

Expand Down Expand Up @@ -649,7 +650,8 @@ private void StopEditing ()
private void RedrawText (bool showCursor, bool useToolLayer)
{
Cairo.ImageSurface surf;

var invalidate_cursor = old_cursor_bounds;

if (!useToolLayer)
surf = PintaCore.Workspace.ActiveDocument.CurrentLayer.Surface;
else {
Expand Down Expand Up @@ -690,6 +692,9 @@ private void RedrawText (bool showCursor, bool useToolLayer)

g.Antialias = Cairo.Antialias.None;
g.DrawLine (new Cairo.PointD (loc.X, loc.Y), new Cairo.PointD (loc.X, loc.Y + loc.Height), new Cairo.Color (0, 0, 0, 1), 1);

loc.Inflate (2, 10);
old_cursor_bounds = loc;
}

g.Restore ();
Expand All @@ -699,6 +704,7 @@ private void RedrawText (bool showCursor, bool useToolLayer)
r.Inflate (10, 10);

PintaCore.Workspace.Invalidate (old_bounds);
PintaCore.Workspace.Invalidate (invalidate_cursor);
PintaCore.Workspace.Invalidate (r);

old_bounds = r;
Expand Down

0 comments on commit 29738af

Please sign in to comment.