OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrSWMaskHelper.h" | 8 #include "GrSWMaskHelper.h" |
9 #include "GrDrawState.h" | 9 #include "GrDrawState.h" |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 helper.toTexture(ast.texture(), 0x00); | 180 helper.toTexture(ast.texture(), 0x00); |
181 | 181 |
182 return ast.detach(); | 182 return ast.detach(); |
183 } | 183 } |
184 | 184 |
185 void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture, | 185 void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture, |
186 GrDrawTarget* target, | 186 GrDrawTarget* target, |
187 const GrIRect& rect) { | 187 const GrIRect& rect) { |
188 GrDrawState* drawState = target->drawState(); | 188 GrDrawState* drawState = target->drawState(); |
189 | 189 |
190 GrDrawState::AutoDeviceCoordDraw adcd(drawState); | 190 GrDrawState::AutoViewMatrixRestore avmr; |
191 if (!adcd.succeeded()) { | 191 if (!avmr.setIdentity(drawState)) { |
192 return; | 192 return; |
193 } | 193 } |
194 enum { | 194 enum { |
195 // the SW path renderer shares this stage with glyph | 195 // the SW path renderer shares this stage with glyph |
196 // rendering (kGlyphMaskStage in GrTextContext) | 196 // rendering (kGlyphMaskStage in GrTextContext) |
197 // && edge rendering (kEdgeEffectStage in GrContext) | 197 // && edge rendering (kEdgeEffectStage in GrContext) |
198 kPathMaskStage = GrPaint::kTotalStages, | 198 kPathMaskStage = GrPaint::kTotalStages, |
199 }; | 199 }; |
200 | 200 |
201 GrRect dstRect = GrRect::MakeLTRB( | 201 GrRect dstRect = GrRect::MakeLTRB( |
(...skipping 14 matching lines...) Expand all Loading... |
216 GrAssert(!drawState->isStageEnabled(kPathMaskStage)); | 216 GrAssert(!drawState->isStageEnabled(kPathMaskStage)); |
217 drawState->setEffect(kPathMaskStage, | 217 drawState->setEffect(kPathMaskStage, |
218 GrSimpleTextureEffect::Create(texture, | 218 GrSimpleTextureEffect::Create(texture, |
219 maskMatrix, | 219 maskMatrix, |
220 false, | 220 false, |
221 GrEffect::kPosition_Coord
sType))->unref(); | 221 GrEffect::kPosition_Coord
sType))->unref(); |
222 | 222 |
223 target->drawSimpleRect(dstRect); | 223 target->drawSimpleRect(dstRect); |
224 drawState->disableStage(kPathMaskStage); | 224 drawState->disableStage(kPathMaskStage); |
225 } | 225 } |
OLD | NEW |