#REFACTORING by stefan
authorStefan Vogel <sv@exept.de>
Wed, 20 Jul 2016 11:17:36 +0200
changeset 7420 c1c1c574f217
parent 7419 b594081e3710
child 7421 0b749b7c7bea
#REFACTORING by stefan class: GraphicsMedium changed:133 methods remove transition code tp delegated GC ("gc == self ifTrue:[]")
GraphicsMedium.st
--- a/GraphicsMedium.st	Wed Jul 20 10:16:09 2016 +0200
+++ b/GraphicsMedium.st	Wed Jul 20 11:17:36 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -9,8 +11,6 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-'From Smalltalk/X, Version:7.1.0.0 on 19-07-2016 at 15:53:05'                   !
-
 "{ Package: 'stx:libview' }"
 
 "{ NameSpace: Smalltalk }"
@@ -301,9 +301,6 @@
     "given a string, return its width in pixels if
      drawn on the receivers device."
 
-    gc == self ifTrue:[
-	^ super widthOfString:aString.
-    ].
     ^ gc widthOfString:aString.
 
     "Modified: 28.5.1996 / 20:22:22 / cg"
@@ -313,9 +310,6 @@
     "given a string, return the width in pixels if
      a substring is drawn on the receivers device."
 
-    gc == self ifTrue:[
-	^ super widthOfString:aString from:start to:stop.
-    ].
     ^ gc widthOfString:aString from:start to:stop.
 
     "Modified: 28.5.1996 / 20:22:18 / cg"
@@ -413,17 +407,13 @@
 fill:aRectangle fillColor:aColor
     "fill the rectangular area specified by aRectangle with the black color"
 
-    gc == self ifTrue:[
-	super fill:aRectangle fillColor:aColor.
-	^ self.
-    ].
     gc fill:aRectangle fillColor:aColor
 !
 
 fillBlack:aRectangle
     "fill the rectangular area specified by aRectangle with the black color"
 
-    self fill:aRectangle fillColor:Color black
+    self fill:aRectangle fillColor:self blackColor
 !
 
 fillColor:something
@@ -436,23 +426,19 @@
 fillRectangle:aRectangle color:aColor
     "fill a rectangle with the given paint color"
 
-    gc == self ifTrue:[
-	super fillRectangle:aRectangle color:aColor.
-	^ self.
-    ].
     gc fillRectangle:aRectangle color:aColor
 !
 
 fillWhite
     "fill all of the receiver with the white color"
 
-    self fill:Color white
+    self fill:self whiteColor
 !
 
 fillWhite:aRectangle
     "fill the rectangular area specified by aRectangle with the white color"
 
-    self fill:aRectangle fillColor:Color white
+    self fill:aRectangle fillColor:self whiteColor
 ! !
 
 !GraphicsMedium methodsFor:'Compatibility-VW'!
@@ -513,19 +499,12 @@
 atX:x y:y
     "return the pixel at the coordinate given by x/y"
 
-    gc == self ifTrue:[
-	^ super atX:x y:y
-    ].
     ^ gc atX:x y:y
 !
 
 atX:x y:y put:aPixelColor
     "set a pixel"
 
-    gc == self ifTrue:[
-	super atX:x y:y put:aPixelColor.
-	^ self.
-    ].
     gc atX:x y:y put:aPixelColor.
 !
 
@@ -533,9 +512,6 @@
     "return the background paint color.
      (used for opaqueForms and opaqueStrings)"
 
-    gc == self ifTrue:[
-	^ super backgroundPaint.
-    ].
     ^ gc backgroundPaint
 !
 
@@ -543,19 +519,12 @@
     "set the background-paint color; this is used in opaque-draw
      operations"
 
-    gc == self ifTrue:[
-	super backgroundPaint:aColor.
-	^ self.
-    ].
     gc backgroundPaint:aColor
 !
 
 basicFont
     "return the font for drawing"
 
-    gc == self ifTrue:[
-	^ super basicFont.
-    ].
     ^ gc basicFont
 !
 
@@ -564,21 +533,14 @@
      This is a low level entry, which is not to be redefined
      (i.e. it must not imply a redraw operation)"
 
-    gc == self ifTrue:[
-	super basicFont:aFont.
-	^ self.
-    ].
     gc basicFont:aFont
 !
 
 blackColor
     gc isNil ifTrue:[
-	^ Color black.
+        ^ Color black.
     ].
-    gc == self ifTrue:[
-	^ super device blackColor.
-    ].
-    ^ gc device blackColor
+    ^ gc blackColor
 !
 
 bottomCenter
@@ -604,9 +566,6 @@
     "return the current cap-style for line-drawing.
      possible styles are: #notLast, #butt, #round, #projecting"
 
-    gc == self ifTrue:[
-	^ super capStyle.
-    ].
     ^ gc capStyle
 !
 
@@ -614,10 +573,6 @@
     "set the cap-style for line-drawing;
      possible styles are: #notLast, #butt, #round, #projecting"
 
-    gc == self ifTrue:[
-	super capStyle:aStyleSymbol.
-	^ self.
-    ].
     gc capStyle:aStyleSymbol
 
     "Modified: 12.5.1996 / 22:24:30 / cg"
