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_CLIP_DISPLAY_ITEM_H_ | 5 #ifndef CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ |
6 #define CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ | 6 #define CC_PLAYBACK_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 "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/SkRRect.h" | 15 #include "third_party/skia/include/core/SkRRect.h" |
16 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
17 | 17 |
18 class SkCanvas; | 18 class SkCanvas; |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 | 21 |
22 class CC_EXPORT ClipDisplayItem : public DisplayItem { | 22 class CC_EXPORT ClipDisplayItem : public DisplayItem { |
23 public: | 23 public: |
24 ClipDisplayItem(const gfx::Rect& clip_rect, | 24 ClipDisplayItem(const gfx::Rect& clip_rect, |
25 const std::vector<SkRRect>& rounded_clip_rects, | 25 const std::vector<SkRRect>& rounded_clip_rects, |
26 bool antialias); | 26 bool antialias); |
27 explicit ClipDisplayItem(const proto::DisplayItem& proto); | |
28 ~ClipDisplayItem() override; | 27 ~ClipDisplayItem() override; |
29 | 28 |
30 void ToProtobuf(proto::DisplayItem* proto) const override; | |
31 void Raster(SkCanvas* canvas, | 29 void Raster(SkCanvas* canvas, |
32 SkPicture::AbortCallback* callback) const override; | 30 SkPicture::AbortCallback* callback) const override; |
33 void AsValueInto(const gfx::Rect& visual_rect, | 31 void AsValueInto(const gfx::Rect& visual_rect, |
34 base::trace_event::TracedValue* array) const override; | 32 base::trace_event::TracedValue* array) const override; |
35 | 33 |
36 size_t ExternalMemoryUsage() const { | 34 size_t ExternalMemoryUsage() const { |
37 return rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]); | 35 return rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]); |
38 } | 36 } |
39 int ApproximateOpCount() const { return 1; } | 37 int ApproximateOpCount() const { return 1; } |
40 | 38 |
41 private: | 39 private: |
42 void SetNew(const gfx::Rect& clip_rect, | 40 void SetNew(const gfx::Rect& clip_rect, |
43 const std::vector<SkRRect>& rounded_clip_rects, | 41 const std::vector<SkRRect>& rounded_clip_rects, |
44 bool antialias); | 42 bool antialias); |
45 | 43 |
46 gfx::Rect clip_rect_; | 44 gfx::Rect clip_rect_; |
47 std::vector<SkRRect> rounded_clip_rects_; | 45 std::vector<SkRRect> rounded_clip_rects_; |
48 bool antialias_; | 46 bool antialias_; |
49 }; | 47 }; |
50 | 48 |
51 class CC_EXPORT EndClipDisplayItem : public DisplayItem { | 49 class CC_EXPORT EndClipDisplayItem : public DisplayItem { |
52 public: | 50 public: |
53 EndClipDisplayItem(); | 51 EndClipDisplayItem(); |
54 explicit EndClipDisplayItem(const proto::DisplayItem& proto); | |
55 ~EndClipDisplayItem() override; | 52 ~EndClipDisplayItem() override; |
56 | 53 |
57 void ToProtobuf(proto::DisplayItem* proto) const override; | |
58 void Raster(SkCanvas* canvas, | 54 void Raster(SkCanvas* canvas, |
59 SkPicture::AbortCallback* callback) const override; | 55 SkPicture::AbortCallback* callback) const override; |
60 void AsValueInto(const gfx::Rect& visual_rect, | 56 void AsValueInto(const gfx::Rect& visual_rect, |
61 base::trace_event::TracedValue* array) const override; | 57 base::trace_event::TracedValue* array) const override; |
62 | 58 |
63 int ApproximateOpCount() const { return 0; } | 59 int ApproximateOpCount() const { return 0; } |
64 }; | 60 }; |
65 | 61 |
66 } // namespace cc | 62 } // namespace cc |
67 | 63 |
68 #endif // CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ | 64 #endif // CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ |
OLD | NEW |