[squeak-dev] The Inbox: Graphics-kfr.530.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Wed Aug 10 08:18:19 UTC 2022


Hi Karl --

Merged. Please avoid stacking unrelated inbox contributions on top of your previous inbox versions. Always base your inbox submission on a recent version from Trunk. kfr.530, kfr.529, and kfr.528 are all different things, yet, their ancestry depends on each other. Makes reviewing and merging more difficult. Thanks. :-)

Best,
Marcel
Am 09.08.2022 07:12:43 schrieb commits at source.squeak.org <commits at source.squeak.org>:
A new version of Graphics was added to project The Inbox:
http://source.squeak.org/inbox/Graphics-kfr.530.mcz

==================== Summary ====================

Name: Graphics-kfr.530
Author: kfr
Time: 9 August 2022, 7:12:20.983085 am
UUID: ee4a3ab4-fc38-f349-b0bc-f6f109ba9d01
Ancestors: Graphics-kfr.529

Avoid call to allButFirstDo: in Rectangle class>>encompassing: and Rectangle class>>merging:.
But keep the call to Rectangle class>>origin: corner: so subclasses can use these methods

=============== Diff against Graphics-kfr.529 ===============

Item was changed:
----- Method: Rectangle class>>encompassing: (in category 'instance creation') -----
encompassing: listOfPoints
"A number of callers of encompass: should use this method."
| topLeft bottomRight |
+ topLeft := bottomRight := nil.
+ listOfPoints do:
+ [:p | topLeft == nil
+ ifTrue: [topLeft := bottomRight := p]
+ ifFalse: [topLeft := topLeft min: p.
+ bottomRight := bottomRight max: p]].
+ ^self origin: topLeft corner: bottomRight!
- topLeft := bottomRight := listOfPoints first.
- listOfPoints allButFirstDo:
- [:p |topLeft := topLeft min: p.
- bottomRight := bottomRight max: p].
- ^self origin: topLeft corner: bottomRight
- !

Item was changed:
----- Method: Rectangle class>>merging: (in category 'instance creation') -----
merging: listOfRects
"A number of callers of merge: should use this method."
+ | minX minY maxX maxY |
- | bottomRight topLeft |
- topLeft := listOfRects first topLeft.
- bottomRight := listOfRects first bottomRight.
listOfRects
+ do: [:r | minX
+ ifNil: [minX := r topLeft x. minY := r topLeft y.
+ maxX := r bottomRight x. maxY := r bottomRight y]
+ ifNotNil: [minX := minX min: r topLeft x. minY := minY min: r topLeft y.
+ maxX := maxX max: r bottomRight x. maxY := maxY max: r bottomRight y]].
+ ^self origin: minX at minY corner: maxX at maxY!
- allButFirstDo: [:r | topLeft := topLeft min: r topLeft.
- bottomRight := bottomRight max: r bottomRight].
- ^self origin: topLeft corner: bottomRight.
- !


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220810/5333671f/attachment.html>


More information about the Squeak-dev mailing list