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

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

Issue 1245883005: Fix variable shadowing in SkMorphologyImageFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | no next file » | 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 655
656 SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height()); 656 SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height());
657 GrSurfaceDesc desc; 657 GrSurfaceDesc desc;
658 desc.fFlags = kRenderTarget_GrSurfaceFlag; 658 desc.fFlags = kRenderTarget_GrSurfaceFlag;
659 desc.fWidth = rect.width(); 659 desc.fWidth = rect.width();
660 desc.fHeight = rect.height(); 660 desc.fHeight = rect.height();
661 desc.fConfig = kSkia8888_GrPixelConfig; 661 desc.fConfig = kSkia8888_GrPixelConfig;
662 SkIRect srcRect = rect; 662 SkIRect srcRect = rect;
663 663
664 if (radius.fWidth > 0) { 664 if (radius.fWidth > 0) {
665 GrTexture* dst = context->textureProvider()->refScratchTexture( 665 GrTexture* scratch = context->textureProvider()->refScratchTexture(
666 desc, GrTextureProvider::kApprox_ScratchTexMatch); 666 desc, GrTextureProvider::kApprox_ScratchTexMatch);
667 if (NULL == dst) { 667 if (NULL == scratch) {
668 return false; 668 return false;
669 } 669 }
670 GrDrawContext* dstDrawContext = context->drawContext(); 670 GrDrawContext* dstDrawContext = context->drawContext();
671 if (!dstDrawContext) { 671 if (!dstDrawContext) {
672 return false; 672 return false;
673 } 673 }
674 674
675 apply_morphology_pass(dstDrawContext, dst->asRenderTarget(), clip, srcTe xture, 675 apply_morphology_pass(dstDrawContext, scratch->asRenderTarget(), clip, s rcTexture,
676 srcRect, dstRect, radius.fWidth, morphType, 676 srcRect, dstRect, radius.fWidth, morphType,
677 Gr1DKernelEffect::kX_Direction); 677 Gr1DKernelEffect::kX_Direction);
678 SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom, 678 SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom,
679 dstRect.width(), radius.fHeight); 679 dstRect.width(), radius.fHeight);
680 GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphT ype ? 680 GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphT ype ?
681 SK_ColorWHITE : 681 SK_ColorWHITE :
682 SK_ColorTRANSPARENT; 682 SK_ColorTRANSPARENT;
683 dstDrawContext->clear(dst->asRenderTarget(), &clearRect, clearColor, fal se); 683 dstDrawContext->clear(scratch->asRenderTarget(), &clearRect, clearColor, false);
684 684
685 srcTexture.reset(dst); 685 srcTexture.reset(scratch);
686 srcRect = dstRect; 686 srcRect = dstRect;
687 } 687 }
688 if (radius.fHeight > 0) { 688 if (radius.fHeight > 0) {
689 GrTexture* dst = context->textureProvider()->refScratchTexture(desc, 689 GrTexture* scratch = context->textureProvider()->refScratchTexture(desc,
690 GrTextureProvider::kApprox_ScratchTexMatch); 690 GrTextureProvider::kApprox_ScratchTexMatch);
691 if (NULL == dst) { 691 if (NULL == scratch) {
692 return false; 692 return false;
693 } 693 }
694 GrDrawContext* dstDrawContext = context->drawContext(); 694 GrDrawContext* dstDrawContext = context->drawContext();
695 if (!dstDrawContext) { 695 if (!dstDrawContext) {
696 return false; 696 return false;
697 } 697 }
698 698
699 apply_morphology_pass(dstDrawContext, dst->asRenderTarget(), clip, srcTe xture, 699 apply_morphology_pass(dstDrawContext, scratch->asRenderTarget(), clip, s rcTexture,
700 srcRect, dstRect, radius.fHeight, morphType, 700 srcRect, dstRect, radius.fHeight, morphType,
701 Gr1DKernelEffect::kY_Direction); 701 Gr1DKernelEffect::kY_Direction);
702 702
703 srcTexture.reset(dst); 703 srcTexture.reset(scratch);
704 } 704 }
705 SkImageFilter::WrapTexture(srcTexture, rect.width(), rect.height(), dst); 705 SkImageFilter::WrapTexture(srcTexture, rect.width(), rect.height(), dst);
706 return true; 706 return true;
707 } 707 }
708 708
709 }; 709 };
710 710
711 bool SkMorphologyImageFilter::filterImageGPUGeneric(bool dilate, 711 bool SkMorphologyImageFilter::filterImageGPUGeneric(bool dilate,
712 Proxy* proxy, 712 Proxy* proxy,
713 const SkBitmap& src, 713 const SkBitmap& src,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 SkBitmap* result, SkIPoint* offset) con st { 757 SkBitmap* result, SkIPoint* offset) con st {
758 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); 758 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset);
759 } 759 }
760 760
761 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 761 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
762 SkBitmap* result, SkIPoint* offset) cons t { 762 SkBitmap* result, SkIPoint* offset) cons t {
763 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); 763 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset);
764 } 764 }
765 765
766 #endif 766 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698