Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: src/gpu/GrBlurUtils.cpp

Issue 2296193005: Add a makeDrawContextWithFallback that handles config fallback (Closed)
Patch Set: update Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/gpu/GrClipStackClip.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 107 sk_sp<GrDrawContext> drawContext(context->makeDrawContextWithFallback(SkBack ingFit::kApprox,
108 // render target so default to RGBA_8888 108 maskRe ct.width(),
109 GrPixelConfig config = kRGBA_8888_GrPixelConfig; 109 maskRe ct.height(),
110 if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, sampleCnt > 0)) { 110 kAlpha _8_GrPixelConfig,
111 config = kAlpha_8_GrPixelConfig; 111 nullpt r,
112 } 112 sample Cnt));
113
114 sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kApp rox,
115 maskRect.width(),
116 maskRect.height(),
117 config,
118 nullptr,
119 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);
128 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); 121 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op);
129 122
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/gpu/GrClipStackClip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698