revert 8265-8264 (broke build)
git-svn-id: http://skia.googlecode.com/svn/trunk@8268 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index e0a9203..0fd42f9 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -169,6 +169,54 @@
bool hasStage() const { return this->hasColorStage() || this->hasCoverageStage(); }
+ /**
+ * Called when the source coord system is changing. preConcatInverse is the inverse of the
+ * transformation from the old coord system to the new coord system. Returns false if the matrix
+ * cannot be inverted.
+ */
+ bool sourceCoordChangeByInverse(const SkMatrix& preConcatInverse) {
+ SkMatrix inv;
+ bool computed = false;
+ for (int i = 0; i < kMaxColorStages; ++i) {
+ if (this->isColorStageEnabled(i)) {
+ if (!computed && !preConcatInverse.invert(&inv)) {
+ return false;
+ } else {
+ computed = true;
+ }
+ fColorStages[i].preConcatCoordChange(inv);
+ }
+ }
+ for (int i = 0; i < kMaxCoverageStages; ++i) {
+ if (this->isCoverageStageEnabled(i)) {
+ if (!computed && !preConcatInverse.invert(&inv)) {
+ return false;
+ } else {
+ computed = true;
+ }
+ fCoverageStages[i].preConcatCoordChange(inv);
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Called when the source coord system is changing. preConcat gives the transformation from the
+ * old coord system to the new coord system.
+ */
+ void sourceCoordChange(const SkMatrix& preConcat) {
+ for (int i = 0; i < kMaxColorStages; ++i) {
+ if (this->isColorStageEnabled(i)) {
+ fColorStages[i].preConcatCoordChange(preConcat);
+ }
+ }
+ for (int i = 0; i < kMaxCoverageStages; ++i) {
+ if (this->isCoverageStageEnabled(i)) {
+ fCoverageStages[i].preConcatCoordChange(preConcat);
+ }
+ }
+ }
+
GrPaint& operator=(const GrPaint& paint) {
fSrcBlendCoeff = paint.fSrcBlendCoeff;
fDstBlendCoeff = paint.fDstBlendCoeff;
@@ -216,51 +264,6 @@
};
private:
- /**
- * Called when the source coord system from which geometry is rendered changes. It ensures that
- * the local coordinates seen by effects remains unchanged. oldToNew gives the transformation
- * from the previous coord system to the new coord system.
- */
- void localCoordChange(const SkMatrix& oldToNew) {
- for (int i = 0; i < kMaxColorStages; ++i) {
- if (this->isColorStageEnabled(i)) {
- fColorStages[i].localCoordChange(oldToNew);
- }
- }
- for (int i = 0; i < kMaxCoverageStages; ++i) {
- if (this->isCoverageStageEnabled(i)) {
- fCoverageStages[i].localCoordChange(oldToNew);
- }
- }
- }
-
- bool localCoordChangeInverse(const SkMatrix& newToOld) {
- SkMatrix oldToNew;
- bool computed = false;
- for (int i = 0; i < kMaxColorStages; ++i) {
- if (this->isColorStageEnabled(i)) {
- if (!computed && !newToOld.invert(&oldToNew)) {
- return false;
- } else {
- computed = true;
- }
- fColorStages[i].localCoordChange(oldToNew);
- }
- }
- for (int i = 0; i < kMaxCoverageStages; ++i) {
- if (this->isCoverageStageEnabled(i)) {
- if (!computed && !newToOld.invert(&oldToNew)) {
- return false;
- } else {
- computed = true;
- }
- fCoverageStages[i].localCoordChange(oldToNew);
- }
- }
- return true;
- }
-
- friend class GrContext; // To access above two functions
GrEffectStage fColorStages[kMaxColorStages];
GrEffectStage fCoverageStages[kMaxCoverageStages];