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