OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrGLProgramEffects.h" | 8 #include "GrGLProgramEffects.h" |
9 #include "GrDrawEffect.h" | 9 #include "GrDrawEffect.h" |
10 #include "gl/GrGLEffect.h" | 10 #include "gl/GrGLEffect.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 kPosition_GrCoordSet : | 83 kPosition_GrCoordSet : |
84 kLocal_GrCoordSet; | 84 kLocal_GrCoordSet; |
85 } | 85 } |
86 | 86 |
87 /** | 87 /** |
88 * Retrieves the final matrix that a transform needs to apply to its source coor
ds. | 88 * Retrieves the final matrix that a transform needs to apply to its source coor
ds. |
89 */ | 89 */ |
90 SkMatrix get_transform_matrix(const GrDrawEffect& drawEffect, int transformIdx)
{ | 90 SkMatrix get_transform_matrix(const GrDrawEffect& drawEffect, int transformIdx)
{ |
91 const GrCoordTransform& coordTransform = drawEffect.effect()->coordTransform
(transformIdx); | 91 const GrCoordTransform& coordTransform = drawEffect.effect()->coordTransform
(transformIdx); |
92 SkMatrix combined; | 92 SkMatrix combined; |
93 if (kLocal_GrCoordSet == coordTransform.sourceCoords() && | 93 |
94 !drawEffect.programHasExplicitLocalCoords()) { | 94 if (kLocal_GrCoordSet == coordTransform.sourceCoords()) { |
| 95 // If we have explicit local coords then we shouldn't need a coord chang
e. |
| 96 SkASSERT(!drawEffect.programHasExplicitLocalCoords() || |
| 97 drawEffect.getCoordChangeMatrix().isIdentity()); |
95 combined.setConcat(coordTransform.getMatrix(), drawEffect.getCoordChange
Matrix()); | 98 combined.setConcat(coordTransform.getMatrix(), drawEffect.getCoordChange
Matrix()); |
96 } else { | 99 } else { |
97 combined = coordTransform.getMatrix(); | 100 combined = coordTransform.getMatrix(); |
98 } | 101 } |
99 if (coordTransform.reverseY()) { | 102 if (coordTransform.reverseY()) { |
100 // combined.postScale(1,-1); | 103 // combined.postScale(1,-1); |
101 // combined.postTranslate(0,1); | 104 // combined.postTranslate(0,1); |
102 combined.set(SkMatrix::kMSkewY, | 105 combined.set(SkMatrix::kMSkewY, |
103 combined[SkMatrix::kMPersp0] - combined[SkMatrix::kMSkewY]); | 106 combined[SkMatrix::kMPersp0] - combined[SkMatrix::kMSkewY]); |
104 combined.set(SkMatrix::kMScaleY, | 107 combined.set(SkMatrix::kMScaleY, |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 } | 504 } |
502 | 505 |
503 void GrGLPathTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, | 506 void GrGLPathTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, |
504 const GrEffectKey& key, | 507 const GrEffectKey& key, |
505 const char* outColor, | 508 const char* outColor, |
506 const char* inColor, | 509 const char* inColor, |
507 int stageIndex) { | 510 int stageIndex) { |
508 SkASSERT(NULL != fProgramEffects.get()); | 511 SkASSERT(NULL != fProgramEffects.get()); |
509 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn
dex); | 512 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn
dex); |
510 } | 513 } |
OLD | NEW |