'From Squeak3.9alpha of 4 July 2005 [latest update: #6693] on 4 October 2005 at 2:44:03 pm'!
"Change Set: FasterRectangelInsetBy
Date: 2 October 2005
Author: Marcus Denker
Rectangle insetBy: was testing with isKindOf: to check if the parameter is
a Rectangle or not. This means, we search up the inheritance hierarchy
for each insetBy with the parameter beeing a point or an Integer... changing
isKindOf: to isRectangle makes insetBy: around 25% faster for Integers"!
!Object methodsFor: 'testing' stamp: 'md 10/2/2005 21:52'!
isRectangle
^false! !
!Rectangle methodsFor: 'testing' stamp: 'md 10/2/2005 21:51'!
isRectangle
^true! !
!Rectangle methodsFor: 'rectangle functions' stamp: 'md 10/4/2005 14:42'!
expandBy: delta
"Answer a Rectangle that is outset from the receiver by delta. delta is a
Rectangle, Point, or scalar."
(delta isRectangle)
ifTrue: [^Rectangle
origin: origin - delta origin
corner: corner + delta corner]
ifFalse: [^Rectangle
origin: origin - delta
corner: corner + delta]! !
!Rectangle methodsFor: 'rectangle functions' stamp: 'md 10/4/2005 14:42'!
extendBy: delta
"Answer a Rectangle with the same origin as the receiver, but whose corner is offset by delta. delta is a
Rectangle, Point, or scalar."
(delta isRectangle)
ifTrue: [^Rectangle
origin: origin
corner: corner + delta corner]
ifFalse: [^Rectangle
origin: origin
corner: corner + delta]! !
!Rectangle methodsFor: 'rectangle functions' stamp: 'md 10/2/2005 21:51'!
insetBy: delta
"Answer a Rectangle that is inset from the receiver by delta. delta is a
Rectangle, Point, or scalar."
(delta isRectangle)
ifTrue: [^Rectangle
origin: origin + delta origin
corner: corner - delta corner]
ifFalse: [^Rectangle
origin: origin + delta
corner: corner - delta]! !
!Rectangle methodsFor: 'rectangle functions' stamp: 'md 10/4/2005 14:41'!
outsetBy: delta
"Answer a Rectangle that is outset from the receiver by delta. delta is a
Rectangle, Point, or scalar."
(delta isRectangle)
ifTrue: [^Rectangle
origin: origin - delta origin
corner: corner + delta corner]
ifFalse: [^Rectangle
origin: origin - delta
corner: corner + delta]! !