diff options
Diffstat (limited to 'src')
21 files changed, 80 insertions, 82 deletions
diff --git a/src/effects/SkBlendImageFilter.cpp b/src/effects/SkBlendImageFilter.cpp index b658acc57a..fcda11454b 100644 --- a/src/effects/SkBlendImageFilter.cpp +++ b/src/effects/SkBlendImageFilter.cpp @@ -207,9 +207,9 @@ GrTexture* SkBlendImageFilter::onFilterImageGPU(Proxy* proxy, GrTexture* src, co backgroundTexMatrix.setIDiv(background->width(), background->height()); foregroundTexMatrix.setIDiv(foreground->width(), foreground->height()); GrPaint paint; - paint.colorSampler(0)->setCustomStage( + paint.colorSampler(0)->setEffect( SkNEW_ARGS(GrSingleTextureEffect, (background.get())), backgroundTexMatrix)->unref(); - paint.colorSampler(1)->setCustomStage( + paint.colorSampler(1)->setEffect( SkNEW_ARGS(GrBlendEffect, (fMode, foreground.get())), foregroundTexMatrix)->unref(); context->drawRect(paint, rect); return dst; diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 8e98415224..ab962fb2b7 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -1046,7 +1046,7 @@ GrEffect* GrDiffuseLightingEffect::TestCreate(SkRandom* random, SkScalar surfaceScale = random->nextSScalar1(); SkScalar kd = random->nextUScalar1(); SkAutoTUnref<SkLight> light(create_random_light(random)); - return SkNEW_ARGS(GrDiffuseLightingEffect, (textures[GrCustomStageUnitTest::kAlphaTextureIdx], + return SkNEW_ARGS(GrDiffuseLightingEffect, (textures[GrEffectUnitTest::kAlphaTextureIdx], light, surfaceScale, kd)); } @@ -1253,7 +1253,7 @@ GrEffect* GrSpecularLightingEffect::TestCreate(SkRandom* random, SkScalar ks = random->nextUScalar1(); SkScalar shininess = random->nextUScalar1(); SkAutoTUnref<SkLight> light(create_random_light(random)); - return SkNEW_ARGS(GrSpecularLightingEffect, (textures[GrCustomStageUnitTest::kAlphaTextureIdx], + return SkNEW_ARGS(GrSpecularLightingEffect, (textures[GrEffectUnitTest::kAlphaTextureIdx], light, surfaceScale, ks, shininess)); } diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp index 3d26189029..2f6d71ca88 100644 --- a/src/effects/SkMatrixConvolutionImageFilter.cpp +++ b/src/effects/SkMatrixConvolutionImageFilter.cpp @@ -495,8 +495,8 @@ GR_DEFINE_CUSTOM_STAGE_TEST(GrMatrixConvolutionEffect); GrEffect* GrMatrixConvolutionEffect::TestCreate(SkRandom* random, GrContext* context, GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx : - GrCustomStageUnitTest::kAlphaTextureIdx; + int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : + GrEffectUnitTest::kAlphaTextureIdx; int width = random->nextRangeU(1, MAX_KERNEL_SIZE); int height = random->nextRangeU(1, MAX_KERNEL_SIZE / width); SkISize kernelSize = SkISize::Make(width, height); diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index dcd38b7b2f..fb82f4f4cf 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -403,8 +403,8 @@ GR_DEFINE_CUSTOM_STAGE_TEST(GrMorphologyEffect); GrEffect* GrMorphologyEffect::TestCreate(SkRandom* random, GrContext* context, GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx : - GrCustomStageUnitTest::kAlphaTextureIdx; + int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : + GrEffectUnitTest::kAlphaTextureIdx; Direction dir = random->nextBool() ? kX_Direction : kY_Direction; static const int kMaxRadius = 10; int radius = random->nextRangeU(1, kMaxRadius); @@ -425,7 +425,7 @@ void apply_morphology_pass(GrContext* context, GrMatrix sampleM; sampleM.setIDiv(texture->width(), texture->height()); GrPaint paint; - paint.colorSampler(0)->setCustomStage(SkNEW_ARGS(GrMorphologyEffect, (texture, direction, radius, morphType)), sampleM)->unref(); + paint.colorSampler(0)->setEffect(SkNEW_ARGS(GrMorphologyEffect, (texture, direction, radius, morphType)), sampleM)->unref(); context->drawRect(paint, rect); } diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index 71d56e28e7..cbbf7e1fc7 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -347,7 +347,7 @@ GR_DEFINE_CUSTOM_STAGE_TEST(ColorTableEffect); GrEffect* ColorTableEffect::TestCreate(SkRandom* random, GrContext* context, GrTexture* textures[]) { - return SkNEW_ARGS(ColorTableEffect, (textures[GrCustomStageUnitTest::kAlphaTextureIdx])); + return SkNEW_ARGS(ColorTableEffect, (textures[GrEffectUnitTest::kAlphaTextureIdx])); } GrEffect* SkTable_ColorFilter::asNewCustomStage(GrContext* context) const { diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp index 5b351d33d0..21b415d58b 100644 --- a/src/effects/gradients/SkLinearGradient.cpp +++ b/src/effects/gradients/SkLinearGradient.cpp @@ -540,10 +540,10 @@ GrEffect* GrLinearGradient::TestCreate(SkRandom* random, tm)); GrSamplerState sampler; shader->asNewCustomStage(context, &sampler); - GrAssert(NULL != sampler.getCustomStage()); + GrAssert(NULL != sampler.getEffect()); // const_cast and ref is a hack! Will remove when asNewCustomStage returns GrEffect* - sampler.getCustomStage()->ref(); - return const_cast<GrEffect*>(sampler.getCustomStage()); + sampler.getEffect()->ref(); + return const_cast<GrEffect*>(sampler.getEffect()); } ///////////////////////////////////////////////////////////////////// @@ -570,9 +570,9 @@ bool SkLinearGradient::asNewCustomStage(GrContext* context, GrSamplerState* samp return false; } matrix.postConcat(fPtsToUnit); - sampler->setCustomStage(stage, matrix); + sampler->setEffect(stage, matrix); } else { - sampler->setCustomStage(stage, fPtsToUnit); + sampler->setEffect(stage, fPtsToUnit); } return true; diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp index ca8325d91b..74d16d56cc 100644 --- a/src/effects/gradients/SkRadialGradient.cpp +++ b/src/effects/gradients/SkRadialGradient.cpp @@ -539,10 +539,10 @@ GrEffect* GrRadialGradient::TestCreate(SkRandom* random, tm)); GrSamplerState sampler; shader->asNewCustomStage(context, &sampler); - GrAssert(NULL != sampler.getCustomStage()); + GrAssert(NULL != sampler.getEffect()); // const_cast and ref is a hack! Will remove when asNewCustomStage returns GrEffect* - sampler.getCustomStage()->ref(); - return const_cast<GrEffect*>(sampler.getCustomStage()); + sampler.getEffect()->ref(); + return const_cast<GrEffect*>(sampler.getEffect()); } ///////////////////////////////////////////////////////////////////// @@ -568,9 +568,9 @@ bool SkRadialGradient::asNewCustomStage(GrContext* context, GrSamplerState* samp return false; } matrix.postConcat(fPtsToUnit); - sampler->setCustomStage(stage, matrix); + sampler->setEffect(stage, matrix); } else { - sampler->setCustomStage(stage, fPtsToUnit); + sampler->setEffect(stage, fPtsToUnit); } return true; diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp index 416babc622..365507b98f 100644 --- a/src/effects/gradients/SkSweepGradient.cpp +++ b/src/effects/gradients/SkSweepGradient.cpp @@ -445,10 +445,10 @@ GrEffect* GrSweepGradient::TestCreate(SkRandom* random, colors, stops, colorCount)); GrSamplerState sampler; shader->asNewCustomStage(context, &sampler); - GrAssert(NULL != sampler.getCustomStage()); + GrAssert(NULL != sampler.getEffect()); // const_cast and ref is a hack! Will remove when asNewCustomStage returns GrEffect* - sampler.getCustomStage()->ref(); - return const_cast<GrEffect*>(sampler.getCustomStage()); + sampler.getEffect()->ref(); + return const_cast<GrEffect*>(sampler.getEffect()); } ///////////////////////////////////////////////////////////////////// @@ -475,9 +475,9 @@ bool SkSweepGradient::asNewCustomStage(GrContext* context, GrSamplerState* sampl return false; } matrix.postConcat(fPtsToUnit); - sampler->setCustomStage(stage, matrix); + sampler->setEffect(stage, matrix); } else { - sampler->setCustomStage(stage, fPtsToUnit); + sampler->setEffect(stage, fPtsToUnit); } return true; diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp index 1b0f58f7b0..4472d03d9f 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp @@ -439,10 +439,10 @@ GrEffect* GrConical2Gradient::TestCreate(SkRandom* random, tm)); GrSamplerState sampler; shader->asNewCustomStage(context, &sampler); - GrAssert(NULL != sampler.getCustomStage()); + GrAssert(NULL != sampler.getEffect()); // const_cast and ref is a hack! Will remove when asNewCustomStage returns GrEffect* - sampler.getCustomStage()->ref(); - return const_cast<GrEffect*>(sampler.getCustomStage()); + sampler.getEffect()->ref(); + return const_cast<GrEffect*>(sampler.getEffect()); } @@ -693,7 +693,7 @@ bool SkTwoPointConicalGradient::asNewCustomStage(GrContext* context, matrix.preConcat(localM); } - sampler->setCustomStage(SkNEW_ARGS(GrConical2Gradient, (context, *this, fTileMode)), matrix)->unref(); + sampler->setEffect(SkNEW_ARGS(GrConical2Gradient, (context, *this, fTileMode)), matrix)->unref(); return true; } diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp index 50938f6fe7..78220f8d2a 100644 --- a/src/effects/gradients/SkTwoPointRadialGradient.cpp +++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp @@ -473,10 +473,10 @@ GrEffect* GrRadial2Gradient::TestCreate(SkRandom* random, tm)); GrSamplerState sampler; shader->asNewCustomStage(context, &sampler); - GrAssert(NULL != sampler.getCustomStage()); + GrAssert(NULL != sampler.getEffect()); // const_cast and ref is a hack! Will remove when asNewCustomStage returns GrEffect* - sampler.getCustomStage()->ref(); - return const_cast<GrEffect*>(sampler.getCustomStage()); + sampler.getEffect()->ref(); + return const_cast<GrEffect*>(sampler.getEffect()); } ///////////////////////////////////////////////////////////////////// @@ -665,7 +665,7 @@ bool SkTwoPointRadialGradient::asNewCustomStage(GrContext* context, matrix.preConcat(localM); } - sampler->setCustomStage(SkNEW_ARGS(GrRadial2Gradient, (context, *this, fTileMode)), matrix)->unref(); + sampler->setEffect(SkNEW_ARGS(GrRadial2Gradient, (context, *this, fTileMode)), matrix)->unref(); return true; } diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 93b8b31351..e6d5b4c576 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -205,7 +205,7 @@ void convolve_gaussian(GrDrawTarget* target, SkAutoTUnref<GrConvolutionEffect> conv(SkNEW_ARGS(GrConvolutionEffect, (texture, direction, radius, sigma))); - drawState->sampler(0)->setCustomStage(conv, sampleM); + drawState->sampler(0)->setEffect(conv, sampleM); target->drawSimpleRect(rect, NULL); } @@ -1345,7 +1345,7 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target, matrix.setTranslate(SK_Scalar1 *left, SK_Scalar1 *top); } matrix.postIDiv(src->width(), src->height()); - drawState->sampler(0)->setCustomStage(stage, matrix); + drawState->sampler(0)->setEffect(stage, matrix); GrRect rect = GrRect::MakeWH(GrIntToScalar(width), GrIntToScalar(height)); fGpu->drawSimpleRect(rect, NULL); // we want to read back from the scratch's origin @@ -1553,7 +1553,7 @@ void GrContext::writeRenderTargetPixels(GrRenderTarget* target, drawState->setRenderTarget(target); matrix.setIDiv(texture->width(), texture->height()); - drawState->sampler(0)->setCustomStage(stage, matrix); + drawState->sampler(0)->setEffect(stage, matrix); fGpu->drawSimpleRect(GrRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)), NULL); } @@ -1817,8 +1817,8 @@ GrTexture* GrContext::gaussianBlur(GrTexture* srcTexture, scale_rect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f, i < scaleFactorY ? 0.5f : 1.0f); - paint.colorSampler(0)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, - (srcTexture, true)), matrix)->unref(); + paint.colorSampler(0)->setEffect(SkNEW_ARGS(GrSingleTextureEffect, + (srcTexture, true)), matrix)->unref(); this->drawRectToRect(paint, dstRect, srcRect); srcRect = dstRect; srcTexture = dstTexture; @@ -1875,9 +1875,8 @@ GrTexture* GrContext::gaussianBlur(GrTexture* srcTexture, // FIXME: This should be mitchell, not bilinear. matrix.setIDiv(srcTexture->width(), srcTexture->height()); this->setRenderTarget(dstTexture->asRenderTarget()); - paint.colorSampler(0)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, - (srcTexture, true)), - matrix)->unref(); + paint.colorSampler(0)->setEffect(SkNEW_ARGS(GrSingleTextureEffect,(srcTexture, true)), + matrix)->unref(); SkRect dstRect(srcRect); scale_rect(&dstRect, (float) scaleFactorX, (float) scaleFactorY); this->drawRectToRect(paint, dstRect, srcRect); diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h index 6951d46e1d..f8db4a5d14 100644 --- a/src/gpu/GrDrawState.h +++ b/src/gpu/GrDrawState.h @@ -69,8 +69,7 @@ public: /** * Resets to the default state. - * Sampler states *will* be modified: textures or CustomStage objects - * will be released. + * Sampler states *will* be modified: textures or GrEffect objects will be released. */ void reset() { @@ -190,27 +189,27 @@ public: * Creates a GrSingleTextureEffect. */ void createTextureEffect(int stage, GrTexture* texture) { - GrAssert(!this->getSampler(stage).getCustomStage()); - this->sampler(stage)->setCustomStage( + GrAssert(!this->getSampler(stage).getEffect()); + this->sampler(stage)->setEffect( SkNEW_ARGS(GrSingleTextureEffect, (texture)))->unref(); } void createTextureEffect(int stage, GrTexture* texture, const GrMatrix& matrix) { - GrAssert(!this->getSampler(stage).getCustomStage()); + GrAssert(!this->getSampler(stage).getEffect()); GrEffect* customStage = SkNEW_ARGS(GrSingleTextureEffect, (texture)); - this->sampler(stage)->setCustomStage(customStage, matrix)->unref(); + this->sampler(stage)->setEffect(customStage, matrix)->unref(); } void createTextureEffect(int stage, GrTexture* texture, const GrMatrix& matrix, const GrTextureParams& params) { - GrAssert(!this->getSampler(stage).getCustomStage()); + GrAssert(!this->getSampler(stage).getEffect()); GrEffect* customStage = SkNEW_ARGS(GrSingleTextureEffect, (texture, params)); - this->sampler(stage)->setCustomStage(customStage, matrix)->unref(); + this->sampler(stage)->setEffect(customStage, matrix)->unref(); } bool stagesDisabled() { for (int i = 0; i < kNumStages; ++i) { - if (NULL != fSamplerStates[i].getCustomStage()) { + if (NULL != fSamplerStates[i].getEffect()) { return false; } } @@ -218,7 +217,7 @@ public: } void disableStage(int index) { - fSamplerStates[index].setCustomStage(NULL); + fSamplerStates[index].setEffect(NULL); } /** @@ -825,7 +824,7 @@ public: bool isStageEnabled(int s) const { GrAssert((unsigned)s < kNumStages); - return (NULL != fSamplerStates[s].getCustomStage()); + return (NULL != fSamplerStates[s].getEffect()); } // Most stages are usually not used, so conditionals here diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index 56dc8d812a..d365a8911a 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -748,7 +748,7 @@ bool GrDrawTarget::checkDraw(GrPrimitiveType type, int startVertex, GrAssert(NULL != drawState.getRenderTarget()); for (int s = 0; s < GrDrawState::kNumStages; ++s) { if (drawState.isStageEnabled(s)) { - const GrEffect* stage = drawState.getSampler(s).getCustomStage(); + const GrEffect* stage = drawState.getSampler(s).getEffect(); int numTextures = stage->numTextures(); for (int t = 0; t < numTextures; ++t) { GrTexture* texture = stage->texture(t); @@ -831,7 +831,7 @@ bool GrDrawTarget::srcAlphaWillBeOne(GrVertexLayout layout) const { // Check if a color stage could create a partial alpha for (int s = 0; s < drawState.getFirstCoverageStage(); ++s) { if (this->isStageEnabled(s)) { - const GrEffect* stage = drawState.getSampler(s).getCustomStage(); + const GrEffect* stage = drawState.getSampler(s).getEffect(); // FIXME: The param indicates whether the texture is opaque or not. However, the stage // already controls its textures. It really needs to know whether the incoming color // (from a uni, per-vertex colors, or previous stage) is opaque or not. diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 74a288888c..b87089ce02 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -441,7 +441,7 @@ SkGpuRenderTarget* SkGpuDevice::accessRenderTarget() { bool SkGpuDevice::bindDeviceAsTexture(GrPaint* paint) { GrTexture* texture = fRenderTarget->asTexture(); if (NULL != texture) { - paint->colorSampler(kBitmapTextureIdx)->setCustomStage( + paint->colorSampler(kBitmapTextureIdx)->setEffect( SkNEW_ARGS(GrSingleTextureEffect, (texture)))->unref(); return true; } @@ -514,7 +514,7 @@ inline bool skPaint2GrPaintNoShader(SkGpuDevice* dev, } else { SkAutoTUnref<GrEffect> stage(colorFilter->asNewCustomStage(dev->context())); if (NULL != stage.get()) { - grPaint->colorSampler(kColorFilterTextureIdx)->setCustomStage(stage); + grPaint->colorSampler(kColorFilterTextureIdx)->setEffect(stage); } else { // TODO: rewrite this using asNewCustomStage() SkColor color; @@ -607,7 +607,7 @@ inline bool skPaint2GrPaintShader(SkGpuDevice* dev, GrScalar sy = SkFloatToScalar(1.f / bitmap.height()); matrix.postScale(sx, sy); } - sampler->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, (texture, params)), matrix)->unref(); + sampler->setEffect(SkNEW_ARGS(GrSingleTextureEffect, (texture, params)), matrix)->unref(); return true; } @@ -874,7 +874,7 @@ bool drawWithGPUMaskFilter(GrContext* context, const SkPath& devPath, matrix.setIDiv(pathTexture->width(), pathTexture->height()); // Blend pathTexture over blurTexture. context->setRenderTarget(blurTexture->asRenderTarget()); - paint.colorSampler(0)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, (pathTexture)), matrix)->unref(); + paint.colorSampler(0)->setEffect(SkNEW_ARGS(GrSingleTextureEffect, (pathTexture)), matrix)->unref(); if (SkMaskFilter::kInner_BlurType == blurType) { // inner: dst = dst * src paint.setBlendFunc(kDC_GrBlendCoeff, kZero_GrBlendCoeff); @@ -905,7 +905,7 @@ bool drawWithGPUMaskFilter(GrContext* context, const SkPath& devPath, matrix.postIDiv(blurTexture->width(), blurTexture->height()); grp->coverageSampler(MASK_IDX)->reset(); - grp->coverageSampler(MASK_IDX)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, (blurTexture)), matrix)->unref(); + grp->coverageSampler(MASK_IDX)->setEffect(SkNEW_ARGS(GrSingleTextureEffect, (blurTexture)), matrix)->unref(); context->drawRect(*grp, finalRect); return true; } @@ -961,7 +961,7 @@ bool drawWithMaskFilter(GrContext* context, const SkPath& devPath, m.setTranslate(-dstM.fBounds.fLeft*SK_Scalar1, -dstM.fBounds.fTop*SK_Scalar1); m.postIDiv(texture->width(), texture->height()); - grp->coverageSampler(MASK_IDX)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, (texture)), m)->unref(); + grp->coverageSampler(MASK_IDX)->setEffect(SkNEW_ARGS(GrSingleTextureEffect, (texture)), m)->unref(); GrRect d; d.setLTRB(GrIntToScalar(dstM.fBounds.fLeft), GrIntToScalar(dstM.fBounds.fTop), @@ -1438,7 +1438,7 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap, } else { stage.reset(SkNEW_ARGS(GrSingleTextureEffect, (texture, params))); } - grPaint->colorSampler(kBitmapTextureIdx)->setCustomStage(stage); + grPaint->colorSampler(kBitmapTextureIdx)->setEffect(stage); fContext->drawRectToRect(*grPaint, dstRect, paintRect, &m); } @@ -1458,7 +1458,7 @@ void apply_custom_stage(GrContext* context, GrMatrix sampleM; sampleM.setIDiv(srcTexture->width(), srcTexture->height()); GrPaint paint; - paint.colorSampler(0)->setCustomStage(stage, sampleM); + paint.colorSampler(0)->setEffect(stage, sampleM); context->drawRect(paint, rect); } @@ -1516,7 +1516,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap, sampler->reset(); // draw sprite uses the default texture params SkAutoCachedTexture act(this, bitmap, NULL, &texture); - grPaint.colorSampler(kBitmapTextureIdx)->setCustomStage(SkNEW_ARGS + grPaint.colorSampler(kBitmapTextureIdx)->setEffect(SkNEW_ARGS (GrSingleTextureEffect, (texture)))->unref(); SkImageFilter* filter = paint.getImageFilter(); @@ -1524,7 +1524,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap, GrTexture* filteredTexture = filter_texture(this, fContext, texture, filter, GrRect::MakeWH(SkIntToScalar(w), SkIntToScalar(h))); if (filteredTexture) { - grPaint.colorSampler(kBitmapTextureIdx)->setCustomStage(SkNEW_ARGS + grPaint.colorSampler(kBitmapTextureIdx)->setEffect(SkNEW_ARGS (GrSingleTextureEffect, (filteredTexture)))->unref(); texture = filteredTexture; filteredTexture->unref(); @@ -1590,7 +1590,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* device, return; } - GrTexture* devTex = grPaint.getColorSampler(kBitmapTextureIdx).getCustomStage()->texture(0); + GrTexture* devTex = grPaint.getColorSampler(kBitmapTextureIdx).getEffect()->texture(0); SkASSERT(NULL != devTex); SkImageFilter* filter = paint.getImageFilter(); @@ -1599,7 +1599,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* device, SkIntToScalar(devTex->height())); GrTexture* filteredTexture = filter_texture(this, fContext, devTex, filter, rect); if (filteredTexture) { - grPaint.colorSampler(kBitmapTextureIdx)->setCustomStage(SkNEW_ARGS + grPaint.colorSampler(kBitmapTextureIdx)->setEffect(SkNEW_ARGS (GrSingleTextureEffect, (filteredTexture)))->unref(); devTex = filteredTexture; filteredTexture->unref(); diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 9689c0faa4..1502905de1 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -109,7 +109,7 @@ GrEffect* GrConfigConversionEffect::TestCreate(SkRandom* random, swapRB = random->nextBool(); } return SkNEW_ARGS(GrConfigConversionEffect, - (textures[GrCustomStageUnitTest::kSkiaPMTextureIdx], swapRB, pmConv)); + (textures[GrEffectUnitTest::kSkiaPMTextureIdx], swapRB, pmConv)); } /////////////////////////////////////////////////////////////////////////////// @@ -185,16 +185,16 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context (tempTex, false, *pmToUPMRule))); context->setRenderTarget(readTex->asRenderTarget()); - paint.colorSampler(0)->setCustomStage(pmToUPMStage1); + paint.colorSampler(0)->setEffect(pmToUPMStage1); context->drawRectToRect(paint, kDstRect, kSrcRect); readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead); context->setRenderTarget(tempTex->asRenderTarget()); - paint.colorSampler(0)->setCustomStage(upmToPMStage); + paint.colorSampler(0)->setEffect(upmToPMStage); context->drawRectToRect(paint, kDstRect, kSrcRect); context->setRenderTarget(readTex->asRenderTarget()); - paint.colorSampler(0)->setCustomStage(pmToUPMStage2); + paint.colorSampler(0)->setEffect(pmToUPMStage2); context->drawRectToRect(paint, kDstRect, kSrcRect); readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, secondRead); diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index 930a0e3a3f..392475f150 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -177,8 +177,8 @@ GR_DEFINE_CUSTOM_STAGE_TEST(GrConvolutionEffect); GrEffect* GrConvolutionEffect::TestCreate(SkRandom* random, GrContext* context, GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx : - GrCustomStageUnitTest::kAlphaTextureIdx; + int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : + GrEffectUnitTest::kAlphaTextureIdx; Direction dir = random->nextBool() ? kX_Direction : kY_Direction; int radius = random->nextRangeU(1, kMaxKernelRadius); float kernel[kMaxKernelRadius]; diff --git a/src/gpu/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp index 52a7448ecb..2f8801c75a 100644 --- a/src/gpu/effects/GrSingleTextureEffect.cpp +++ b/src/gpu/effects/GrSingleTextureEffect.cpp @@ -71,7 +71,7 @@ GR_DEFINE_CUSTOM_STAGE_TEST(GrSingleTextureEffect); GrEffect* GrSingleTextureEffect::TestCreate(SkRandom* random, GrContext* context, GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx : - GrCustomStageUnitTest::kAlphaTextureIdx; + int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : + GrEffectUnitTest::kAlphaTextureIdx; return SkNEW_ARGS(GrSingleTextureEffect, (textures[texIdx])); } diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp index 289b6210b4..1319814d6d 100644 --- a/src/gpu/effects/GrTextureDomainEffect.cpp +++ b/src/gpu/effects/GrTextureDomainEffect.cpp @@ -117,8 +117,8 @@ GR_DEFINE_CUSTOM_STAGE_TEST(GrTextureDomainEffect); GrEffect* GrTextureDomainEffect::TestCreate(SkRandom* random, GrContext* context, GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx : - GrCustomStageUnitTest::kAlphaTextureIdx; + int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : + GrEffectUnitTest::kAlphaTextureIdx; GrRect domain; domain.fLeft = random->nextUScalar1(); domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1); diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index 847b6efe47..08e58e8cd5 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -977,8 +977,8 @@ void GrGLProgram::setData(const GrDrawState& drawState) { for (int s = 0; s < GrDrawState::kNumStages; ++s) { if (NULL != fProgramStage[s]) { const GrSamplerState& sampler = drawState.getSampler(s); - GrAssert(NULL != sampler.getCustomStage()); - fProgramStage[s]->setData(fUniformManager, *sampler.getCustomStage()); + GrAssert(NULL != sampler.getEffect()); + fProgramStage[s]->setData(fUniformManager, *sampler.getEffect()); } } } diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index a810d67ccc..858e93891a 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -2019,7 +2019,7 @@ inline GrGLenum tile_to_gl_wrap(SkShader::TileMode tm) { void GrGpuGL::flushBoundTextureAndParams(int stage) { GrDrawState* drawState = this->drawState(); // FIXME: Assuming at most one texture per custom stage - const GrEffect* customStage = drawState->sampler(stage)->getCustomStage(); + const GrEffect* customStage = drawState->sampler(stage)->getEffect(); if (customStage->numTextures() > 0) { GrGLTexture* nextTexture = static_cast<GrGLTexture*>(customStage->texture(0)); if (NULL != nextTexture) { diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp index 6608c66bec..b0656b2512 100644 --- a/src/gpu/gl/GrGpuGL_program.cpp +++ b/src/gpu/gl/GrGpuGL_program.cpp @@ -199,7 +199,7 @@ void GrGpuGL::flushTextureMatrix(int s) { const GrDrawState& drawState = this->getDrawState(); // FIXME: Still assuming only a single texture per custom stage - const GrEffect* stage = drawState.getSampler(s).getCustomStage(); + const GrEffect* stage = drawState.getSampler(s).getEffect(); if (0 == stage->numTextures()) { return; } @@ -570,7 +570,7 @@ void setup_custom_stage(GrGLProgram::Desc::StageDesc* stage, const GrGLCaps& caps, const GrEffect** customStages, GrGLProgram* program, int index) { - const GrEffect* customStage = sampler.getCustomStage(); + const GrEffect* customStage = sampler.getEffect(); if (customStage) { const GrProgramStageFactory& factory = customStage->getFactory(); stage->fCustomStageKey = factory.glStageKey(*customStage, caps); @@ -675,7 +675,7 @@ void GrGpuGL::buildProgram(bool isPoints, lastEnabledStage = s; const GrSamplerState& sampler = drawState.getSampler(s); // FIXME: Still assuming one texture per custom stage - const GrEffect* customStage = drawState.getSampler(s).getCustomStage(); + const GrEffect* customStage = drawState.getSampler(s).getEffect(); if (customStage->numTextures() > 0) { const GrGLTexture* texture = |