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/playback/display_item.h" | 14 #include "cc/playback/display_item.h" |
15 #include "third_party/skia/include/core/SkPath.h" | 15 #include "third_party/skia/include/core/SkPath.h" |
16 #include "third_party/skia/include/core/SkRegion.h" | 16 #include "third_party/skia/include/core/SkRegion.h" |
17 | 17 |
18 class SkCanvas; | 18 class SkCanvas; |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 class ImageSerializationProcessor; | |
22 | 21 |
23 class CC_EXPORT ClipPathDisplayItem : public DisplayItem { | 22 class CC_EXPORT ClipPathDisplayItem : public DisplayItem { |
24 public: | 23 public: |
25 ClipPathDisplayItem(const SkPath& path, SkRegion::Op clip_op, bool antialias); | 24 ClipPathDisplayItem(const SkPath& path, SkRegion::Op clip_op, bool antialias); |
26 explicit ClipPathDisplayItem(const proto::DisplayItem& proto); | 25 explicit ClipPathDisplayItem(const proto::DisplayItem& proto); |
27 ~ClipPathDisplayItem() override; | 26 ~ClipPathDisplayItem() override; |
28 | 27 |
29 void ToProtobuf(proto::DisplayItem* proto, | 28 void ToProtobuf(proto::DisplayItem* proto) const override; |
30 ImageSerializationProcessor* image_serialization_processor) | |
31 const override; | |
32 void Raster(SkCanvas* canvas, | 29 void Raster(SkCanvas* canvas, |
33 SkPicture::AbortCallback* callback) const override; | 30 SkPicture::AbortCallback* callback) const override; |
34 void AsValueInto(const gfx::Rect& visual_rect, | 31 void AsValueInto(const gfx::Rect& visual_rect, |
35 base::trace_event::TracedValue* array) const override; | 32 base::trace_event::TracedValue* array) const override; |
36 size_t ExternalMemoryUsage() const override; | 33 size_t ExternalMemoryUsage() const override; |
37 | 34 |
38 int ApproximateOpCount() const { return 1; } | 35 int ApproximateOpCount() const { return 1; } |
39 | 36 |
40 private: | 37 private: |
41 void SetNew(const SkPath& path, SkRegion::Op clip_op, bool antialias); | 38 void SetNew(const SkPath& path, SkRegion::Op clip_op, bool antialias); |
42 | 39 |
43 SkPath clip_path_; | 40 SkPath clip_path_; |
44 SkRegion::Op clip_op_; | 41 SkRegion::Op clip_op_; |
45 bool antialias_; | 42 bool antialias_; |
46 }; | 43 }; |
47 | 44 |
48 class CC_EXPORT EndClipPathDisplayItem : public DisplayItem { | 45 class CC_EXPORT EndClipPathDisplayItem : public DisplayItem { |
49 public: | 46 public: |
50 EndClipPathDisplayItem(); | 47 EndClipPathDisplayItem(); |
51 explicit EndClipPathDisplayItem(const proto::DisplayItem& proto); | 48 explicit EndClipPathDisplayItem(const proto::DisplayItem& proto); |
52 ~EndClipPathDisplayItem() override; | 49 ~EndClipPathDisplayItem() override; |
53 | 50 |
54 static std::unique_ptr<EndClipPathDisplayItem> Create() { | 51 static std::unique_ptr<EndClipPathDisplayItem> Create() { |
55 return base::WrapUnique(new EndClipPathDisplayItem()); | 52 return base::WrapUnique(new EndClipPathDisplayItem()); |
56 } | 53 } |
57 | 54 |
58 void ToProtobuf(proto::DisplayItem* proto, | 55 void ToProtobuf(proto::DisplayItem* proto) const override; |
59 ImageSerializationProcessor* image_serialization_processor) | |
60 const override; | |
61 void Raster(SkCanvas* canvas, | 56 void Raster(SkCanvas* canvas, |
62 SkPicture::AbortCallback* callback) const override; | 57 SkPicture::AbortCallback* callback) const override; |
63 void AsValueInto(const gfx::Rect& visual_rect, | 58 void AsValueInto(const gfx::Rect& visual_rect, |
64 base::trace_event::TracedValue* array) const override; | 59 base::trace_event::TracedValue* array) const override; |
65 size_t ExternalMemoryUsage() const override; | 60 size_t ExternalMemoryUsage() const override; |
66 | 61 |
67 int ApproximateOpCount() const { return 0; } | 62 int ApproximateOpCount() const { return 0; } |
68 }; | 63 }; |
69 | 64 |
70 } // namespace cc | 65 } // namespace cc |
71 | 66 |
72 #endif // CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ | 67 #endif // CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ |
OLD | NEW |