@@ -140,21 +140,18 @@ struct GlyphLine {
140
140
public readonly int count ;
141
141
public readonly int totalCountUnits ;
142
142
143
- readonly GlyphPosition [ ] _positions ;
144
-
145
- public GlyphLine ( GlyphPosition [ ] positions , int start , int count , int totalCountUnits ) {
146
- this . _positions = positions ;
143
+ public GlyphLine ( int start , int count , int totalCountUnits ) {
147
144
this . start = start ;
148
145
this . count = count ;
149
146
this . totalCountUnits = totalCountUnits ;
150
147
}
151
148
152
- public GlyphPosition get ( int i ) {
153
- return this . _positions [ this . start + i ] ;
149
+ public GlyphPosition get ( int i , GlyphPosition [ ] glyphPositions ) {
150
+ return glyphPositions [ this . start + i ] ;
154
151
}
155
152
156
- public GlyphPosition last ( ) {
157
- return this . _positions [ this . start + this . count - 1 ] ;
153
+ public GlyphPosition last ( GlyphPosition [ ] glyphPositions ) {
154
+ return glyphPositions [ this . start + this . count - 1 ] ;
158
155
}
159
156
}
160
157
@@ -483,7 +480,8 @@ public void layout(ParagraphConstraints constraints) {
483
480
// Create code unit run
484
481
this . _codeUnitRuns [ this . _codeUnitRunsCount ++ ] = new CodeUnitRun (
485
482
new Range < int > ( start , end ) ,
486
- new Range < float > ( this . _glyphPositions [ 0 ] . xPos . start , this . _glyphPositions . last ( ) . xPos . end ) ,
483
+ new Range < float > ( this . _glyphPositions [ glyphPositionStyleRunStart ] . xPos . start ,
484
+ this . _glyphPositions [ pGlyphPositions - 1 ] . xPos . end ) ,
487
485
lineNumber , TextDirection . ltr , glyphPositionStyleRunStart , textCount ) ;
488
486
489
487
lineStyleRunIndex ++ ;
@@ -551,7 +549,7 @@ void updateLineMetrics(FontMetrics metrics, float styleHeight) {
551
549
? this . _lineRanges [ lineNumber + 1 ] . start
552
550
: this . _text . Length ;
553
551
this . _glyphLines [ lineNumber ] =
554
- new GlyphLine ( this . _glyphPositions , glyphPositionLineStart , count , nextLineStart - lineStart ) ;
552
+ new GlyphLine ( glyphPositionLineStart , count , nextLineStart - lineStart ) ;
555
553
for ( int i = 0 ; i < lineStyleRunCount ; i ++ ) {
556
554
var paintRecord = this . _paintRecords [ this . _paintRecordsCount - 1 - i ] ;
557
555
paintRecord . shift ( lineXOffset , yOffset ) ;
@@ -731,17 +729,17 @@ internal PositionWithAffinity getGlyphPositionAtCoordinate(float dx, float dy) {
731
729
bool gpSet = false ;
732
730
for ( int xIndex = 0 ; xIndex < glyphLine . count ; ++ xIndex ) {
733
731
float glyphEnd = xIndex < glyphLine . count - 1
734
- ? glyphLine . get ( xIndex + 1 ) . xPos . start
735
- : glyphLine . get ( xIndex ) . xPos . end ;
732
+ ? glyphLine . get ( xIndex + 1 , this . _glyphPositions ) . xPos . start
733
+ : glyphLine . get ( xIndex , this . _glyphPositions ) . xPos . end ;
736
734
if ( dx < glyphEnd ) {
737
- gp = glyphLine . get ( xIndex ) ;
735
+ gp = glyphLine . get ( xIndex , this . _glyphPositions ) ;
738
736
gpSet = true ;
739
737
break ;
740
738
}
741
739
}
742
740
743
741
if ( ! gpSet ) {
744
- GlyphPosition lastGlyph = glyphLine . last ( ) ;
742
+ GlyphPosition lastGlyph = glyphLine . last ( this . _glyphPositions ) ;
745
743
return new PositionWithAffinity ( lastGlyph . codeUnit + 1 , TextAffinity . upstream ) ;
746
744
}
747
745
0 commit comments