| Index: src/gpu/effects/GrConfigConversionEffect.cpp
|
| diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
|
| index 8b072f627b6fe594830f2c9057e0c600eac51678..4927e29f8a4480514ccc2c050bc5b95845088660 100644
|
| --- a/src/gpu/effects/GrConfigConversionEffect.cpp
|
| +++ b/src/gpu/effects/GrConfigConversionEffect.cpp
|
| @@ -100,11 +100,12 @@ private:
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| -GrConfigConversionEffect::GrConfigConversionEffect(GrTexture* texture,
|
| +GrConfigConversionEffect::GrConfigConversionEffect(GrProcessorDataManager* procDataManager,
|
| + GrTexture* texture,
|
| bool swapRedAndBlue,
|
| PMConversion pmConversion,
|
| const SkMatrix& matrix)
|
| - : GrSingleTextureEffect(texture, matrix)
|
| + : INHERITED(procDataManager, texture, matrix)
|
| , fSwapRedAndBlue(swapRedAndBlue)
|
| , fPMConversion(pmConversion) {
|
| this->initClassID<GrConfigConversionEffect>();
|
| @@ -137,7 +138,8 @@ GrFragmentProcessor* GrConfigConversionEffect::TestCreate(GrProcessorTestData* d
|
| swapRB = d->fRandom->nextBool();
|
| }
|
| return SkNEW_ARGS(GrConfigConversionEffect,
|
| - (d->fTextures[GrProcessorUnitTest::kSkiaPMTextureIdx],
|
| + (d->fProcDataManager,
|
| + d->fTextures[GrProcessorUnitTest::kSkiaPMTextureIdx],
|
| swapRB,
|
| pmConv,
|
| GrTest::TestMatrix(d->fRandom)));
|
| @@ -220,17 +222,22 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
|
| // from readTex to tempTex followed by a PM->UPM draw to readTex and finally read the data.
|
| // We then verify that two reads produced the same values.
|
|
|
| + GrPaint paint1;
|
| + GrPaint paint2;
|
| + GrPaint paint3;
|
| SkAutoTUnref<GrFragmentProcessor> pmToUPM1(
|
| SkNEW_ARGS(GrConfigConversionEffect,
|
| - (dataTex, false, *pmToUPMRule, SkMatrix::I())));
|
| + (paint1.getProcessorDataManager(), dataTex, false, *pmToUPMRule,
|
| + SkMatrix::I())));
|
| SkAutoTUnref<GrFragmentProcessor> upmToPM(
|
| SkNEW_ARGS(GrConfigConversionEffect,
|
| - (readTex, false, *upmToPMRule, SkMatrix::I())));
|
| + (paint2.getProcessorDataManager(), readTex, false, *upmToPMRule,
|
| + SkMatrix::I())));
|
| SkAutoTUnref<GrFragmentProcessor> pmToUPM2(
|
| SkNEW_ARGS(GrConfigConversionEffect,
|
| - (tempTex, false, *pmToUPMRule, SkMatrix::I())));
|
| + (paint3.getProcessorDataManager(), tempTex, false, *pmToUPMRule,
|
| + SkMatrix::I())));
|
|
|
| - GrPaint paint1;
|
| paint1.addColorProcessor(pmToUPM1);
|
| drawContext->drawNonAARectToRect(readTex->asRenderTarget(),
|
| GrClip::WideOpen(),
|
| @@ -241,7 +248,6 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
|
|
|
| readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead);
|
|
|
| - GrPaint paint2;
|
| paint2.addColorProcessor(upmToPM);
|
| drawContext->drawNonAARectToRect(tempTex->asRenderTarget(),
|
| GrClip::WideOpen(),
|
| @@ -250,7 +256,6 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
|
| kDstRect,
|
| kSrcRect);
|
|
|
| - GrPaint paint3;
|
| paint3.addColorProcessor(pmToUPM2);
|
| drawContext->drawNonAARectToRect(readTex->asRenderTarget(),
|
| GrClip::WideOpen(),
|
| @@ -277,15 +282,16 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
|
| }
|
| }
|
|
|
| -const GrFragmentProcessor* GrConfigConversionEffect::Create(GrTexture* texture,
|
| - bool swapRedAndBlue,
|
| - PMConversion pmConversion,
|
| - const SkMatrix& matrix) {
|
| +const GrFragmentProcessor* GrConfigConversionEffect::Create(GrProcessorDataManager* procDataManager,
|
| + GrTexture* texture,
|
| + bool swapRedAndBlue,
|
| + PMConversion pmConversion,
|
| + const SkMatrix& matrix) {
|
| if (!swapRedAndBlue && kNone_PMConversion == pmConversion) {
|
| // If we returned a GrConfigConversionEffect that was equivalent to a GrSimpleTextureEffect
|
| // then we may pollute our texture cache with redundant shaders. So in the case that no
|
| // conversions were requested we instead return a GrSimpleTextureEffect.
|
| - return GrSimpleTextureEffect::Create(texture, matrix);
|
| + return GrSimpleTextureEffect::Create(procDataManager, texture, matrix);
|
| } else {
|
| if (kRGBA_8888_GrPixelConfig != texture->config() &&
|
| kBGRA_8888_GrPixelConfig != texture->config() &&
|
| @@ -293,7 +299,8 @@ const GrFragmentProcessor* GrConfigConversionEffect::Create(GrTexture* texture,
|
| // The PM conversions assume colors are 0..255
|
| return NULL;
|
| }
|
| - return SkNEW_ARGS(GrConfigConversionEffect, (texture,
|
| + return SkNEW_ARGS(GrConfigConversionEffect, (procDataManager,
|
| + texture,
|
| swapRedAndBlue,
|
| pmConversion,
|
| matrix));
|
|
|