aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrShape.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-05-04 08:27:41 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-04 08:27:42 -0700
commitfb08327e592a1dd19a0c3107243ccd01f6b7f848 (patch)
tree91f622773ed07e4d233ab9d66f0bad7cabbf1bdf /src/gpu/GrShape.h
parent419ca64f0f800dc098369b5aa5a604acd017b240 (diff)
Expand GrStyle's interface.
Adds some basic getters on GrStyle as well as static const instances for fill and hairline. Adds the ability to apply a GrStyle to a SkPath to produce an output SkPath. Moves style key functions from GrShape to GrStyle. Also fixes some issues with SkPath creation when applying style to GrShapes. Adds tests that GrShape produces the correct SkPath when its GrStyle is applied. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1951613002 Review-Url: https://codereview.chromium.org/1951613002
Diffstat (limited to 'src/gpu/GrShape.h')
-rw-r--r--src/gpu/GrShape.h32
1 files changed, 3 insertions, 29 deletions
diff --git a/src/gpu/GrShape.h b/src/gpu/GrShape.h
index 0e863e2c6e..efc28cf737 100644
--- a/src/gpu/GrShape.h
+++ b/src/gpu/GrShape.h
@@ -106,19 +106,7 @@ public:
const GrStyle& style() const { return fStyle; }
- /**
- * Returns a GrShape where the shape's geometry fully reflects the original shape's GrStyle.
- * The GrStyle of the returned shape will either be fill or hairline.
- */
- GrShape applyFullStyle() { return GrShape(*this, false); }
-
- /**
- * Similar to above but applies only the path effect. Path effects take the original geometry
- * and fill/stroking information and compute a new geometry and residual fill/stroking
- * information to be applied. The path effect's output geometry and stroking will be captured
- * in the returned GrShape.
- */
- GrShape applyPathEffect() { return GrShape(*this, true); }
+ GrShape applyStyle(GrStyle::Apply apply) { return GrShape(*this, apply); }
bool asRRect(SkRRect* rrect) const {
if (Type::kRRect != fType) {
@@ -165,29 +153,15 @@ private:
kPath,
};
- /**
- * Computes the key length for a GrStyle. The return will be negative if it cannot be turned
- * into a key.
- */
- static int StyleKeySize(const GrStyle& , bool stopAfterPE);
-
- /**
- * Writes a unique key for the style into the provided buffer. This function assumes the buffer
- * has room for at least StyleKeySize() values. It assumes that StyleKeySize() returns a
- * positive value for the style and stopAfterPE param. This is written so that the key for just
- * dash application followed by the key for the remaining SkStrokeRec is the same as the
- * key for applying dashing and SkStrokeRec all at once.
- */
- static void StyleKey(uint32_t*, const GrStyle&, bool stopAfterPE);
/** Constructor used by Apply* functions */
- GrShape(const GrShape& parentShape, bool stopAfterPE);
+ GrShape(const GrShape& parentShape, GrStyle::Apply);
/**
* Determines the key we should inherit from the input shape's geometry and style when
* we are applying the style to create a new shape.
*/
- void setInheritedKey(const GrShape& parentShape, bool stopAfterPE);
+ void setInheritedKey(const GrShape& parentShape, GrStyle::Apply);
void attemptToReduceFromPath() {
SkASSERT(Type::kPath == fType);