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

Unified Diff: src/gpu/glsl/GrGLSLGeometryProcessor.h

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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/glsl/GrGLSLGeometryProcessor.h
diff --git a/src/gpu/glsl/GrGLSLGeometryProcessor.h b/src/gpu/glsl/GrGLSLGeometryProcessor.h
index 72f00f15090ae372085e0005167ff4ea4b00f240..00652a5b99bd2b07834ea55f5e0f4f0bd7a2ff67 100644
--- a/src/gpu/glsl/GrGLSLGeometryProcessor.h
+++ b/src/gpu/glsl/GrGLSLGeometryProcessor.h
@@ -27,18 +27,25 @@ public:
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataMatrix(SkMatrix::I(), pdman, index, transforms);
+ this->setTransformDataHelper(SkMatrix::I(), pdman, index, transforms);
}
protected:
- // A helper which subclasses can use if needed
- template <class GeometryProcessor>
- void setTransformDataHelper(const GrPrimitiveProcessor& primProc,
+ // A helper which subclasses can use if needed and used above in the default setTransformData().
+ void setTransformDataHelper(const SkMatrix& localMatrix,
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) {
- const GeometryProcessor& gp = primProc.cast<GeometryProcessor>();
- this->setTransformDataMatrix(gp.localMatrix(), pdman, index, transforms);
+ SkSTArray<2, UniformTransform, true>& procTransforms = fInstalledTransforms[index];
+ int numTransforms = transforms.count();
+ for (int t = 0; t < numTransforms; ++t) {
+ SkASSERT(procTransforms[t].fHandle.isValid());
+ const SkMatrix& transform = GetTransformMatrix(localMatrix, *transforms[t]);
+ if (!procTransforms[t].fCurrentValue.cheapEqualTo(transform)) {
+ pdman.setSkMatrix(procTransforms[t].fHandle.toIndex(), transform);
+ procTransforms[t].fCurrentValue = transform;
+ }
+ }
}
// Emit a uniform matrix for each coord transform.
@@ -96,22 +103,6 @@ protected:
}
private:
- void setTransformDataMatrix(const SkMatrix& localMatrix,
- const GrGLSLProgramDataManager& pdman,
- int index,
- const SkTArray<const GrCoordTransform*, true>& transforms) {
- SkSTArray<2, UniformTransform, true>& procTransforms = fInstalledTransforms[index];
- int numTransforms = transforms.count();
- for (int t = 0; t < numTransforms; ++t) {
- SkASSERT(procTransforms[t].fHandle.isValid());
- const SkMatrix& transform = GetTransformMatrix(localMatrix, *transforms[t]);
- if (!procTransforms[t].fCurrentValue.cheapEqualTo(transform)) {
- pdman.setSkMatrix(procTransforms[t].fHandle.toIndex(), transform);
- procTransforms[t].fCurrentValue = transform;
- }
- }
- }
-
virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0;
struct UniformTransform : public Transform {
« src/gpu/batches/GrAnalyticRectBatch.cpp ('K') | « src/gpu/effects/GrDashingEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698