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_CLIP_PATH_DISPLAY_ITEM_H_ | 5 #ifndef CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ |
6 #define CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ | 6 #define CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
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/SkPath.h" | 16 #include "third_party/skia/include/core/SkPath.h" |
16 | 17 |
17 class SkCanvas; | |
18 | |
19 namespace cc { | 18 namespace cc { |
20 | 19 |
21 class CC_EXPORT ClipPathDisplayItem : public DisplayItem { | 20 class CC_EXPORT ClipPathDisplayItem : public DisplayItem { |
22 public: | 21 public: |
23 ClipPathDisplayItem(const SkPath& path, bool antialias); | 22 ClipPathDisplayItem(const SkPath& path, bool antialias); |
24 ~ClipPathDisplayItem() override; | 23 ~ClipPathDisplayItem() override; |
25 | 24 |
26 void Raster(SkCanvas* canvas, | 25 void Raster(PaintCanvas* canvas, |
27 SkPicture::AbortCallback* callback) const override; | 26 PaintRecord::AbortCallback* callback) const override; |
28 void AsValueInto(const gfx::Rect& visual_rect, | 27 void AsValueInto(const gfx::Rect& visual_rect, |
29 base::trace_event::TracedValue* array) const override; | 28 base::trace_event::TracedValue* array) const override; |
30 | 29 |
31 size_t ExternalMemoryUsage() const { | 30 size_t ExternalMemoryUsage() const { |
32 // The size of SkPath's external storage is not currently accounted for (and | 31 // The size of SkPath's external storage is not currently accounted for (and |
33 // may well be shared anyway). | 32 // may well be shared anyway). |
34 return 0; | 33 return 0; |
35 } | 34 } |
36 int ApproximateOpCount() const { return 1; } | 35 int ApproximateOpCount() const { return 1; } |
37 | 36 |
38 private: | 37 private: |
39 void SetNew(const SkPath& path, bool antialias); | 38 void SetNew(const SkPath& path, bool antialias); |
40 | 39 |
41 SkPath clip_path_; | 40 SkPath clip_path_; |
42 bool antialias_; | 41 bool antialias_; |
43 }; | 42 }; |
44 | 43 |
45 class CC_EXPORT EndClipPathDisplayItem : public DisplayItem { | 44 class CC_EXPORT EndClipPathDisplayItem : public DisplayItem { |
46 public: | 45 public: |
47 EndClipPathDisplayItem(); | 46 EndClipPathDisplayItem(); |
48 ~EndClipPathDisplayItem() override; | 47 ~EndClipPathDisplayItem() override; |
49 | 48 |
50 static std::unique_ptr<EndClipPathDisplayItem> Create() { | 49 static std::unique_ptr<EndClipPathDisplayItem> Create() { |
51 return base::MakeUnique<EndClipPathDisplayItem>(); | 50 return base::MakeUnique<EndClipPathDisplayItem>(); |
52 } | 51 } |
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_PATH_DISPLAY_ITEM_H_ | 63 #endif // CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ |
OLD | NEW |