| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_PLAYBACK_FILTER_DISPLAY_ITEM_H_ | |
| 6 #define CC_PLAYBACK_FILTER_DISPLAY_ITEM_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 | |
| 12 #include "base/memory/ptr_util.h" | |
| 13 #include "cc/base/cc_export.h" | |
| 14 #include "cc/output/filter_operations.h" | |
| 15 #include "cc/playback/display_item.h" | |
| 16 #include "ui/gfx/geometry/rect_f.h" | |
| 17 | |
| 18 class SkCanvas; | |
| 19 | |
| 20 namespace cc { | |
| 21 | |
| 22 class CC_EXPORT FilterDisplayItem : public DisplayItem { | |
| 23 public: | |
| 24 FilterDisplayItem(const FilterOperations& filters, | |
| 25 const gfx::RectF& bounds, | |
| 26 const gfx::PointF& origin); | |
| 27 ~FilterDisplayItem() override; | |
| 28 | |
| 29 void Raster(SkCanvas* canvas, | |
| 30 SkPicture::AbortCallback* callback) const override; | |
| 31 | |
| 32 size_t ExternalMemoryUsage() const { | |
| 33 // FilterOperations doesn't expose its capacity, but size is probably good | |
| 34 // enough. | |
| 35 return filters_.size() * sizeof(filters_.at(0)); | |
| 36 } | |
| 37 int ApproximateOpCount() const { return 1; } | |
| 38 | |
| 39 const gfx::RectF& bounds() const { return bounds_; } | |
| 40 | |
| 41 private: | |
| 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 }; | |
| 50 | |
| 51 class CC_EXPORT EndFilterDisplayItem : public DisplayItem { | |
| 52 public: | |
| 53 EndFilterDisplayItem(); | |
| 54 ~EndFilterDisplayItem() override; | |
| 55 | |
| 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; } | |
| 64 }; | |
| 65 | |
| 66 } // namespace cc | |
| 67 | |
| 68 #endif // CC_PLAYBACK_FILTER_DISPLAY_ITEM_H_ | |
| OLD | NEW |