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 "GrContext.h" | 11 #include "GrContext.h" |
11 #include "effects/GrSimpleTextureEffect.h" | 12 #include "effects/GrSimpleTextureEffect.h" |
12 #include "GrStrokeInfo.h" | 13 #include "GrStrokeInfo.h" |
13 #include "GrTexture.h" | 14 #include "GrTexture.h" |
14 #include "GrTextureProvider.h" | 15 #include "GrTextureProvider.h" |
15 #include "SkDraw.h" | 16 #include "SkDraw.h" |
16 #include "SkGr.h" | 17 #include "SkGr.h" |
17 #include "SkMaskFilter.h" | 18 #include "SkMaskFilter.h" |
18 #include "SkPaint.h" | 19 #include "SkPaint.h" |
19 | 20 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 int sampleCnt) { | 104 int sampleCnt) { |
104 GrSurfaceDesc desc; | 105 GrSurfaceDesc desc; |
105 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 106 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
106 desc.fWidth = SkScalarCeilToInt(maskRect.width()); | 107 desc.fWidth = SkScalarCeilToInt(maskRect.width()); |
107 desc.fHeight = SkScalarCeilToInt(maskRect.height()); | 108 desc.fHeight = SkScalarCeilToInt(maskRect.height()); |
108 desc.fSampleCnt = doAA ? sampleCnt : 0; | 109 desc.fSampleCnt = doAA ? sampleCnt : 0; |
109 // We actually only need A8, but it often isn't supported as a | 110 // We actually only need A8, but it often isn't supported as a |
110 // render target so default to RGBA_8888 | 111 // render target so default to RGBA_8888 |
111 desc.fConfig = kRGBA_8888_GrPixelConfig; | 112 desc.fConfig = kRGBA_8888_GrPixelConfig; |
112 | 113 |
113 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, desc.fSampleCnt > 0)
) { | 114 if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, desc.fSample
Cnt > 0)) { |
114 desc.fConfig = kAlpha_8_GrPixelConfig; | 115 desc.fConfig = kAlpha_8_GrPixelConfig; |
115 } | 116 } |
116 | 117 |
117 GrTexture* mask = context->textureProvider()->refScratchTexture( | 118 GrTexture* mask = context->textureProvider()->refScratchTexture( |
118 desc, GrTextureProvider::kApprox_ScratchTexMatch); | 119 desc, GrTextureProvider::kApprox_ScratchTexMatch); |
119 if (NULL == mask) { | 120 if (NULL == mask) { |
120 return NULL; | 121 return NULL; |
121 } | 122 } |
122 | 123 |
123 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); | 124 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 SkPaint::kFill_Sty
le; | 287 SkPaint::kFill_Sty
le; |
287 draw_with_mask_filter(drawContext, context->textureProvider(), renderTar
get, | 288 draw_with_mask_filter(drawContext, context->textureProvider(), renderTar
get, |
288 clip, viewMatrix, *devPathPtr, | 289 clip, viewMatrix, *devPathPtr, |
289 paint.getMaskFilter(), clipBounds, &grPaint, style
); | 290 paint.getMaskFilter(), clipBounds, &grPaint, style
); |
290 return; | 291 return; |
291 } | 292 } |
292 | 293 |
293 drawContext->drawPath(renderTarget, clip, grPaint, viewMatrix, *pathPtr, str
okeInfo); | 294 drawContext->drawPath(renderTarget, clip, grPaint, viewMatrix, *pathPtr, str
okeInfo); |
294 } | 295 } |
295 | 296 |
OLD | NEW |