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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 namespace cc { | 23 namespace cc { |
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 SkBlendMode xfermode, | 28 SkBlendMode xfermode, |
29 SkRect* bounds, | 29 SkRect* bounds, |
30 sk_sp<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); | |
33 ~CompositingDisplayItem() override; | 32 ~CompositingDisplayItem() override; |
34 | 33 |
35 void ToProtobuf(proto::DisplayItem* proto) const override; | |
36 void Raster(SkCanvas* canvas, | 34 void Raster(SkCanvas* canvas, |
37 SkPicture::AbortCallback* callback) const override; | 35 SkPicture::AbortCallback* callback) const override; |
38 void AsValueInto(const gfx::Rect& visual_rect, | 36 void AsValueInto(const gfx::Rect& visual_rect, |
39 base::trace_event::TracedValue* array) const override; | 37 base::trace_event::TracedValue* array) const override; |
40 | 38 |
41 size_t ExternalMemoryUsage() const { | 39 size_t ExternalMemoryUsage() const { |
42 // TODO(pdr): Include color_filter's memory here. | 40 // TODO(pdr): Include color_filter's memory here. |
43 return 0; | 41 return 0; |
44 } | 42 } |
45 int ApproximateOpCount() const { return 1; } | 43 int ApproximateOpCount() const { return 1; } |
46 | 44 |
47 private: | 45 private: |
48 void SetNew(uint8_t alpha, | 46 void SetNew(uint8_t alpha, |
49 SkBlendMode xfermode, | 47 SkBlendMode xfermode, |
50 SkRect* bounds, | 48 SkRect* bounds, |
51 sk_sp<SkColorFilter> color_filter, | 49 sk_sp<SkColorFilter> color_filter, |
52 bool lcd_text_requires_opaque_layer); | 50 bool lcd_text_requires_opaque_layer); |
53 | 51 |
54 uint8_t alpha_; | 52 uint8_t alpha_; |
55 SkBlendMode xfermode_; | 53 SkBlendMode xfermode_; |
56 bool has_bounds_; | 54 bool has_bounds_; |
57 SkRect bounds_; | 55 SkRect bounds_; |
58 sk_sp<SkColorFilter> color_filter_; | 56 sk_sp<SkColorFilter> color_filter_; |
59 bool lcd_text_requires_opaque_layer_; | 57 bool lcd_text_requires_opaque_layer_; |
60 }; | 58 }; |
61 | 59 |
62 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { | 60 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { |
63 public: | 61 public: |
64 EndCompositingDisplayItem(); | 62 EndCompositingDisplayItem(); |
65 explicit EndCompositingDisplayItem(const proto::DisplayItem& proto); | |
66 ~EndCompositingDisplayItem() override; | 63 ~EndCompositingDisplayItem() override; |
67 | 64 |
68 static std::unique_ptr<EndCompositingDisplayItem> Create() { | 65 static std::unique_ptr<EndCompositingDisplayItem> Create() { |
69 return base::MakeUnique<EndCompositingDisplayItem>(); | 66 return base::MakeUnique<EndCompositingDisplayItem>(); |
70 } | 67 } |
71 | 68 |
72 void ToProtobuf(proto::DisplayItem* proto) const override; | |
73 void Raster(SkCanvas* canvas, | 69 void Raster(SkCanvas* canvas, |
74 SkPicture::AbortCallback* callback) const override; | 70 SkPicture::AbortCallback* callback) const override; |
75 void AsValueInto(const gfx::Rect& visual_rect, | 71 void AsValueInto(const gfx::Rect& visual_rect, |
76 base::trace_event::TracedValue* array) const override; | 72 base::trace_event::TracedValue* array) const override; |
77 | 73 |
78 int ApproximateOpCount() const { return 0; } | 74 int ApproximateOpCount() const { return 0; } |
79 }; | 75 }; |
80 | 76 |
81 } // namespace cc | 77 } // namespace cc |
82 | 78 |
83 #endif // CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ | 79 #endif // CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ |
OLD | NEW |