Browse Source

scale preview if big pixels on non MacOS system, don't scale SVG twice

Juliette ELSASS 1 year ago
parent
commit
dca46d0798
1 changed files with 7 additions and 3 deletions
  1. 7 3
      lazpaint/uimagepreview.pas

+ 7 - 3
lazpaint/uimagepreview.pas

@@ -140,7 +140,7 @@ end;
 
 
 procedure TImagePreview.SurfaceRedraw(Sender: TObject; Bitmap: TBGRABitmap);
 procedure TImagePreview.SurfaceRedraw(Sender: TObject; Bitmap: TBGRABitmap);
 begin
 begin
-  FScaling := FSurface.GetCanvasScaleFactor;
+  FScaling := FSurface.GetCanvasScaleFactor * Trunc(Screen.PixelsPerInch/OriginalDPI+0.25);
   TVolatileScrollBar.InitDPI(FScaling);
   TVolatileScrollBar.InitDPI(FScaling);
   FSurfaceScaledHeight := Bitmap.Height;
   FSurfaceScaledHeight := Bitmap.Height;
   if (Bitmap.Width = 0) or (Bitmap.Height = 0) then
   if (Bitmap.Width = 0) or (Bitmap.Height = 0) then
@@ -318,8 +318,12 @@ begin
   else
   else
     exit;
     exit;
 
 
-  w := round(w*FScaling);
-  h := round(h*FScaling);
+  // SVG is already scaled
+  if FImageFormat <> ifSVG then
+  begin
+    w := round(w*FScaling);
+    h := round(h*FScaling);
+  end;
 
 
   if w > bitmap.Width then
   if w > bitmap.Width then
   begin
   begin