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_FLOAT_CLIP_DISPLAY_ITEM_H_ | 5 #ifndef CC_PLAYBACK_FLOAT_CLIP_DISPLAY_ITEM_H_ |
6 #define CC_PLAYBACK_FLOAT_CLIP_DISPLAY_ITEM_H_ | 6 #define CC_PLAYBACK_FLOAT_CLIP_DISPLAY_ITEM_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
15 #include "cc/playback/display_item.h" | 15 #include "cc/playback/display_item.h" |
16 #include "ui/gfx/geometry/rect_f.h" | 16 #include "ui/gfx/geometry/rect_f.h" |
17 | 17 |
18 class SkCanvas; | 18 class SkCanvas; |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 | 21 |
22 class CC_EXPORT FloatClipDisplayItem : public DisplayItem { | 22 class CC_EXPORT FloatClipDisplayItem : public DisplayItem { |
23 public: | 23 public: |
24 explicit FloatClipDisplayItem(const gfx::RectF& clip_rect); | 24 explicit FloatClipDisplayItem(const gfx::RectF& clip_rect); |
25 explicit FloatClipDisplayItem(const proto::DisplayItem& proto); | |
26 ~FloatClipDisplayItem() override; | 25 ~FloatClipDisplayItem() override; |
27 | 26 |
28 void ToProtobuf(proto::DisplayItem* proto) const override; | |
29 void Raster(SkCanvas* canvas, | 27 void Raster(SkCanvas* canvas, |
30 SkPicture::AbortCallback* callback) const override; | 28 SkPicture::AbortCallback* callback) const override; |
31 void AsValueInto(const gfx::Rect& visual_rect, | 29 void AsValueInto(const gfx::Rect& visual_rect, |
32 base::trace_event::TracedValue* array) const override; | 30 base::trace_event::TracedValue* array) const override; |
33 | 31 |
34 size_t ExternalMemoryUsage() const { return 0; } | 32 size_t ExternalMemoryUsage() const { return 0; } |
35 int ApproximateOpCount() const { return 1; } | 33 int ApproximateOpCount() const { return 1; } |
36 | 34 |
37 private: | 35 private: |
38 void SetNew(const gfx::RectF& clip_rect); | 36 void SetNew(const gfx::RectF& clip_rect); |
39 | 37 |
40 gfx::RectF clip_rect_; | 38 gfx::RectF clip_rect_; |
41 }; | 39 }; |
42 | 40 |
43 class CC_EXPORT EndFloatClipDisplayItem : public DisplayItem { | 41 class CC_EXPORT EndFloatClipDisplayItem : public DisplayItem { |
44 public: | 42 public: |
45 EndFloatClipDisplayItem(); | 43 EndFloatClipDisplayItem(); |
46 explicit EndFloatClipDisplayItem(const proto::DisplayItem& proto); | |
47 ~EndFloatClipDisplayItem() override; | 44 ~EndFloatClipDisplayItem() override; |
48 | 45 |
49 static std::unique_ptr<EndFloatClipDisplayItem> Create() { | 46 static std::unique_ptr<EndFloatClipDisplayItem> Create() { |
50 return base::MakeUnique<EndFloatClipDisplayItem>(); | 47 return base::MakeUnique<EndFloatClipDisplayItem>(); |
51 } | 48 } |
52 | 49 |
53 void ToProtobuf(proto::DisplayItem* proto) const override; | |
54 void Raster(SkCanvas* canvas, | 50 void Raster(SkCanvas* canvas, |
55 SkPicture::AbortCallback* callback) const override; | 51 SkPicture::AbortCallback* callback) const override; |
56 void AsValueInto(const gfx::Rect& visual_rect, | 52 void AsValueInto(const gfx::Rect& visual_rect, |
57 base::trace_event::TracedValue* array) const override; | 53 base::trace_event::TracedValue* array) const override; |
58 | 54 |
59 int ApproximateOpCount() const { return 0; } | 55 int ApproximateOpCount() const { return 0; } |
60 }; | 56 }; |
61 | 57 |
62 } // namespace cc | 58 } // namespace cc |
63 | 59 |
64 #endif // CC_PLAYBACK_FLOAT_CLIP_DISPLAY_ITEM_H_ | 60 #endif // CC_PLAYBACK_FLOAT_CLIP_DISPLAY_ITEM_H_ |
OLD | NEW |