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