diff options
author | 2012-10-05 14:54:42 +0000 | |
---|---|---|
committer | 2012-10-05 14:54:42 +0000 | |
commit | 88becf450f015007d785f2b5aa7fe4690e295868 (patch) | |
tree | 2d3442dea04ff54d42cd402be58a3dd0cb3c5434 | |
parent | 6f1dbff980d6d9717d9207585bab83be7f2ff73d (diff) |
Rename GrPaint fields/enums/members texture->color mask->coverage.
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6615046
git-svn-id: http://skia.googlecode.com/svn/trunk@5827 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | gm/texdata.cpp | 4 | ||||
-rw-r--r-- | include/gpu/GrPaint.h | 99 | ||||
-rw-r--r-- | src/effects/SkBlendImageFilter.cpp | 8 | ||||
-rw-r--r-- | src/effects/SkMorphologyImageFilter.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrContext.cpp | 14 | ||||
-rw-r--r-- | src/gpu/GrDrawState.cpp | 18 | ||||
-rw-r--r-- | src/gpu/GrTextContext.cpp | 14 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 70 | ||||
-rw-r--r-- | src/gpu/effects/GrConfigConversionEffect.cpp | 6 |
9 files changed, 118 insertions, 119 deletions
diff --git a/gm/texdata.cpp b/gm/texdata.cpp index cf1a701cef..a87be453ea 100644 --- a/gm/texdata.cpp +++ b/gm/texdata.cpp @@ -115,10 +115,10 @@ protected: ctx->setMatrix(vm); GrMatrix tm; tm = vm; - GrMatrix* sampleMat = paint.textureSampler(0)->matrix(); + GrMatrix* sampleMat = paint.colorSampler(0)->matrix(); *sampleMat = vm; sampleMat->postIDiv(2*S, 2*S); - paint.textureSampler(0)->setCustomStage( + paint.colorSampler(0)->setCustomStage( SkNEW_ARGS(GrSingleTextureEffect, (texture)))->unref(); diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h index f9573bba93..9b07a4be16 100644 --- a/include/gpu/GrPaint.h +++ b/include/gpu/GrPaint.h @@ -24,8 +24,8 @@ class GrPaint { public: enum { - kMaxTextures = 2, - kMaxMasks = 1, + kMaxColorStages = 2, + kMaxCoverageStages = 1, }; // All the paint fields are public except textures/samplers @@ -42,58 +42,57 @@ public: SkXfermode::Mode fColorFilterXfermode; float fColorMatrix[20]; - GrSamplerState* textureSampler(int i) { - GrAssert((unsigned)i < kMaxTextures); - return fTextureSamplers + i; + GrSamplerState* colorSampler(int i) { + GrAssert((unsigned)i < kMaxColorStages); + return fColorSamplers + i; } - const GrSamplerState& getTextureSampler(int i) const { - GrAssert((unsigned)i < kMaxTextures); - return fTextureSamplers[i]; + const GrSamplerState& getColorSampler(int i) const { + GrAssert((unsigned)i < kMaxColorStages); + return fColorSamplers[i]; } - bool isTextureStageEnabled(int i) const { - GrAssert((unsigned)i < kMaxTextures); - return (NULL != fTextureSamplers[i].getCustomStage()); + bool isColorStageEnabled(int i) const { + GrAssert((unsigned)i < kMaxColorStages); + return (NULL != fColorSamplers[i].getCustomStage()); } - - // mask's sampler matrix is always applied to the positions + // The coverage stage's sampler matrix is always applied to the positions // (i.e. no explicit texture coordinates) - GrSamplerState* maskSampler(int i) { - GrAssert((unsigned)i < kMaxMasks); - return fMaskSamplers + i; + GrSamplerState* coverageSampler(int i) { + GrAssert((unsigned)i < kMaxCoverageStages); + return fCoverageSamplers + i; } - const GrSamplerState& getMaskSampler(int i) const { - GrAssert((unsigned)i < kMaxMasks); - return fMaskSamplers[i]; + const GrSamplerState& getCoverageSampler(int i) const { + GrAssert((unsigned)i < kMaxCoverageStages); + return fCoverageSamplers[i]; } - bool isMaskStageEnabled(int i) const { - GrAssert((unsigned)i < kMaxTextures); - return (NULL != fMaskSamplers[i].getCustomStage()); + bool isCoverageStageEnabled(int i) const { + GrAssert((unsigned)i < kMaxCoverageStages); + return (NULL != fCoverageSamplers[i].getCustomStage()); } - bool hasMask() const { - for (int i = 0; i < kMaxMasks; ++i) { - if (this->isMaskStageEnabled(i)) { + bool hasCoverageStage() const { + for (int i = 0; i < kMaxCoverageStages; ++i) { + if (this->isCoverageStageEnabled(i)) { return true; } } return false; } - bool hasTexture() const { - for (int i = 0; i < kMaxTextures; ++i) { - if (this->isTextureStageEnabled(i)) { + bool hasColorStage() const { + for (int i = 0; i < kMaxColorStages; ++i) { + if (this->isColorStageEnabled(i)) { return true; } } return false; } - bool hasTextureOrMask() const { return this->hasTexture() || this->hasMask(); } + bool hasStage() const { return this->hasColorStage() || this->hasCoverageStage(); } /** * Preconcats the matrix of all samplers in the mask with the inverse of a @@ -103,24 +102,24 @@ public: bool preConcatSamplerMatricesWithInverse(const GrMatrix& matrix) { GrMatrix inv; bool computed = false; - for (int i = 0; i < kMaxTextures; ++i) { - if (this->isTextureStageEnabled(i)) { + for (int i = 0; i < kMaxColorStages; ++i) { + if (this->isColorStageEnabled(i)) { if (!computed && !matrix.invert(&inv)) { return false; } else { computed = true; } - fTextureSamplers[i].preConcatMatrix(inv); + fColorSamplers[i].preConcatMatrix(inv); } } - for (int i = 0; i < kMaxMasks; ++i) { - if (this->isMaskStageEnabled(i)) { + for (int i = 0; i < kMaxCoverageStages; ++i) { + if (this->isCoverageStageEnabled(i)) { if (!computed && !matrix.invert(&inv)) { return false; } else { computed = true; } - fMaskSamplers[i].preConcatMatrix(inv); + fCoverageSamplers[i].preConcatMatrix(inv); } } return true; @@ -152,14 +151,14 @@ public: memcpy(fColorMatrix, paint.fColorMatrix, sizeof(fColorMatrix)); } - for (int i = 0; i < kMaxTextures; ++i) { - if (paint.isTextureStageEnabled(i)) { - fTextureSamplers[i] = paint.fTextureSamplers[i]; + for (int i = 0; i < kMaxColorStages; ++i) { + if (paint.isColorStageEnabled(i)) { + fColorSamplers[i] = paint.fColorSamplers[i]; } } - for (int i = 0; i < kMaxMasks; ++i) { - if (paint.isMaskStageEnabled(i)) { - fMaskSamplers[i] = paint.fMaskSamplers[i]; + for (int i = 0; i < kMaxCoverageStages; ++i) { + if (paint.isCoverageStageEnabled(i)) { + fCoverageSamplers[i] = paint.fCoverageSamplers[i]; } } return *this; @@ -186,15 +185,15 @@ public: // GrPaint's textures and masks map to the first N stages // of GrDrawTarget in that order (textures followed by masks) enum { - kFirstTextureStage = 0, - kFirstMaskStage = kMaxTextures, - kTotalStages = kMaxTextures + kMaxMasks, + kFirstColorStage = 0, + kFirstCoverageStage = kMaxColorStages, + kTotalStages = kFirstColorStage + kMaxColorStages + kMaxCoverageStages, }; private: - GrSamplerState fTextureSamplers[kMaxTextures]; - GrSamplerState fMaskSamplers[kMaxMasks]; + GrSamplerState fColorSamplers[kMaxColorStages]; + GrSamplerState fCoverageSamplers[kMaxCoverageStages]; void resetBlend() { fSrcBlendCoeff = kOne_GrBlendCoeff; @@ -215,14 +214,14 @@ private: } void resetTextures() { - for (int i = 0; i < kMaxTextures; ++i) { - fTextureSamplers[i].reset(); + for (int i = 0; i < kMaxColorStages; ++i) { + fColorSamplers[i].reset(); } } void resetMasks() { - for (int i = 0; i < kMaxMasks; ++i) { - fMaskSamplers[i].reset(); + for (int i = 0; i < kMaxCoverageStages; ++i) { + fCoverageSamplers[i].reset(); } } }; diff --git a/src/effects/SkBlendImageFilter.cpp b/src/effects/SkBlendImageFilter.cpp index b604bc2dfe..f1714003b9 100644 --- a/src/effects/SkBlendImageFilter.cpp +++ b/src/effects/SkBlendImageFilter.cpp @@ -218,10 +218,10 @@ GrTexture* SkBlendImageFilter::onFilterImageGPU(Proxy* proxy, GrTexture* src, co sampleM.setIDiv(background->width(), background->height()); GrPaint paint; paint.reset(); - paint.textureSampler(0)->reset(sampleM); - paint.textureSampler(0)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, (background.get())))->unref(); - paint.textureSampler(1)->reset(sampleM); - paint.textureSampler(1)->setCustomStage(SkNEW_ARGS(GrBlendEffect, (fMode, foreground.get())))->unref(); + paint.colorSampler(0)->reset(sampleM); + paint.colorSampler(0)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, (background.get())))->unref(); + paint.colorSampler(1)->reset(sampleM); + paint.colorSampler(1)->setCustomStage(SkNEW_ARGS(GrBlendEffect, (fMode, foreground.get())))->unref(); context->drawRect(paint, rect); return dst; } diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 1d834178a2..7a4f5a9dbf 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -432,8 +432,8 @@ void apply_morphology_pass(GrContext* context, sampleM.setIDiv(texture->width(), texture->height()); GrPaint paint; paint.reset(); - paint.textureSampler(0)->reset(sampleM); - paint.textureSampler(0)->setCustomStage(SkNEW_ARGS(GrMorphologyEffect, (texture, direction, radius, morphType)))->unref(); + paint.colorSampler(0)->reset(sampleM); + paint.colorSampler(0)->setCustomStage(SkNEW_ARGS(GrMorphologyEffect, (texture, direction, radius, morphType)))->unref(); context->drawRect(paint, rect); } diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index b113ca3e5b..400d6ff717 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -603,7 +603,7 @@ void GrContext::drawPaint(const GrPaint& paint) { } inverse.mapRect(&r); } else { - if (paint.hasTextureOrMask()) { + if (paint.hasStage()) { tmpPaint.set(paint); p = tmpPaint.get(); if (!tmpPaint.get()->preConcatSamplerMatricesWithInverse(fDrawState->getViewMatrix())) { @@ -841,8 +841,8 @@ void GrContext::drawRectToRect(const GrPaint& paint, const GrMatrix* srcMatrix) { SK_TRACE_EVENT0("GrContext::drawRectToRect"); - // srcRect refers to paint's first texture - if (!paint.isTextureStageEnabled(0)) { + // srcRect refers to paint's first color stage + if (!paint.isColorStageEnabled(0)) { drawRect(paint, dstRect, -1, dstMatrix); return; } @@ -1830,13 +1830,13 @@ GrTexture* GrContext::gaussianBlur(GrTexture* srcTexture, paint.reset(); for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) { - paint.textureSampler(0)->matrix()->setIDiv(srcTexture->width(), + paint.colorSampler(0)->matrix()->setIDiv(srcTexture->width(), srcTexture->height()); this->setRenderTarget(dstTexture->asRenderTarget()); SkRect dstRect(srcRect); scale_rect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f, i < scaleFactorY ? 0.5f : 1.0f); - paint.textureSampler(0)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, + paint.colorSampler(0)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, (srcTexture, true)))->unref(); this->drawRectToRect(paint, dstRect, srcRect); srcRect = dstRect; @@ -1891,10 +1891,10 @@ GrTexture* GrContext::gaussianBlur(GrTexture* srcTexture, 1, srcIRect.height()); this->clear(&clearRect, 0x0); // FIXME: This should be mitchell, not bilinear. - paint.textureSampler(0)->matrix()->setIDiv(srcTexture->width(), + paint.colorSampler(0)->matrix()->setIDiv(srcTexture->width(), srcTexture->height()); this->setRenderTarget(dstTexture->asRenderTarget()); - paint.textureSampler(0)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, + paint.colorSampler(0)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect, (srcTexture, true)))->unref(); SkRect dstRect(srcRect); scale_rect(&dstRect, (float) scaleFactorX, (float) scaleFactorY); diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp index 2d2dc1a147..bd6e2685bb 100644 --- a/src/gpu/GrDrawState.cpp +++ b/src/gpu/GrDrawState.cpp @@ -10,19 +10,19 @@ #include "GrPaint.h" void GrDrawState::setFromPaint(const GrPaint& paint) { - for (int i = 0; i < GrPaint::kMaxTextures; ++i) { - int s = i + GrPaint::kFirstTextureStage; - if (paint.isTextureStageEnabled(i)) { - *this->sampler(s) = paint.getTextureSampler(i); + for (int i = 0; i < GrPaint::kMaxColorStages; ++i) { + int s = i + GrPaint::kFirstColorStage; + if (paint.isColorStageEnabled(i)) { + *this->sampler(s) = paint.getColorSampler(i); } } - this->setFirstCoverageStage(GrPaint::kFirstMaskStage); + this->setFirstCoverageStage(GrPaint::kFirstCoverageStage); - for (int i = 0; i < GrPaint::kMaxMasks; ++i) { - int s = i + GrPaint::kFirstMaskStage; - if (paint.isMaskStageEnabled(i)) { - *this->sampler(s) = paint.getMaskSampler(i); + for (int i = 0; i < GrPaint::kMaxCoverageStages; ++i) { + int s = i + GrPaint::kFirstCoverageStage; + if (paint.isCoverageStageEnabled(i)) { + *this->sampler(s) = paint.getCoverageSampler(i); } } diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp index 109fc6bc95..5c8b9e50d3 100644 --- a/src/gpu/GrTextContext.cpp +++ b/src/gpu/GrTextContext.cpp @@ -40,7 +40,7 @@ void GrTextContext::flushGlyphs() { if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) { if (kOne_GrBlendCoeff != fPaint.fSrcBlendCoeff || kISA_GrBlendCoeff != fPaint.fDstBlendCoeff || - fPaint.hasTexture()) { + fPaint.hasColorStage()) { GrPrintf("LCD Text will not draw correctly.\n"); } // setup blend so that we get mask * paintColor + (1-mask)*dstColor @@ -121,19 +121,19 @@ GrTextContext::GrTextContext(GrContext* context, */ bool invVMComputed = false; GrMatrix invVM; - for (int t = 0; t < GrPaint::kMaxTextures; ++t) { - if (fPaint.isTextureStageEnabled(t)) { + for (int t = 0; t < GrPaint::kMaxColorStages; ++t) { + if (fPaint.isColorStageEnabled(t)) { if (invVMComputed || fOrigViewMatrix.invert(&invVM)) { invVMComputed = true; - fPaint.textureSampler(t)->preConcatMatrix(invVM); + fPaint.colorSampler(t)->preConcatMatrix(invVM); } } } - for (int m = 0; m < GrPaint::kMaxMasks; ++m) { - if (fPaint.isMaskStageEnabled(m)) { + for (int m = 0; m < GrPaint::kMaxCoverageStages; ++m) { + if (fPaint.isCoverageStageEnabled(m)) { if (invVMComputed || fOrigViewMatrix.invert(&invVM)) { invVMComputed = true; - fPaint.maskSampler(m)->preConcatMatrix(invVM); + fPaint.coverageSampler(m)->preConcatMatrix(invVM); } } } diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index c712a0d447..a792977ff8 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -475,7 +475,7 @@ SkGpuRenderTarget* SkGpuDevice::accessRenderTarget() { bool SkGpuDevice::bindDeviceAsTexture(GrPaint* paint) { GrTexture* texture = fRenderTarget->asTexture(); if (NULL != texture) { - paint->textureSampler(kBitmapTextureIdx)->setCustomStage( + paint->colorSampler(kBitmapTextureIdx)->setCustomStage( SkNEW_ARGS(GrSingleTextureEffect, (texture)))->unref(); return true; } @@ -537,7 +537,7 @@ inline bool skPaint2GrPaintNoShader(SkGpuDevice* dev, GrAssert(!constantColor); } else { grPaint->fColor = SkColor2GrColor(skPaint.getColor()); - GrAssert(!grPaint->isTextureStageEnabled(kShaderTextureIdx)); + GrAssert(!grPaint->isColorStageEnabled(kShaderTextureIdx)); } SkColorFilter* colorFilter = skPaint.getColorFilter(); SkColor color; @@ -564,7 +564,7 @@ inline bool skPaint2GrPaintNoShader(SkGpuDevice* dev, // pass NULL because the color table effect doesn't use tiling or filtering. GrTexture* texture = act->set(dev, colorTransformTable, NULL); - GrSamplerState* colorSampler = grPaint->textureSampler(kColorFilterTextureIdx); + GrSamplerState* colorSampler = grPaint->colorSampler(kColorFilterTextureIdx); colorSampler->reset(); colorSampler->setCustomStage(SkNEW_ARGS(GrColorTableEffect, (texture)))->unref(); } @@ -578,7 +578,7 @@ inline bool skPaint2GrPaintNoShader(SkGpuDevice* dev, inline bool skPaint2GrPaintShader(SkGpuDevice* dev, const SkPaint& skPaint, bool constantColor, - SkGpuDevice::SkAutoCachedTexture textures[GrPaint::kMaxTextures], + SkGpuDevice::SkAutoCachedTexture textures[GrPaint::kMaxColorStages], GrPaint* grPaint) { SkShader* shader = skPaint.getShader(); if (NULL == shader) { @@ -593,7 +593,7 @@ inline bool skPaint2GrPaintShader(SkGpuDevice* dev, return false; } - GrSamplerState* sampler = grPaint->textureSampler(kShaderTextureIdx); + GrSamplerState* sampler = grPaint->colorSampler(kShaderTextureIdx); GrCustomStage* stage = shader->asNewCustomStage(dev->context(), sampler); if (NULL != stage) { @@ -677,7 +677,7 @@ void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { CHECK_SHOULD_DRAW(draw); GrPaint grPaint; - SkAutoCachedTexture textures[GrPaint::kMaxTextures]; + SkAutoCachedTexture textures[GrPaint::kMaxColorStages]; if (!skPaint2GrPaintShader(this, paint, true, @@ -713,7 +713,7 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, } GrPaint grPaint; - SkAutoCachedTexture textures[GrPaint::kMaxTextures]; + SkAutoCachedTexture textures[GrPaint::kMaxColorStages]; if (!skPaint2GrPaintShader(this, paint, true, @@ -775,7 +775,7 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, } GrPaint grPaint; - SkAutoCachedTexture textures[GrPaint::kMaxTextures]; + SkAutoCachedTexture textures[GrPaint::kMaxColorStages]; if (!skPaint2GrPaintShader(this, paint, true, @@ -920,11 +920,11 @@ bool drawWithGPUMaskFilter(GrContext* context, const SkPath& path, if (!isNormalBlur) { GrPaint paint; paint.reset(); - paint.textureSampler(0)->matrix()->setIDiv(pathTexture->width(), + paint.colorSampler(0)->matrix()->setIDiv(pathTexture->width(), pathTexture->height()); // Blend pathTexture over blurTexture. context->setRenderTarget(blurTexture->asRenderTarget()); - paint.textureSampler(0)->setCustomStage(SkNEW_ARGS + paint.colorSampler(0)->setCustomStage(SkNEW_ARGS (GrSingleTextureEffect, (pathTexture)))->unref(); if (SkMaskFilter::kInner_BlurType == blurType) { // inner: dst = dst * src @@ -949,15 +949,15 @@ bool drawWithGPUMaskFilter(GrContext* context, const SkPath& path, return false; } - static const int MASK_IDX = GrPaint::kMaxMasks - 1; + static const int MASK_IDX = GrPaint::kMaxCoverageStages - 1; // we assume the last mask index is available for use - GrAssert(!grp->isMaskStageEnabled(MASK_IDX)); - grp->maskSampler(MASK_IDX)->reset(); - grp->maskSampler(MASK_IDX)->setCustomStage( + GrAssert(!grp->isCoverageStageEnabled(MASK_IDX)); + grp->coverageSampler(MASK_IDX)->reset(); + grp->coverageSampler(MASK_IDX)->setCustomStage( SkNEW_ARGS(GrSingleTextureEffect, (blurTexture)))->unref(); - grp->maskSampler(MASK_IDX)->matrix()->setTranslate(-finalRect.fLeft, + grp->coverageSampler(MASK_IDX)->matrix()->setTranslate(-finalRect.fLeft, -finalRect.fTop); - grp->maskSampler(MASK_IDX)->matrix()->postIDiv(blurTexture->width(), + grp->coverageSampler(MASK_IDX)->matrix()->postIDiv(blurTexture->width(), blurTexture->height()); context->drawRect(*grp, finalRect); return true; @@ -1012,11 +1012,11 @@ bool drawWithMaskFilter(GrContext* context, const SkPath& path, texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, dstM.fImage, dstM.fRowBytes); - static const int MASK_IDX = GrPaint::kMaxMasks - 1; + static const int MASK_IDX = GrPaint::kMaxCoverageStages - 1; // we assume the last mask index is available for use - GrAssert(!grp->isMaskStageEnabled(MASK_IDX)); - grp->maskSampler(MASK_IDX)->reset(); - grp->maskSampler(MASK_IDX)->setCustomStage( + GrAssert(!grp->isCoverageStageEnabled(MASK_IDX)); + grp->coverageSampler(MASK_IDX)->reset(); + grp->coverageSampler(MASK_IDX)->setCustomStage( SkNEW_ARGS(GrSingleTextureEffect, (texture)))->unref(); GrRect d; d.setLTRB(GrIntToScalar(dstM.fBounds.fLeft), @@ -1024,7 +1024,7 @@ bool drawWithMaskFilter(GrContext* context, const SkPath& path, GrIntToScalar(dstM.fBounds.fRight), GrIntToScalar(dstM.fBounds.fBottom)); - GrMatrix* m = grp->maskSampler(MASK_IDX)->matrix(); + GrMatrix* m = grp->coverageSampler(MASK_IDX)->matrix(); m->setTranslate(-dstM.fBounds.fLeft*SK_Scalar1, -dstM.fBounds.fTop*SK_Scalar1); m->postIDiv(texture->width(), texture->height()); @@ -1045,7 +1045,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, bool doFill = true; GrPaint grPaint; - SkAutoCachedTexture textures[GrPaint::kMaxTextures]; + SkAutoCachedTexture textures[GrPaint::kMaxColorStages]; if (!skPaint2GrPaintShader(this, paint, true, @@ -1435,7 +1435,7 @@ void SkGpuDevice::internalDrawBitmap(const SkDraw& draw, return; } - GrSamplerState* sampler = grPaint->textureSampler(kBitmapTextureIdx); + GrSamplerState* sampler = grPaint->colorSampler(kBitmapTextureIdx); sampler->matrix()->reset(); @@ -1501,7 +1501,7 @@ void SkGpuDevice::internalDrawBitmap(const SkDraw& draw, } else { stage.reset(SkNEW_ARGS(GrSingleTextureEffect, (texture, params))); } - grPaint->textureSampler(kBitmapTextureIdx)->setCustomStage(stage); + grPaint->colorSampler(kBitmapTextureIdx)->setCustomStage(stage); fContext->drawRectToRect(*grPaint, dstRect, paintRect, &m); } @@ -1521,8 +1521,8 @@ void apply_custom_stage(GrContext* context, sampleM.setIDiv(srcTexture->width(), srcTexture->height()); GrPaint paint; paint.reset(); - paint.textureSampler(0)->reset(sampleM); - paint.textureSampler(0)->setCustomStage(stage); + paint.colorSampler(0)->reset(sampleM); + paint.colorSampler(0)->setCustomStage(stage); context->drawRect(paint, rect); } @@ -1572,13 +1572,13 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap, GrContext::AutoMatrix avm(fContext, GrMatrix::I()); - GrSamplerState* sampler = grPaint.textureSampler(kBitmapTextureIdx); + GrSamplerState* sampler = grPaint.colorSampler(kBitmapTextureIdx); GrTexture* texture; sampler->reset(); // draw sprite uses the default texture params SkAutoCachedTexture act(this, bitmap, NULL, &texture); - grPaint.textureSampler(kBitmapTextureIdx)->setCustomStage(SkNEW_ARGS + grPaint.colorSampler(kBitmapTextureIdx)->setCustomStage(SkNEW_ARGS (GrSingleTextureEffect, (texture)))->unref(); SkImageFilter* filter = paint.getImageFilter(); @@ -1586,7 +1586,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.textureSampler(kBitmapTextureIdx)->setCustomStage(SkNEW_ARGS + grPaint.colorSampler(kBitmapTextureIdx)->setCustomStage(SkNEW_ARGS (GrSingleTextureEffect, (filteredTexture)))->unref(); texture = filteredTexture; filteredTexture->unref(); @@ -1645,13 +1645,13 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* device, GrPaint grPaint; SkAutoCachedTexture colorLutTexture; - grPaint.textureSampler(kBitmapTextureIdx)->reset(); + grPaint.colorSampler(kBitmapTextureIdx)->reset(); if (!dev->bindDeviceAsTexture(&grPaint) || !skPaint2GrPaintNoShader(this, paint, true, false, &colorLutTexture, &grPaint)) { return; } - GrTexture* devTex = grPaint.getTextureSampler(kBitmapTextureIdx).getCustomStage()->texture(0); + GrTexture* devTex = grPaint.getColorSampler(kBitmapTextureIdx).getCustomStage()->texture(0); SkASSERT(NULL != devTex); SkImageFilter* filter = paint.getImageFilter(); @@ -1660,7 +1660,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* device, SkIntToScalar(devTex->height())); GrTexture* filteredTexture = filter_texture(this, fContext, devTex, filter, rect); if (filteredTexture) { - grPaint.textureSampler(kBitmapTextureIdx)->setCustomStage(SkNEW_ARGS + grPaint.colorSampler(kBitmapTextureIdx)->setCustomStage(SkNEW_ARGS (GrSingleTextureEffect, (filteredTexture)))->unref(); devTex = filteredTexture; filteredTexture->unref(); @@ -1744,7 +1744,7 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode, CHECK_SHOULD_DRAW(draw); GrPaint grPaint; - SkAutoCachedTexture textures[GrPaint::kMaxTextures]; + SkAutoCachedTexture textures[GrPaint::kMaxColorStages]; // we ignore the shader if texs is null. if (NULL == texs) { if (!skPaint2GrPaintNoShader(this, @@ -1859,7 +1859,7 @@ void SkGpuDevice::drawText(const SkDraw& draw, const void* text, SkDraw myDraw(draw); GrPaint grPaint; - SkAutoCachedTexture textures[GrPaint::kMaxTextures]; + SkAutoCachedTexture textures[GrPaint::kMaxColorStages]; if (!skPaint2GrPaintShader(this, paint, true, @@ -1887,7 +1887,7 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, SkDraw myDraw(draw); GrPaint grPaint; - SkAutoCachedTexture textures[GrPaint::kMaxTextures]; + SkAutoCachedTexture textures[GrPaint::kMaxColorStages]; if (!skPaint2GrPaintShader(this, paint, true, diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 6852f91fe6..3af0979be9 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -186,16 +186,16 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context (tempTex, false, *pmToUPMRule))); context->setRenderTarget(readTex->asRenderTarget()); - paint.textureSampler(0)->setCustomStage(pmToUPMStage1); + paint.colorSampler(0)->setCustomStage(pmToUPMStage1); context->drawRectToRect(paint, kDstRect, kSrcRect); readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead); context->setRenderTarget(tempTex->asRenderTarget()); - paint.textureSampler(0)->setCustomStage(upmToPMStage); + paint.colorSampler(0)->setCustomStage(upmToPMStage); context->drawRectToRect(paint, kDstRect, kSrcRect); context->setRenderTarget(readTex->asRenderTarget()); - paint.textureSampler(0)->setCustomStage(pmToUPMStage2); + paint.colorSampler(0)->setCustomStage(pmToUPMStage2); context->drawRectToRect(paint, kDstRect, kSrcRect); readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, secondRead); |