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 14 matching lines...) Expand all Loading... |
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 // If we have explicit local coords or are in device coords then we shou
ldn't need a coord |
| 36 // change. |
36 const SkMatrix& ccm = stage.getCoordChangeMatrix(); | 37 const SkMatrix& ccm = stage.getCoordChangeMatrix(); |
37 combined.setConcat(coordTransform.getMatrix(), ccm); | 38 combined.setConcat(coordTransform.getMatrix(), ccm); |
38 } else { | 39 } else { |
39 combined = coordTransform.getMatrix(); | 40 combined = coordTransform.getMatrix(); |
40 } | 41 } |
41 if (coordTransform.reverseY()) { | 42 if (coordTransform.reverseY()) { |
42 // combined.postScale(1,-1); | 43 // combined.postScale(1,-1); |
43 // combined.postTranslate(0,1); | 44 // combined.postTranslate(0,1); |
44 combined.set(SkMatrix::kMSkewY, | 45 combined.set(SkMatrix::kMSkewY, |
45 combined[SkMatrix::kMPersp0] - combined[SkMatrix::kMSkewY]); | 46 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) { | 342 for (int t = 0; t < numTransforms; ++t) { |
342 const SkMatrix& transform = get_transform_matrix(proc, t); | 343 const SkMatrix& transform = get_transform_matrix(proc, t); |
343 GrGLPathRendering::PathTexGenComponents components = | 344 GrGLPathRendering::PathTexGenComponents components = |
344 GrGLPathRendering::kST_PathTexGenComponents; | 345 GrGLPathRendering::kST_PathTexGenComponents; |
345 if (proc.isPerspectiveCoordTransform(t)) { | 346 if (proc.isPerspectiveCoordTransform(t)) { |
346 components = GrGLPathRendering::kSTR_PathTexGenComponents; | 347 components = GrGLPathRendering::kSTR_PathTexGenComponents; |
347 } | 348 } |
348 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t
ransform); | 349 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t
ransform); |
349 } | 350 } |
350 } | 351 } |
OLD | NEW |