Переглянути джерело

add DPI scaling of checkers

Johann ELSASS 4 роки тому
батько
коміт
c1f0312c33

+ 5 - 2
lazpaint/dialog/usaveoption.pas

@@ -274,7 +274,7 @@ end;
 
 procedure TFSaveOption.BGRAPreviewRedraw(Sender: TObject;
   Bitmap: TBGRABitmap);
-var ratioX,ratioY,ratio: single;
+var ratioX,ratioY,ratio, checkerScale: single;
   picture: TBGRABitmap;
   mustFreePic: boolean;
   x,y,visualWidth,visualHeight: integer;
@@ -341,7 +341,10 @@ begin
     thumb.Free;
   end else
   begin
-    DrawCheckers(Bitmap, r);
+    checkerScale := DoScaleX(60, OriginalDPI)/60;
+    if not BGRAPreview.BitmapAutoScale then
+      checkerScale *= BGRAPreview.GetCanvasScaleFactor;
+    DrawCheckers(Bitmap, r, checkerScale);
     Bitmap.StretchPutImage(r, picture, dmDrawWithTransparency);
   end;
   if mustFreePic then picture.Free;

+ 2 - 2
lazpaint/uimagepreview.pas

@@ -110,7 +110,7 @@ type
 implementation
 
 uses FPimage, BGRAReadJpeg, BGRAOpenRaster, BGRAPaintNet, BGRAReadLzp, Dialogs, UNewimage,
-  LCLType, BGRAPhoxo, BGRASVG, math, URaw, UImage;
+  LCLType, BGRAPhoxo, BGRASVG, math, URaw, UImage, LCScaleDPI;
 
 { TImagePreview }
 
@@ -336,7 +336,7 @@ begin
   bitmap.FillRect(rect(x+w,y+ofs,x+ofs+w,y+ofs+h), BGRA(0,0,0,128),dmDrawWithTransparency);
   bitmap.FillRect(rect(x+ofs,y+h,x+w,y+ofs+h), BGRA(0,0,0,128),dmDrawWithTransparency);
 
-  DrawThumbnailCheckers(Bitmap, rect(x,y,x+w,y+h), false, FScaling);
+  DrawThumbnailCheckers(Bitmap, rect(x,y,x+w,y+h), false, DoScaleX(round(60*FScaling), OriginalDPI)/60);
   bitmap.StretchPutImage(rect(x,y,x+w,y+h), frame, dmDrawWithTransparency)
 end;
 

+ 1 - 1
lazpaint/uimageview.pas

@@ -467,7 +467,7 @@ begin
       OffsetRect(renderRect, -FLastPictureParameters.scaledVirtualScreenArea.Left,
                              -FLastPictureParameters.scaledVirtualScreenArea.Top);
 
-      DrawThumbnailCheckers(FVirtualScreen, renderRect, Image.IsIconCursor, CanvasScale);
+      DrawThumbnailCheckers(FVirtualScreen, renderRect, Image.IsIconCursor, DoScaleX(60*CanvasScale, OriginalDPI)/60);
 
       //draw image (with merged selection)
       FVirtualScreen.StretchPutImage(renderRect,Image.RenderedImage,dmDrawWithTransparency);