diff options
author | joshualitt <joshualitt@chromium.org> | 2015-07-28 10:01:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-28 10:01:18 -0700 |
commit | 0d986d877edae36ad7dc6fbdbc69a56ca9372702 (patch) | |
tree | dde0c889d166d9021f0f1fea43e182b422cd59bf /src/gpu/GrDefaultGeoProcFactory.h | |
parent | b542bae1f5a2726e52a15fa90acec7e7b935cb71 (diff) |
Cleanup GrDefaultGeoProcFactory localCoords
TBR=bsalomon@google.com
BUG=skia:
Review URL: https://codereview.chromium.org/1257193002
Diffstat (limited to 'src/gpu/GrDefaultGeoProcFactory.h')
-rw-r--r-- | src/gpu/GrDefaultGeoProcFactory.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/gpu/GrDefaultGeoProcFactory.h b/src/gpu/GrDefaultGeoProcFactory.h index 86c59c40e1..243685439d 100644 --- a/src/gpu/GrDefaultGeoProcFactory.h +++ b/src/gpu/GrDefaultGeoProcFactory.h @@ -111,26 +111,36 @@ public: struct LocalCoords { enum Type { - kNone_Type, + kUnused_Type, kUsePosition_Type, kHasExplicit_Type, }; + LocalCoords(Type type) : fType(type), fMatrix(NULL) {} + LocalCoords(Type type, const SkMatrix* matrix) : fType(type), fMatrix(matrix) { + SkASSERT(kUnused_Type != type); + } + bool hasLocalMatrix() const { return NULL != fMatrix; } + + Type fType; + const SkMatrix* fMatrix; }; static const GrGeometryProcessor* Create(const Color&, const Coverage&, - LocalCoords::Type, - const SkMatrix& viewMatrix = SkMatrix::I(), - const SkMatrix& localMatrix = SkMatrix::I()); + const LocalCoords&, + const SkMatrix& viewMatrix = SkMatrix::I()); /* - * The following functions are used to create default GPs. If you just need to create - * attributes separately from creating the default GP, use the SetAttribs function followed - * by the Create function. Otherwise use CreateAndSetAttribs to do both at once. - * - * You must unref the return from Create. + * Use this factory to create a GrGeometryProcessor that expects a device space vertex position + * attribute. The view matrix must still be provided to compute correctly transformed + * coordinates for GrFragmentProcessors. It may fail if the view matrix is not invertible. */ - // TODO clean this up + static const GrGeometryProcessor* CreateForDeviceSpace(const Color&, + const Coverage&, + const LocalCoords&, + const SkMatrix& viewMatrix); + + // TODO deprecate this static const GrGeometryProcessor* Create(uint32_t gpTypeFlags, GrColor, bool localCoordsWillBeRead, |