const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<DefaultGeoProc>(primProc, pdman, index, transforms);
+ this->setTransformDataHelper(primProc.cast<DefaultGeoProc>().fLocalMatrix, pdman, index,
+ transforms);
}
private:
bool implementsDistanceVector() const override { return true; };
- const SkMatrix& localMatrix() const { return fLocalMatrix; }
-
virtual ~CircleGeometryProcessor() {}
const char* name() const override { return "CircleEdge"; }
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<CircleGeometryProcessor>(primProc, pdman, index,
- transforms);
+ this->setTransformDataHelper(primProc.cast<CircleGeometryProcessor>().fLocalMatrix,
+ pdman, index, transforms);
}
private:
const char* name() const override { return "EllipseEdge"; }
- const SkMatrix& localMatrix() const { return fLocalMatrix; }
-
void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
GLSLProcessor::GenKey(*this, caps, b);
}
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<EllipseGeometryProcessor>(primProc, pdman, index,
- transforms);
+ this->setTransformDataHelper(primProc.cast<EllipseGeometryProcessor>().fLocalMatrix,
+ pdman, index, transforms);
}
private:
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<QuadEdgeEffect>(primProc, pdman, index, transforms);
+ this->setTransformDataHelper(primProc.cast<QuadEdgeEffect>().fLocalMatrix, pdman, index,
+ transforms);
}
private:
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<RectGeometryProcessor>(primProc, pdman, index, transforms);
+ this->setTransformDataHelper(primProc.cast<RectGeometryProcessor>().fLocalMatrix, pdman,
+ index, transforms);
}
private:
const Attribute* inUV() const { return fInUV; }
const Attribute* inColor() const { return fInColor; }
const SkMatrix& viewMatrix() const { return fViewMatrix; }
- const SkMatrix& localMatrix() const { return SkMatrix::I(); }
class GLSLProcessor : public GrGLSLGeometryProcessor {
public:
}
}
- void setTransformData(const GrPrimitiveProcessor& primProc,
- const GrGLSLProgramDataManager& pdman,
- int index,
- const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<MSAAQuadProcessor>(primProc, pdman, index, transforms);
- }
-
private:
typedef GrGLSLGeometryProcessor INHERITED;
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<PLSAATriangleEffect>(primProc, pdman, index, transforms);
+ this->setTransformDataHelper(primProc.cast<PLSAATriangleEffect>().fLocalMatrix, pdman,
+ index, transforms);
}
private:
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<PLSQuadEdgeEffect>(primProc, pdman, index, transforms);
+ this->setTransformDataHelper(primProc.cast<PLSQuadEdgeEffect>().fLocalMatrix, pdman,
+ index, transforms);
}
private:
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<PLSFinishEffect>(primProc, pdman, index, transforms);
+ this->setTransformDataHelper(primProc.cast<PLSFinishEffect>().fLocalMatrix, pdman,
+ index, transforms);
}
private:
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<GrConicEffect>(primProc, pdman, index, transforms);
+ this->setTransformDataHelper(primProc.cast<GrConicEffect>().localMatrix(), pdman, index,
+ transforms);
}
private:
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<GrQuadEffect>(primProc, pdman, index, transforms);
+ this->setTransformDataHelper(primProc.cast<GrQuadEffect>().localMatrix(), pdman, index,
+ transforms);
}
private:
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<GrBitmapTextGeoProc>(primProc, pdman, index, transforms);
+ this->setTransformDataHelper(primProc.cast<GrBitmapTextGeoProc>().localMatrix(), pdman,
+ index, transforms);
}
static inline void GenKey(const GrGeometryProcessor& proc,
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<DashingCircleEffect>(primProc, pdman, index, transforms);
+ this->setTransformDataHelper(primProc.cast<DashingCircleEffect>().localMatrix(), pdman,
+ index, transforms);
}
private:
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) override {
- this->setTransformDataHelper<DashingLineEffect>(primProc, pdman, index, transforms);
+ this->setTransformDataHelper(primProc.cast<DashingLineEffect>().localMatrix(), pdman, index,
+ transforms);
}
private:
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.
}
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 {