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

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

Issue 1321353002: Limit lifetime of GrDrawContext objects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 5 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
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 desc.fConfig = kAlpha_8_GrPixelConfig; 115 desc.fConfig = kAlpha_8_GrPixelConfig;
116 } 116 }
117 117
118 GrTexture* mask = context->textureProvider()->createApproxTexture(desc); 118 GrTexture* mask = context->textureProvider()->createApproxTexture(desc);
119 if (nullptr == mask) { 119 if (nullptr == mask) {
120 return nullptr; 120 return nullptr;
121 } 121 }
122 122
123 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); 123 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height());
124 124
125 GrDrawContext* drawContext = context->drawContext(); 125 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext());
126 if (!drawContext) { 126 if (!drawContext) {
127 return nullptr; 127 return nullptr;
128 } 128 }
129 129
130 drawContext->clear(mask->asRenderTarget(), nullptr, 0x0, true); 130 drawContext->clear(mask->asRenderTarget(), nullptr, 0x0, true);
131 131
132 GrPaint tempPaint; 132 GrPaint tempPaint;
133 tempPaint.setAntiAlias(doAA); 133 tempPaint.setAntiAlias(doAA);
134 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); 134 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op);
135 135
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 SkPaint::kFill_Sty le; 286 SkPaint::kFill_Sty le;
287 draw_with_mask_filter(drawContext, context->textureProvider(), renderTar get, 287 draw_with_mask_filter(drawContext, context->textureProvider(), renderTar get,
288 clip, viewMatrix, *devPathPtr, 288 clip, viewMatrix, *devPathPtr,
289 paint.getMaskFilter(), clipBounds, &grPaint, style ); 289 paint.getMaskFilter(), clipBounds, &grPaint, style );
290 return; 290 return;
291 } 291 }
292 292
293 drawContext->drawPath(renderTarget, clip, grPaint, viewMatrix, *pathPtr, str okeInfo); 293 drawContext->drawPath(renderTarget, clip, grPaint, viewMatrix, *pathPtr, str okeInfo);
294 } 294 }
295 295
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698