| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::AutoDeviceCoordDraw adcd(drawState); |
| 191 if (!adcd.succeeded()) { | 191 if (!adcd.succeeded()) { |
| 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 GrBatchedTextContext) | 196 // rendering (kGlyphMaskStage in GrTextContext) |
| 197 // && edge rendering (kEdgeEffectStage in GrContext) |
| 197 kPathMaskStage = GrPaint::kTotalStages, | 198 kPathMaskStage = GrPaint::kTotalStages, |
| 198 }; | 199 }; |
| 199 GrAssert(!drawState->isStageEnabled(kPathMaskStage)); | 200 GrAssert(!drawState->isStageEnabled(kPathMaskStage)); |
| 200 drawState->createTextureEffect(kPathMaskStage, texture, SkMatrix::I()); | 201 drawState->createTextureEffect(kPathMaskStage, texture, SkMatrix::I()); |
| 201 SkScalar w = SkIntToScalar(rect.width()); | 202 SkScalar w = SkIntToScalar(rect.width()); |
| 202 SkScalar h = SkIntToScalar(rect.height()); | 203 SkScalar h = SkIntToScalar(rect.height()); |
| 203 GrRect maskRect = GrRect::MakeWH(w / texture->width(), | 204 GrRect maskRect = GrRect::MakeWH(w / texture->width(), |
| 204 h / texture->height()); | 205 h / texture->height()); |
| 205 | 206 |
| 206 GrRect dstRect = GrRect::MakeLTRB( | 207 GrRect dstRect = GrRect::MakeLTRB( |
| 207 SK_Scalar1 * rect.fLeft, | 208 SK_Scalar1 * rect.fLeft, |
| 208 SK_Scalar1 * rect.fTop, | 209 SK_Scalar1 * rect.fTop, |
| 209 SK_Scalar1 * rect.fRight, | 210 SK_Scalar1 * rect.fRight, |
| 210 SK_Scalar1 * rect.fBottom); | 211 SK_Scalar1 * rect.fBottom); |
| 211 target->drawRect(dstRect, NULL, &maskRect, NULL, kPathMaskStage); | 212 target->drawRect(dstRect, NULL, &maskRect, NULL, kPathMaskStage); |
| 212 drawState->disableStage(kPathMaskStage); | 213 drawState->disableStage(kPathMaskStage); |
| 213 } | 214 } |
| OLD | NEW |