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

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

Issue 680413005: Don't allow renderTarget==NULL to GrContext::clear() and friends. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 6 years, 1 month 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 | « include/gpu/GrContext.h ('k') | src/effects/SkGpuBlurUtils.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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 context->refScratchTexture(maskDesc, GrContext::kApprox_ScratchTexMa tch)); 287 context->refScratchTexture(maskDesc, GrContext::kApprox_ScratchTexMa tch));
288 if (!maskTexture) { 288 if (!maskTexture) {
289 return false; 289 return false;
290 } 290 }
291 291
292 { 292 {
293 GrContext::AutoRenderTarget art(context, maskTexture->asRenderTarget ()); 293 GrContext::AutoRenderTarget art(context, maskTexture->asRenderTarget ());
294 GrPaint grPaint; 294 GrPaint grPaint;
295 grPaint.setBlendFunc(kOne_GrBlendCoeff, kZero_GrBlendCoeff); 295 grPaint.setBlendFunc(kOne_GrBlendCoeff, kZero_GrBlendCoeff);
296 SkRegion::Iterator iter(fRegion); 296 SkRegion::Iterator iter(fRegion);
297 context->clear(NULL, 0x0, true); 297 context->clear(NULL, 0x0, true, maskTexture->asRenderTarget());
298 298
299 SkMatrix old_matrix = context->getMatrix(); 299 SkMatrix old_matrix = context->getMatrix();
300 context->setMatrix(in_matrix); 300 context->setMatrix(in_matrix);
301 301
302 while (!iter.done()) { 302 while (!iter.done()) {
303 SkRect rect = SkRect::Make(iter.rect()); 303 SkRect rect = SkRect::Make(iter.rect());
304 context->drawRect(grPaint, rect); 304 context->drawRect(grPaint, rect);
305 iter.next(); 305 iter.next();
306 } 306 }
307 context->setMatrix(old_matrix); 307 context->setMatrix(old_matrix);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 (U8CPU)(SkColorGetG(source) * scale), 377 (U8CPU)(SkColorGetG(source) * scale),
378 (U8CPU)(SkColorGetB(source) * scale)); 378 (U8CPU)(SkColorGetB(source) * scale));
379 } 379 }
380 } 380 }
381 dptr[y * dst->width() + x] = output_color; 381 dptr[y * dst->width() + x] = output_color;
382 } 382 }
383 } 383 }
384 384
385 return true; 385 return true;
386 } 386 }
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/effects/SkGpuBlurUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698