[squeak-dev] The Trunk: Graphics-nice.139.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Jul 25 12:26:08 UTC 2010
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.139.mcz
==================== Summary ====================
Name: Graphics-nice.139
Author: nice
Time: 20 June 2010, 10:08:24.066 pm
UUID: 223e2d4c-b60c-834e-8a77-5b84e525c6f7
Ancestors: Graphics-cmm.138
Change behaviour of empty Rectangle:
- don't let an empty Rectangle #intersects:
- let #flipBy:centerAt: and #rotateBy:centerAt: preserve a Rectangle emptyness
=============== Diff against Graphics-cmm.138 ===============
Item was changed:
----- Method: Rectangle>>intersects: (in category 'testing') -----
intersects: aRectangle
"Answer whether aRectangle intersects the receiver anywhere."
"Optimized; old code answered:
(origin max: aRectangle origin) < (corner min: aRectangle corner)"
| rOrigin rCorner |
rOrigin := aRectangle origin.
rCorner := aRectangle corner.
rCorner x <= origin x ifTrue: [^ false].
rCorner y <= origin y ifTrue: [^ false].
rOrigin x >= corner x ifTrue: [^ false].
rOrigin y >= corner y ifTrue: [^ false].
+ "None of the two rectangle shall be empty"
+ corner x <= origin x ifTrue: [^ false].
+ corner y <= origin y ifTrue: [^ false].
+ rCorner x <= rOrigin x ifTrue: [^ false].
+ rCorner y <= rOrigin y ifTrue: [^ false].
^ true
!
Item was changed:
----- Method: Rectangle>>rotateBy:centerAt: (in category 'transforming') -----
rotateBy: direction centerAt: aPoint
"Return a copy rotated #right, #left, or #pi about aPoint"
+ | futureOrigin futureCorner |
+ direction == #pi
+ ifTrue:
+ [futureOrigin := self corner.
+ futureCorner := self origin]
+ ifFalse: [direction == #left
+ ifTrue:
+ [futureOrigin := self topRight.
+ futureCorner := self bottomLeft]
+ ifFalse: [direction == #right
+ ifTrue:
+ [futureOrigin := self bottomLeft.
+ futureCorner := self topRight]
+ ifFalse: [self error: 'unrecognizable direction']]].
+ ^ (futureOrigin rotateBy: direction centerAt: aPoint)
+ corner: (futureCorner rotateBy: direction centerAt: aPoint)!
- ^ (origin rotateBy: direction centerAt: aPoint)
- rect: (corner rotateBy: direction centerAt: aPoint)!
Item was changed:
----- Method: Rectangle>>flipBy:centerAt: (in category 'transforming') -----
flipBy: direction centerAt: aPoint
"Return a copy flipped #vertical or #horizontal, about aPoint."
+ | futureOrigin futureCorner |
+ direction == #horizontal
+ ifTrue:
+ [futureOrigin := self topRight.
+ futureCorner := self bottomLeft]
+ ifFalse: [direction == #vertical
+ ifTrue:
+ [futureOrigin := self bottomLeft.
+ futureCorner := self topRight]
+ ifFalse: [self error: 'unrecognizable direction']].
+ ^ (futureOrigin flipBy: direction centerAt: aPoint)
+ corner: (futureCorner flipBy: direction centerAt: aPoint)!
- ^ (origin flipBy: direction centerAt: aPoint)
- rect: (corner flipBy: direction centerAt: aPoint)!
More information about the Squeak-dev
mailing list
|