| 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 "GrGpuResource.h" | 11 #include "GrGpuResource.h" |
| 12 #include "GrStrokeInfo.h" |
| 12 #include "SkPath.h" | 13 #include "SkPath.h" |
| 13 #include "SkRect.h" | 14 #include "SkRect.h" |
| 14 #include "SkStrokeRec.h" | |
| 15 | 15 |
| 16 class GrPath : public GrGpuResource { | 16 class GrPath : public GrGpuResource { |
| 17 public: | 17 public: |
| 18 SK_DECLARE_INST_COUNT(GrPath); | 18 SK_DECLARE_INST_COUNT(GrPath); |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * Initialize to a path with a fixed stroke. Stroke must not be hairline. | 21 * Initialize to a path with a fixed stroke. Stroke must not be hairline. |
| 22 */ | 22 */ |
| 23 GrPath(GrGpu* gpu, const SkPath& skPath, const SkStrokeRec& stroke) | 23 GrPath(GrGpu* gpu, const SkPath& skPath, const GrStrokeInfo& stroke) |
| 24 : INHERITED(gpu, kCached_LifeCycle), | 24 : INHERITED(gpu, kCached_LifeCycle) |
| 25 fSkPath(skPath), | 25 , fBounds(skPath.getBounds()) |
| 26 fStroke(stroke), | 26 #ifdef SK_DEBUG |
| 27 fBounds(skPath.getBounds()) { | 27 , fSkPath(skPath) |
| 28 , fStroke(stroke) |
| 29 #endif |
| 30 { |
| 28 } | 31 } |
| 29 | 32 |
| 30 static void ComputeKey(const SkPath& path, const SkStrokeRec& stroke, GrUniq
ueKey* key); | 33 static void ComputeKey(const SkPath& path, const GrStrokeInfo& stroke, GrUni
queKey* key); |
| 31 static uint64_t ComputeStrokeKey(const SkStrokeRec&); | |
| 32 | |
| 33 bool isEqualTo(const SkPath& path, const SkStrokeRec& stroke) { | |
| 34 return fSkPath == path && fStroke.hasEqualEffect(stroke); | |
| 35 } | |
| 36 | 34 |
| 37 const SkRect& getBounds() const { return fBounds; } | 35 const SkRect& getBounds() const { return fBounds; } |
| 38 | 36 |
| 39 const SkStrokeRec& getStroke() const { return fStroke; } | 37 #ifdef SK_DEBUG |
| 38 bool isEqualTo(const SkPath& path, const GrStrokeInfo& stroke) { |
| 39 return fSkPath == path && fStroke.hasEqualEffect(stroke); |
| 40 } |
| 41 #endif |
| 40 | 42 |
| 41 protected: | 43 protected: |
| 44 SkRect fBounds; |
| 45 #ifdef SK_DEBUG |
| 42 SkPath fSkPath; | 46 SkPath fSkPath; |
| 43 SkStrokeRec fStroke; | 47 GrStrokeInfo fStroke; |
| 44 SkRect fBounds; | 48 #endif |
| 45 | 49 |
| 46 private: | 50 private: |
| 47 typedef GrGpuResource INHERITED; | 51 typedef GrGpuResource INHERITED; |
| 48 }; | 52 }; |
| 49 | 53 |
| 50 #endif | 54 #endif |
| OLD | NEW |