aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGpuDevice.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-26 19:39:06 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-26 19:39:06 +0000
commit1c31f633232df572f89a3bc1b0fee3e46d22cb5b (patch)
treea2e615f86b0a4c53009f60fc9a27b5c6b79d012e /src/gpu/SkGpuDevice.cpp
parentea5488b9655fc7d71345c3a823de85f8b74e3279 (diff)
Remove texture/mask setters on GrPaint
Review URL: http://codereview.appspot.com/6446052/ git-svn-id: http://skia.googlecode.com/svn/trunk@4790 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/SkGpuDevice.cpp')
-rw-r--r--src/gpu/SkGpuDevice.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index cb33d7687a..1256285192 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -482,13 +482,8 @@ SkGpuRenderTarget* SkGpuDevice::accessRenderTarget() {
bool SkGpuDevice::bindDeviceAsTexture(GrPaint* paint) {
if (NULL != fTexture) {
- // FIXME: cannot use GrSingleTextureEffect here: fails
- // assert in line 1617: null != devTex; generalizing GrPaint::getTexture()
- // to grab textures off of GrCustomStages breaks gms in various ways -
- // particularly since table color filter requires multiple textures
- paint->setTexture(kBitmapTextureIdx, fTexture);
- //paint->textureSampler(kBitmapTextureIdx)->setCustomStage(
- //SkNEW_ARGS(GrSingleTextureEffect, (fTexture)))->unref();
+ paint->textureSampler(kBitmapTextureIdx)->setCustomStage(
+ SkNEW_ARGS(GrSingleTextureEffect, (fTexture)))->unref();
return true;
}
return false;
@@ -549,7 +544,7 @@ inline bool skPaint2GrPaintNoShader(SkGpuDevice* dev,
GrAssert(!constantColor);
} else {
grPaint->fColor = SkColor2GrColor(skPaint.getColor());
- GrAssert(NULL == grPaint->getTexture(kShaderTextureIdx));
+ GrAssert(!grPaint->isTextureStageEnabled(kShaderTextureIdx));
}
SkColorFilter* colorFilter = skPaint.getColorFilter();
SkColor color;
@@ -971,9 +966,9 @@ bool drawWithGPUMaskFilter(GrContext* context, const SkPath& path,
static const int MASK_IDX = GrPaint::kMaxMasks - 1;
// we assume the last mask index is available for use
GrAssert(!grp->isMaskStageEnabled(MASK_IDX));
- grp->setMask(MASK_IDX, blurTexture);
grp->maskSampler(MASK_IDX)->reset();
-
+ grp->maskSampler(MASK_IDX)->setCustomStage(
+ SkNEW_ARGS(GrSingleTextureEffect, (blurTexture)))->unref();
grp->maskSampler(MASK_IDX)->matrix()->setTranslate(-finalRect.fLeft,
-finalRect.fTop);
grp->maskSampler(MASK_IDX)->matrix()->postIDiv(blurTexture->width(),
@@ -1034,9 +1029,9 @@ bool drawWithMaskFilter(GrContext* context, const SkPath& path,
static const int MASK_IDX = GrPaint::kMaxMasks - 1;
// we assume the last mask index is available for use
GrAssert(!grp->isMaskStageEnabled(MASK_IDX));
- grp->setMask(MASK_IDX, texture);
grp->maskSampler(MASK_IDX)->reset();
-
+ grp->maskSampler(MASK_IDX)->setCustomStage(
+ SkNEW_ARGS(GrSingleTextureEffect, (texture)))->unref();
GrRect d;
d.setLTRB(GrIntToScalar(dstM.fBounds.fLeft),
GrIntToScalar(dstM.fBounds.fTop),
@@ -1628,25 +1623,23 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* device,
GrPaint grPaint;
SkAutoCachedTexture colorLutTexture;
+ grPaint.textureSampler(kBitmapTextureIdx)->reset();
if (!dev->bindDeviceAsTexture(&grPaint) ||
!skPaint2GrPaintNoShader(this, paint, true, false, &colorLutTexture, &grPaint)) {
return;
}
- GrTexture* devTex = grPaint.getTexture(0);
+ GrTexture* devTex = grPaint.getTextureSampler(kBitmapTextureIdx).getCustomStage()->texture(0);
SkASSERT(NULL != devTex);
SkImageFilter* filter = paint.getImageFilter();
- grPaint.textureSampler(kBitmapTextureIdx)->reset();
if (NULL != filter) {
- GrRect rect = GrRect::MakeWH(SkIntToScalar(devTex->width()),
+ GrRect rect = GrRect::MakeWH(SkIntToScalar(devTex->width()),
SkIntToScalar(devTex->height()));
- GrTexture* filteredTexture = filter_texture(fContext, devTex, filter,
- rect);
+ GrTexture* filteredTexture = filter_texture(fContext, devTex, filter, rect);
if (filteredTexture) {
grPaint.textureSampler(kBitmapTextureIdx)->setCustomStage(SkNEW_ARGS
(GrSingleTextureEffect, (filteredTexture)))->unref();
- grPaint.setTexture(kBitmapTextureIdx, NULL);
devTex = filteredTexture;
filteredTexture->unref();
}