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