aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrStyle.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-05-10 09:14:17 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-10 09:14:17 -0700
commit6663acff010ce752e4bf778da81fa97448c9db31 (patch)
treeba48f7716f7ef948d9faac90599b8a555c0f51d3 /src/gpu/GrStyle.h
parent44d427e048b2e290e086dc2c9f9227818388ef17 (diff)
Replace GrStrokeInfo with GrStyle.
A side effect is that arbitrary path effects can no be pushed deeper into the Ganesh flow for paths. They may be applied by path renderers. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1957363002 Committed: https://skia.googlesource.com/skia/+/33595bdf4b64a745f6340338d307e806e96c587f Review-Url: https://codereview.chromium.org/1957363002
Diffstat (limited to 'src/gpu/GrStyle.h')
-rw-r--r--src/gpu/GrStyle.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gpu/GrStyle.h b/src/gpu/GrStyle.h
index 6166b56fb7..07efb40866 100644
--- a/src/gpu/GrStyle.h
+++ b/src/gpu/GrStyle.h
@@ -85,6 +85,11 @@ public:
this->initPathEffect(paint.getPathEffect());
}
+ explicit GrStyle(const SkPaint& paint, SkPaint::Style overrideStyle)
+ : fStrokeRec(paint, overrideStyle) {
+ this->initPathEffect(paint.getPathEffect());
+ }
+
GrStyle& operator=(const GrStyle& that) {
fPathEffect = that.fPathEffect;
fDashInfo = that.fDashInfo;
@@ -133,6 +138,12 @@ public:
return this->pathEffect() || (!fStrokeRec.isFillStyle() && !fStrokeRec.isHairlineStyle());
}
+ static SkScalar MatrixToScaleFactor(const SkMatrix& matrix) {
+ // getMaxScale will return -1 if the matrix has perspective. In that case we can use a scale
+ // factor of 1. This isn't necessarily a good choice and in the future we might consider
+ // taking a bounds here for the perspective case.
+ return SkScalarAbs(matrix.getMaxScale());
+ }
/**
* Applies just the path effect and returns remaining stroke information. This will fail if
* there is no path effect. dst may or may not have been overwritten on failure. Scale controls