| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
| 13 #include "cc/playback/display_item.h" | 13 #include "cc/playback/display_item.h" |
| 14 #include "skia/ext/refptr.h" | |
| 15 #include "third_party/skia/include/core/SkColorFilter.h" | 14 #include "third_party/skia/include/core/SkColorFilter.h" |
| 16 #include "third_party/skia/include/core/SkRect.h" | 15 #include "third_party/skia/include/core/SkRect.h" |
| 16 #include "third_party/skia/include/core/SkRefCnt.h" |
| 17 #include "third_party/skia/include/core/SkXfermode.h" | 17 #include "third_party/skia/include/core/SkXfermode.h" |
| 18 #include "ui/gfx/geometry/rect_f.h" | 18 #include "ui/gfx/geometry/rect_f.h" |
| 19 | 19 |
| 20 class SkCanvas; | 20 class SkCanvas; |
| 21 | 21 |
| 22 namespace cc { | 22 namespace cc { |
| 23 class ImageSerializationProcessor; | 23 class ImageSerializationProcessor; |
| 24 | 24 |
| 25 class CC_EXPORT CompositingDisplayItem : public DisplayItem { | 25 class CC_EXPORT CompositingDisplayItem : public DisplayItem { |
| 26 public: | 26 public: |
| 27 CompositingDisplayItem(uint8_t alpha, | 27 CompositingDisplayItem(uint8_t alpha, |
| 28 SkXfermode::Mode xfermode, | 28 SkXfermode::Mode xfermode, |
| 29 SkRect* bounds, | 29 SkRect* bounds, |
| 30 skia::RefPtr<SkColorFilter> color_filter, | 30 sk_sp<SkColorFilter> color_filter, |
| 31 bool lcd_text_requires_opaque_layer); | 31 bool lcd_text_requires_opaque_layer); |
| 32 explicit CompositingDisplayItem(const proto::DisplayItem& proto); | 32 explicit CompositingDisplayItem(const proto::DisplayItem& proto); |
| 33 ~CompositingDisplayItem() override; | 33 ~CompositingDisplayItem() override; |
| 34 | 34 |
| 35 void ToProtobuf(proto::DisplayItem* proto, | 35 void ToProtobuf(proto::DisplayItem* proto, |
| 36 ImageSerializationProcessor* image_serialization_processor) | 36 ImageSerializationProcessor* image_serialization_processor) |
| 37 const override; | 37 const override; |
| 38 void Raster(SkCanvas* canvas, | 38 void Raster(SkCanvas* canvas, |
| 39 const gfx::Rect& canvas_target_playback_rect, | 39 const gfx::Rect& canvas_target_playback_rect, |
| 40 SkPicture::AbortCallback* callback) const override; | 40 SkPicture::AbortCallback* callback) const override; |
| 41 void AsValueInto(const gfx::Rect& visual_rect, | 41 void AsValueInto(const gfx::Rect& visual_rect, |
| 42 base::trace_event::TracedValue* array) const override; | 42 base::trace_event::TracedValue* array) const override; |
| 43 size_t ExternalMemoryUsage() const override; | 43 size_t ExternalMemoryUsage() const override; |
| 44 | 44 |
| 45 int ApproximateOpCount() const { return 1; } | 45 int ApproximateOpCount() const { return 1; } |
| 46 bool IsSuitableForGpuRasterization() const { return true; } | 46 bool IsSuitableForGpuRasterization() const { return true; } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 void SetNew(uint8_t alpha, | 49 void SetNew(uint8_t alpha, |
| 50 SkXfermode::Mode xfermode, | 50 SkXfermode::Mode xfermode, |
| 51 SkRect* bounds, | 51 SkRect* bounds, |
| 52 skia::RefPtr<SkColorFilter> color_filter, | 52 sk_sp<SkColorFilter> color_filter, |
| 53 bool lcd_text_requires_opaque_layer); | 53 bool lcd_text_requires_opaque_layer); |
| 54 | 54 |
| 55 uint8_t alpha_; | 55 uint8_t alpha_; |
| 56 SkXfermode::Mode xfermode_; | 56 SkXfermode::Mode xfermode_; |
| 57 bool has_bounds_; | 57 bool has_bounds_; |
| 58 SkRect bounds_; | 58 SkRect bounds_; |
| 59 skia::RefPtr<SkColorFilter> color_filter_; | 59 sk_sp<SkColorFilter> color_filter_; |
| 60 bool lcd_text_requires_opaque_layer_; | 60 bool lcd_text_requires_opaque_layer_; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { | 63 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { |
| 64 public: | 64 public: |
| 65 EndCompositingDisplayItem(); | 65 EndCompositingDisplayItem(); |
| 66 explicit EndCompositingDisplayItem(const proto::DisplayItem& proto); | 66 explicit EndCompositingDisplayItem(const proto::DisplayItem& proto); |
| 67 ~EndCompositingDisplayItem() override; | 67 ~EndCompositingDisplayItem() override; |
| 68 | 68 |
| 69 static scoped_ptr<EndCompositingDisplayItem> Create() { | 69 static scoped_ptr<EndCompositingDisplayItem> Create() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 80 base::trace_event::TracedValue* array) const override; | 80 base::trace_event::TracedValue* array) const override; |
| 81 size_t ExternalMemoryUsage() const override; | 81 size_t ExternalMemoryUsage() const override; |
| 82 | 82 |
| 83 int ApproximateOpCount() const { return 0; } | 83 int ApproximateOpCount() const { return 0; } |
| 84 bool IsSuitableForGpuRasterization() const { return true; } | 84 bool IsSuitableForGpuRasterization() const { return true; } |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 } // namespace cc | 87 } // namespace cc |
| 88 | 88 |
| 89 #endif // CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ | 89 #endif // CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ |
| OLD | NEW |