OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DISPLAY_ITEM_H_ | 5 #ifndef CC_PLAYBACK_DISPLAY_ITEM_H_ |
6 #define CC_PLAYBACK_DISPLAY_ITEM_H_ | 6 #define CC_PLAYBACK_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 "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
13 #include "cc/debug/traced_value.h" | 13 #include "cc/debug/traced_value.h" |
14 #include "third_party/skia/include/core/SkPicture.h" | 14 #include "third_party/skia/include/core/SkPicture.h" |
15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
16 | 16 |
17 class SkCanvas; | 17 class SkCanvas; |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 | 20 |
21 namespace proto { | |
22 class DisplayItem; | |
23 } // namespace proto | |
24 | |
25 class CC_EXPORT DisplayItem { | 21 class CC_EXPORT DisplayItem { |
26 public: | 22 public: |
27 enum Type { | 23 enum Type { |
28 CLIP, | 24 CLIP, |
29 END_CLIP, | 25 END_CLIP, |
30 CLIP_PATH, | 26 CLIP_PATH, |
31 END_CLIP_PATH, | 27 END_CLIP_PATH, |
32 COMPOSITING, | 28 COMPOSITING, |
33 END_COMPOSITING, | 29 END_COMPOSITING, |
34 DRAWING, | 30 DRAWING, |
35 FILTER, | 31 FILTER, |
36 END_FILTER, | 32 END_FILTER, |
37 FLOAT_CLIP, | 33 FLOAT_CLIP, |
38 END_FLOAT_CLIP, | 34 END_FLOAT_CLIP, |
39 TRANSFORM, | 35 TRANSFORM, |
40 END_TRANSFORM, | 36 END_TRANSFORM, |
41 }; | 37 }; |
42 | 38 |
43 virtual ~DisplayItem() {} | 39 virtual ~DisplayItem() {} |
44 | 40 |
45 virtual void ToProtobuf(proto::DisplayItem* proto) const = 0; | |
46 virtual sk_sp<const SkPicture> GetPicture() const; | 41 virtual sk_sp<const SkPicture> GetPicture() const; |
47 virtual void Raster(SkCanvas* canvas, | 42 virtual void Raster(SkCanvas* canvas, |
48 SkPicture::AbortCallback* callback) const = 0; | 43 SkPicture::AbortCallback* callback) const = 0; |
49 virtual void AsValueInto(const gfx::Rect& visual_rect, | 44 virtual void AsValueInto(const gfx::Rect& visual_rect, |
50 base::trace_event::TracedValue* array) const = 0; | 45 base::trace_event::TracedValue* array) const = 0; |
51 | 46 |
52 Type type() const { return type_; } | 47 Type type() const { return type_; } |
53 | 48 |
54 protected: | 49 protected: |
55 explicit DisplayItem(Type type) : type_(type) {} | 50 explicit DisplayItem(Type type) : type_(type) {} |
56 | 51 |
57 const Type type_; | 52 const Type type_; |
58 }; | 53 }; |
59 | 54 |
60 } // namespace cc | 55 } // namespace cc |
61 | 56 |
62 #endif // CC_PLAYBACK_DISPLAY_ITEM_H_ | 57 #endif // CC_PLAYBACK_DISPLAY_ITEM_H_ |
OLD | NEW |