Make GrPaint have a variable sized array of color and coverage stages rather than a fixed size.
R=robertphillips@google.com, jvanverth@google.com
Author: bsalomon@google.com
Review URL: https://chromiumcodereview.appspot.com/18686007
git-svn-id: http://skia.googlecode.com/svn/trunk@10062 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index d9924bf..31d5ff1 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1766,20 +1766,16 @@
return NULL;
}
- GrPaint paint;
- paint.reset();
-
for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
+ GrPaint paint;
SkMatrix matrix;
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.colorStage(0)->setEffect(GrSimpleTextureEffect::Create(srcTexture,
- matrix,
- true))->unref();
+ GrTextureParams params(SkShader::kClamp_TileMode, true);
+ paint.addColorTextureEffect(srcTexture, matrix, params);
this->drawRectToRect(paint, dstRect, srcRect);
srcRect = dstRect;
srcTexture = dstTexture;
@@ -1797,7 +1793,7 @@
radiusX, srcIRect.height());
this->clear(&clearRect, 0x0);
}
-
+ GrPaint paint;
this->setRenderTarget(dstTexture->asRenderTarget());
AutoRestoreEffects are;
GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are);
@@ -1817,6 +1813,7 @@
}
this->setRenderTarget(dstTexture->asRenderTarget());
+ GrPaint paint;
AutoRestoreEffects are;
GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are);
convolve_gaussian(target, srcTexture, srcRect, sigmaY, radiusY,
@@ -1835,12 +1832,14 @@
1, srcIRect.height());
this->clear(&clearRect, 0x0);
SkMatrix matrix;
- // FIXME: This should be mitchell, not bilinear.
matrix.setIDiv(srcTexture->width(), srcTexture->height());
this->setRenderTarget(dstTexture->asRenderTarget());
- paint.colorStage(0)->setEffect(GrSimpleTextureEffect::Create(srcTexture,
- matrix,
- true))->unref();
+
+ GrPaint paint;
+ // FIXME: This should be mitchell, not bilinear.
+ GrTextureParams params(SkShader::kClamp_TileMode, true);
+ paint.addColorTextureEffect(srcTexture, matrix, params);
+
SkRect dstRect(srcRect);
scale_rect(&dstRect, (float) scaleFactorX, (float) scaleFactorY);
this->drawRectToRect(paint, dstRect, srcRect);