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

Side by Side Diff: src/gpu/gl/GrGLPathProcessor.cpp

Issue 1333273003: Start trying to collapse path program stuff (Closed) Base URL: https://skia.googlesource.com/skia.git@removebt
Patch Set: windows Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLGeometryProcessor.cpp ('k') | src/gpu/gl/GrGLPathProgramDataManager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrGLPathProcessor.h" 8 #include "GrGLPathProcessor.h"
9 9
10 #include "GrPathProcessor.h" 10 #include "GrPathProcessor.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 fInstalledTransforms[i].push_back_n(coordTransforms.count()); 66 fInstalledTransforms[i].push_back_n(coordTransforms.count());
67 for (int t = 0; t < coordTransforms.count(); t++) { 67 for (int t = 0; t < coordTransforms.count(); t++) {
68 GrSLType varyingType = 68 GrSLType varyingType =
69 coordTransforms[t]->getMatrix().hasPerspective() ? kVec3f_Gr SLType : 69 coordTransforms[t]->getMatrix().hasPerspective() ? kVec3f_Gr SLType :
70 kVec2f_Gr SLType; 70 kVec2f_Gr SLType;
71 71
72 SkString strVaryingName("MatrixCoord"); 72 SkString strVaryingName("MatrixCoord");
73 strVaryingName.appendf("_%i_%i", i, t); 73 strVaryingName.appendf("_%i_%i", i, t);
74 GrGLVertToFrag v(varyingType); 74 GrGLVertToFrag v(varyingType);
75 fInstalledTransforms[i][t].fHandle = 75 fInstalledTransforms[i][t].fHandle =
76 pb->addSeparableVarying(strVaryingName.c_str(), &v).toShader BuilderIndex(); 76 pb->addSeparableVarying(strVaryingName.c_str(), &v).toIndex( );
77 fInstalledTransforms[i][t].fType = varyingType; 77 fInstalledTransforms[i][t].fType = varyingType;
78 78
79 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCoords , 79 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCoords ,
80 (SkString(v.fsIn()), varyingType)); 80 (SkString(v.fsIn()), varyingType));
81 } 81 }
82 } 82 }
83 } 83 }
84 84
85 void GrGLPathProcessor::setTransformData( 85 void GrGLPathProcessor::setTransformData(
86 const GrPrimitiveProcessor& primProc, 86 const GrPrimitiveProcessor& primProc,
87 const GrGLPathProgramDataManager& pdman, 87 const GrGLPathProgramDataManager& pdman,
88 int index, 88 int index,
89 const SkTArray<const GrCoordTransform*, true>& coordTransforms) { 89 const SkTArray<const GrCoordTransform*, true>& coordTransforms) {
90 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); 90 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
91 SkSTArray<2, Transform, true>& transforms = fInstalledTransforms[index]; 91 SkSTArray<2, Transform, true>& transforms = fInstalledTransforms[index];
92 int numTransforms = transforms.count(); 92 int numTransforms = transforms.count();
93 for (int t = 0; t < numTransforms; ++t) { 93 for (int t = 0; t < numTransforms; ++t) {
94 SkASSERT(transforms[t].fHandle.isValid()); 94 SkASSERT(transforms[t].fHandle.isValid());
95 const SkMatrix& transform = GetTransformMatrix(pathProc.localMatrix(), 95 const SkMatrix& transform = GetTransformMatrix(pathProc.localMatrix(),
96 *coordTransforms[t]); 96 *coordTransforms[t]);
97 if (transforms[t].fCurrentValue.cheapEqualTo(transform)) { 97 if (transforms[t].fCurrentValue.cheapEqualTo(transform)) {
98 continue; 98 continue;
99 } 99 }
100 transforms[t].fCurrentValue = transform; 100 transforms[t].fCurrentValue = transform;
101 101
102 SkASSERT(transforms[t].fType == kVec2f_GrSLType || 102 SkASSERT(transforms[t].fType == kVec2f_GrSLType ||
103 transforms[t].fType == kVec3f_GrSLType); 103 transforms[t].fType == kVec3f_GrSLType);
104 unsigned components = transforms[t].fType == kVec2f_GrSLType ? 2 : 3; 104 unsigned components = transforms[t].fType == kVec2f_GrSLType ? 2 : 3;
105 pdman.setPathFragmentInputTransform(transforms[t].fHandle.handle(), comp onents, transform); 105 pdman.setPathFragmentInputTransform(transforms[t].fHandle, components, t ransform);
106 } 106 }
107 } 107 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGeometryProcessor.cpp ('k') | src/gpu/gl/GrGLPathProgramDataManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698