From 83cb5d256015a1eb5f79a9ced4b22332b61b4d24 Mon Sep 17 00:00:00 2001 From: ondrej Date: Sun, 13 May 2018 21:37:00 +0000 Subject: [PATCH] Cocoa: improve r57928 #fda9deecd3 git-svn-id: trunk@57931 - --- lcl/interfaces/cocoa/cocoawsbuttons.pp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lcl/interfaces/cocoa/cocoawsbuttons.pp b/lcl/interfaces/cocoa/cocoawsbuttons.pp index d51d74c75f..7216ef6d14 100644 --- a/lcl/interfaces/cocoa/cocoawsbuttons.pp +++ b/lcl/interfaces/cocoa/cocoawsbuttons.pp @@ -126,21 +126,23 @@ var AEffect: TGraphicsDrawEffect; AImgRes: TScaledImageListResolution; ImgSize: NSSize; + ScaleFactor: Double; begin //WriteLn('[TCocoaWSBitBtn.SetGlyph]'); Img := nil; if ABitBtn.CanShowGlyph(True) then begin AGlyph := TBitmap.Create; + ScaleFactor := ABitBtn.GetCanvasScaleFactor; AValue.GetImageIndexAndEffect(bsUp, ABitBtn.Font.PixelsPerInch, - ABitBtn.GetCanvasScaleFactor, AImgRes, AIndex, AEffect); + ScaleFactor, AImgRes, AIndex, AEffect); AImgRes.GetBitmap(AIndex, AGlyph, AEffect); Img := TCocoaBitmap(AGlyph.Handle).image; - if AImgRes.Resolution.ImageList.Scaled then // resize only if the image list is scaled + if AImgRes.Resolution.ImageList.Scaled and not SameValue(ScaleFactor, 1) then // resize only if the image list is scaled begin ImgSize := Img.size; - ImgSize.height := ImgSize.height / ABitBtn.GetCanvasScaleFactor; - ImgSize.width := ImgSize.width / ABitBtn.GetCanvasScaleFactor; + ImgSize.height := ImgSize.height / ScaleFactor; + ImgSize.width := ImgSize.width / ScaleFactor; Img.setSize(ImgSize); end; lButtonHandle := TCocoaButton(ABitBtn.Handle);