Skip to content

Commit

Permalink
[Fixes bugs #724982, #606240] Fix issues with partially missing selec…
Browse files Browse the repository at this point in the history
…tions.

The canvas offset was being used in addition to the layer offset when
rendering a selection that was translated by the Move Pixels tool.

This causes issues once the canvas is zoomed in and the canvas offset
is non-zero, because the selection appears to be shifted and partially
(or entirely) missing.
  • Loading branch information
cameronwhite committed Sep 16, 2012
1 parent 8912ae8 commit 0c73369
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Pinta.Gui.Widgets/Widgets/Canvas/CanvasRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ private Layer CreateLivePreviewLayer (Layer original)
return preview_layer;
}

private Layer CreateOffsetLayer (Layer original, Point canvas_offset)
private Layer CreateOffsetLayer (Layer original)
{
var offset = OffsetLayer;
offset.Surface.Clear ();

using (var g = new Cairo.Context (offset.Surface)) {
g.SetSourceSurface (original.Surface, canvas_offset.X + (int)original.Offset.X, canvas_offset.Y + (int)original.Offset.Y);
g.SetSourceSurface (original.Surface, (int)original.Offset.X, (int)original.Offset.Y);
g.Paint ();
}

Expand All @@ -114,7 +114,7 @@ private unsafe void RenderOneToOne (List<Layer> layers, Cairo.ImageSurface dst,

// If the layer is offset, handle it here
if (!layer.Offset.IsEmpty ())
layer = CreateOffsetLayer (layer, offset);
layer = CreateOffsetLayer (layer);

var src = layer.Surface;

Expand Down Expand Up @@ -178,7 +178,7 @@ private unsafe void RenderZoomIn (List<Layer> layers, Cairo.ImageSurface dst, Gd

// If the layer is offset, handle it here
if (!layer.Offset.IsEmpty ())
layer = CreateOffsetLayer (layer, offset);
layer = CreateOffsetLayer (layer);

var src = layer.Surface;

Expand Down Expand Up @@ -249,7 +249,7 @@ private unsafe void RenderZoomOut (List<Layer> layers, Cairo.ImageSurface dst, G

// If the layer is offset, handle it here
if (!layer.Offset.IsEmpty ())
layer = CreateOffsetLayer (layer, offset);
layer = CreateOffsetLayer (layer);

var src = layer.Surface;

Expand Down

0 comments on commit 0c73369

Please sign in to comment.