@@ -99,7 +99,7 @@ void _save() {
99
99
layer . clipStack . save ( ) ;
100
100
}
101
101
102
- readonly uiOffset [ ] _saveLayer_Points = new uiOffset [ 4 ] ;
102
+ static uiOffset [ ] _cachedPoints = new uiOffset [ 4 ] ;
103
103
104
104
void _saveLayer ( uiRect bounds , uiPaint paint ) {
105
105
D . assert ( bounds . width > 0 ) ;
@@ -132,30 +132,31 @@ void _saveLayer(uiRect bounds, uiPaint paint) {
132
132
this . _currentLayer = layer ;
133
133
134
134
if ( paint . backdrop != null ) {
135
- if ( paint . backdrop is _BlurImageFilter ) {
136
- var filter = ( _BlurImageFilter ) paint . backdrop ;
135
+
136
+ if ( paint . backdrop is _uiBlurImageFilter ) {
137
+ var filter = ( _uiBlurImageFilter ) paint . backdrop ;
137
138
if ( ! ( filter . sigmaX == 0 && filter . sigmaY == 0 ) ) {
138
- this . _saveLayer_Points [ 0 ] = bounds . topLeft ;
139
- this . _saveLayer_Points [ 1 ] = bounds . bottomLeft ;
140
- this . _saveLayer_Points [ 2 ] = bounds . bottomRight ;
141
- this . _saveLayer_Points [ 3 ] = bounds . topRight ;
139
+ _cachedPoints [ 0 ] = bounds . topLeft ;
140
+ _cachedPoints [ 1 ] = bounds . bottomLeft ;
141
+ _cachedPoints [ 2 ] = bounds . bottomRight ;
142
+ _cachedPoints [ 3 ] = bounds . topRight ;
142
143
143
- state . matrix . Value . mapPoints ( this . _saveLayer_Points ) ;
144
+ state . matrix . Value . mapPoints ( ref _cachedPoints ) ;
144
145
145
146
var parentBounds = parentLayer . layerBounds ;
146
147
for ( int i = 0 ; i < 4 ; i ++ ) {
147
- this . _saveLayer_Points [ i ] = new uiOffset (
148
- ( this . _saveLayer_Points [ i ] . dx - parentBounds . left ) / parentBounds . width ,
149
- ( this . _saveLayer_Points [ i ] . dy - parentBounds . top ) / parentBounds . height
148
+ _cachedPoints [ i ] = new uiOffset (
149
+ ( _cachedPoints [ i ] . dx - parentBounds . left ) / parentBounds . width ,
150
+ ( _cachedPoints [ i ] . dy - parentBounds . top ) / parentBounds . height
150
151
) ;
151
152
}
152
153
153
154
var mesh = ImageMeshGenerator . imageMesh (
154
155
null ,
155
- this . _saveLayer_Points [ 0 ] ,
156
- this . _saveLayer_Points [ 1 ] ,
157
- this . _saveLayer_Points [ 2 ] ,
158
- this . _saveLayer_Points [ 3 ] ,
156
+ _cachedPoints [ 0 ] ,
157
+ _cachedPoints [ 1 ] ,
158
+ _cachedPoints [ 2 ] ,
159
+ _cachedPoints [ 3 ] ,
159
160
bounds ) ;
160
161
var renderDraw = CanvasShader . texRT ( layer , layer . layerPaint . Value , mesh , parentLayer ) ;
161
162
layer . draws . Add ( renderDraw ) ;
@@ -165,35 +166,36 @@ void _saveLayer(uiRect bounds, uiPaint paint) {
165
166
layer . draws . Add ( CanvasShader . texRT ( layer , paint , blurMesh , blurLayer ) ) ;
166
167
}
167
168
}
168
- else if ( paint . backdrop is _MatrixImageFilter ) {
169
- var filter = ( _MatrixImageFilter ) paint . backdrop ;
169
+ else if ( paint . backdrop is _uiMatrixImageFilter ) {
170
+ var filter = ( _uiMatrixImageFilter ) paint . backdrop ;
170
171
if ( ! filter . transform . isIdentity ( ) ) {
171
172
layer . filterMode = filter . filterMode ;
172
173
173
- this . _saveLayer_Points [ 0 ] = bounds . topLeft ;
174
- this . _saveLayer_Points [ 1 ] = bounds . bottomLeft ;
175
- this . _saveLayer_Points [ 2 ] = bounds . bottomRight ;
176
- this . _saveLayer_Points [ 3 ] = bounds . topRight ;
177
- state . matrix . Value . mapPoints ( this . _saveLayer_Points ) ;
174
+ _cachedPoints [ 0 ] = bounds . topLeft ;
175
+ _cachedPoints [ 1 ] = bounds . bottomLeft ;
176
+ _cachedPoints [ 2 ] = bounds . bottomRight ;
177
+ _cachedPoints [ 3 ] = bounds . topRight ;
178
+
179
+ state . matrix . Value . mapPoints ( ref _cachedPoints ) ;
178
180
179
181
var parentBounds = parentLayer . layerBounds ;
180
182
for ( int i = 0 ; i < 4 ; i ++ ) {
181
- this . _saveLayer_Points [ i ] = new uiOffset (
182
- ( this . _saveLayer_Points [ i ] . dx - parentBounds . left ) / parentBounds . width ,
183
- ( this . _saveLayer_Points [ i ] . dy - parentBounds . top ) / parentBounds . height
183
+ _cachedPoints [ i ] = new uiOffset (
184
+ ( _cachedPoints [ i ] . dx - parentBounds . left ) / parentBounds . width ,
185
+ ( _cachedPoints [ i ] . dy - parentBounds . top ) / parentBounds . height
184
186
) ;
185
187
}
186
188
187
189
var matrix = uiMatrix3 . makeTrans ( - bounds . left , - bounds . top ) ;
188
- matrix . postConcat ( uiMatrix3 . fromMatrix3 ( filter . transform ) ) ;
190
+ matrix . postConcat ( filter . transform ) ;
189
191
matrix . postTranslate ( bounds . left , bounds . top ) ;
190
192
191
193
var mesh = ImageMeshGenerator . imageMesh (
192
194
matrix ,
193
- this . _saveLayer_Points [ 0 ] ,
194
- this . _saveLayer_Points [ 1 ] ,
195
- this . _saveLayer_Points [ 2 ] ,
196
- this . _saveLayer_Points [ 3 ] ,
195
+ _cachedPoints [ 0 ] ,
196
+ _cachedPoints [ 1 ] ,
197
+ _cachedPoints [ 2 ] ,
198
+ _cachedPoints [ 3 ] ,
197
199
bounds ) ;
198
200
var renderDraw = CanvasShader . texRT ( layer , layer . layerPaint . Value , mesh , parentLayer ) ;
199
201
layer . draws . Add ( renderDraw ) ;
0 commit comments