OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrBlurUtils.h" | 8 #include "GrBlurUtils.h" |
9 #include "GrDrawContext.h" | 9 #include "GrDrawContext.h" |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return nullptr; | 118 return nullptr; |
119 } | 119 } |
120 | 120 |
121 drawContext->clear(nullptr, 0x0, true); | 121 drawContext->clear(nullptr, 0x0, true); |
122 | 122 |
123 GrPaint tempPaint; | 123 GrPaint tempPaint; |
124 tempPaint.setAntiAlias(doAA); | 124 tempPaint.setAntiAlias(doAA); |
125 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); | 125 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); |
126 | 126 |
127 // setup new clip | 127 // setup new clip |
128 const SkRect clipRect = SkRect::MakeIWH(maskRect.width(), maskRect.height())
; | 128 const SkIRect clipRect = SkIRect::MakeWH(maskRect.width(), maskRect.height()
); |
129 GrClip clip(clipRect); | 129 GrFixedClip clip(clipRect); |
130 | 130 |
131 // Draw the mask into maskTexture with the path's integerized top-left at | 131 // Draw the mask into maskTexture with the path's integerized top-left at |
132 // the origin using tempPaint. | 132 // the origin using tempPaint. |
133 SkMatrix translate; | 133 SkMatrix translate; |
134 translate.setTranslate(-SkIntToScalar(maskRect.fLeft), -SkIntToScalar(maskRe
ct.fTop)); | 134 translate.setTranslate(-SkIntToScalar(maskRect.fLeft), -SkIntToScalar(maskRe
ct.fTop)); |
135 drawContext->drawPath(clip, tempPaint, translate, devPath, GrStyle(fillOrHai
rline)); | 135 drawContext->drawPath(clip, tempPaint, translate, devPath, GrStyle(fillOrHai
rline)); |
136 return drawContext->asTexture();; | 136 return drawContext->asTexture();; |
137 } | 137 } |
138 | 138 |
139 static void draw_path_with_mask_filter(GrContext* context, | 139 static void draw_path_with_mask_filter(GrContext* context, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 292 } |
293 | 293 |
294 if (paint.getMaskFilter()) { | 294 if (paint.getMaskFilter()) { |
295 draw_path_with_mask_filter(context, drawContext, clip, &grPaint, viewMat
rix, | 295 draw_path_with_mask_filter(context, drawContext, clip, &grPaint, viewMat
rix, |
296 paint.getMaskFilter(), style, | 296 paint.getMaskFilter(), style, |
297 path, pathIsMutable); | 297 path, pathIsMutable); |
298 } else { | 298 } else { |
299 drawContext->drawPath(clip, grPaint, viewMatrix, *path, style); | 299 drawContext->drawPath(clip, grPaint, viewMatrix, *path, style); |
300 } | 300 } |
301 } | 301 } |
OLD | NEW |