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_TRANSFORM_DISPLAY_ITEM_H_ | 5 #ifndef CC_PLAYBACK_TRANSFORM_DISPLAY_ITEM_H_ |
6 #define CC_PLAYBACK_TRANSFORM_DISPLAY_ITEM_H_ | 6 #define CC_PLAYBACK_TRANSFORM_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 "ui/gfx/transform.h" | 15 #include "ui/gfx/transform.h" |
16 | 16 |
17 class SkCanvas; | 17 class SkCanvas; |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 class ImageSerializationProcessor; | |
21 | 20 |
22 class CC_EXPORT TransformDisplayItem : public DisplayItem { | 21 class CC_EXPORT TransformDisplayItem : public DisplayItem { |
23 public: | 22 public: |
24 explicit TransformDisplayItem(const gfx::Transform& transform); | 23 explicit TransformDisplayItem(const gfx::Transform& transform); |
25 explicit TransformDisplayItem(const proto::DisplayItem& proto); | 24 explicit TransformDisplayItem(const proto::DisplayItem& proto); |
26 ~TransformDisplayItem() override; | 25 ~TransformDisplayItem() override; |
27 | 26 |
28 void ToProtobuf(proto::DisplayItem* proto, | 27 void ToProtobuf(proto::DisplayItem* proto) const override; |
29 ImageSerializationProcessor* image_serialization_processor) | |
30 const override; | |
31 void Raster(SkCanvas* canvas, | 28 void Raster(SkCanvas* canvas, |
32 const gfx::Rect& canvas_target_playback_rect, | 29 const gfx::Rect& canvas_target_playback_rect, |
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 gfx::Transform& transform); | 38 void SetNew(const gfx::Transform& transform); |
42 | 39 |
43 gfx::Transform transform_; | 40 gfx::Transform transform_; |
44 }; | 41 }; |
45 | 42 |
46 class CC_EXPORT EndTransformDisplayItem : public DisplayItem { | 43 class CC_EXPORT EndTransformDisplayItem : public DisplayItem { |
47 public: | 44 public: |
48 EndTransformDisplayItem(); | 45 EndTransformDisplayItem(); |
49 explicit EndTransformDisplayItem(const proto::DisplayItem& proto); | 46 explicit EndTransformDisplayItem(const proto::DisplayItem& proto); |
50 ~EndTransformDisplayItem() override; | 47 ~EndTransformDisplayItem() override; |
51 | 48 |
52 static std::unique_ptr<EndTransformDisplayItem> Create() { | 49 static std::unique_ptr<EndTransformDisplayItem> Create() { |
53 return base::WrapUnique(new EndTransformDisplayItem()); | 50 return base::WrapUnique(new EndTransformDisplayItem()); |
54 } | 51 } |
55 | 52 |
56 void ToProtobuf(proto::DisplayItem* proto, | 53 void ToProtobuf(proto::DisplayItem* proto) const override; |
57 ImageSerializationProcessor* image_serialization_processor) | |
58 const override; | |
59 void Raster(SkCanvas* canvas, | 54 void Raster(SkCanvas* canvas, |
60 const gfx::Rect& canvas_target_playback_rect, | 55 const gfx::Rect& canvas_target_playback_rect, |
61 SkPicture::AbortCallback* callback) const override; | 56 SkPicture::AbortCallback* callback) const override; |
62 void AsValueInto(const gfx::Rect& visual_rect, | 57 void AsValueInto(const gfx::Rect& visual_rect, |
63 base::trace_event::TracedValue* array) const override; | 58 base::trace_event::TracedValue* array) const override; |
64 size_t ExternalMemoryUsage() const override; | 59 size_t ExternalMemoryUsage() const override; |
65 | 60 |
66 int ApproximateOpCount() const { return 0; } | 61 int ApproximateOpCount() const { return 0; } |
67 bool IsSuitableForGpuRasterization() const { return true; } | 62 bool IsSuitableForGpuRasterization() const { return true; } |
68 }; | 63 }; |
69 | 64 |
70 } // namespace cc | 65 } // namespace cc |
71 | 66 |
72 #endif // CC_PLAYBACK_TRANSFORM_DISPLAY_ITEM_H_ | 67 #endif // CC_PLAYBACK_TRANSFORM_DISPLAY_ITEM_H_ |
OLD | NEW |