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 ~ClipDisplayItem() override; | 26 ~ClipDisplayItem() override; |
28 | 27 |
29 void Raster(SkCanvas* canvas, | 28 void Raster(PaintCanvas* canvas, |
30 SkPicture::AbortCallback* callback) const override; | 29 PaintRecord::AbortCallback* callback) const override; |
31 void AsValueInto(const gfx::Rect& visual_rect, | 30 void AsValueInto(const gfx::Rect& visual_rect, |
32 base::trace_event::TracedValue* array) const override; | 31 base::trace_event::TracedValue* array) const override; |
33 | 32 |
34 size_t ExternalMemoryUsage() const { | 33 size_t ExternalMemoryUsage() const { |
35 return rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]); | 34 return rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]); |
36 } | 35 } |
37 int ApproximateOpCount() const { return 1; } | 36 int ApproximateOpCount() const { return 1; } |
38 | 37 |
39 private: | 38 private: |
40 void SetNew(const gfx::Rect& clip_rect, | 39 void SetNew(const gfx::Rect& clip_rect, |
41 const std::vector<SkRRect>& rounded_clip_rects, | 40 const std::vector<SkRRect>& rounded_clip_rects, |
42 bool antialias); | 41 bool antialias); |
43 | 42 |
44 gfx::Rect clip_rect_; | 43 gfx::Rect clip_rect_; |
45 std::vector<SkRRect> rounded_clip_rects_; | 44 std::vector<SkRRect> rounded_clip_rects_; |
46 bool antialias_; | 45 bool antialias_; |
47 }; | 46 }; |
48 | 47 |
49 class CC_EXPORT EndClipDisplayItem : public DisplayItem { | 48 class CC_EXPORT EndClipDisplayItem : public DisplayItem { |
50 public: | 49 public: |
51 EndClipDisplayItem(); | 50 EndClipDisplayItem(); |
52 ~EndClipDisplayItem() override; | 51 ~EndClipDisplayItem() override; |
53 | 52 |
54 void Raster(SkCanvas* canvas, | 53 void Raster(PaintCanvas* canvas, |
55 SkPicture::AbortCallback* callback) const override; | 54 PaintRecord::AbortCallback* callback) const override; |
56 void AsValueInto(const gfx::Rect& visual_rect, | 55 void AsValueInto(const gfx::Rect& visual_rect, |
57 base::trace_event::TracedValue* array) const override; | 56 base::trace_event::TracedValue* array) const override; |
58 | 57 |
59 int ApproximateOpCount() const { return 0; } | 58 int ApproximateOpCount() const { return 0; } |
60 }; | 59 }; |
61 | 60 |
62 } // namespace cc | 61 } // namespace cc |
63 | 62 |
64 #endif // CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ | 63 #endif // CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ |
OLD | NEW |