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