Skip to content

Commit

Permalink
Fix resize-related bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Equbuxu committed Sep 2, 2021
1 parent e05eeed commit 68bf476
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion PixiEditor/Models/Controllers/BitmapOperationsUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ private LayerChange[] ApplyToLayers(Layer[] layers, LayerChange[] changes)
Layer layer = layers[i];
LayerChange change = changes.First(x => x.LayerGuid == layer.LayerGuid);
layer.SetPixels(change.PixelChanges, false);
layer.InvokeLayerBitmapChange(new System.Windows.Int32Rect(layer.OffsetX, layer.OffsetY, layer.Width, layer.Height));
}

return oldPixelValues;
Expand Down
2 changes: 1 addition & 1 deletion PixiEditor/Models/Controllers/LayerStackRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void Resize(int newWidth, int newHeight)
finalSurface?.Dispose();
backingSurface?.Dispose();
finalSurface = new Surface(newWidth, newHeight);
finalBitmap = new WriteableBitmap(newWidth, newHeight, 96, 96, PixelFormats.Pbgra32, null);
FinalBitmap = new WriteableBitmap(newWidth, newHeight, 96, 96, PixelFormats.Pbgra32, null);
var imageInfo = new SKImageInfo(newWidth, newHeight, SKColorType.Bgra8888, SKAlphaType.Premul, SKColorSpace.CreateSrgb());
backingSurface = SKSurface.Create(imageInfo, finalBitmap.BackBuffer, finalBitmap.BackBufferStride);
Update(new Int32Rect(0, 0, newWidth, newHeight));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ private Document()
Layers.CollectionChanged += Layers_CollectionChanged;
LayerStructure.Groups.CollectionChanged += Groups_CollectionChanged;
LayerStructure.LayerStructureChanged += LayerStructure_LayerStructureChanged;
DocumentSizeChanged += (sender, args) => Renderer.Resize(args.NewWidth, args.NewHeight);
}

private void LayerStructure_LayerStructureChanged(object sender, LayerStructureChangedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion PixiEditor/Models/DataHolders/Surface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Surface : IDisposable
{
public static SKPaint ReplacingPaint { get; } = new SKPaint() { BlendMode = SKBlendMode.Src };

private static readonly SKPaint nearestNeighborReplacingPaint = new SKPaint() { BlendMode = SKBlendMode.Src, FilterQuality = SKFilterQuality.Low };
private static readonly SKPaint nearestNeighborReplacingPaint = new SKPaint() { BlendMode = SKBlendMode.Src, FilterQuality = SKFilterQuality.None };

public SKSurface SkiaSurface { get; }
public int Width { get; }
Expand Down

0 comments on commit 68bf476

Please sign in to comment.