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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 const SkIRect& maskRect, | 97 const SkIRect& maskRect, |
98 const SkPath& devPath, | 98 const SkPath& devPath, |
99 SkStrokeRec::InitStyle fillOrHairline, | 99 SkStrokeRec::InitStyle fillOrHairline, |
100 bool doAA, | 100 bool doAA, |
101 int sampleCnt) { | 101 int sampleCnt) { |
102 if (!doAA) { | 102 if (!doAA) { |
103 // Don't need MSAA if mask isn't AA | 103 // Don't need MSAA if mask isn't AA |
104 sampleCnt = 0; | 104 sampleCnt = 0; |
105 } | 105 } |
106 | 106 |
107 // We actually only need A8, but it often isn't supported as a | |
108 // render target so default to RGBA_8888 | |
109 GrPixelConfig config = kRGBA_8888_GrPixelConfig; | |
110 if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, sampleCnt >
0)) { | |
111 config = kAlpha_8_GrPixelConfig; | |
112 } | |
113 | |
114 sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kApp
rox, | 107 sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kApp
rox, |
115 maskRect.width(), | 108 maskRect.width(), |
116 maskRect.height(), | 109 maskRect.height(), |
117 config, | 110 kAlpha_8_GrPixelCo
nfig, |
118 nullptr, | 111 nullptr, |
119 sampleCnt)); | 112 sampleCnt)); |
120 if (!drawContext) { | 113 if (!drawContext) { |
121 return nullptr; | 114 return nullptr; |
122 } | 115 } |
123 | 116 |
124 drawContext->clear(nullptr, 0x0, true); | 117 drawContext->clear(nullptr, 0x0, true); |
125 | 118 |
126 GrPaint tempPaint; | 119 GrPaint tempPaint; |
127 tempPaint.setAntiAlias(doAA); | 120 tempPaint.setAntiAlias(doAA); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 287 } |
295 | 288 |
296 if (paint.getMaskFilter()) { | 289 if (paint.getMaskFilter()) { |
297 draw_path_with_mask_filter(context, drawContext, clip, &grPaint, viewMat
rix, | 290 draw_path_with_mask_filter(context, drawContext, clip, &grPaint, viewMat
rix, |
298 paint.getMaskFilter(), style, | 291 paint.getMaskFilter(), style, |
299 path, pathIsMutable); | 292 path, pathIsMutable); |
300 } else { | 293 } else { |
301 drawContext->drawPath(clip, grPaint, viewMatrix, *path, style); | 294 drawContext->drawPath(clip, grPaint, viewMatrix, *path, style); |
302 } | 295 } |
303 } | 296 } |
OLD | NEW |