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

Side by Side Diff: src/effects/SkAlphaThresholdFilter.cpp

Issue 1918003003: Bring sk_sp to GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 7 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 2013 Google Inc. 2 * Copyright 2013 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 "SkAlphaThresholdFilter.h" 8 #include "SkAlphaThresholdFilter.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 maskDesc.fFlags = kRenderTarget_GrSurfaceFlag; 104 maskDesc.fFlags = kRenderTarget_GrSurfaceFlag;
105 // Add one pixel of border to ensure that clamp mode will be all zeros 105 // Add one pixel of border to ensure that clamp mode will be all zeros
106 // the outside. 106 // the outside.
107 maskDesc.fWidth = bounds.width(); 107 maskDesc.fWidth = bounds.width();
108 maskDesc.fHeight = bounds.height(); 108 maskDesc.fHeight = bounds.height();
109 sk_sp<GrTexture> maskTexture(context->textureProvider()->createApproxTexture (maskDesc)); 109 sk_sp<GrTexture> maskTexture(context->textureProvider()->createApproxTexture (maskDesc));
110 if (!maskTexture) { 110 if (!maskTexture) {
111 return nullptr; 111 return nullptr;
112 } 112 }
113 113
114 sk_sp<GrDrawContext> drawContext(context->drawContext(maskTexture->asRenderT arget())); 114 sk_sp<GrDrawContext> drawContext(
115 context->drawContext(sk_ref_sp(maskTexture->asRe nderTarget())));
115 if (!drawContext) { 116 if (!drawContext) {
116 return nullptr; 117 return nullptr;
117 } 118 }
118 119
119 GrPaint grPaint; 120 GrPaint grPaint;
120 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 121 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
121 SkRegion::Iterator iter(fRegion); 122 SkRegion::Iterator iter(fRegion);
122 drawContext->clear(nullptr, 0x0, true); 123 drawContext->clear(nullptr, 0x0, true);
123 124
124 GrClip clip(SkRect::Make(SkIRect::MakeWH(bounds.width(), bounds.height()))); 125 GrClip clip(SkRect::Make(SkIRect::MakeWH(bounds.width(), bounds.height())));
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 dst); 267 dst);
267 } 268 }
268 269
269 #ifndef SK_IGNORE_TO_STRING 270 #ifndef SK_IGNORE_TO_STRING
270 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { 271 void SkAlphaThresholdFilterImpl::toString(SkString* str) const {
271 str->appendf("SkAlphaThresholdImageFilter: ("); 272 str->appendf("SkAlphaThresholdImageFilter: (");
272 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); 273 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold);
273 str->append(")"); 274 str->append(")");
274 } 275 }
275 #endif 276 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698