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

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

Issue 1107973004: Pull cache out of GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixpicturerenderer.cpp Created 5 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
« no previous file with comments | « src/effects/SkLightingImageFilter.cpp ('k') | src/effects/SkXfermodeImageFilter.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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 660
661 SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height()); 661 SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height());
662 GrSurfaceDesc desc; 662 GrSurfaceDesc desc;
663 desc.fFlags = kRenderTarget_GrSurfaceFlag; 663 desc.fFlags = kRenderTarget_GrSurfaceFlag;
664 desc.fWidth = rect.width(); 664 desc.fWidth = rect.width();
665 desc.fHeight = rect.height(); 665 desc.fHeight = rect.height();
666 desc.fConfig = kSkia8888_GrPixelConfig; 666 desc.fConfig = kSkia8888_GrPixelConfig;
667 SkIRect srcRect = rect; 667 SkIRect srcRect = rect;
668 668
669 if (radius.fWidth > 0) { 669 if (radius.fWidth > 0) {
670 GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox _ScratchTexMatch); 670 GrTexture* texture = context->textureProvider()->refScratchTexture(
671 desc, GrTextureProvider::kApprox_ScratchTexMatch);
671 if (NULL == texture) { 672 if (NULL == texture) {
672 return false; 673 return false;
673 } 674 }
674 apply_morphology_pass(context, texture->asRenderTarget(), clip, srcTextu re, 675 apply_morphology_pass(context, texture->asRenderTarget(), clip, srcTextu re,
675 srcRect, dstRect, radius.fWidth, morphType, 676 srcRect, dstRect, radius.fWidth, morphType,
676 Gr1DKernelEffect::kX_Direction); 677 Gr1DKernelEffect::kX_Direction);
677 SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom, 678 SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom,
678 dstRect.width(), radius.fHeight); 679 dstRect.width(), radius.fHeight);
679 GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphT ype ? 680 GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphT ype ?
680 SK_ColorWHITE : 681 SK_ColorWHITE :
681 SK_ColorTRANSPARENT; 682 SK_ColorTRANSPARENT;
682 context->clear(&clearRect, clearColor, false, texture->asRenderTarget()) ; 683 context->clear(&clearRect, clearColor, false, texture->asRenderTarget()) ;
683 srcTexture.reset(texture); 684 srcTexture.reset(texture);
684 srcRect = dstRect; 685 srcRect = dstRect;
685 } 686 }
686 if (radius.fHeight > 0) { 687 if (radius.fHeight > 0) {
687 GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox _ScratchTexMatch); 688 GrTexture* texture = context->textureProvider()->refScratchTexture(desc,
689 GrTextureProvider::kApprox_ScratchTexMatch);
688 if (NULL == texture) { 690 if (NULL == texture) {
689 return false; 691 return false;
690 } 692 }
691 apply_morphology_pass(context, texture->asRenderTarget(), clip, srcTextu re, 693 apply_morphology_pass(context, texture->asRenderTarget(), clip, srcTextu re,
692 srcRect, dstRect, radius.fHeight, morphType, 694 srcRect, dstRect, radius.fHeight, morphType,
693 Gr1DKernelEffect::kY_Direction); 695 Gr1DKernelEffect::kY_Direction);
694 srcTexture.reset(texture); 696 srcTexture.reset(texture);
695 } 697 }
696 SkImageFilter::WrapTexture(srcTexture, rect.width(), rect.height(), dst); 698 SkImageFilter::WrapTexture(srcTexture, rect.width(), rect.height(), dst);
697 return true; 699 return true;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 SkBitmap* result, SkIPoint* offset) con st { 749 SkBitmap* result, SkIPoint* offset) con st {
748 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); 750 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset);
749 } 751 }
750 752
751 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 753 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
752 SkBitmap* result, SkIPoint* offset) cons t { 754 SkBitmap* result, SkIPoint* offset) cons t {
753 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); 755 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset);
754 } 756 }
755 757
756 #endif 758 #endif
OLDNEW
« no previous file with comments | « src/effects/SkLightingImageFilter.cpp ('k') | src/effects/SkXfermodeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698