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 17 matching lines...) Expand all Loading... |
28 static bool draw_mask(GrDrawContext* drawContext, | 28 static bool draw_mask(GrDrawContext* drawContext, |
29 const GrClip& clip, | 29 const GrClip& clip, |
30 const SkMatrix& viewMatrix, | 30 const SkMatrix& viewMatrix, |
31 const SkIRect& maskRect, | 31 const SkIRect& maskRect, |
32 GrPaint* grp, | 32 GrPaint* grp, |
33 GrTexture* mask) { | 33 GrTexture* mask) { |
34 SkMatrix matrix; | 34 SkMatrix matrix; |
35 matrix.setTranslate(-SkIntToScalar(maskRect.fLeft), -SkIntToScalar(maskRect.
fTop)); | 35 matrix.setTranslate(-SkIntToScalar(maskRect.fLeft), -SkIntToScalar(maskRect.
fTop)); |
36 matrix.postIDiv(mask->width(), mask->height()); | 36 matrix.postIDiv(mask->width(), mask->height()); |
37 | 37 |
38 grp->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(mask, matrix
, | 38 grp->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(mask, matrix, |
39 kDevice_GrCo
ordSet))->unref(); | 39 kDevice_GrCoor
dSet)); |
40 | 40 |
41 SkMatrix inverse; | 41 SkMatrix inverse; |
42 if (!viewMatrix.invert(&inverse)) { | 42 if (!viewMatrix.invert(&inverse)) { |
43 return false; | 43 return false; |
44 } | 44 } |
45 drawContext->fillRectWithLocalMatrix(clip, *grp, SkMatrix::I(), | 45 drawContext->fillRectWithLocalMatrix(clip, *grp, SkMatrix::I(), |
46 SkRect::Make(maskRect), inverse); | 46 SkRect::Make(maskRect), inverse); |
47 return true; | 47 return true; |
48 } | 48 } |
49 | 49 |
(...skipping 242 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 |