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

Side by Side Diff: src/gpu/GrDefaultGeoProcFactory.cpp

Issue 2250563004: Detemplatize GrGLSLGeometryProcessor::setTransformDataHelper() (Closed) Base URL: https://chromium.googlesource.com/skia.git@clean
Patch Set: simplify Created 4 years, 4 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 | « no previous file | src/gpu/GrOvalRenderer.cpp » ('j') | src/gpu/batches/GrAAConvexPathRenderer.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "GrDefaultGeoProcFactory.h" 8 #include "GrDefaultGeoProcFactory.h"
9 9
10 #include "GrInvariantOutput.h" 10 #include "GrInvariantOutput.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 const char* name() const override { return "DefaultGeometryProcessor"; } 46 const char* name() const override { return "DefaultGeometryProcessor"; }
47 47
48 const Attribute* inPosition() const { return fInPosition; } 48 const Attribute* inPosition() const { return fInPosition; }
49 const Attribute* inColor() const { return fInColor; } 49 const Attribute* inColor() const { return fInColor; }
50 const Attribute* inLocalCoords() const { return fInLocalCoords; } 50 const Attribute* inLocalCoords() const { return fInLocalCoords; }
51 const Attribute* inCoverage() const { return fInCoverage; } 51 const Attribute* inCoverage() const { return fInCoverage; }
52 GrColor color() const { return fColor; } 52 GrColor color() const { return fColor; }
53 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } 53 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
54 bool hasVertexColor() const { return SkToBool(fInColor); } 54 bool hasVertexColor() const { return SkToBool(fInColor); }
55 const SkMatrix& viewMatrix() const { return fViewMatrix; } 55 const SkMatrix& viewMatrix() const { return fViewMatrix; }
robertphillips 2016/08/17 16:27:25 Do we still need this ?
bsalomon 2016/08/17 16:33:00 All of these getters are still used in emitCode. T
56 const SkMatrix& localMatrix() const { return fLocalMatrix; } 56 const SkMatrix& localMatrix() const { return fLocalMatrix; }
57 bool localCoordsWillBeRead() const { return fLocalCoordsWillBeRead; } 57 bool localCoordsWillBeRead() const { return fLocalCoordsWillBeRead; }
58 uint8_t coverage() const { return fCoverage; } 58 uint8_t coverage() const { return fCoverage; }
59 bool coverageWillBeIgnored() const { return fCoverageWillBeIgnored; } 59 bool coverageWillBeIgnored() const { return fCoverageWillBeIgnored; }
60 bool hasVertexCoverage() const { return SkToBool(fInCoverage); } 60 bool hasVertexCoverage() const { return SkToBool(fInCoverage); }
61 61
62 class GLSLProcessor : public GrGLSLGeometryProcessor { 62 class GLSLProcessor : public GrGLSLGeometryProcessor {
63 public: 63 public:
64 GLSLProcessor() 64 GLSLProcessor()
65 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), f Coverage(0xff) {} 65 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), f Coverage(0xff) {}
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 dgp.coverage() != fCoverage && !dgp.hasVertexCoverage()) { 179 dgp.coverage() != fCoverage && !dgp.hasVertexCoverage()) {
180 pdman.set1f(fCoverageUniform, GrNormalizeByteToFloat(dgp.coverag e())); 180 pdman.set1f(fCoverageUniform, GrNormalizeByteToFloat(dgp.coverag e()));
181 fCoverage = dgp.coverage(); 181 fCoverage = dgp.coverage();
182 } 182 }
183 } 183 }
184 184
185 void setTransformData(const GrPrimitiveProcessor& primProc, 185 void setTransformData(const GrPrimitiveProcessor& primProc,
186 const GrGLSLProgramDataManager& pdman, 186 const GrGLSLProgramDataManager& pdman,
187 int index, 187 int index,
188 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override { 188 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override {
189 this->setTransformDataHelper<DefaultGeoProc>(primProc, pdman, index, transforms); 189 this->setTransformDataHelper(primProc.cast<DefaultGeoProc>().fLocalM atrix, pdman, index,
190 transforms);
190 } 191 }
191 192
192 private: 193 private:
193 SkMatrix fViewMatrix; 194 SkMatrix fViewMatrix;
194 GrColor fColor; 195 GrColor fColor;
195 uint8_t fCoverage; 196 uint8_t fCoverage;
196 UniformHandle fViewMatrixUniform; 197 UniformHandle fViewMatrixUniform;
197 UniformHandle fColorUniform; 198 UniformHandle fColorUniform;
198 UniformHandle fCoverageUniform; 199 UniformHandle fCoverageUniform;
199 200
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 337 }
337 338
338 if (localCoords.hasLocalMatrix()) { 339 if (localCoords.hasLocalMatrix()) {
339 invert.preConcat(*localCoords.fMatrix); 340 invert.preConcat(*localCoords.fMatrix);
340 } 341 }
341 } 342 }
342 343
343 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert); 344 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert);
344 return Make(color, coverage, inverted, SkMatrix::I()); 345 return Make(color, coverage, inverted, SkMatrix::I());
345 } 346 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrOvalRenderer.cpp » ('j') | src/gpu/batches/GrAAConvexPathRenderer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698