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

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

Issue 939623005: Pass Rendertarget into context (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: sampleapp Created 5 years, 10 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/core/SkMaskFilter.cpp ('k') | src/effects/SkBlurMaskFilter.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 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 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // the outside. 278 // the outside.
279 maskDesc.fWidth = texture->width(); 279 maskDesc.fWidth = texture->width();
280 maskDesc.fHeight = texture->height(); 280 maskDesc.fHeight = texture->height();
281 SkAutoTUnref<GrTexture> maskTexture( 281 SkAutoTUnref<GrTexture> maskTexture(
282 context->refScratchTexture(maskDesc, GrContext::kApprox_ScratchTexMa tch)); 282 context->refScratchTexture(maskDesc, GrContext::kApprox_ScratchTexMa tch));
283 if (!maskTexture) { 283 if (!maskTexture) {
284 return false; 284 return false;
285 } 285 }
286 286
287 { 287 {
288 GrContext::AutoRenderTarget art(context, maskTexture->asRenderTarget ());
289 GrPaint grPaint; 288 GrPaint grPaint;
290 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 289 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
291 SkRegion::Iterator iter(fRegion); 290 SkRegion::Iterator iter(fRegion);
292 context->clear(NULL, 0x0, true, maskTexture->asRenderTarget()); 291 context->clear(NULL, 0x0, true, maskTexture->asRenderTarget());
293 292
294 while (!iter.done()) { 293 while (!iter.done()) {
295 SkRect rect = SkRect::Make(iter.rect()); 294 SkRect rect = SkRect::Make(iter.rect());
296 context->drawRect(grPaint, in_matrix, rect); 295 context->drawRect(maskTexture->asRenderTarget(), grPaint, in_mat rix, rect);
297 iter.next(); 296 iter.next();
298 } 297 }
299 } 298 }
300 299
301 *fp = AlphaThresholdEffect::Create(texture, 300 *fp = AlphaThresholdEffect::Create(texture,
302 maskTexture, 301 maskTexture,
303 fInnerThreshold, 302 fInnerThreshold,
304 fOuterThreshold); 303 fOuterThreshold);
305 } 304 }
306 return true; 305 return true;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 } 376 }
378 377
379 #ifndef SK_IGNORE_TO_STRING 378 #ifndef SK_IGNORE_TO_STRING
380 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { 379 void SkAlphaThresholdFilterImpl::toString(SkString* str) const {
381 str->appendf("SkAlphaThresholdImageFilter: ("); 380 str->appendf("SkAlphaThresholdImageFilter: (");
382 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); 381 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold);
383 str->append(")"); 382 str->append(")");
384 } 383 }
385 #endif 384 #endif
386 385
OLDNEW
« no previous file with comments | « src/core/SkMaskFilter.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698