Skip to content

Commit

Permalink
fix(Studio): DPI-awareness on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Nov 8, 2024
1 parent eb4de63 commit 37c133c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Studio/CelesteStudio.Mac/SkiaDrawableHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public override void DrawRect(CGRect dirtyRect) {

surface?.Dispose();
surface = SKSurface.Create(info, bitmapData.MutableBytes, info.RowBytes);
surface.Canvas.Scale((float)scale);
surface.Canvas.Save();
}

var canvas = surface.Canvas;
Expand All @@ -63,7 +65,7 @@ public override void DrawRect(CGRect dirtyRect) {

var ctx = NSGraphicsContext.CurrentContext.GraphicsPort;
// NOTE: macOS uses a different coordinate-system
ctx.DrawImage(new CGRect(bounds.X, Bounds.Height - bounds.Height - bounds.Y, bounds.Width, bounds.Height), image);
ctx.DrawImage(new CGRect(bounds.X, Bounds.Height - bounds.Height - bounds.Y, bounds.Width / scale, bounds.Height / scale), image);
}

protected override void Dispose(bool disposing) {
Expand Down

0 comments on commit 37c133c

Please sign in to comment.