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 const gfx::Rect& canvas_target_playback_rect, | 30 const gfx::Rect& canvas_target_playback_rect, |
34 SkPicture::AbortCallback* callback) const override; | 31 SkPicture::AbortCallback* callback) const override; |
35 void AsValueInto(const gfx::Rect& visual_rect, | 32 void AsValueInto(const gfx::Rect& visual_rect, |
36 base::trace_event::TracedValue* array) const override; | 33 base::trace_event::TracedValue* array) const override; |
37 size_t ExternalMemoryUsage() const override; | 34 size_t ExternalMemoryUsage() const override; |
38 | 35 |
39 int ApproximateOpCount() const { return 1; } | 36 int ApproximateOpCount() const { return 1; } |
40 bool IsSuitableForGpuRasterization() const { return true; } | 37 bool IsSuitableForGpuRasterization() const { return true; } |
41 | 38 |
42 private: | 39 private: |
43 void SetNew(const SkPath& path, SkRegion::Op clip_op, bool antialias); | 40 void SetNew(const SkPath& path, SkRegion::Op clip_op, bool antialias); |
44 | 41 |
45 SkPath clip_path_; | 42 SkPath clip_path_; |
46 SkRegion::Op clip_op_; | 43 SkRegion::Op clip_op_; |
47 bool antialias_; | 44 bool antialias_; |
48 }; | 45 }; |
49 | 46 |
50 class CC_EXPORT EndClipPathDisplayItem : public DisplayItem { | 47 class CC_EXPORT EndClipPathDisplayItem : public DisplayItem { |
51 public: | 48 public: |
52 EndClipPathDisplayItem(); | 49 EndClipPathDisplayItem(); |
53 explicit EndClipPathDisplayItem(const proto::DisplayItem& proto); | 50 explicit EndClipPathDisplayItem(const proto::DisplayItem& proto); |
54 ~EndClipPathDisplayItem() override; | 51 ~EndClipPathDisplayItem() override; |
55 | 52 |
56 static std::unique_ptr<EndClipPathDisplayItem> Create() { | 53 static std::unique_ptr<EndClipPathDisplayItem> Create() { |
57 return base::WrapUnique(new EndClipPathDisplayItem()); | 54 return base::WrapUnique(new EndClipPathDisplayItem()); |
58 } | 55 } |
59 | 56 |
60 void ToProtobuf(proto::DisplayItem* proto, | 57 void ToProtobuf(proto::DisplayItem* proto) const override; |
61 ImageSerializationProcessor* image_serialization_processor) | |
62 const override; | |
63 void Raster(SkCanvas* canvas, | 58 void Raster(SkCanvas* canvas, |
64 const gfx::Rect& canvas_target_playback_rect, | 59 const gfx::Rect& canvas_target_playback_rect, |
65 SkPicture::AbortCallback* callback) const override; | 60 SkPicture::AbortCallback* callback) const override; |
66 void AsValueInto(const gfx::Rect& visual_rect, | 61 void AsValueInto(const gfx::Rect& visual_rect, |
67 base::trace_event::TracedValue* array) const override; | 62 base::trace_event::TracedValue* array) const override; |
68 size_t ExternalMemoryUsage() const override; | 63 size_t ExternalMemoryUsage() const override; |
69 | 64 |
70 int ApproximateOpCount() const { return 0; } | 65 int ApproximateOpCount() const { return 0; } |
71 bool IsSuitableForGpuRasterization() const { return true; } | 66 bool IsSuitableForGpuRasterization() const { return true; } |
72 }; | 67 }; |
73 | 68 |
74 } // namespace cc | 69 } // namespace cc |
75 | 70 |
76 #endif // CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ | 71 #endif // CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ |
OLD | NEW |