[squeak-dev] The Trunk: ST80-nice.161.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Oct 11 23:16:39 UTC 2013


Nicolas Cellier uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-nice.161.mcz

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

Name: ST80-nice.161
Author: nice
Time: 12 October 2013, 1:15:57.094 am
UUID: da82ea7f-b543-4eb1-9883-ee6c4f220f33
Ancestors: ST80-nice.160

Remove MVC stuff from abstract DisplayScanner.
A true MVC wants to displayLines: with a good old BitBltDisplayScanner.

=============== Diff against ST80-nice.160 ===============

Item was changed:
  ----- Method: BitBltDisplayScanner>>displayLines:in:clippedBy: (in category '*ST80-Support') -----
  displayLines: linesInterval in: aParagraph clippedBy: visibleRectangle
  	"The central display routine. The call on the primitive 
  	(scanCharactersFrom:to:in:rightX:) will be interrupted according to an 
  	array of stop conditions passed to the scanner at which time the code to 
  	handle the stop condition is run and the call on the primitive continued 
  	until a stop condition returns true (which means the line has 
  	terminated)."
  	| leftInRun |
  	"leftInRun is the # of characters left to scan in the current run;
  		when 0, it is time to call 'self setStopConditions'"
  	morphicOffset := 0 at 0.
  	leftInRun := 0.
  	self initializeFromParagraph: aParagraph clippedBy: visibleRectangle.
  	ignoreColorChanges := false.
+ 	foregroundColor := defaultTextColor := paragraphColor := aParagraph foregroundColor.
- 	foregroundColor := paragraphColor := aParagraph foregroundColor.
  	backgroundColor := aParagraph backgroundColor.
  	aParagraph backgroundColor isTransparent
  		ifTrue: [fillBlt := nil]
  		ifFalse: [fillBlt := bitBlt copy.  "Blt to fill spaces, tabs, margins"
  				fillBlt sourceForm: nil; sourceOrigin: 0 at 0.
  				fillBlt fillColor: aParagraph backgroundColor].
  	rightMargin := aParagraph rightMarginForDisplay.
  	lineY := aParagraph topAtLineIndex: linesInterval first.
  	bitBlt destForm deferUpdatesIn: visibleRectangle while: [
  		linesInterval do: 
  			[:lineIndex | 
  			| string startIndex lastPos runLength stopCondition baselineY lineHeight stop |
  			line := aParagraph lines at: lineIndex.
  			lastDisplayableIndex := lastIndex := line first.
  			leftInRun <= 0
  				ifTrue: [self setStopConditions.  "also sets the font, alignment and emphasisCode"
  						leftInRun := text runLengthFor: line first].
  			leftMargin := aParagraph leftMarginForDisplayForLine: lineIndex alignment: alignment.
  			destX := leftMargin.
  			lineHeight := line lineHeight.
  			fillBlt == nil ifFalse:
  				[fillBlt destX: visibleRectangle left destY: lineY
  					width: visibleRectangle width height: lineHeight; copyBits].
  			baselineY := lineY + line baseline.
  			destY := baselineY - font ascent.  "Should have happened in setFont"
  			runLength := leftInRun.
  			runStopIndex := lastIndex + (runLength - 1) min: line last.
  			leftInRun := leftInRun - (runStopIndex - lastIndex + 1).
  			spaceCount := 0.
  			string := text string.
  			self handleIndentation.
  			[
  				startIndex := lastIndex.
  				lastPos := destX at destY.
  				"Reset the stopping conditions of this displaying loop, and also the font."
  				stopConditionsMustBeReset
  					ifTrue:[self setStopConditions].
  				stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
  							in: string rightX: rightMargin stopConditions: stopConditions
  							kern: kern.
  				stop := self perform: stopCondition.
  				lastDisplayableIndex >= startIndex ifTrue:[
  					font displayString: string on: bitBlt 
  						from: startIndex to: lastDisplayableIndex at: lastPos kern: kern].
  				stop
  			] whileFalse.
  			fillBlt == nil ifFalse:
  				[fillBlt destX: destX destY: lineY width: visibleRectangle right-destX height: lineHeight; copyBits].
  			lineY := lineY + lineHeight]]!

