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 "GrDrawTargetCaps.h" | 10 #include "GrDrawTargetCaps.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } else { | 66 } else { |
67 if (stroke.isFillStyle()) { | 67 if (stroke.isFillStyle()) { |
68 paint.setStyle(SkPaint::kFill_Style); | 68 paint.setStyle(SkPaint::kFill_Style); |
69 } else { | 69 } else { |
70 paint.setStyle(SkPaint::kStroke_Style); | 70 paint.setStyle(SkPaint::kStroke_Style); |
71 paint.setStrokeJoin(stroke.getJoin()); | 71 paint.setStrokeJoin(stroke.getJoin()); |
72 paint.setStrokeCap(stroke.getCap()); | 72 paint.setStrokeCap(stroke.getCap()); |
73 paint.setStrokeWidth(stroke.getWidth()); | 73 paint.setStrokeWidth(stroke.getWidth()); |
74 } | 74 } |
75 } | 75 } |
| 76 paint.setAntiAlias(antiAlias); |
76 | 77 |
77 SkXfermode* mode = SkXfermode::Create(op_to_mode(op)); | 78 if (SkRegion::kReplace_Op == op && 0xFF == alpha) { |
78 | 79 SkASSERT(0xFF == paint.getAlpha()); |
79 paint.setXfermode(mode); | 80 fDraw.drawPathCoverage(path, paint); |
80 paint.setAntiAlias(antiAlias); | 81 } else { |
81 paint.setColor(SkColorSetARGB(alpha, alpha, alpha, alpha)); | 82 paint.setXfermodeMode(op_to_mode(op)); |
82 | 83 paint.setColor(SkColorSetARGB(alpha, alpha, alpha, alpha)); |
83 fDraw.drawPath(path, paint); | 84 fDraw.drawPath(path, paint); |
84 | 85 } |
85 SkSafeUnref(mode); | |
86 } | 86 } |
87 | 87 |
88 bool GrSWMaskHelper::init(const SkIRect& resultBounds, | 88 bool GrSWMaskHelper::init(const SkIRect& resultBounds, |
89 const SkMatrix* matrix) { | 89 const SkMatrix* matrix) { |
90 if (NULL != matrix) { | 90 if (NULL != matrix) { |
91 fMatrix = *matrix; | 91 fMatrix = *matrix; |
92 } else { | 92 } else { |
93 fMatrix.setIdentity(); | 93 fMatrix.setIdentity(); |
94 } | 94 } |
95 | 95 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 maskMatrix.preConcat(drawState->getViewMatrix()); | 204 maskMatrix.preConcat(drawState->getViewMatrix()); |
205 | 205 |
206 drawState->addCoverageEffect( | 206 drawState->addCoverageEffect( |
207 GrSimpleTextureEffect::Create(texture, | 207 GrSimpleTextureEffect::Create(texture, |
208 maskMatrix, | 208 maskMatrix, |
209 GrTextureParams::kNone_Fi
lterMode, | 209 GrTextureParams::kNone_Fi
lterMode, |
210 kPosition_GrCoordSet))->u
nref(); | 210 kPosition_GrCoordSet))->u
nref(); |
211 | 211 |
212 target->drawSimpleRect(dstRect); | 212 target->drawSimpleRect(dstRect); |
213 } | 213 } |
OLD | NEW |