The Trunk: ST80-nice.158.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: ST80-nice.158.mcz

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

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

Name: ST80-nice.158
Author: nice
Time: 9 October 2013, 2:20:39.862 am
UUID: 32f810c1-ddd6-49b7-a593-762fba87856b
Ancestors: ST80-nice.157

DisplayScanner does not require a lineHeight inst. var., it can be a temporary.

=============== Diff against ST80-nice.157 ===============

Item was changed:
  ----- 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@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@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 |
- | string startIndex lastPos runLength stopCondition baselineY |
  line := aParagraph lines at: lineIndex.
+ lastDisplayableIndex := lastIndex := line first.
- 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@destY.
  stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
  in: string rightX: rightMargin stopConditions: stopConditions
  kern: kern.
  lastIndex >= startIndex ifTrue:[
  font displayString: string on: bitBlt
  from: startIndex to: lastIndex at: lastPos kern: kern].
  "see setStopConditions for stopping conditions for displaying."
  self perform: stopCondition
  ] whileFalse.
  fillBlt == nil ifFalse:
  [fillBlt destX: destX destY: lineY width: visibleRectangle right-destX height: lineHeight; copyBits].
  lineY := lineY + lineHeight]]!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: ST80-nice.158.mcz

Nicolas Cellier
The lastDisplayableIndex slept from a future update, but that should not matter too much...


2013/10/9 <[hidden email]>
Nicolas Cellier uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-nice.158.mcz

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

Name: ST80-nice.158
Author: nice
Time: 9 October 2013, 2:20:39.862 am
UUID: 32f810c1-ddd6-49b7-a593-762fba87856b
Ancestors: ST80-nice.157

DisplayScanner does not require a lineHeight inst. var., it can be a temporary.

=============== Diff against ST80-nice.157 ===============

Item was changed:
  ----- 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@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@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 |
-                       | string startIndex lastPos runLength stopCondition baselineY |
                        line := aParagraph lines at: lineIndex.
+                       lastDisplayableIndex := lastIndex := line first.
-                       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@destY.
                                stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
                                                        in: string rightX: rightMargin stopConditions: stopConditions
                                                        kern: kern.
                                lastIndex >= startIndex ifTrue:[
                                        font displayString: string on: bitBlt
                                                from: startIndex to: lastIndex at: lastPos kern: kern].
                                "see setStopConditions for stopping conditions for displaying."
                                self perform: stopCondition
                        ] whileFalse.
                        fillBlt == nil ifFalse:
                                [fillBlt destX: destX destY: lineY width: visibleRectangle right-destX height: lineHeight; copyBits].
                        lineY := lineY + lineHeight]]!