diff options
author | Chris Dalton <csmartdalton@google.com> | 2018-05-22 13:09:48 -0600 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-22 19:34:46 +0000 |
commit | 1c5489412de12ab9afdbc0085e65418ca8753b43 (patch) | |
tree | c153d1e151f6ea23dec4f51fb58ed935e42e213e /src/gpu/ccpr/GrCCPathProcessor.h | |
parent | 91dfa3b571f1048d70033385de2c0c8b4a07373f (diff) |
ccpr: Remove local matrix data from path instances
Uses the built-in local matrix code instead trying to bake it into the
path instance data. If we find a case that can benefit from this type
of optimization in the future, we can use something like a texel
buffer and send in all of the coord transform data -- not just the
local matrix.
Bug: skia:
Change-Id: I194bc9e4f83e588f8aa93a1a4d40097475d84977
Reviewed-on: https://skia-review.googlesource.com/129332
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/ccpr/GrCCPathProcessor.h')
-rw-r--r-- | src/gpu/ccpr/GrCCPathProcessor.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gpu/ccpr/GrCCPathProcessor.h b/src/gpu/ccpr/GrCCPathProcessor.h index 40b16a4e9d..47893266da 100644 --- a/src/gpu/ccpr/GrCCPathProcessor.h +++ b/src/gpu/ccpr/GrCCPathProcessor.h @@ -32,8 +32,6 @@ public: enum class InstanceAttribs { kDevBounds, kDevBounds45, - kViewMatrix, // FIXME: This causes a lot of duplication. It could move to a texel buffer. - kViewTranslate, kAtlasOffset, kColor }; @@ -43,24 +41,24 @@ public: SkRect fDevBounds; SkRect fDevBounds45; // Bounding box in "| 1 -1 | * devCoords" space. // | 1 1 | - std::array<float, 4> fViewMatrix; // {kScaleX, kSkewy, kSkewX, kScaleY} - std::array<float, 2> fViewTranslate; std::array<int16_t, 2> fAtlasOffset; uint32_t fColor; GR_STATIC_ASSERT(SK_SCALAR_IS_FLOAT); }; - GR_STATIC_ASSERT(4 * 16 == sizeof(Instance)); + GR_STATIC_ASSERT(4 * 10 == sizeof(Instance)); static sk_sp<const GrBuffer> FindVertexBuffer(GrOnFlushResourceProvider*); static sk_sp<const GrBuffer> FindIndexBuffer(GrOnFlushResourceProvider*); - GrCCPathProcessor(GrResourceProvider*, sk_sp<GrTextureProxy> atlas, SkPath::FillType); + GrCCPathProcessor(GrResourceProvider*, sk_sp<GrTextureProxy> atlas, SkPath::FillType, + const SkMatrix& viewMatrixIfUsingLocalCoords = SkMatrix::I()); const char* name() const override { return "GrCCPathProcessor"; } const GrSurfaceProxy* atlasProxy() const { return fAtlasAccess.proxy(); } const GrTexture* atlas() const { return fAtlasAccess.peekTexture(); } + const SkMatrix& localMatrix() const { return fLocalMatrix; } SkPath::FillType fillType() const { return fFillType; } const Attribute& getInstanceAttrib(InstanceAttribs attribID) const { const Attribute& attrib = this->getAttrib((int)attribID); @@ -84,6 +82,7 @@ public: private: const SkPath::FillType fFillType; const TextureSampler fAtlasAccess; + SkMatrix fLocalMatrix; typedef GrGeometryProcessor INHERITED; }; |