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_FILTER_DISPLAY_ITEM_H_ | 5 #ifndef CC_PLAYBACK_FILTER_DISPLAY_ITEM_H_ |
6 #define CC_PLAYBACK_FILTER_DISPLAY_ITEM_H_ | 6 #define CC_PLAYBACK_FILTER_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/output/filter_operations.h" | 14 #include "cc/output/filter_operations.h" |
15 #include "cc/playback/display_item.h" | 15 #include "cc/playback/display_item.h" |
16 #include "ui/gfx/geometry/rect_f.h" | 16 #include "ui/gfx/geometry/rect_f.h" |
17 | 17 |
18 class SkCanvas; | |
19 | |
20 namespace cc { | 18 namespace cc { |
21 | 19 |
22 class CC_EXPORT FilterDisplayItem : public DisplayItem { | 20 class CC_EXPORT FilterDisplayItem : public DisplayItem { |
23 public: | 21 public: |
24 FilterDisplayItem(const FilterOperations& filters, | 22 FilterDisplayItem(const FilterOperations& filters, |
25 const gfx::RectF& bounds, | 23 const gfx::RectF& bounds, |
26 const gfx::PointF& origin); | 24 const gfx::PointF& origin); |
27 ~FilterDisplayItem() override; | 25 ~FilterDisplayItem() override; |
28 | 26 |
29 void Raster(SkCanvas* canvas, | 27 void Raster(PaintCanvas* canvas, |
30 SkPicture::AbortCallback* callback) const override; | 28 PaintRecord::AbortCallback* callback) const override; |
31 void AsValueInto(const gfx::Rect& visual_rect, | 29 void AsValueInto(const gfx::Rect& visual_rect, |
32 base::trace_event::TracedValue* array) const override; | 30 base::trace_event::TracedValue* array) const override; |
33 | 31 |
34 size_t ExternalMemoryUsage() const { | 32 size_t ExternalMemoryUsage() const { |
35 // FilterOperations doesn't expose its capacity, but size is probably good | 33 // FilterOperations doesn't expose its capacity, but size is probably good |
36 // enough. | 34 // enough. |
37 return filters_.size() * sizeof(filters_.at(0)); | 35 return filters_.size() * sizeof(filters_.at(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 FilterOperations& filters, | 40 void SetNew(const FilterOperations& filters, |
43 const gfx::RectF& bounds, | 41 const gfx::RectF& bounds, |
44 const gfx::PointF& origin); | 42 const gfx::PointF& origin); |
45 | 43 |
46 FilterOperations filters_; | 44 FilterOperations filters_; |
47 gfx::RectF bounds_; | 45 gfx::RectF bounds_; |
48 gfx::PointF origin_; | 46 gfx::PointF origin_; |
49 }; | 47 }; |
50 | 48 |
51 class CC_EXPORT EndFilterDisplayItem : public DisplayItem { | 49 class CC_EXPORT EndFilterDisplayItem : public DisplayItem { |
52 public: | 50 public: |
53 EndFilterDisplayItem(); | 51 EndFilterDisplayItem(); |
54 ~EndFilterDisplayItem() override; | 52 ~EndFilterDisplayItem() override; |
55 | 53 |
56 static std::unique_ptr<EndFilterDisplayItem> Create() { | 54 static std::unique_ptr<EndFilterDisplayItem> Create() { |
57 return base::MakeUnique<EndFilterDisplayItem>(); | 55 return base::MakeUnique<EndFilterDisplayItem>(); |
58 } | 56 } |
59 | 57 |
60 void Raster(SkCanvas* canvas, | 58 void Raster(PaintCanvas* canvas, |
61 SkPicture::AbortCallback* callback) const override; | 59 PaintRecord::AbortCallback* callback) const override; |
62 void AsValueInto(const gfx::Rect& visual_rect, | 60 void AsValueInto(const gfx::Rect& visual_rect, |
63 base::trace_event::TracedValue* array) const override; | 61 base::trace_event::TracedValue* array) const override; |
64 | 62 |
65 int ApproximateOpCount() const { return 0; } | 63 int ApproximateOpCount() const { return 0; } |
66 }; | 64 }; |
67 | 65 |
68 } // namespace cc | 66 } // namespace cc |
69 | 67 |
70 #endif // CC_PLAYBACK_FILTER_DISPLAY_ITEM_H_ | 68 #endif // CC_PLAYBACK_FILTER_DISPLAY_ITEM_H_ |
OLD | NEW |