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

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

Issue 1139753002: Refactor GrBufferAllocPools to use resource cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up 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
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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
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->textureProvider()->refScratchTexture( 670 GrTexture* texture = context->textureProvider()->refScratchTexture(
671 desc, GrTextureProvider::kApprox_ScratchTexMatch); 671 desc, GrTextureProvider::kApprox_ScratchMatch);
672 if (NULL == texture) { 672 if (NULL == texture) {
673 return false; 673 return false;
674 } 674 }
675 apply_morphology_pass(context, texture->asRenderTarget(), clip, srcTextu re, 675 apply_morphology_pass(context, texture->asRenderTarget(), clip, srcTextu re,
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 context->clear(&clearRect, clearColor, false, texture->asRenderTarget()) ; 683 context->clear(&clearRect, clearColor, false, texture->asRenderTarget()) ;
684 srcTexture.reset(texture); 684 srcTexture.reset(texture);
685 srcRect = dstRect; 685 srcRect = dstRect;
686 } 686 }
687 if (radius.fHeight > 0) { 687 if (radius.fHeight > 0) {
688 GrTexture* texture = context->textureProvider()->refScratchTexture(desc, 688 GrTexture* texture = context->textureProvider()->refScratchTexture(desc,
689 GrTextureProvider::kApprox_ScratchTexMatch); 689 GrTextureProvider::kApprox_ScratchMatch);
690 if (NULL == texture) { 690 if (NULL == texture) {
691 return false; 691 return false;
692 } 692 }
693 apply_morphology_pass(context, texture->asRenderTarget(), clip, srcTextu re, 693 apply_morphology_pass(context, texture->asRenderTarget(), clip, srcTextu re,
694 srcRect, dstRect, radius.fHeight, morphType, 694 srcRect, dstRect, radius.fHeight, morphType,
695 Gr1DKernelEffect::kY_Direction); 695 Gr1DKernelEffect::kY_Direction);
696 srcTexture.reset(texture); 696 srcTexture.reset(texture);
697 } 697 }
698 SkImageFilter::WrapTexture(srcTexture, rect.width(), rect.height(), dst); 698 SkImageFilter::WrapTexture(srcTexture, rect.width(), rect.height(), dst);
699 return true; 699 return true;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 SkBitmap* result, SkIPoint* offset) con st { 749 SkBitmap* result, SkIPoint* offset) con st {
750 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); 750 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset);
751 } 751 }
752 752
753 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 753 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
754 SkBitmap* result, SkIPoint* offset) cons t { 754 SkBitmap* result, SkIPoint* offset) cons t {
755 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); 755 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset);
756 } 756 }
757 757
758 #endif 758 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698