aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrContext.cpp
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-22 20:51:19 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-22 20:51:19 +0000
commit84207c42789e67ef377befb0c9057b9b73fbd6e3 (patch)
tree2de3ef8b70b68b36fcc9a02a28f05e8c62b596c4 /src/gpu/GrContext.cpp
parentab2246fa08a9fbea134818a057f40d4f73e71f9c (diff)
Move the code for the GPU implementation of morphology effects from GrContext
and GrMorphologyEffect.* into SkMorphologyImageFilter.cpp. Review URL: https://codereview.appspot.com/6458065/ git-svn-id: http://skia.googlecode.com/svn/trunk@5241 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rw-r--r--src/gpu/GrContext.cpp66
1 files changed, 0 insertions, 66 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 66da55971c..f2419ae57e 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -9,7 +9,6 @@
#include "GrContext.h"
-#include "effects/GrMorphologyEffect.h"
#include "effects/GrConvolutionEffect.h"
#include "effects/GrSingleTextureEffect.h"
@@ -185,26 +184,6 @@ float adjust_sigma(float sigma, int *scaleFactor, int *radius) {
return sigma;
}
-void apply_morphology(GrDrawTarget* target,
- GrTexture* texture,
- const SkRect& rect,
- int radius,
- GrContext::MorphologyType morphType,
- Gr1DKernelEffect::Direction direction) {
-
- GrRenderTarget* rt = target->drawState()->getRenderTarget();
- GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kReset_ASRInit);
- GrDrawState* drawState = target->drawState();
- drawState->setRenderTarget(rt);
- GrMatrix sampleM;
- sampleM.setIDiv(texture->width(), texture->height());
- drawState->sampler(0)->reset(sampleM);
- SkAutoTUnref<GrCustomStage> morph(
- SkNEW_ARGS(GrMorphologyEffect, (texture, direction, radius, morphType)));
- drawState->sampler(0)->setCustomStage(morph);
- target->drawSimpleRect(rect, NULL);
-}
-
void convolve_gaussian(GrDrawTarget* target,
GrTexture* texture,
const SkRect& rect,
@@ -1852,51 +1831,6 @@ GrTexture* GrContext::gaussianBlur(GrTexture* srcTexture,
}
}
-GrTexture* GrContext::applyMorphology(GrTexture* srcTexture,
- const GrRect& rect,
- MorphologyType morphType,
- SkISize radius) {
- ASSERT_OWNED_RESOURCE(srcTexture);
- srcTexture->ref();
- GrRenderTarget* oldRenderTarget = this->getRenderTarget();
-
- AutoMatrix avm(this, GrMatrix::I());
-
- AutoClip acs(this, GrRect::MakeWH(SkIntToScalar(srcTexture->width()),
- SkIntToScalar(srcTexture->height())));
- GrTextureDesc desc;
- desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
- desc.fWidth = SkScalarCeilToInt(rect.width());
- desc.fHeight = SkScalarCeilToInt(rect.height());
- desc.fConfig = kRGBA_8888_GrPixelConfig;
- if (radius.fWidth > 0) {
- GrAutoScratchTexture ast(this, desc);
- this->setRenderTarget(ast.texture()->asRenderTarget());
- GrDrawTarget* target = this->prepareToDraw(NULL, DEFAULT_BUFFERING);
- apply_morphology(target, srcTexture, rect, radius.fWidth, morphType,
- Gr1DKernelEffect::kX_Direction);
- SkIRect clearRect = SkIRect::MakeXYWH(
- SkScalarFloorToInt(rect.fLeft),
- SkScalarFloorToInt(rect.fBottom),
- SkScalarFloorToInt(rect.width()),
- radius.fHeight);
- this->clear(&clearRect, 0x0);
- srcTexture->unref();
- srcTexture = ast.detach();
- }
- if (radius.fHeight > 0) {
- GrAutoScratchTexture ast(this, desc);
- this->setRenderTarget(ast.texture()->asRenderTarget());
- GrDrawTarget* target = this->prepareToDraw(NULL, DEFAULT_BUFFERING);
- apply_morphology(target, srcTexture, rect, radius.fHeight, morphType,
- Gr1DKernelEffect::kY_Direction);
- srcTexture->unref();
- srcTexture = ast.detach();
- }
- this->setRenderTarget(oldRenderTarget);
- return srcTexture;
-}
-
///////////////////////////////////////////////////////////////////////////////
#if GR_DEBUG
void GrContext::printCacheStats() const {