Item was removed:
- ----- Method: DisplayScanner>>displayLines:in:clippedBy: (in category '*ST80-Support') -----
- displayLines: linesInterval in: aParagraph clippedBy: visibleRectangle
- 	"The central display routine. The call on the primitive 
- 	(scanCharactersFrom:to:in:rightX:) will be interrupted according to an 
- 	array of stop conditions passed to the scanner at which time the code to 
- 	handle the stop condition is run and the call on the primitive continued 
- 	until a stop condition returns true (which means the line has 
- 	terminated)."
- 	| leftInRun |
- 	"leftInRun is the # of characters left to scan in the current run;
- 		when 0, it is time to call 'self setStopConditions'"
- 	morphicOffset := 0 at 0.
- 	leftInRun := 0.
- 	self initializeFromParagraph: aParagraph clippedBy: visibleRectangle.
- 	ignoreColorChanges := false.
- 	foregroundColor := paragraphColor := aParagraph foregroundColor.
- 	backgroundColor := aParagraph backgroundColor.
- 	aParagraph backgroundColor isTransparent
- 		ifTrue: [fillBlt := nil]
- 		ifFalse: [fillBlt := bitBlt copy.  "Blt to fill spaces, tabs, margins"
- 				fillBlt sourceForm: nil; sourceOrigin: 0 at 0.
- 				fillBlt fillColor: aParagraph backgroundColor].
- 	rightMargin := aParagraph rightMarginForDisplay.
- 	lineY := aParagraph topAtLineIndex: linesInterval first.
- 	bitBlt destForm deferUpdatesIn: visibleRectangle while: [
- 		linesInterval do: 
- 			[:lineIndex | 
- 			| string startIndex lastPos runLength stopCondition baselineY lineHeight stop |
- 			line := aParagraph lines at: lineIndex.
- 			lastDisplayableIndex := lastIndex := line first.
- 			leftInRun <= 0
- 				ifTrue: [self setStopConditions.  "also sets the font, alignment and emphasisCode"
- 						leftInRun := text runLengthFor: line first].
- 			leftMargin := aParagraph leftMarginForDisplayForLine: lineIndex alignment: alignment.
- 			destX := leftMargin.
- 			lineHeight := line lineHeight.
- 			fillBlt == nil ifFalse:
- 				[fillBlt destX: visibleRectangle left destY: lineY
- 					width: visibleRectangle width height: lineHeight; copyBits].
- 			baselineY := lineY + line baseline.
- 			destY := baselineY - font ascent.  "Should have happened in setFont"
- 			runLength := leftInRun.
- 			runStopIndex := lastIndex + (runLength - 1) min: line last.
- 			leftInRun := leftInRun - (runStopIndex - lastIndex + 1).
- 			spaceCount := 0.
- 			string := text string.
- 			self handleIndentation.
- 			[
- 				startIndex := lastIndex.
- 				lastPos := destX at destY.
- 				"Reset the stopping conditions of this displaying loop, and also the font."
- 				stopConditionsMustBeReset
- 					ifTrue:[self setStopConditions].
- 				stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
- 							in: string rightX: rightMargin stopConditions: stopConditions
- 							kern: kern.
- 				stop := self perform: stopCondition.
- 				lastDisplayableIndex >= startIndex ifTrue:[
- 					font displayString: string on: bitBlt 
- 						from: startIndex to: lastDisplayableIndex at: lastPos kern: kern].
- 				stop
- 			] whileFalse.
- 			fillBlt == nil ifFalse:
- 				[fillBlt destX: destX destY: lineY width: visibleRectangle right-destX height: lineHeight; copyBits].
- 			lineY := lineY + lineHeight]]!

Item was removed:
- ----- Method: DisplayScanner>>initializeFromParagraph:clippedBy: (in category '*ST80-Support') -----
- initializeFromParagraph: aParagraph clippedBy: clippingRectangle
- 
- 	super initializeFromParagraph: aParagraph clippedBy: clippingRectangle.
- 	bitBlt := BitBlt asGrafPort toForm: aParagraph destinationForm.
- 	bitBlt sourceX: 0; width: 0.	"Init BitBlt so that the first call to a primitive will not fail"
- 	bitBlt combinationRule:
- 		((Display depth = 1)
- 			ifTrue:
- 				[aParagraph rule]
- 			ifFalse:
- 				[Form paint]).
- 	bitBlt colorMap:
- 		(Bitmap with: 0      "Assumes 1-bit deep fonts"
- 				with: (bitBlt destForm pixelValueFor: aParagraph foregroundColor)).
- 	bitBlt clipRect: clippingRectangle!

Item was changed:
  ----- Method: Paragraph>>displayLines:affectedRectangle: (in category 'private') -----
  displayLines: linesInterval affectedRectangle: affectedRectangle
  	"This is the first level workhorse in the display portion of the TextForm routines.
  	It checks to see which lines in the interval are actually visible, has the
  	CharacterScanner display only those, clears out the areas in which display will
  	occur, and clears any space remaining in the visibleRectangle following the space
  	occupied by lastLine."
  
  	| topY firstLineIndex lastLineIndex lastLineIndexBottom |
  
  	"Save some time by only displaying visible lines"
  	firstLineIndex := self lineIndexOfTop: affectedRectangle top.
  	firstLineIndex < linesInterval first ifTrue: [firstLineIndex := linesInterval first].
  	lastLineIndex := self lineIndexOfTop: affectedRectangle bottom - 1.
  	lastLineIndex > linesInterval last ifTrue:
  			[linesInterval last > lastLine
  		 		ifTrue: [lastLineIndex := lastLine]
  		  		ifFalse: [lastLineIndex := linesInterval last]].
  	lastLineIndexBottom := (self bottomAtLineIndex: lastLineIndex).
  	((Rectangle 
  		origin: affectedRectangle left @ (topY := self topAtLineIndex: firstLineIndex) 
  		corner: affectedRectangle right @ lastLineIndexBottom)
  	  intersects: affectedRectangle)
  		ifTrue: [ " . . . (skip to clear-below if no lines displayed)"
+ 				BitBltDisplayScanner new
- 				DisplayScanner new
  					displayLines: (firstLineIndex to: lastLineIndex)
  					in: self clippedBy: affectedRectangle].
  	lastLineIndex = lastLine ifTrue: 
  		 [destinationForm  "Clear out white space below last line"
  		 	fill: (affectedRectangle left @ (lastLineIndexBottom max: affectedRectangle top)
  				corner: affectedRectangle bottomRight)
  		 	rule: rule fillColor: self backgroundColor]!



More information about the Squeak-dev mailing list