#TUNING by cg
class: ListView
changed:
#drawFromVisibleLine:to:with:and:
#drawLine:atX:inVisible:with:and:
#drawLine:fromX:inVisible:with:and:
#drawLine:inVisible:col:with:and:
#drawLine:inVisible:from:to:with:and:
#drawLine:inVisible:from:with:and:
#redrawX:y:width:height:
draw by sending messages to gc instead of self.
(new GC structure)
--- a/ListView.st Tue Jan 24 23:04:58 2017 +0100
+++ b/ListView.st Tue Jan 24 23:06:30 2017 +0100
@@ -1925,11 +1925,10 @@
sH := lineSpacing // 2.
backgroundAlreadyClearedColor == bg ifFalse:[
- self paint:bg.
- self fillRectangleX:margin
- y:y-sH
- width:(width - (margin * 2))
- height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
+ gc paint:bg.
+ gc fillRectangleX:margin y:y-sH
+ width:(width - (margin * 2))
+ height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
].
list isNil ifTrue:[^ self].
@@ -1951,14 +1950,14 @@
(startLine <= e) ifTrue:[
x := textStartLeft - viewOrigin x.
- self paint:fg on:bg.
+ gc paint:fg on:bg.
"/ don't use list from:to:do:, to allow for subclasses to redefine the enumeration (TableView)
self from:startLine to:e do:[:line |
line notNil ifTrue:[
"/ remove line's color emphasis, to enforce color.
"/ otherwise blue text is not visible if selection-bg is blue
l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
- self displayOpaqueString:l x:x y:y.
+ gc displayOpaqueString:l x:x y:y.
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
self updateWidthOfWidestLineFor:l
@@ -1986,12 +1985,12 @@
self highlightLineSpacing ifTrue:[
extraBelow := halfSpacing.
].
- self fillRectangleX:margin y:y - halfSpacing
- width:(width - (2 * margin))
- height:fontHeight+extraBelow.
+ gc fillRectangleX:margin y:y - halfSpacing
+ width:(width - (2 * margin))
+ height:fontHeight+extraBelow.
].
line notNil ifTrue:[
- self paint:fg on:bg.
+ gc paint:fg on:bg.
"/ remove lines color emphasis, to enforce color.
"/ otherwise blue text is not visible if selection-bg is blue.
@@ -2001,7 +2000,7 @@
] ifFalse:[
l := line
].
- self displayOpaqueString:l x:x y:(y + fontAscent).
+ gc displayOpaqueString:l x:x y:(y + fontAscent).
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
self updateWidthOfWidestLineFor:l
@@ -2020,12 +2019,12 @@
y := self yOfVisibleLine:visLineNr.
line notNil ifTrue:[
- self paint:fg on:bg.
+ gc paint:fg on:bg.
"/ remove lines color emphasis, to enforce color.
"/ otherwise blue text is not visible if selection-bg is blue
l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
- self displayOpaqueString:l x:x y:(y + fontAscent).
+ gc displayOpaqueString:l x:x y:(y + fontAscent).
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
self updateWidthOfWidestLineFor:l
@@ -2047,14 +2046,14 @@
y := self yOfVisibleLine:visLineNr.
yf := y - (lineSpacing // 2).
- self paint:bg.
+ gc paint:bg.
(lineString notNil and:[lineString isString not]) ifTrue:[
w := lineString widthFrom:col to:(col min:len) on:self.
w <= 0 ifTrue:[
w := gc font width.
- self fillRectangleX:x y:yf width:w height:fontHeight.
- self paint:fg
+ gc fillRectangleX:x y:yf width:w height:fontHeight.
+ gc paint:fg
].
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
self drawVisibleLine:visLineNr with:fg and:bg
@@ -2063,8 +2062,8 @@
].
(lineString isNil or:[col > len]) ifTrue:[
- self fillRectangleX:x y:yf width:(gc font width) height:fontHeight.
- self paint:fg
+ gc fillRectangleX:x y:yf width:(gc font width) height:fontHeight.
+ gc paint:fg
] ifFalse:[
characterString := lineString copyFrom:col to:col.
@@ -2073,10 +2072,10 @@
characterString := self withoutColorEmphasis:characterString ifFg:fg andBg:bg.
w := characterString widthOn:self.
- self fillRectangleX:x y:yf width:w height:fontHeight.
- self paint:fg.
+ gc fillRectangleX:x y:yf width:w height:fontHeight.
+ gc paint:fg.
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
- self displayString:characterString x:x y:(y + fontAscent)
+ gc displayString:characterString x:x y:(y + fontAscent)
].
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
@@ -2113,12 +2112,12 @@
] ifFalse:[
numExtraCols := (endCol - len" + 1").
].
- self paint:bg.
- self fillRectangleX:x+w y:yf width:(numExtraCols * fontWidth) height:fontHeight.
+ gc paint:bg.
+ gc fillRectangleX:x+w y:yf width:(numExtraCols * fontWidth) height:fontHeight.
].
w > 0 ifTrue:[
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
- self drawVisibleLine:visLineNr with:fg and:bg.
+ gc drawVisibleLine:visLineNr with:fg and:bg.
].
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
self updateWidthOfWidestLineFor:characterString
@@ -2130,8 +2129,8 @@
(sCol > len) ifTrue:[
backgroundAlreadyClearedColor == bg ifFalse:[
len := endCol - sCol + 1.
- self paint:bg.
- self fillRectangleX:x y:yf
+ gc paint:bg.
+ gc fillRectangleX:x y:yf
width:(fontWidth * len)
height:fontHeight
]
@@ -2161,21 +2160,19 @@
] ifFalse:[
w := lineString widthFrom:sCol to:endCol on:self
].
- self paint:bg.
- self fillRectangleX:x y:yf
- width:w
- height:fontHeight.
+ gc paint:bg.
+ gc fillRectangleX:x y:yf width:w height:fontHeight.
].
- self paint:fg on:bg.
+ gc paint:fg on:bg.
w notNil ifTrue:[
"/ clip req'd for VISTAs new font rendering (which seems to shoot over the compute
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
"/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
- self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
+ gc displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
]
] ifFalse:[
"/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
- self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) opaque:false maxWidth:self width
+ gc displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) opaque:false maxWidth:self width
].
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
self updateWidthOfWidestLineFor:lineString
@@ -2199,10 +2196,9 @@
y := self yOfVisibleLine:visLineNr.
x := (self xOfCol:index1 inVisibleLine:visLineNr) - viewOrigin x.
backgroundAlreadyClearedColor == bg ifFalse:[
- self paint:bg.
- self fillRectangleX:x y:y - (lineSpacing // 2)
- width:(width + viewOrigin x - x)
- height:fontHeight.
+ gc paint:bg.
+ gc fillRectangleX:x y:y - (lineSpacing // 2)
+ width:(width + viewOrigin x - x) height:fontHeight.
].
lineString notNil ifTrue:[
lineString isString ifFalse:[
@@ -2214,7 +2210,7 @@
(index1 <= index2) ifTrue:[
self paint:fg on:bg.
"/ self displayOpaqueString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent)
- self displayString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent).
+ gc displayString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent).
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
self updateWidthOfWidestLineFor:lineWithoutColor
@@ -2434,8 +2430,8 @@
saveClip := gc clippingBoundsOrNil.
self clippingBounds:(Rectangle left:x top:y width:w height:h).
- self paint:bgColor.
- self fillRectangleX:x y:y width:w height:h.
+ gc paint:bgColor.
+ gc fillRectangleX:x y:y width:w height:h.
backgroundAlreadyClearedColor := bgColor.
(includesNonStrings or:[w > (width // 4 * 3)]) ifTrue:[