OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ | 5 #ifndef CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ |
6 #define CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ | 6 #define CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
| 14 #include "cc/paint/paint_canvas.h" |
14 #include "cc/playback/display_item.h" | 15 #include "cc/playback/display_item.h" |
15 #include "third_party/skia/include/core/SkPath.h" | 16 #include "third_party/skia/include/core/SkPath.h" |
16 | 17 |
17 class SkCanvas; | |
18 | |
19 namespace cc { | 18 namespace cc { |
20 | 19 |
21 class CC_EXPORT ClipPathDisplayItem : public DisplayItem { | 20 class CC_EXPORT ClipPathDisplayItem : public DisplayItem { |
22 public: | 21 public: |
23 ClipPathDisplayItem(const SkPath& path, bool antialias); | 22 ClipPathDisplayItem(const SkPath& path, bool antialias); |
24 explicit ClipPathDisplayItem(const proto::DisplayItem& proto); | 23 explicit ClipPathDisplayItem(const proto::DisplayItem& proto); |
25 ~ClipPathDisplayItem() override; | 24 ~ClipPathDisplayItem() override; |
26 | 25 |
27 void ToProtobuf(proto::DisplayItem* proto) const override; | 26 void ToProtobuf(proto::DisplayItem* proto) const override; |
28 void Raster(SkCanvas* canvas, | 27 void Raster(PaintCanvas* canvas, |
29 SkPicture::AbortCallback* callback) const override; | 28 PaintRecord::AbortCallback* callback) const override; |
30 void AsValueInto(const gfx::Rect& visual_rect, | 29 void AsValueInto(const gfx::Rect& visual_rect, |
31 base::trace_event::TracedValue* array) const override; | 30 base::trace_event::TracedValue* array) const override; |
32 | 31 |
33 size_t ExternalMemoryUsage() const { | 32 size_t ExternalMemoryUsage() const { |
34 // The size of SkPath's external storage is not currently accounted for (and | 33 // The size of SkPath's external storage is not currently accounted for (and |
35 // may well be shared anyway). | 34 // may well be shared anyway). |
36 return 0; | 35 return 0; |
37 } | 36 } |
38 int ApproximateOpCount() const { return 1; } | 37 int ApproximateOpCount() const { return 1; } |
39 | 38 |
40 private: | 39 private: |
41 void SetNew(const SkPath& path, bool antialias); | 40 void SetNew(const SkPath& path, bool antialias); |
42 | 41 |
43 SkPath clip_path_; | 42 SkPath clip_path_; |
44 bool antialias_; | 43 bool antialias_; |
45 }; | 44 }; |
46 | 45 |
47 class CC_EXPORT EndClipPathDisplayItem : public DisplayItem { | 46 class CC_EXPORT EndClipPathDisplayItem : public DisplayItem { |
48 public: | 47 public: |
49 EndClipPathDisplayItem(); | 48 EndClipPathDisplayItem(); |
50 explicit EndClipPathDisplayItem(const proto::DisplayItem& proto); | 49 explicit EndClipPathDisplayItem(const proto::DisplayItem& proto); |
51 ~EndClipPathDisplayItem() override; | 50 ~EndClipPathDisplayItem() override; |
52 | 51 |
53 static std::unique_ptr<EndClipPathDisplayItem> Create() { | 52 static std::unique_ptr<EndClipPathDisplayItem> Create() { |
54 return base::MakeUnique<EndClipPathDisplayItem>(); | 53 return base::MakeUnique<EndClipPathDisplayItem>(); |
55 } | 54 } |
56 | 55 |
57 void ToProtobuf(proto::DisplayItem* proto) const override; | 56 void ToProtobuf(proto::DisplayItem* proto) const override; |
58 void Raster(SkCanvas* canvas, | 57 void Raster(PaintCanvas* canvas, |
59 SkPicture::AbortCallback* callback) const override; | 58 PaintRecord::AbortCallback* callback) const override; |
60 void AsValueInto(const gfx::Rect& visual_rect, | 59 void AsValueInto(const gfx::Rect& visual_rect, |
61 base::trace_event::TracedValue* array) const override; | 60 base::trace_event::TracedValue* array) const override; |
62 | 61 |
63 int ApproximateOpCount() const { return 0; } | 62 int ApproximateOpCount() const { return 0; } |
64 }; | 63 }; |
65 | 64 |
66 } // namespace cc | 65 } // namespace cc |
67 | 66 |
68 #endif // CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ | 67 #endif // CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ |
OLD | NEW |