| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_COMPOSITING_DISPLAY_ITEM_H_ | 5 #ifndef CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ |
| 6 #define CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ | 6 #define CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
| 10 #include "cc/playback/display_item.h" | 10 #include "cc/playback/display_item.h" |
| 11 #include "skia/ext/refptr.h" | 11 #include "skia/ext/refptr.h" |
| 12 #include "third_party/skia/include/core/SkColorFilter.h" | 12 #include "third_party/skia/include/core/SkColorFilter.h" |
| 13 #include "third_party/skia/include/core/SkRect.h" | 13 #include "third_party/skia/include/core/SkRect.h" |
| 14 #include "third_party/skia/include/core/SkXfermode.h" | 14 #include "third_party/skia/include/core/SkXfermode.h" |
| 15 #include "ui/gfx/geometry/rect_f.h" | 15 #include "ui/gfx/geometry/rect_f.h" |
| 16 | 16 |
| 17 class SkCanvas; | 17 class SkCanvas; |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 | 20 |
| 21 class CC_EXPORT CompositingDisplayItem : public DisplayItem { | 21 class CC_EXPORT CompositingDisplayItem : public DisplayItem { |
| 22 public: | 22 public: |
| 23 CompositingDisplayItem(); | 23 CompositingDisplayItem(uint8_t alpha, |
| 24 SkXfermode::Mode xfermode, |
| 25 SkRect* bounds, |
| 26 skia::RefPtr<SkColorFilter> color_filter); |
| 27 explicit CompositingDisplayItem(const proto::DisplayItem& proto); |
| 24 ~CompositingDisplayItem() override; | 28 ~CompositingDisplayItem() override; |
| 25 | 29 |
| 26 void SetNew(uint8_t alpha, | 30 void SetNew(uint8_t alpha, |
| 27 SkXfermode::Mode xfermode, | 31 SkXfermode::Mode xfermode, |
| 28 SkRect* bounds, | 32 SkRect* bounds, |
| 29 skia::RefPtr<SkColorFilter> color_filter); | 33 skia::RefPtr<SkColorFilter> color_filter); |
| 30 | 34 |
| 31 void ToProtobuf(proto::DisplayItem* proto) const override; | 35 void ToProtobuf(proto::DisplayItem* proto) const override; |
| 32 void FromProtobuf(const proto::DisplayItem& proto) override; | 36 void FromProtobuf(const proto::DisplayItem& proto) override; |
| 33 void Raster(SkCanvas* canvas, | 37 void Raster(SkCanvas* canvas, |
| 34 const gfx::Rect& canvas_target_playback_rect, | 38 const gfx::Rect& canvas_target_playback_rect, |
| 35 SkPicture::AbortCallback* callback) const override; | 39 SkPicture::AbortCallback* callback) const override; |
| 36 void AsValueInto(const gfx::Rect& visual_rect, | 40 void AsValueInto(const gfx::Rect& visual_rect, |
| 37 base::trace_event::TracedValue* array) const override; | 41 base::trace_event::TracedValue* array) const override; |
| 42 size_t ExternalMemoryUsage() const override; |
| 43 int ApproximateOpCount() const override; |
| 38 | 44 |
| 39 private: | 45 private: |
| 40 uint8_t alpha_; | 46 uint8_t alpha_; |
| 41 SkXfermode::Mode xfermode_; | 47 SkXfermode::Mode xfermode_; |
| 42 bool has_bounds_; | 48 bool has_bounds_; |
| 43 SkRect bounds_; | 49 SkRect bounds_; |
| 44 skia::RefPtr<SkColorFilter> color_filter_; | 50 skia::RefPtr<SkColorFilter> color_filter_; |
| 45 }; | 51 }; |
| 46 | 52 |
| 47 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { | 53 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { |
| 48 public: | 54 public: |
| 49 EndCompositingDisplayItem(); | 55 EndCompositingDisplayItem(); |
| 56 explicit EndCompositingDisplayItem(const proto::DisplayItem& proto); |
| 50 ~EndCompositingDisplayItem() override; | 57 ~EndCompositingDisplayItem() override; |
| 51 | 58 |
| 52 static scoped_ptr<EndCompositingDisplayItem> Create() { | 59 static scoped_ptr<EndCompositingDisplayItem> Create() { |
| 53 return make_scoped_ptr(new EndCompositingDisplayItem()); | 60 return make_scoped_ptr(new EndCompositingDisplayItem()); |
| 54 } | 61 } |
| 55 | 62 |
| 56 void ToProtobuf(proto::DisplayItem* proto) const override; | 63 void ToProtobuf(proto::DisplayItem* proto) const override; |
| 57 void FromProtobuf(const proto::DisplayItem& proto) override; | 64 void FromProtobuf(const proto::DisplayItem& proto) override; |
| 58 void Raster(SkCanvas* canvas, | 65 void Raster(SkCanvas* canvas, |
| 59 const gfx::Rect& canvas_target_playback_rect, | 66 const gfx::Rect& canvas_target_playback_rect, |
| 60 SkPicture::AbortCallback* callback) const override; | 67 SkPicture::AbortCallback* callback) const override; |
| 61 void AsValueInto(const gfx::Rect& visual_rect, | 68 void AsValueInto(const gfx::Rect& visual_rect, |
| 62 base::trace_event::TracedValue* array) const override; | 69 base::trace_event::TracedValue* array) const override; |
| 70 size_t ExternalMemoryUsage() const override; |
| 71 int ApproximateOpCount() const override; |
| 63 }; | 72 }; |
| 64 | 73 |
| 65 } // namespace cc | 74 } // namespace cc |
| 66 | 75 |
| 67 #endif // CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ | 76 #endif // CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ |
| OLD | NEW |