Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: include/gpu/GrPaint.h

Issue 12531015: Adds local coords to GrEffect system. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrEffectStage.h ('k') | include/gpu/GrTBackendEffectFactory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrPaint.h
===================================================================
--- include/gpu/GrPaint.h (revision 8241)
+++ include/gpu/GrPaint.h (working copy)
@@ -169,54 +169,6 @@
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;
@@ -264,7 +216,52 @@
};
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 GrContext; // To access above two functions
+
GrEffectStage fColorStages[kMaxColorStages];
GrEffectStage fCoverageStages[kMaxCoverageStages];
« no previous file with comments | « include/gpu/GrEffectStage.h ('k') | include/gpu/GrTBackendEffectFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698