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