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