Marcel Taeumel uploaded a new version of Graphics to project The Trunk: http://source.squeak.org/trunk/Graphics-mt.549.mcz
==================== Summary ====================
Name: Graphics-mt.549 Author: mt Time: 8 December 2023, 9:44:03.724103 am UUID: d73c6d39-cf42-6549-9068-c9f2201aeb9b Ancestors: Graphics-dtl.548
Expand commentary for #px, now that I realized that mixed-arithmetic is the reason why float*int is faster than int*float. Might still be a bug in the VM though.
=============== Diff against Graphics-dtl.548 ===============
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...because mixed-arithmetic seems to only be optimized this way around."! - "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."!
packages@lists.squeakfoundation.org