[Pkg] The Trunk: Graphics-nice.261.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Oct 9 22:11:23 UTC 2013

Nicolas Cellier uploaded a new version of Graphics to project The Trunk:

==================== Summary ====================

Name: Graphics-nice.261
Author: nice
Time: 10 October 2013, 12:10:00.574 am
UUID: 4e33de46-7e9a-4493-b363-3c1ab0344c15
Ancestors: Graphics-nice.260

If we perform the stopCondition before displaying the string in order to find the lastDisplayableIndex,
then the stopCondition will reset the font at each endOfRun,
and the display will occur with the wrong font.

It's impossible to keep a pointer on lastFont := font, because the font glyphs seem to be recycled for obscure optimization reasons.

Instead, add a new inst. var. stopConditionsMustBeReset to differ the setFont (setStopCondition) at next scan loop.

Set this inst. var. so that we can safely use it at next commit.

=============== Diff against Graphics-nice.260 ===============

Item was changed:
  CharacterScanner subclass: #DisplayScanner
+ 	instanceVariableNames: 'bitBlt lineY foregroundColor backgroundColor fillBlt paragraphColor morphicOffset ignoreColorChanges lastDisplayableIndex stopConditionsMustBeReset'
- 	instanceVariableNames: 'bitBlt lineY foregroundColor backgroundColor fillBlt paragraphColor morphicOffset ignoreColorChanges lastDisplayableIndex'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Graphics-Text'!
+ !DisplayScanner commentStamp: 'nice 10/9/2013 23:56' prior: 0!
- !DisplayScanner commentStamp: 'nice 10/9/2013 02:33' prior: 0!
  A DisplayScanner displays characters on Screen or other Form with help of a BitBlt.
  Instance Variables
  	backgroundColor:		<Color>
  	bitBlt:		<BitBlt>
  	fillBlt:		<BitBlt>
  	foregroundColor:		<Color>
  	ignoreColorChanges:		<Boolean>
  	lastDisplayableIndex:		<Integer>
  	lineY:		<Number>
  	morphicOffset:		<Point>
  	paragraphColor:		<Color>
+ 	stopConditionsMustBeReset:		<Boolean>
  	- the background color for displaying text.
  	Note that this can be set to Color transparent, in which case no background is displayed.
  	- the object which knows how to copy bits from one Form (the font glyph data) to another (the destination Form)
  	- another object for copying form bits, initialized for displaying the background.
  	- the foreground color for displaying text
  	- indicates that any change of color specified in text attributes shall be ignored.
  	This is used for displaying text in a shadow mode, when dragging text for example.
  	- the index of last character to be displayed.
  	A different index than lastIndex is required in order to avoid display of control characters.
  	This variable must be updated by the stop condition at each inner scan loop.
  	- the distance between destination form top and current line top
  	- an offset for positionning the embedded morphs.
  	- the default foreground color for displaying text in absence of other text attributes specification 
+ stopConditionsMustBeReset
+ 	- indicates that it's necessary to call setStopConditions in next scan loop.
+ Notes:
+ In order to correctly set the lastDisplayableIndex, the display scanner performs the stopCondition BEFORE displaying the string being scanned.
+ This explains why the stopCondition must not reset the font immediately, but differ this reset AFTER the display, thanks to stopConditionsMustBeReset.

Item was changed:
  ----- Method: DisplayScanner>>endOfRun (in category 'stop conditions') -----
  	"The end of a run in the display case either means that there is actually 
  	a change in the style (run code) to be associated with the string or the 
  	end of this line has been reached."
  	| runLength |
  	lastDisplayableIndex := lastIndex.
  	lastIndex = line last ifTrue: [^true].
  	runLength := text runLengthFor: (lastIndex := lastIndex + 1).
  	runStopIndex := lastIndex + (runLength - 1) min: line last.
+ 	stopConditionsMustBeReset := true.
  	self setStopConditions.
  	^ false!

Item was added:
+ ----- Method: DisplayScanner>>setStopConditions (in category 'private') -----
+ setStopConditions
+ 	super setStopConditions.
+ 	stopConditionsMustBeReset := false!

More information about the Packages mailing list