OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrGLProgram.h" | 8 #include "GrGLProgram.h" |
9 | 9 |
10 #include "GrAllocator.h" | 10 #include "GrAllocator.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 #define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X) | 24 #define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X) |
25 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fGpu->glInterface(), R, X) | 25 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(fGpu->glInterface(), R, X) |
26 | 26 |
27 /** | 27 /** |
28 * Retrieves the final matrix that a transform needs to apply to its source coor ds. | 28 * Retrieves the final matrix that a transform needs to apply to its source coor ds. |
29 */ | 29 */ |
30 static SkMatrix get_transform_matrix(const GrPendingFragmentStage& stage, int tr ansformIdx) { | 30 static SkMatrix get_transform_matrix(const GrPendingFragmentStage& stage, int tr ansformIdx) { |
31 const GrCoordTransform& coordTransform = stage.getProcessor()->coordTransfor m(transformIdx); | 31 const GrCoordTransform& coordTransform = stage.getProcessor()->coordTransfor m(transformIdx); |
32 SkMatrix combined; | 32 SkMatrix combined; |
33 | 33 |
34 if (kLocal_GrCoordSet == coordTransform.sourceCoords()) { | 34 if (kLocal_GrCoordSet == coordTransform.sourceCoords() || |
35 // If we have explicit local coords then we shouldn't need a coord chang e. | 35 kDevice_GrCoordSet == coordTransform.sourceCoords()) { |
bsalomon
2014/12/17 19:45:28
backwards... don't apply ccm if using device coord
| |
36 // If we have explicit local coords or are in device coords then we shou ldn't need a coord | |
37 // change. | |
36 const SkMatrix& ccm = stage.getCoordChangeMatrix(); | 38 const SkMatrix& ccm = stage.getCoordChangeMatrix(); |
37 combined.setConcat(coordTransform.getMatrix(), ccm); | 39 combined.setConcat(coordTransform.getMatrix(), ccm); |
38 } else { | 40 } else { |
39 combined = coordTransform.getMatrix(); | 41 combined = coordTransform.getMatrix(); |
40 } | 42 } |
41 if (coordTransform.reverseY()) { | 43 if (coordTransform.reverseY()) { |
42 // combined.postScale(1,-1); | 44 // combined.postScale(1,-1); |
43 // combined.postTranslate(0,1); | 45 // combined.postTranslate(0,1); |
44 combined.set(SkMatrix::kMSkewY, | 46 combined.set(SkMatrix::kMSkewY, |
45 combined[SkMatrix::kMPersp0] - combined[SkMatrix::kMSkewY]); | 47 combined[SkMatrix::kMPersp0] - combined[SkMatrix::kMSkewY]); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 for (int t = 0; t < numTransforms; ++t) { | 343 for (int t = 0; t < numTransforms; ++t) { |
342 const SkMatrix& transform = get_transform_matrix(proc, t); | 344 const SkMatrix& transform = get_transform_matrix(proc, t); |
343 GrGLPathRendering::PathTexGenComponents components = | 345 GrGLPathRendering::PathTexGenComponents components = |
344 GrGLPathRendering::kST_PathTexGenComponents; | 346 GrGLPathRendering::kST_PathTexGenComponents; |
345 if (proc.isPerspectiveCoordTransform(t)) { | 347 if (proc.isPerspectiveCoordTransform(t)) { |
346 components = GrGLPathRendering::kSTR_PathTexGenComponents; | 348 components = GrGLPathRendering::kSTR_PathTexGenComponents; |
347 } | 349 } |
348 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t ransform); | 350 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t ransform); |
349 } | 351 } |
350 } | 352 } |
OLD | NEW |