bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 1 | /* |
2 | * Copyright 2012 Google Inc. | ||||
3 | * | ||||
4 | * Use of this source code is governed by a BSD-style license that can be | ||||
5 | * found in the LICENSE file. | ||||
6 | */ | ||||
7 | |||||
8 | #ifndef GrPath_DEFINED | ||||
9 | #define GrPath_DEFINED | ||||
10 | |||||
bsalomon | 6d3fe02 | 2014-07-25 08:35:45 -0700 | [diff] [blame] | 11 | #include "GrGpuResource.h" |
kkinnunen | c6e7a13 | 2015-12-07 23:39:01 -0800 | [diff] [blame] | 12 | #include "GrPathRendering.h" |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 13 | #include "GrStyle.h" |
commit-bot@chromium.org | 5c8ee25 | 2013-11-01 15:23:44 +0000 | [diff] [blame] | 14 | #include "SkPath.h" |
commit-bot@chromium.org | fd03d4a | 2013-07-17 21:39:42 +0000 | [diff] [blame] | 15 | #include "SkRect.h" |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 16 | |
bsalomon | 7bffcd2 | 2016-09-15 13:55:33 -0700 | [diff] [blame] | 17 | class GrShape; |
18 | |||||
bsalomon | 6d3fe02 | 2014-07-25 08:35:45 -0700 | [diff] [blame] | 19 | class GrPath : public GrGpuResource { |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 20 | public: |
cdalton | b85a0aa | 2014-07-21 15:32:44 -0700 | [diff] [blame] | 21 | /** |
22 | * Initialize to a path with a fixed stroke. Stroke must not be hairline. | ||||
23 | */ | ||||
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 24 | GrPath(GrGpu* gpu, const SkPath& skPath, const GrStyle& style) |
kkinnunen | 2e6055b | 2016-04-22 01:48:29 -0700 | [diff] [blame] | 25 | : INHERITED(gpu) |
kkinnunen | c6e7a13 | 2015-12-07 23:39:01 -0800 | [diff] [blame] | 26 | , fBounds(SkRect::MakeEmpty()) |
27 | , fFillType(GrPathRendering::kWinding_FillType) | ||||
kkinnunen | 50b58e6 | 2015-05-18 23:02:07 -0700 | [diff] [blame] | 28 | #ifdef SK_DEBUG |
29 | , fSkPath(skPath) | ||||
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 30 | , fStyle(style) |
kkinnunen | 50b58e6 | 2015-05-18 23:02:07 -0700 | [diff] [blame] | 31 | #endif |
32 | { | ||||
commit-bot@chromium.org | 5c8ee25 | 2013-11-01 15:23:44 +0000 | [diff] [blame] | 33 | } |
34 | |||||
bsalomon | 7bffcd2 | 2016-09-15 13:55:33 -0700 | [diff] [blame] | 35 | static void ComputeKey(const GrShape&, GrUniqueKey* key, bool* outIsVolatile); |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 36 | |
commit-bot@chromium.org | fd03d4a | 2013-07-17 21:39:42 +0000 | [diff] [blame] | 37 | const SkRect& getBounds() const { return fBounds; } |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 38 | |
kkinnunen | c6e7a13 | 2015-12-07 23:39:01 -0800 | [diff] [blame] | 39 | GrPathRendering::FillType getFillType() const { return fFillType; } |
kkinnunen | 50b58e6 | 2015-05-18 23:02:07 -0700 | [diff] [blame] | 40 | #ifdef SK_DEBUG |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 41 | bool isEqualTo(const SkPath& path, const GrStyle& style) const; |
kkinnunen | 50b58e6 | 2015-05-18 23:02:07 -0700 | [diff] [blame] | 42 | #endif |
commit-bot@chromium.org | 32184d8 | 2013-10-09 15:14:18 +0000 | [diff] [blame] | 43 | |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 44 | protected: |
kkinnunen | c6e7a13 | 2015-12-07 23:39:01 -0800 | [diff] [blame] | 45 | // Subclass should init these. |
commit-bot@chromium.org | 5c8ee25 | 2013-11-01 15:23:44 +0000 | [diff] [blame] | 46 | SkRect fBounds; |
kkinnunen | c6e7a13 | 2015-12-07 23:39:01 -0800 | [diff] [blame] | 47 | GrPathRendering::FillType fFillType; |
kkinnunen | 50b58e6 | 2015-05-18 23:02:07 -0700 | [diff] [blame] | 48 | #ifdef SK_DEBUG |
49 | SkPath fSkPath; | ||||
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 50 | GrStyle fStyle; |
kkinnunen | 50b58e6 | 2015-05-18 23:02:07 -0700 | [diff] [blame] | 51 | #endif |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 52 | |
53 | private: | ||||
bsalomon | 6d3fe02 | 2014-07-25 08:35:45 -0700 | [diff] [blame] | 54 | typedef GrGpuResource INHERITED; |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 55 | }; |
56 | |||||
57 | #endif |