Clean up tessellation cache in prep for other tesselation types
bug:15536396
Also fixes compilation warning, avoids SkPaint deep copy
Change-Id: I74334f08b1d34c6789aabf968ff62db5bacbed1b
diff --git a/libs/hwui/TessellationCache.h b/libs/hwui/TessellationCache.h
index d4ff943..688a699 100644
--- a/libs/hwui/TessellationCache.h
+++ b/libs/hwui/TessellationCache.h
@@ -50,30 +50,28 @@
enum Type {
kNone,
kRoundRect,
- kAmbientShadow,
- kSpotShadow
};
Type type;
+ float scaleX;
+ float scaleY;
bool aa;
SkPaint::Cap cap;
SkPaint::Style style;
float strokeWidth;
union Shape {
struct RoundRect {
- float mScaleX;
- float mScaleY;
- float mWidth;
- float mHeight;
- float mRx;
- float mRy;
+ float width;
+ float height;
+ float rx;
+ float ry;
} roundRect;
} shape;
Description();
- Description(Type type);
- Description(Type type, const SkPaint* paint);
+ Description(Type type, const Matrix4& transform, const SkPaint& paint);
hash_t hash() const;
+ void setupMatrixAndPaint(Matrix4* matrix, SkPaint* paint) const;
};
struct ShadowDescription {
@@ -123,12 +121,12 @@
// TODO: precache/get for Oval, Lines, Points, etc.
- void precacheRoundRect(const Matrix4& transform,
- float width, float height, float rx, float ry, const SkPaint* paint) {
- getRoundRectBuffer(transform, width, height, rx, ry, paint);
+ void precacheRoundRect(const Matrix4& transform, const SkPaint& paint,
+ float width, float height, float rx, float ry) {
+ getRoundRectBuffer(transform, paint, width, height, rx, ry);
}
- const VertexBuffer* getRoundRect(const Matrix4& transform,
- float width, float height, float rx, float ry, const SkPaint* paint);
+ const VertexBuffer* getRoundRect(const Matrix4& transform, const SkPaint& paint,
+ float width, float height, float rx, float ry);
void precacheShadows(const Matrix4* drawTransform, const Rect& localClip,
bool opaque, const SkPath* casterPerimeter,
@@ -146,14 +144,14 @@
class TessellationTask;
class TessellationProcessor;
+ typedef VertexBuffer* (*Tessellator)(const Description&);
- typedef VertexBuffer* (*Tessellator)(const Description&, const SkPaint&);
+ Buffer* getRectBuffer(const Matrix4& transform, const SkPaint& paint,
+ float width, float height);
+ Buffer* getRoundRectBuffer(const Matrix4& transform, const SkPaint& paint,
+ float width, float height, float rx, float ry);
- Buffer* getRoundRectBuffer(const Matrix4& transform,
- float width, float height, float rx, float ry, const SkPaint* paint);
-
- Buffer* getOrCreateBuffer(const Description& entry,
- Tessellator tessellator, const SkPaint* paint);
+ Buffer* getOrCreateBuffer(const Description& entry, Tessellator tessellator);
uint32_t mSize;
uint32_t mMaxSize;