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

Side by Side Diff: src/effects/SkMorphologyImageFilter.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 | « src/effects/SkGpuBlurUtils.cpp ('k') | src/gpu/GrContext.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 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
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 "SkMorphologyImageFilter.h" 8 #include "SkMorphologyImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 if (radius.fWidth > 0) { 523 if (radius.fWidth > 0) {
524 GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox _ScratchTexMatch); 524 GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox _ScratchTexMatch);
525 if (NULL == texture) { 525 if (NULL == texture) {
526 return false; 526 return false;
527 } 527 }
528 GrContext::AutoRenderTarget art(context, texture->asRenderTarget()); 528 GrContext::AutoRenderTarget art(context, texture->asRenderTarget());
529 apply_morphology_pass(context, srcTexture, srcRect, dstRect, radius.fWid th, 529 apply_morphology_pass(context, srcTexture, srcRect, dstRect, radius.fWid th,
530 morphType, Gr1DKernelEffect::kX_Direction); 530 morphType, Gr1DKernelEffect::kX_Direction);
531 SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom, 531 SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom,
532 dstRect.width(), radius.fHeight); 532 dstRect.width(), radius.fHeight);
533 context->clear(&clearRect, GrMorphologyEffect::kErode_MorphologyType == morphType ? 533 GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphT ype ?
534 SK_ColorWHITE : 534 SK_ColorWHITE :
535 SK_ColorTRANSPARENT, false); 535 SK_ColorTRANSPARENT;
536 context->clear(&clearRect, clearColor, false, texture->asRenderTarget()) ;
536 srcTexture.reset(texture); 537 srcTexture.reset(texture);
537 srcRect = dstRect; 538 srcRect = dstRect;
538 } 539 }
539 if (radius.fHeight > 0) { 540 if (radius.fHeight > 0) {
540 GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox _ScratchTexMatch); 541 GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox _ScratchTexMatch);
541 if (NULL == texture) { 542 if (NULL == texture) {
542 return false; 543 return false;
543 } 544 }
544 GrContext::AutoRenderTarget art(context, texture->asRenderTarget()); 545 GrContext::AutoRenderTarget art(context, texture->asRenderTarget());
545 apply_morphology_pass(context, srcTexture, srcRect, dstRect, radius.fHei ght, 546 apply_morphology_pass(context, srcTexture, srcRect, dstRect, radius.fHei ght,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 SkBitmap* result, SkIPoint* offset) con st { 601 SkBitmap* result, SkIPoint* offset) con st {
601 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); 602 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset);
602 } 603 }
603 604
604 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 605 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
605 SkBitmap* result, SkIPoint* offset) cons t { 606 SkBitmap* result, SkIPoint* offset) cons t {
606 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); 607 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset);
607 } 608 }
608 609
609 #endif 610 #endif
OLDNEW
« no previous file with comments | « src/effects/SkGpuBlurUtils.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698