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 <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
15 #include "cc/playback/display_item.h" | 15 #include "cc/playback/display_item.h" |
16 #include "third_party/skia/include/core/SkColorFilter.h" | 16 #include "third_party/skia/include/core/SkColorFilter.h" |
17 #include "third_party/skia/include/core/SkRect.h" | 17 #include "third_party/skia/include/core/SkRect.h" |
18 #include "third_party/skia/include/core/SkRefCnt.h" | 18 #include "third_party/skia/include/core/SkRefCnt.h" |
19 #include "third_party/skia/include/core/SkXfermode.h" | |
20 #include "ui/gfx/geometry/rect_f.h" | 19 #include "ui/gfx/geometry/rect_f.h" |
21 | 20 |
22 class SkCanvas; | 21 class SkCanvas; |
23 | 22 |
24 namespace cc { | 23 namespace cc { |
25 | 24 |
26 class CC_EXPORT CompositingDisplayItem : public DisplayItem { | 25 class CC_EXPORT CompositingDisplayItem : public DisplayItem { |
27 public: | 26 public: |
28 CompositingDisplayItem(uint8_t alpha, | 27 CompositingDisplayItem(uint8_t alpha, |
29 SkXfermode::Mode xfermode, | 28 SkBlendMode xfermode, |
30 SkRect* bounds, | 29 SkRect* bounds, |
31 sk_sp<SkColorFilter> color_filter, | 30 sk_sp<SkColorFilter> color_filter, |
32 bool lcd_text_requires_opaque_layer); | 31 bool lcd_text_requires_opaque_layer); |
33 explicit CompositingDisplayItem(const proto::DisplayItem& proto); | 32 explicit CompositingDisplayItem(const proto::DisplayItem& proto); |
34 ~CompositingDisplayItem() override; | 33 ~CompositingDisplayItem() override; |
35 | 34 |
36 void ToProtobuf(proto::DisplayItem* proto) const override; | 35 void ToProtobuf(proto::DisplayItem* proto) const override; |
37 void Raster(SkCanvas* canvas, | 36 void Raster(SkCanvas* canvas, |
38 SkPicture::AbortCallback* callback) const override; | 37 SkPicture::AbortCallback* callback) const override; |
39 void AsValueInto(const gfx::Rect& visual_rect, | 38 void AsValueInto(const gfx::Rect& visual_rect, |
40 base::trace_event::TracedValue* array) const override; | 39 base::trace_event::TracedValue* array) const override; |
41 size_t ExternalMemoryUsage() const override; | 40 size_t ExternalMemoryUsage() const override; |
42 | 41 |
43 int ApproximateOpCount() const { return 1; } | 42 int ApproximateOpCount() const { return 1; } |
44 | 43 |
45 private: | 44 private: |
46 void SetNew(uint8_t alpha, | 45 void SetNew(uint8_t alpha, |
47 SkXfermode::Mode xfermode, | 46 SkBlendMode xfermode, |
48 SkRect* bounds, | 47 SkRect* bounds, |
49 sk_sp<SkColorFilter> color_filter, | 48 sk_sp<SkColorFilter> color_filter, |
50 bool lcd_text_requires_opaque_layer); | 49 bool lcd_text_requires_opaque_layer); |
51 | 50 |
52 uint8_t alpha_; | 51 uint8_t alpha_; |
53 SkXfermode::Mode xfermode_; | 52 SkBlendMode xfermode_; |
54 bool has_bounds_; | 53 bool has_bounds_; |
55 SkRect bounds_; | 54 SkRect bounds_; |
56 sk_sp<SkColorFilter> color_filter_; | 55 sk_sp<SkColorFilter> color_filter_; |
57 bool lcd_text_requires_opaque_layer_; | 56 bool lcd_text_requires_opaque_layer_; |
58 }; | 57 }; |
59 | 58 |
60 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { | 59 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { |
61 public: | 60 public: |
62 EndCompositingDisplayItem(); | 61 EndCompositingDisplayItem(); |
63 explicit EndCompositingDisplayItem(const proto::DisplayItem& proto); | 62 explicit EndCompositingDisplayItem(const proto::DisplayItem& proto); |
64 ~EndCompositingDisplayItem() override; | 63 ~EndCompositingDisplayItem() override; |
65 | 64 |
66 static std::unique_ptr<EndCompositingDisplayItem> Create() { | 65 static std::unique_ptr<EndCompositingDisplayItem> Create() { |
67 return base::MakeUnique<EndCompositingDisplayItem>(); | 66 return base::MakeUnique<EndCompositingDisplayItem>(); |
68 } | 67 } |
69 | 68 |
70 void ToProtobuf(proto::DisplayItem* proto) const override; | 69 void ToProtobuf(proto::DisplayItem* proto) const override; |
71 void Raster(SkCanvas* canvas, | 70 void Raster(SkCanvas* canvas, |
72 SkPicture::AbortCallback* callback) const override; | 71 SkPicture::AbortCallback* callback) const override; |
73 void AsValueInto(const gfx::Rect& visual_rect, | 72 void AsValueInto(const gfx::Rect& visual_rect, |
74 base::trace_event::TracedValue* array) const override; | 73 base::trace_event::TracedValue* array) const override; |
75 size_t ExternalMemoryUsage() const override; | 74 size_t ExternalMemoryUsage() const override; |
76 | 75 |
77 int ApproximateOpCount() const { return 0; } | 76 int ApproximateOpCount() const { return 0; } |
78 }; | 77 }; |
79 | 78 |
80 } // namespace cc | 79 } // namespace cc |
81 | 80 |
82 #endif // CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ | 81 #endif // CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ |
OLD | NEW |