Beef up GrContext::AutoMatrix to handle doing GrPaint matrix adjustments.
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6656047
git-svn-id: http://skia.googlecode.com/svn/trunk@5918 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 9f9403e..3c29662 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -189,9 +189,8 @@
bool hasStage() const { return this->hasColorStage() || this->hasCoverageStage(); }
/**
- * Preconcats the matrix of all samplers in the mask with the inverse of a matrix. If the
- * matrix inverse cannot be computed (and there is at least one enabled stage) then false is
- * returned.
+ * Preconcats the matrix of all enabled stages with the inverse of a matrix. If the matrix
+ * inverse cannot be computed (and there is at least one enabled stage) then false is returned.
*/
bool preConcatSamplerMatricesWithInverse(const GrMatrix& matrix) {
GrMatrix inv;
@@ -219,6 +218,22 @@
return true;
}
+ /**
+ * Preconcats the matrix of all stages with a matrix.
+ */
+ void preConcatSamplerMatrices(const GrMatrix& matrix) {
+ for (int i = 0; i < kMaxColorStages; ++i) {
+ if (this->isColorStageEnabled(i)) {
+ fColorSamplers[i].preConcatMatrix(matrix);
+ }
+ }
+ for (int i = 0; i < kMaxCoverageStages; ++i) {
+ if (this->isCoverageStageEnabled(i)) {
+ fCoverageSamplers[i].preConcatMatrix(matrix);
+ }
+ }
+ }
+
GrPaint& operator=(const GrPaint& paint) {
fSrcBlendCoeff = paint.fSrcBlendCoeff;
fDstBlendCoeff = paint.fDstBlendCoeff;