Revert r5962 because of failures.
git-svn-id: http://skia.googlecode.com/svn/trunk@5963 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 8b7d2d0..ee3a4e1 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -202,10 +202,11 @@
drawState->setRenderTarget(rt);
GrMatrix sampleM;
sampleM.setIDiv(texture->width(), texture->height());
+ drawState->sampler(0)->reset(sampleM);
SkAutoTUnref<GrConvolutionEffect> conv(SkNEW_ARGS(GrConvolutionEffect,
(texture, direction, radius,
sigma)));
- drawState->sampler(0)->setCustomStage(conv, sampleM);
+ drawState->sampler(0)->setCustomStage(conv);
target->drawSimpleRect(rect, NULL);
}
@@ -312,8 +313,9 @@
// if filtering is not desired then we want to ensure all
// texels in the resampled image are copies of texels from
// the original.
+ drawState->sampler(0)->reset();
GrTextureParams params(SkShader::kClamp_TileMode, needsFiltering);
- drawState->createTextureEffect(0, clampedTexture, GrMatrix::I(), params);
+ drawState->createTextureEffect(0, clampedTexture, params);
static const GrVertexLayout layout =
GrDrawTarget::StageTexCoordVertexLayoutBit(0,0);
@@ -1346,7 +1348,8 @@
matrix.setTranslate(SK_Scalar1 *left, SK_Scalar1 *top);
}
matrix.postIDiv(src->width(), src->height());
- drawState->sampler(0)->setCustomStage(stage, matrix);
+ drawState->sampler(0)->reset(matrix);
+ drawState->sampler(0)->setCustomStage(stage);
GrRect rect = GrRect::MakeWH(GrIntToScalar(width), GrIntToScalar(height));
fGpu->drawSimpleRect(rect, NULL);
// we want to read back from the scratch's origin
@@ -1446,7 +1449,8 @@
drawState->setRenderTarget(dst);
GrMatrix sampleM;
sampleM.setIDiv(src->width(), src->height());
- drawState->createTextureEffect(0, src, sampleM);
+ drawState->sampler(0)->reset(sampleM);
+ drawState->createTextureEffect(0, src);
SkRect rect = SkRect::MakeXYWH(0, 0,
SK_Scalar1 * src->width(),
SK_Scalar1 * src->height());
@@ -1554,7 +1558,8 @@
drawState->setRenderTarget(target);
matrix.setIDiv(texture->width(), texture->height());
- drawState->sampler(0)->setCustomStage(stage, matrix);
+ drawState->sampler(0)->reset(matrix);
+ drawState->sampler(0)->setCustomStage(stage);
fGpu->drawSimpleRect(GrRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)), NULL);
}
@@ -1808,15 +1813,14 @@
paint.reset();
for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
- GrMatrix matrix;
- matrix.setIDiv(srcTexture->width(), srcTexture->height());
+ 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);
-
+ i < scaleFactorY ? 0.5f : 1.0f);
paint.colorSampler(0)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect,
- (srcTexture, true)), matrix)->unref();
+ (srcTexture, true)))->unref();
this->drawRectToRect(paint, dstRect, srcRect);
srcRect = dstRect;
srcTexture = dstTexture;
@@ -1869,13 +1873,12 @@
clearRect = SkIRect::MakeXYWH(srcIRect.fRight, srcIRect.fTop,
1, srcIRect.height());
this->clear(&clearRect, 0x0);
- GrMatrix matrix;
// FIXME: This should be mitchell, not bilinear.
- matrix.setIDiv(srcTexture->width(), srcTexture->height());
+ paint.colorSampler(0)->matrix()->setIDiv(srcTexture->width(),
+ srcTexture->height());
this->setRenderTarget(dstTexture->asRenderTarget());
paint.colorSampler(0)->setCustomStage(SkNEW_ARGS(GrSingleTextureEffect,
- (srcTexture, true)),
- matrix)->unref();
+ (srcTexture, true)))->unref();
SkRect dstRect(srcRect);
scale_rect(&dstRect, (float) scaleFactorX, (float) scaleFactorY);
this->drawRectToRect(paint, dstRect, srcRect);