OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrPath_DEFINED | 8 #ifndef GrPath_DEFINED |
9 #define GrPath_DEFINED | 9 #define GrPath_DEFINED |
10 | 10 |
11 #include "GrResource.h" | 11 #include "GrResource.h" |
| 12 #include "GrResourceCache.h" |
| 13 #include "SkPath.h" |
12 #include "SkRect.h" | 14 #include "SkRect.h" |
13 #include "SkStrokeRec.h" | 15 #include "SkStrokeRec.h" |
14 | 16 |
15 class GrPath : public GrResource { | 17 class GrPath : public GrResource { |
16 public: | 18 public: |
17 SK_DECLARE_INST_COUNT(GrPath); | 19 SK_DECLARE_INST_COUNT(GrPath); |
18 | 20 |
19 GrPath(GrGpu* gpu, bool isWrapped, const SkStrokeRec& stroke) | 21 GrPath(GrGpu* gpu, bool isWrapped, const SkPath& skPath, const SkStrokeRec&
stroke) |
20 : INHERITED(gpu, isWrapped), | 22 : INHERITED(gpu, isWrapped), |
21 fStroke(stroke) { | 23 fSkPath(skPath), |
| 24 fStroke(stroke), |
| 25 fBounds(skPath.getBounds()) { |
| 26 } |
| 27 |
| 28 static GrResourceKey ComputeKey(const SkPath& path, const SkStrokeRec& strok
e); |
| 29 |
| 30 bool isEqualTo(const SkPath& path, const SkStrokeRec& stroke) { |
| 31 return fSkPath == path && fStroke == stroke; |
22 } | 32 } |
23 | 33 |
24 const SkRect& getBounds() const { return fBounds; } | 34 const SkRect& getBounds() const { return fBounds; } |
25 | 35 |
26 const SkStrokeRec& getStroke() const { return fStroke; } | 36 const SkStrokeRec& getStroke() const { return fStroke; } |
27 | 37 |
28 protected: | 38 protected: |
| 39 SkPath fSkPath; |
| 40 SkStrokeRec fStroke; |
29 SkRect fBounds; | 41 SkRect fBounds; |
30 SkStrokeRec fStroke; | |
31 | 42 |
32 private: | 43 private: |
33 typedef GrResource INHERITED; | 44 typedef GrResource INHERITED; |
34 }; | 45 }; |
35 | 46 |
36 #endif | 47 #endif |
OLD | NEW |