Marcel Taeumel uploaded a new version of Graphics to project The Trunk: http://source.squeak.org/trunk/Graphics-mt.544.mcz
==================== Summary ====================
Name: Graphics-mt.544 Author: mt Time: 31 August 2023, 10:52:58.559282 am UUID: b70909d7-fda1-c44f-9ef1-97c666c840fc Ancestors: Graphics-mt.543
Speed up and extend #px to be conveniently used for #scaleFactor support of magic (pixel-based) numbers.
=============== Diff against Graphics-mt.543 ===============
Item was changed: ----- Method: Number>>px (in category '*Graphics-scale factor') ----- px "Convert the receiver representing raw pixels at 100% (96ppi) to the current scale factor. Note that you currently have to do this manually for all graphics-related properties and layout-specific measures such as #borderWidth: and #layoutInset:. Only for model windows (see #initialExtent) that are no dialogs, that scaling will happen automatically in ToolBuilder."
+ | scaleFactor | + self = 0 ifTrue: [^ self]. + (scaleFactor := RealEstateAgent scaleFactor) = 1 ifTrue: [^ self]. + ^ self > 4 + ifTrue: [(scaleFactor * self) rounded] + ifFalse: [(scaleFactor * self) truncated] + + "For self > 4, we recommend #rounded instead of #truncated. For smaller values, however, rounding makes no sense because we have no sub-pixel access and things would look too big too soon. Also, #scaleFactor might be a float and self is usually an integer. Thus, self should be on the right side of the multiplication to speed up the whole thing."! - self flag: #discuss. "mt: For self > 4, I would recommend #rounded instead of #truncated. For smaller values, however, rounding makes no sense because we have no sub-pixel access and things would look too big too soon." - ^ (self * RealEstateAgent scaleFactor) truncated!
packages@lists.squeakfoundation.org