@@ -637,9 +592,6 @@
      and required when japanese/chinese/korean text is edited.
      (encoding is something like #'iso8859-5' #euc, #sjis, #jis7, #gb, #big5 or #ksc)"
 
-    gc == self ifTrue:[
-	^ super characterEncoding.
-    ].
     ^ gc characterEncoding
 !
 
@@ -652,10 +604,6 @@
      another encoding internally. One such view is the CharacterSetView,
      which wants to show character as they are actually present in a font."
 
-    gc == self ifTrue:[
-	super characterEncoding:encodingArg.
-	^ self.
-    ].
     gc characterEncoding:encodingArg
 !
 
@@ -701,10 +649,6 @@
      Only useful for the rootView, to draw over any visible views.
      (for example, when dragging a rubber-line)"
 
-    gc == self ifTrue:[
-	super clippedByChildren:aBoolean.
-	^ self.
-    ].
     gc clippedByChildren:aBoolean.
 
     "Created: 17.7.1996 / 13:25:16 / cg"
@@ -714,9 +658,6 @@
 clippingBounds
     "return the clipping rectangle for drawing, nil if there is none."
 
-    gc == self ifTrue:[
-	^ super clippingBounds.
-    ].
     ^ gc clippingBounds
 !
 
@@ -724,19 +665,12 @@
     "set the clipping rectangle for drawing (in logical coordinates);
      a nil argument turn off clipping (i.e. whole view is drawable)"
 
-    gc == self ifTrue:[
-	super clippingBounds:aRectangleOrNil.
-	^ self.
-    ].
     gc clippingBounds:aRectangleOrNil
 !
 
 clippingBoundsOrNil
     "return the clipping rectangle for drawing, nil if there is none."
 
-    gc == self ifTrue:[
-	^ super clippingBoundsOrNil.
-    ].
     ^ gc clippingBoundsOrNil
 !
 
@@ -768,9 +702,6 @@
 colorAtX:x y:y
     "return the color of the pixel at the coordinate given by aPoint"
 
-    gc == self ifTrue:[
-	^ super colorAtX:x y:y.
-    ].
     ^ gc colorAtX:x y:y
 !
 
@@ -803,9 +734,6 @@
      The dashOffset specifies where in the dashList the dashing starts.
      Ignored here - this may not be supported by all graphics devices."
 
-    gc == self ifTrue:[
-	^ super dashStyle:aDashList offset:dashOffset.
-    ].
     ^ gc dashStyle:aDashList offset:dashOffset
 !
 
@@ -819,41 +747,30 @@
     "set the device"
 
     aDevice isNil ifTrue:[
-	^ self.
+        ^ self.
     ].
 
     device := aDevice.
     gc isNil ifTrue:[
-	gc := aDevice newGraphicsContextFor:self.
-	^ self.
+        gc := aDevice newGraphicsContextFor:self.
+        ^ self.
     ].
 
-    gc == self ifTrue:[
-	super device:aDevice.
-    ] ifFalse:[
-	gc device:aDevice
-    ].
+    gc device:aDevice
 !
 
 deviceClippingRectangle:aRectangleOrNil
     "set the clipping rectangle for drawing (in device coordinates);
      a nil argument turns off clipping (i.e. whole view is drawable - incl. margins)"
 
-    gc == self ifTrue:[
-	super deviceClippingRectangle:aRectangleOrNil.
-	^ self.
-    ].
     gc deviceClippingRectangle:aRectangleOrNil
 !
 
 drawableId
     "return the id of the drawable on the device"
 
-    gc == self ifTrue:[
-	^ super drawableId.
-    ].
     gc isNil ifTrue:[
-	^ nil.
+        ^ nil.
     ].
     ^ gc drawableId
 !
@@ -875,9 +792,6 @@
 font
     "return the current drawing font"
 
-    gc == self ifTrue:[
-	^ super font.
-    ].
     ^ gc font
 !
 
@@ -886,41 +800,27 @@
      This should be redefined in some widget to perform an automatic
      redraw. See also: #basicFont:"
 
-    gc == self ifTrue:[
-	super font:aFont.
-    ] ifFalse:[
-	gc font:aFont.
-    ].
+    gc font:aFont.
     self changed:#font.
 !
 
 function
     "return the current drawing function"
 
-    gc == self ifTrue:[
-	^ super function.
-    ].
     ^ gc function
 !
 
 function:aSymbol
     "set the drawing function if it has changed"
 
-    gc == self ifTrue:[
-	super function:aSymbol.
-	^ self.
-    ].
     gc function:aSymbol
 !
 
 gcId
     "return the receivers graphic context id on the device"
 
-    gc == self ifTrue:[
-	^ super gcId.
-    ].
     gc isNil ifTrue:[
-	^ nil.
+        ^ nil.
     ].
     ^ gc gcId.
 !
@@ -967,9 +867,6 @@
     "return the current join-style for polygon-drawing.
      possible styles are: #miter, #bevel, #round"
 
-    gc == self ifTrue:[
-	^ super joinStyle.
-    ].
     ^ gc joinStyle
 !
 
@@ -977,10 +874,6 @@
     "set the join-style of lines in polygon-drawing;
      possible styles are: #miter, #bevel, #round"
 
-    gc == self ifTrue:[
-	super joinStyle:aStyleSymbol.
-	^ self.
-    ].
     gc joinStyle:aStyleSymbol
 !
 
@@ -1001,9 +894,6 @@
      possible styles are: #solid, #dashed, #doubleDashed,
      #dotted, #dashDot or #dashDotDot."
 
-    gc == self ifTrue:[
-	^ super lineStyle.
-    ].
     ^ gc lineStyle
 !
 
@@ -1012,48 +902,30 @@
      possible styles are: #solid, #dashed, #doubleDashed,
      #dotted, #dashDot or #dashDotDot."
 
-    gc == self ifTrue:[
-	super lineStyle:aStyleSymbol.
-	^ self.
-    ].
     gc lineStyle:aStyleSymbol
 !
 
 lineWidth
     "return the current drawing linewidth"
 
-    gc == self ifTrue:[
-	^ super lineWidth.
-    ].
     ^ gc lineWidth
 !
 
 lineWidth:aNumber
     "set the line drawing width in pixels"
 
-    gc == self ifTrue:[
-	super lineWidth:aNumber.
-	^ self.
-    ].
     gc lineWidth:aNumber
 !
 
 mask
     "return the current drawing mask"
 
-    gc == self ifTrue:[
-	^ super mask.
-    ].
     ^ gc mask
 !
 
 mask:aForm
     "set the drawing mask"
 
-    gc == self ifTrue:[
-	super mask:aForm.
-	^ self.
-    ].
     gc mask:aForm
 !
 
@@ -1062,9 +934,6 @@
      Should be redefined in classes which support it.
      This is an alias for ST-80's #phase"
 
-    gc == self ifTrue:[
-	^ super maskOrigin.
-    ].
     ^ gc maskOrigin
 !
 
@@ -1073,10 +942,6 @@
      Should be redefined in classes which support it.
      This is an alias for ST-80's #phase:"
 
-    gc == self ifTrue:[
-	super maskOrigin:aPoint.
-	^ self.
-    ].
     gc maskOrigin:aPoint
 !
 
@@ -1091,9 +956,6 @@
 medium
     "return the destination medium i.e. the underlying graphics device"
 
-    gc == self ifTrue:[
-	^ super graphicsDevice.
-    ].
     ^ gc graphicsDevice
 !
 
@@ -1117,19 +979,12 @@
 paint
     "return the current paint drawing color"
 
-    gc == self ifTrue:[
-	^ super paint.
-    ].
     ^ gc paint
 !
 
 paint:aColor
     "set the drawing painting color, aColor can be a dithered one"
 
-    gc == self ifTrue:[
-	super paint:aColor.
-	^ self.
-    ].
     gc paint:aColor
 !
 
@@ -1137,10 +992,6 @@
     "set the paint and backgroundPaint, used for text and bitmaps.
      Both colors may be dithered colors"
 
-    gc == self ifTrue:[
-	super paint:fgColor on:bgColor.
-	^ self.
-    ].
     gc paint:fgColor on:bgColor
 !
 
@@ -1176,10 +1027,6 @@
 !
 
 setClippingBounds:aRectangleOrNil
-    gc == self ifTrue:[
-	super setClippingBounds:aRectangleOrNil.
-	^ self.
-    ].
     gc setClippingBounds:aRectangleOrNil
 !
 
@@ -1187,10 +1034,6 @@
     "want to if aBoolean is true - or don't want to be notified
      of graphics exposures"
 
-    gc == self ifTrue:[
-	super setGraphicsExposures:aBoolean.
-	^ self.
-    ].
     gc setGraphicsExposures:aBoolean
 !
 
@@ -1253,12 +1096,9 @@
 
 whiteColor
     gc isNil ifTrue:[
-	^ Color white.
+        ^ Color white.
     ].
-    gc == self ifTrue:[
-	^ super graphicsDevice whiteColor.
-    ].
-    ^ gc graphicsDevice whiteColor
+    ^ gc whiteColor
 !
 
 width
@@ -1287,9 +1127,6 @@
     "return the current background drawing color.
      OBSOLETE: use #paint: / #backgroundPaint: / #paint:on:"
 
-    gc == self ifTrue:[
-	^ super background.
-    ].
     ^ gc background
 
     "Modified: 12.5.1996 / 22:28:09 / cg"
@@ -1300,10 +1137,6 @@
     "set the internal background color for drawing - aColor must be a real color.
      OBSOLETE: this method will vanish; use #paint: / #backgroundPaint: / #paint:on:"
 
-    gc == self ifTrue:[
-	super background:aColor.
-	^ self.
-    ].
     gc background:aColor
 !
 
@@ -1312,9 +1145,6 @@
     "return the current foreground drawing color.
      OBSOLETE: use #paint: / #paint:on:"
 
-    gc == self ifTrue:[
-	^ super foreground.
-    ].
     ^ gc foreground
 !
 
@@ -1323,10 +1153,6 @@
     "set the internal foreground color for drawing - aColor must be a real color.
      OBSOLETE: this method will vanish; use #paint: / #paint:on:"
 
-    gc == self ifTrue:[
-	super foreground:aColor.
-	^ self.
-    ].
     gc foreground:aColor
 !
 
@@ -1336,10 +1162,6 @@
      - these must be real colors.
      OBSOLETE: this method will vanish; use #paint: / #paint:on:"
 
-    gc == self ifTrue:[
-	super foreground:fgColor background:bgColor.
-	^ self.
-    ].
     gc foreground:fgColor background:bgColor
 !
 
@@ -1359,10 +1181,6 @@
     "set the foreground color and function for drawing.
      OBSOLETE: this method will vanish; use #paint: / #paint:on:"
 
-    gc == self ifTrue:[
-	super foreground:aColor function:fun.
-	^ self.
-    ].
     gc foreground:aColor function:fun
 !
 
@@ -1379,67 +1197,42 @@
 scale
     "return the scale factor (as point) of the transformation"
 
-    gc == self ifTrue:[
-	^ super scale.
-    ].
     ^ gc scale
 !
 
 scale:aPoint
     "set the scale factor of the transformation"
 
-    gc == self ifTrue:[
-	super scale:aPoint.
-	^ self.
-    ].
     ^ gc scale:aPoint
 !
 
 transformation
     "return the transformation"
 
-    gc == self ifTrue:[
-	^ super transformation.
-    ].
     ^ gc transformation
 !
 
 transformation:aTransformation
     "set the transformation"
 
-    gc == self ifTrue:[
-	super transformation:aTransformation.
-	^ self.
-    ].
     ^ gc transformation:aTransformation
 !
 
 translateBy:aPoint
     "add to the translation offset of the transformation"
 
-    gc == self ifTrue:[
-	super translateBy:aPoint.
-	^ self.
-    ].
     ^ gc translateBy:aPoint
 !
 
 translation
     "return the translation factor (as point) of the transformation"
 
-    gc == self ifTrue:[
-	^ super translation.
-    ].
     ^ gc translation
 !
 
 translation:aPoint
     "set the translation offset of the transformation"
 
-    gc == self ifTrue:[
-	super translation:aPoint.
-	^ self.
-    ].
     ^ gc translation:aPoint
 ! !
 
@@ -1449,10 +1242,6 @@
     "draw an arc in a box
      - this could be recoded to draw using displayLine"
 
-    gc == self ifTrue:[
-	super displayArcX:x y:y width:width height:height from:startAngle angle:angle.
-	^ self.
-    ].
     gc displayArcX:x y:y width:width height:height from:startAngle angle:angle
 !
 
@@ -1461,30 +1250,18 @@
      A general implementation is found here; deviceGC's
      may reimplement this if directly supported by the device"
 
-    gc == self ifTrue:[
-	super displayDottedRectangleX:x y:y width:w height:h.
-	^ self.
-    ].
     gc displayDottedRectangleX:x y:y width:w height:h
 !
 
 displayHorizontalWavelineFromX:x0 y:y0 toX:x1
     "draw a horizontal wave-line from x0/y0 to x1/y0"
 
-    gc == self ifTrue:[
-	super displayHorizontalWavelineFromX:x0 y:y0 toX:x1.
-	^ self.
-    ].
     gc displayHorizontalWavelineFromX:x0 y:y0 toX:x1
 !
 
 displayLineFromX:x0 y:y0 toX:x1 y:y1
     "draw a line from x0/y0 to x1/y1"
 
-    gc == self ifTrue:[
-	super displayLineFromX:x0 y:y0 toX:x1 y:y1.
-	^ self.
-    ].
     gc displayLineFromX:x0 y:y0 toX:x1 y:y1
 !
 
@@ -1493,20 +1270,12 @@
      drawn in current fg, 0's in current bg color.
      If the form has depth ~~ 1, it is copied as is onto the receiver"
 
-    gc == self ifTrue:[
-	super displayOpaqueForm:aForm x:x y:y.
-	^ self.
-    ].
     gc displayOpaqueForm:aForm x:x y:y
 !
 
 displayOpaqueString:aString from:index1 to:index2 x:x y:y
     "draw part of a string with both fg and bg at x/y in current font"
 
-    gc == self ifTrue:[
-	super displayString:aString from:index1 to:index2 x:x y:y opaque:true maxWidth:self width.
-	^ self.
-    ].
     gc displayString:aString from:index1 to:index2 x:x y:y opaque:true maxWidth:self width
 !
 
@@ -1514,10 +1283,6 @@
     "draw a polygon
      - this could be recoded to draw using displayLine"
 
-    gc == self ifTrue:[
-	super displayPolygon:aPolygon.
-	^ self.
-    ].
     gc displayPolygon:aPolygon
 !
 
@@ -1525,10 +1290,6 @@
     "draw a rectangle
      - this could be recoded to draw using displayLine"
 
-    gc == self ifTrue:[
-	super displayRectangleX:x y:y width:w height:h.
-	^ self.
-    ].
     gc displayRectangleX:x y:y width:w height:h
 !
 
@@ -1547,10 +1308,6 @@
 displayString:aString from:index1 to:index2 x:x y:y opaque:opaque maxWidth:maxWidth
     "draw part of a string with both fg and bg at x/y in current font"
 
-    gc == self ifTrue:[
-	super displayString:aString from:index1 to:index2 x:x y:y opaque:opaque maxWidth:maxWidth.
-	^ self.
-    ].
     gc displayString:aString from:index1 to:index2 x:x y:y opaque:opaque maxWidth:maxWidth
 ! !
 
@@ -1559,40 +1316,24 @@
 fillArcX:x y:y width:w height:h from:start angle:angle
     "fill an arc with current paint color"
 
-    gc == self ifTrue:[
-	super fillArcX:x y:y width:w height:h from:start angle:angle.
-	^ self.
-    ].
     gc fillArcX:x y:y width:w height:h from:start angle:angle
 !
 
 fillPolygon:points
     "fill a polygon with current paint color"
 
-    gc == self ifTrue:[
-	super fillPolygon:points.
-	^ self.
-    ].
     gc fillPolygon:points
 !
 
 fillRectangleX:x y:y width:w height:h
     "fill a rectangle with current paint color"
 
-    gc == self ifTrue:[
-	super fillRectangleX:x y:y width:w height:h.
-	^ self.
-    ].
     gc fillRectangleX:x y:y width:w height:h
 !
 
 fillRectangleX:x y:y width:w height:h color:aColor
     "fill a rectangle with given color"
 
-    gc == self ifTrue:[
-	super fillRectangleX:x y:y width:w height:h color:aColor.
-	^ self.
-    ].
     gc fillRectangleX:x y:y width:w height:h color:aColor
 ! !
 
@@ -1605,10 +1346,6 @@
      The byteOrder is MSB and will be converted as appropriate by the underlying devices
      method to whatever the device needs."
 
-    gc == self ifTrue:[
-	super copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth padding:pad width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY.
-	^ self.
-    ].
     gc copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth padding:pad width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY
 !
 
@@ -1620,30 +1357,18 @@
      method to whatever the device needs.
      Assumes the source bits are in ST/X's natural padding (i.e. 8-bit padded)"
 
-    gc == self ifTrue:[
-	super copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY.
-	^ self.
-    ].
     gc copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY
 !
 
 copyFrom:aGC toX:dstX y:dstY
     "copy from a drawable - maybe self"
 
-    gc == self ifTrue:[
-	super copyFrom:aGC toX:dstX y:dstY.
-	^ self.
-    ].
     gc copyFrom:aGC toX:dstX y:dstY
 !
 
 copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h
     "copy from a drawable - maybe self"
 
-    gc == self ifTrue:[
-	super copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h.
-	^ self.
-    ].
     gc copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h
 !
 
@@ -1656,38 +1381,28 @@
      (not all devices care for this).
      If the receiver is a pixmap, the call always returns immediately."
 
-    |myDevice deviceDrawable asy|
-
-    myDevice := gc graphicsDevice.
-
-    ((aDrawable graphicsDevice ~~ myDevice)
+    |deviceDrawable asy|
+
+    ((aDrawable graphicsDevice ~~ device)
      or:[aDrawable isImage]) ifTrue:[
-	deviceDrawable := aDrawable asFormOn:myDevice.
+        deviceDrawable := aDrawable asFormOn:device.
     ] ifFalse:[
-	deviceDrawable := aDrawable
+        deviceDrawable := aDrawable
     ].
     asy := async or:[self isView not].
     asy ifFalse:[
-	self catchExpose
+        self catchExpose
     ].
-    gc == self ifTrue:[
-	super copyFrom:deviceDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async.
-    ] ifFalse:[
-	gc copyFrom:deviceDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async.
-    ].
+    gc copyFrom:deviceDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async.
     asy ifFalse:[
-	myDevice flush.
-	self waitForExpose
+        device flush.
+        self waitForExpose
     ]
 !
 
 copyFrom:aGC x:dstX y:dstY width:w height:h
     "copy from a drawable - maybe self"
 
-    gc == self ifTrue:[
-	super copyFrom:aGC x:dstX y:dstY width:w height:h.
-	^ self.
-    ].
     gc copyFrom:aGC x:dstX y:dstY width:w height:h
 !
 
@@ -1698,10 +1413,6 @@
      The drawable must have been allocated on the same device.
      All coordinates are in device coordinates."
 
-    gc == self ifTrue:[
-	super copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h.
-	^ self.
-    ].
     gc copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h
 ! !
 
@@ -1775,10 +1486,6 @@
 displayCircle:aPoint radius:r
     "draw a circle around a center point"
 
-    gc == self ifTrue:[
-	super displayCircleX:(aPoint x) y:(aPoint y) radius:r.
-	^ self.
-    ].
     gc displayCircleX:(aPoint x) y:(aPoint y) radius:r
 !
 
@@ -1815,10 +1522,6 @@
 displayForm:aFormOrImage
     "draw a form (or image) at the origin"
 
-    gc == self ifTrue:[
-	super displayForm:aFormOrImage x:0 y:0.
-	^ self.
-    ].
     gc displayForm:aFormOrImage x:0 y:0
 
     "Modified: / 24.4.1997 / 16:00:11 / cg"
@@ -1828,10 +1531,6 @@
 displayForm:aFormOrImage at:aPoint
     "draw a form (or image)"
 
-    gc == self ifTrue:[
-	super displayForm:aFormOrImage x:(aPoint x) y:(aPoint y).
-	^ self.
-    ].
     gc displayForm:aFormOrImage x:(aPoint x) y:(aPoint y)
 
     "Modified: 24.4.1997 / 16:00:11 / cg"
@@ -1850,10 +1549,6 @@
      certain, that the colors are real colors (actually, only for
      noColor or allColor)."
 
-    gc == self ifTrue:[
-	super displayForm:formToDraw x:x y:y.
-	^ self.
-    ].
     gc displayForm:formToDraw x:x y:y
 !
 
@@ -1875,10 +1570,6 @@
      Provided for ST-80 compatibilty;
      in ST/X, images are also handled by #displayForm:"
 
-    gc == self ifTrue:[
-	super displayForm:aFormOrImage x:0 y:0.
-	^ self.
-    ].
     gc displayForm:aFormOrImage x:0 y:0
 !
 
@@ -1887,10 +1578,6 @@
      Provided for ST-80 compatibilty;
      in ST/X, images are also handled by #displayForm:"
 
-    gc == self ifTrue:[
-	super displayForm:aFormOrImage x:(aPoint x) y:(aPoint y).
-	^ self.
-    ].
     gc displayForm:aFormOrImage x:(aPoint x) y:(aPoint y)
 
     "Modified: 24.4.1997 / 16:02:43 / cg"
@@ -1901,10 +1588,6 @@
      Provided for ST-80 compatibilty;
      in ST/X, images are also handled by #displayForm:"
 
-    gc == self ifTrue:[
-	super displayForm:aFormOrImage x:x y:y.
-	^ self.
-    ].
     gc displayForm:aFormOrImage x:x y:y
 
     "Created: 24.4.1997 / 16:03:03 / cg"
@@ -1913,13 +1596,8 @@
 displayLineFrom:point1 to:point2
     "draw a line"
 
-    gc == self ifTrue:[
-	super displayLineFromX:(point1 x) y:(point1 y)
-		      toX:(point2 x) y:(point2 y).
-	^ self.
-    ].
     gc displayLineFromX:(point1 x) y:(point1 y)
-		      toX:(point2 x) y:(point2 y)
+                      toX:(point2 x) y:(point2 y)
 !
 
 displayLineFromX:xStart y:yStart toX:xEnd y:yEnd brush:aForm
@@ -2014,10 +1692,6 @@
 displayOpaqueString:aString at:aPoint
     "draw a string with both fg and bg"
 
-    gc == self ifTrue:[
-	super displayOpaqueString:aString x:(aPoint x) y:(aPoint y).
-	^ self.
-    ].
     gc displayOpaqueString:aString x:(aPoint x) y:(aPoint y)
 !
 
@@ -2034,10 +1708,6 @@
      Assuming that device can only draw in device colors, we have to handle
      the case where paint and/or bgPaint are dithered colors or images."
 
-    gc == self ifTrue:[
-	super displayOpaqueString:aString x:x y:y.
-	^ self.
-    ].
     gc displayOpaqueString:aString x:x y:y
 !
 
@@ -2049,12 +1719,8 @@
      Drawing is done by first drawing the string into a temporary bitmap,
      which is rotated and finally drawn as usual.
      NOTICE: due to the rotation of the temporary bitmap, this is a slow
-	     operation - not to be used with cillions of strings ..."
-
-    gc == self ifTrue:[
-	super displayString:aString x:x y:y angle:drawAngle opaque:true.
-	^ self.
-    ].
+             operation - not to be used with cillions of strings ..."
+
     gc displayString:aString x:x y:y angle:drawAngle opaque:true
 
     "
@@ -2064,8 +1730,8 @@
      v extent:300@200.
      v openAndWait.
      0 to:360 by:45 do:[:a |
-	 v paint:Color black on:Color red.
-	 v displayOpaqueString:'hello world' x:100 y:100 angle:a.
+         v paint:Color black on:Color red.
+         v displayOpaqueString:'hello world' x:100 y:100 angle:a.
      ].
     "
 
@@ -2076,8 +1742,8 @@
      v extent:300@200.
      v openAndWait.
      0 to:360 by:45 do:[:a |
-	 v paint:Color black on:Color red.
-	 v displayString:'hello world' x:100 y:100 angle:a.
+         v paint:Color black on:Color red.
+         v displayString:'hello world' x:100 y:100 angle:a.
      ].
     "
 
@@ -2087,20 +1753,12 @@
 displayPoint:aPoint
     "draw a pixel"
 
-    gc == self ifTrue:[
-	super displayPointX:(aPoint x) y:(aPoint y).
-	^ self.
-    ].
     gc displayPointX:(aPoint x) y:(aPoint y)
 !
 
 displayPointX:x y:y
     "draw a point (with current paint-color); apply transformation if nonNil"
 
-    gc == self ifTrue:[
-	super displayPointX:x y:y.
-	^ self.
-    ].
     gc displayPointX:x y:y
 !
 
@@ -2303,14 +1961,10 @@
      Drawing is done by first drawing the string into a temporary bitmap,
      which is rotated and finally drawn as usual.
      NOTICE: due to the rotation of the temporary bitmap, this is a slow
-	     operation - not to be used with cillions of strings ...
+             operation - not to be used with cillions of strings ...
      CAVEAT: if the string is not a real string (i.e. a LabelAndIcon),
-	     this can (currently) only be done opaque"
-
-    gc == self ifTrue:[
-	super displayString:aString x:x y:y angle:drawAngle opaque:opaque.
-	^ self.
-    ].
+             this can (currently) only be done opaque"
+
     gc displayString:aString x:x y:y angle:drawAngle opaque:opaque
 !
 
@@ -2328,10 +1982,6 @@
      noColor or allColor).
      The origins coordinate is transformed, but the image itself is unscaled."
 
-    gc == self ifTrue:[
-	super displayUnscaledForm:formToDraw x:x y:y.
-	^ self.
-    ].
     gc displayUnscaledForm:formToDraw x:x y:y
 !
 
@@ -2343,10 +1993,6 @@
      settings are ignored and the form is drawn as-is (opaque).
      The origins coordinate is transformed, but the image itself is unscaled."
 
-    gc == self ifTrue:[
-	super displayUnscaledOpaqueForm:formToDraw x:x y:y.
-	^ self.
-    ].
     gc displayUnscaledOpaqueForm:formToDraw x:x y:y
 !
 
@@ -2354,10 +2000,6 @@
     "draw a substring at the transformed coordinate x/y but do not scale the font.
      Draw foreground pixels in paint-color, background pixels in bgPaint color."
 
-    gc == self ifTrue:[
-	super displayUnscaledOpaqueString:aString from:index1 to:index2 x:x y:y.
-	^ self.
-    ].
     gc displayUnscaledOpaqueString:aString from:index1 to:index2 x:x y:y
 !
 
@@ -2365,10 +2007,6 @@
     "draw a string at the transformed coordinate x/y but do not scale the font.
      Draw foreground pixels in paint-color, background pixels in bgPaint color."
 
-    gc == self ifTrue:[
-	super displayUnscaledOpaqueString:aString x:x y:y.
-	^ self.
-    ].
     gc displayUnscaledOpaqueString:aString x:x y:y
 !
 
@@ -2376,10 +2014,6 @@
     "draw a substring at the transformed coordinate x/y but do not scale the font.
      draw foreground-pixels only (in current paint-color), leaving background as-is."
 
-    gc == self ifTrue:[
-	super displayUnscaledString:aString from:index1 to:index2 x:x y:y.
-	^ self.
-    ].
     gc displayUnscaledString:aString from:index1 to:index2 x:x y:y
 !
 
@@ -2387,10 +2021,6 @@
     "draw a string at the transformed coordinate x/y but do not scale the font.
      draw foreground-pixels only (in current paint-color), leaving background as-is."
 
-    gc == self ifTrue:[
-	super displayUnscaledString:aString x:x y:y.
-	^ self.
-    ].
     gc displayUnscaledString:aString x:x y:y
 ! !
 
@@ -2414,20 +2044,12 @@
      certain, that the colors are real colors (actually, only for
      noColor or allColor)."
 
-    gc == self ifTrue:[
-	super displayDeviceForm:aForm x:x y:y.
-	^ self.
-    ].
     gc displayDeviceForm:aForm x:x y:y
 !
 
 displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2
     "draw a line in device coordinates"
 
-    gc == self ifTrue:[
-	super displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2.
-	^ self.
-    ].
     gc displayDeviceLineFromX:x1 y:y1 toX:x2 y:y2
 !
 
@@ -2445,10 +2067,6 @@
      its converted here, which slows down the draw.
      Drawing is in device coordinates; no scaling is done."
 
-    gc == self ifTrue:[
-	super displayDeviceOpaqueForm:aForm x:x y:y.
-	^ self.
-    ].
     gc displayDeviceOpaqueForm:aForm x:x y:y
 !
 
@@ -2473,10 +2091,6 @@
 displayDeviceRectangleX:x y:y width:w height:h
     "draw a rectangle in device coordinates"
 
-    gc == self ifTrue:[
-	super displayDeviceRectangleX:x y:y width:w height:h.
-	^ self.
-    ].
     gc displayDeviceRectangleX:x y:y width:w height:h
 !
 
@@ -2485,10 +2099,6 @@
      draw foreground-pixels only (in current paint-color), leaving background as-is.
      No translation or scaling is done"
 
-    gc == self ifTrue:[
-	super displayDeviceString:aString from:index1 to:index2 in:font x:x y:y.
-	^ self.
-    ].
     gc displayDeviceString:aString from:index1 to:index2 in:font x:x y:y
 !
 
@@ -2511,10 +2121,6 @@
 fillDeviceRectangleX:x y:y width:w height:h
     "fill a rectangle with current paint color (device coordinates)"
 
-    gc == self ifTrue:[
-	super fillDeviceRectangleX:x y:y width:w height:h.
-	^ self.
-    ].
     gc fillDeviceRectangleX:x y:y width:w height:h
 ! !
 
@@ -2659,80 +2265,48 @@
     "evaluate aBlock with foreground and background interchanged.
      This can be reimplemented here in a faster way."
 
-    gc == self ifTrue:[
-	super reverseDo:aBlock.
-	^ self.
-    ].
     gc reverseDo:aBlock
 !
 
 withBackground:fgColor do:aBlock
     "evaluate aBlock with changed background."
 
-    gc == self ifTrue:[
-	super withBackground:fgColor do:aBlock.
-	^ self.
-    ].
     gc withBackground:fgColor do:aBlock
 !
 
 withForeground:fgColor background:bgColor do:aBlock
     "evaluate aBlock with changed foreground and background."
 
-    gc == self ifTrue:[
-	super withForeground:fgColor background:bgColor do:aBlock.
-	^ self.
-    ].
     gc withForeground:fgColor background:bgColor do:aBlock
 !
 
 withForeground:fgColor background:bgColor function:aFunction do:aBlock
     "evaluate aBlock with foreground, background and function"
 
-    gc == self ifTrue:[
-	super withForeground:fgColor background:bgColor function:aFunction do:aBlock.
-	^ self.
-    ].
     gc withForeground:fgColor background:bgColor function:aFunction do:aBlock
 !
 
 withForeground:fgColor background:bgColor mask:aMask do:aBlock
     "evaluate aBlock with foreground, background and mask"
 
-    gc == self ifTrue:[
-	super withForeground:fgColor background:bgColor mask:aMask do:aBlock.
-	^ self.
-    ].
     gc withForeground:fgColor background:bgColor mask:aMask do:aBlock
 !
 
 withForeground:fgColor do:aBlock
     "evaluate aBlock with changed foreground."
 
-    gc == self ifTrue:[
-	super withForeground:fgColor do:aBlock.
-	^ self.
-    ].
     gc withForeground:fgColor do:aBlock
 !
 
 withForeground:fgColor function:aFunction do:aBlock
     "evaluate aBlock with changed foreground and function."
 
-    gc == self ifTrue:[
-	super withForeground:fgColor function:aFunction do:aBlock.
-	^ self.
-    ].
     gc withForeground:fgColor function:aFunction do:aBlock
 !
 
 xoring:aBlock
     "evaluate aBlock with function xoring"
 
-    gc == self ifTrue:[
-	super xoring:aBlock.
-	^ self.
-    ].
     gc xoring:aBlock
 ! !
 
@@ -2790,14 +2364,7 @@
     "fill the receiver with something;
      something may be a Form, Color or colorIndex"
 
-    |oldPaint|
-
-    oldPaint := self paint.
-    self paint:something.
-    self fillRectangleX:0 y:0 width:width height:height.
-    self paint:oldPaint
-
-    "Modified: 28.5.1996 / 20:13:29 / cg"
+    gc fillRectangle:self boundingBox color:something
 !
 
 fillArc:origin radius:r from:startAngle angle:angle
@@ -3018,7 +2585,7 @@
 white
     "fill the receiver with white"
 
-    self fill:Color white
+    self fill:self whiteColor
 ! !
 
 !GraphicsMedium methodsFor:'initialization & release'!
@@ -3045,10 +2612,6 @@
      really drawn, none is created.
      This method is sent, when the first drawing happens"
 
-    gc == self ifTrue:[
-	super initGC.
-	^ self.
-    ].
     gc initGC
 !
 
@@ -3089,12 +2652,8 @@
     "destroy the associated device GC resource - can be done to be nice to the
      display if you know that you are done with a drawable."
 
-    gc == self ifTrue:[
-	super releaseGC.
-	^ self.
-    ].
     gc notNil ifTrue:[
-	gc releaseGC.
+        gc releaseGC.
     ].
 ! !
 
@@ -3115,32 +2674,20 @@
 flush
     "send all buffered drawing to the device."
 
-    gc == self ifTrue:[
-	super flush.
-	^ self.
-    ].
     gc flush
 !
 
 setDevice:aDevice id:aDrawbleId gcId:aGCId
     "private"
 
-    gc == self ifTrue:[
-	super setDevice:aDevice id:aDrawbleId gcId:aGCId.
-	^ self.
-    ].
     gc notNil ifTrue:[
-	gc setDevice:aDevice id:aDrawbleId gcId:aGCId
+        gc setDevice:aDevice id:aDrawbleId gcId:aGCId
     ].
 !
 
 setId:aDrawableId
     "private"
 
-    gc == self ifTrue:[
-	super setId:aDrawableId.
-	^ self.
-    ].
     gc setId:aDrawableId
 !
 
@@ -3150,20 +2697,12 @@
      Only set the variables, but do not send it to the device,
      Used on initialization."
 
-    gc == self ifTrue:[
-	super setPaint:fgColor on:bgColor.
-	^ self.
-    ].
     gc setPaint:fgColor on:bgColor
 !
 
 sync
     "send all buffered drawing to the device and wait until the device responds"
 
-    gc == self ifTrue:[
-	super sync.
-	^ self.
-    ].
     gc sync
 ! !
 
@@ -3182,9 +2721,6 @@
 fontAscent
     "answer the ascent of the current font on the current device"
 
-    gc == self ifTrue:[
-	^ super fontAscent.
-    ].
     ^ gc fontAscent
 !
 
@@ -3203,9 +2739,6 @@
 horizontalPixelPerMillimeter
     "return the number of pixels per millimeter (not rounded)"
 
-    gc == self ifTrue:[
-	^ super horizontalPixelPerMillimeter.
-    ].
     ^ gc horizontalPixelPerMillimeter
 !
 
@@ -3218,9 +2751,6 @@
 resolution
     "return a point consisting of pixel-per-inch horizontally and vertically."
 
-    gc == self ifTrue:[
-	^ super resolution.
-    ].
     ^ gc resolution
 !
 
@@ -3239,9 +2769,6 @@
 verticalPixelPerMillimeter
     "return the number of pixels per millimeter (not rounded)"
 
-    gc == self ifTrue:[
-	^ super verticalPixelPerMillimeter.
-    ].
     ^ gc verticalPixelPerMillimeter
 !
 
@@ -3256,38 +2783,22 @@
 createBitmapFromArray:data width:width height:height
     "create a bitmap from data and set the drawableId"
 
-    gc == self ifTrue:[
-	super createBitmapFromArray:data width:width height:height.
-	^ self.
-    ].
     gc createBitmapFromArray:data width:width height:height
 !
 
 createPixmapWidth:w height:h depth:d
     "create a pixmap and set the drawableId"
 
-    gc == self ifTrue:[
-	super createPixmapWidth:w height:h depth:d.
-	^ self.
-    ].
     gc createPixmapWidth:w height:h depth:d
 !
 
 createRootWindow
-    gc == self ifTrue:[
-	super createRootWindowFor:self.
-	^ self.
-    ].
     gc createRootWindowFor:self
 !
 
 createWindowFor:aView type:typeSymbol origin:org extent:ext minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv style:styleSymbol inputOnly:inp label:label owner:owner icon:icn iconMask:icnM iconView:icnV
     "create a window and set the drawableId"
 
-    gc == self ifTrue:[
-	super createWindowFor:aView type:typeSymbol origin:org extent:ext minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv style:styleSymbol inputOnly:inp label:label owner:owner icon:icn iconMask:icnM iconView:icnV.
-	^ self.
-    ].
     gc createWindowFor:aView type:typeSymbol origin:org extent:ext minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv style:styleSymbol inputOnly:inp label:label owner:owner icon:icn iconMask:icnM iconView:icnV
 ! !