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>
diff --git a/src/gpu/ccpr/GrCCPathProcessor.h b/src/gpu/ccpr/GrCCPathProcessor.h
index 40b16a4..4789326 100644
--- a/src/gpu/ccpr/GrCCPathProcessor.h
+++ b/src/gpu/ccpr/GrCCPathProcessor.h
@@ -32,8 +32,6 @@
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 @@
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 @@
private:
const SkPath::FillType fFillType;
const TextureSampler fAtlasAccess;
+ SkMatrix fLocalMatrix;
typedef GrGeometryProcessor INHERITED;
};