diff options
author | Brian Salomon <bsalomon@google.com> | 2017-09-01 09:00:45 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-01 15:31:37 +0000 |
commit | 4f40caf33e15c4e2e21742854dfd5cfd31812c3f (patch) | |
tree | 626b1e828cb840095368e4f1ec4427ca06753d53 /src/gpu/GrShape.h | |
parent | 867017de0cd9d2104a291ddd6d6eef808edd82b6 (diff) |
Add methods for converting GrShape to filled style
Bug: skia:
Change-Id: I6726428d1358909972adec8d63686b637ef5bb5e
Reviewed-on: https://skia-review.googlesource.com/40222
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrShape.h')
-rw-r--r-- | src/gpu/GrShape.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gpu/GrShape.h b/src/gpu/GrShape.h index 5226c239cd..2b48eca633 100644 --- a/src/gpu/GrShape.h +++ b/src/gpu/GrShape.h @@ -30,7 +30,7 @@ * * Currently this can only be constructed from a path, rect, or rrect though it can become a path * applying style to the geometry. The idea is to expand this to cover most or all of the geometries - * that have SkCanvas::draw APIs. + * that have fast paths in the GPU backend. */ class GrShape { public: @@ -121,6 +121,25 @@ public: ~GrShape() { this->changeType(Type::kEmpty); } + /** + * Informs MakeFilled on how to modify that shape's fill rule when making a simple filled + * version of the shape. + */ + enum class FillInversion { + kPreserve, + kFlip, + kForceNoninverted, + kForceInverted + }; + /** + * Makes a filled shape from the pre-styled original shape and optionally modifies whether + * the fill is inverted or not. It's important to note that the original shape's geometry + * may already have been modified if doing so was neutral with respect to its style + * (e.g. filled paths are always closed when stored in a shape and dashed paths are always + * made non-inverted since dashing ignores inverseness). + */ + static GrShape MakeFilled(const GrShape& original, FillInversion = FillInversion::kPreserve); + const GrStyle& style() const { return fStyle; } /** @@ -347,6 +366,7 @@ public: void writeUnstyledKey(uint32_t* key) const; private: + enum class Type { kEmpty, kInvertedEmpty, |