always remember the deviceClipRect internally;
convert back to logical, when asked for.
--- a/DevGC.st Tue May 18 21:16:32 1999 +0200
+++ b/DevGC.st Tue May 18 21:22:32 1999 +0200
@@ -280,14 +280,13 @@
|rect|
- clipRect isNil ifTrue:[
- rect := 0@0 extent:(self extent).
- transformation notNil ifTrue:[
- rect := transformation applyInverseTo:rect.
- ].
- ^ rect
+ (rect := clipRect) isNil ifTrue:[
+ rect := 0@0 extent:(self extent).
].
- ^ clipRect
+ transformation notNil ifTrue:[
+ rect := transformation applyInverseTo:rect.
+ ].
+ ^ rect
"Modified: 10.4.1996 / 14:32:22 / cg"
!
@@ -318,50 +317,51 @@
"set the clipping rectangle for drawing (in logical coordinates);
a nil argument turn off clipping (i.e. whole view is drawable)"
- |x y w h|
-
- aRectangleOrNil isNil ifTrue:[
- clipRect isNil ifTrue:[^ self].
- gcId notNil ifTrue:[
- device noClipIn:drawableId gc:gcId
- ]
+ |x y w h r|
+
+ (r := aRectangleOrNil) isNil ifTrue:[
+ clipRect isNil ifTrue:[^ self].
+ gcId notNil ifTrue:[
+ device noClipIn:drawableId gc:gcId
+ ]
] ifFalse:[
- clipRect notNil ifTrue:[
- (clipRect = aRectangleOrNil) ifTrue:[^ self]
- ].
- gcId notNil ifTrue:[
- x := aRectangleOrNil left.
- y := aRectangleOrNil top.
- w := aRectangleOrNil width.
- h := aRectangleOrNil height.
- transformation notNil ifTrue:[
- x := transformation applyToX:x.
- y := transformation applyToY:y.
- w := transformation applyScaleX:w.
- h := transformation applyScaleY:h.
- ].
- (x class == SmallInteger) ifFalse:[
- w := w + (x - x truncated).
- x := x truncated
- ].
- (y class == SmallInteger) ifFalse:[
- h := h + (y - y truncated).
- y := y truncated
- ].
- (w class == SmallInteger) ifFalse:[
- w := w truncated + 1
- ].
- (h class == SmallInteger) ifFalse:[
- h := h truncated + 1
- ].
-
- device setClipX:x y:y width:w height:h in:drawableId gc:gcId
- ]
+ clipRect notNil ifTrue:[
+ (clipRect = aRectangleOrNil) ifTrue:[^ self]
+ ].
+ gcId notNil ifTrue:[
+ x := aRectangleOrNil left.
+ y := aRectangleOrNil top.
+ w := aRectangleOrNil width.
+ h := aRectangleOrNil height.
+ transformation notNil ifTrue:[
+ x := transformation applyToX:x.
+ y := transformation applyToY:y.
+ w := transformation applyScaleX:w.
+ h := transformation applyScaleY:h.
+ ].
+ (x class == SmallInteger) ifFalse:[
+ w := w + (x - x truncated).
+ x := x truncated
+ ].
+ (y class == SmallInteger) ifFalse:[
+ h := h + (y - y truncated).
+ y := y truncated
+ ].
+ (w class == SmallInteger) ifFalse:[
+ w := w truncated + 1
+ ].
+ (h class == SmallInteger) ifFalse:[
+ h := h truncated + 1
+ ].
+
+ device setClipX:x y:y width:w height:h in:drawableId gc:gcId.
+ r := Rectangle left:x top:y width:w height:h
+ ]
].
- clipRect := aRectangleOrNil
-
- "Modified: 22.5.1996 / 13:12:07 / cg"
- "Created: 28.5.1996 / 19:40:20 / cg"
+ clipRect := r
+
+ "Created: / 28.5.1996 / 19:40:20 / cg"
+ "Modified: / 16.5.1999 / 19:40:37 / cg"
!
colorAt:aPoint
@@ -3831,6 +3831,6 @@
!DeviceGraphicsContext class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Attic/DevGC.st,v 1.66 1999-04-23 12:42:04 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Attic/DevGC.st,v 1.67 1999-05-18 19:22:32 cg Exp $'
! !
DeviceGraphicsContext initialize!
--- a/DeviceGraphicsContext.st Tue May 18 21:16:32 1999 +0200
+++ b/DeviceGraphicsContext.st Tue May 18 21:22:32 1999 +0200
@@ -280,14 +280,13 @@
|rect|
- clipRect isNil ifTrue:[
- rect := 0@0 extent:(self extent).
- transformation notNil ifTrue:[
- rect := transformation applyInverseTo:rect.
- ].
- ^ rect
+ (rect := clipRect) isNil ifTrue:[
+ rect := 0@0 extent:(self extent).
].
- ^ clipRect
+ transformation notNil ifTrue:[
+ rect := transformation applyInverseTo:rect.
+ ].
+ ^ rect
"Modified: 10.4.1996 / 14:32:22 / cg"
!
@@ -318,50 +317,51 @@
"set the clipping rectangle for drawing (in logical coordinates);
a nil argument turn off clipping (i.e. whole view is drawable)"
- |x y w h|
-
- aRectangleOrNil isNil ifTrue:[
- clipRect isNil ifTrue:[^ self].
- gcId notNil ifTrue:[
- device noClipIn:drawableId gc:gcId
- ]
+ |x y w h r|
+
+ (r := aRectangleOrNil) isNil ifTrue:[
+ clipRect isNil ifTrue:[^ self].
+ gcId notNil ifTrue:[
+ device noClipIn:drawableId gc:gcId
+ ]
] ifFalse:[
- clipRect notNil ifTrue:[
- (clipRect = aRectangleOrNil) ifTrue:[^ self]
- ].
- gcId notNil ifTrue:[
- x := aRectangleOrNil left.
- y := aRectangleOrNil top.
- w := aRectangleOrNil width.
- h := aRectangleOrNil height.
- transformation notNil ifTrue:[
- x := transformation applyToX:x.
- y := transformation applyToY:y.
- w := transformation applyScaleX:w.
- h := transformation applyScaleY:h.
- ].
- (x class == SmallInteger) ifFalse:[
- w := w + (x - x truncated).
- x := x truncated
- ].
- (y class == SmallInteger) ifFalse:[
- h := h + (y - y truncated).
- y := y truncated
- ].
- (w class == SmallInteger) ifFalse:[
- w := w truncated + 1
- ].
- (h class == SmallInteger) ifFalse:[
- h := h truncated + 1
- ].
-
- device setClipX:x y:y width:w height:h in:drawableId gc:gcId
- ]
+ clipRect notNil ifTrue:[
+ (clipRect = aRectangleOrNil) ifTrue:[^ self]
+ ].
+ gcId notNil ifTrue:[
+ x := aRectangleOrNil left.
+ y := aRectangleOrNil top.
+ w := aRectangleOrNil width.
+ h := aRectangleOrNil height.
+ transformation notNil ifTrue:[
+ x := transformation applyToX:x.
+ y := transformation applyToY:y.
+ w := transformation applyScaleX:w.
+ h := transformation applyScaleY:h.
+ ].
+ (x class == SmallInteger) ifFalse:[
+ w := w + (x - x truncated).
+ x := x truncated
+ ].
+ (y class == SmallInteger) ifFalse:[
+ h := h + (y - y truncated).
+ y := y truncated
+ ].
+ (w class == SmallInteger) ifFalse:[
+ w := w truncated + 1
+ ].
+ (h class == SmallInteger) ifFalse:[
+ h := h truncated + 1
+ ].
+
+ device setClipX:x y:y width:w height:h in:drawableId gc:gcId.
+ r := Rectangle left:x top:y width:w height:h
+ ]
].
- clipRect := aRectangleOrNil
-
- "Modified: 22.5.1996 / 13:12:07 / cg"
- "Created: 28.5.1996 / 19:40:20 / cg"
+ clipRect := r
+
+ "Created: / 28.5.1996 / 19:40:20 / cg"
+ "Modified: / 16.5.1999 / 19:40:37 / cg"
!
colorAt:aPoint
@@ -3831,6 +3831,6 @@
!DeviceGraphicsContext class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.66 1999-04-23 12:42:04 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.67 1999-05-18 19:22:32 cg Exp $'
! !
DeviceGraphicsContext initialize!