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(uint8_t alpha, | 23 CompositingDisplayItem(uint8_t alpha, |
24 SkXfermode::Mode xfermode, | 24 SkXfermode::Mode xfermode, |
25 SkRect* bounds, | 25 SkRect* bounds, |
26 skia::RefPtr<SkColorFilter> color_filter); | 26 skia::RefPtr<SkColorFilter> color_filter, |
| 27 bool lcd_text_requires_opaque_layer); |
27 explicit CompositingDisplayItem(const proto::DisplayItem& proto); | 28 explicit CompositingDisplayItem(const proto::DisplayItem& proto); |
28 ~CompositingDisplayItem() override; | 29 ~CompositingDisplayItem() override; |
29 | 30 |
30 void ToProtobuf(proto::DisplayItem* proto) const override; | 31 void ToProtobuf(proto::DisplayItem* proto) const override; |
31 void Raster(SkCanvas* canvas, | 32 void Raster(SkCanvas* canvas, |
32 const gfx::Rect& canvas_target_playback_rect, | 33 const gfx::Rect& canvas_target_playback_rect, |
33 SkPicture::AbortCallback* callback) const override; | 34 SkPicture::AbortCallback* callback) const override; |
34 void AsValueInto(const gfx::Rect& visual_rect, | 35 void AsValueInto(const gfx::Rect& visual_rect, |
35 base::trace_event::TracedValue* array) const override; | 36 base::trace_event::TracedValue* array) const override; |
36 size_t ExternalMemoryUsage() const override; | 37 size_t ExternalMemoryUsage() const override; |
37 | 38 |
38 int ApproximateOpCount() const { return 1; } | 39 int ApproximateOpCount() const { return 1; } |
39 bool IsSuitableForGpuRasterization() const { return true; } | 40 bool IsSuitableForGpuRasterization() const { return true; } |
40 | 41 |
41 private: | 42 private: |
42 void SetNew(uint8_t alpha, | 43 void SetNew(uint8_t alpha, |
43 SkXfermode::Mode xfermode, | 44 SkXfermode::Mode xfermode, |
44 SkRect* bounds, | 45 SkRect* bounds, |
45 skia::RefPtr<SkColorFilter> color_filter); | 46 skia::RefPtr<SkColorFilter> color_filter, |
| 47 bool lcd_text_requires_opaque_layer); |
46 | 48 |
47 uint8_t alpha_; | 49 uint8_t alpha_; |
48 SkXfermode::Mode xfermode_; | 50 SkXfermode::Mode xfermode_; |
49 bool has_bounds_; | 51 bool has_bounds_; |
50 SkRect bounds_; | 52 SkRect bounds_; |
51 skia::RefPtr<SkColorFilter> color_filter_; | 53 skia::RefPtr<SkColorFilter> color_filter_; |
| 54 bool lcd_text_requires_opaque_layer_; |
52 }; | 55 }; |
53 | 56 |
54 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { | 57 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { |
55 public: | 58 public: |
56 EndCompositingDisplayItem(); | 59 EndCompositingDisplayItem(); |
57 explicit EndCompositingDisplayItem(const proto::DisplayItem& proto); | 60 explicit EndCompositingDisplayItem(const proto::DisplayItem& proto); |
58 ~EndCompositingDisplayItem() override; | 61 ~EndCompositingDisplayItem() override; |
59 | 62 |
60 static scoped_ptr<EndCompositingDisplayItem> Create() { | 63 static scoped_ptr<EndCompositingDisplayItem> Create() { |
61 return make_scoped_ptr(new EndCompositingDisplayItem()); | 64 return make_scoped_ptr(new EndCompositingDisplayItem()); |
62 } | 65 } |
63 | 66 |
64 void ToProtobuf(proto::DisplayItem* proto) const override; | 67 void ToProtobuf(proto::DisplayItem* proto) const override; |
65 void Raster(SkCanvas* canvas, | 68 void Raster(SkCanvas* canvas, |
66 const gfx::Rect& canvas_target_playback_rect, | 69 const gfx::Rect& canvas_target_playback_rect, |
67 SkPicture::AbortCallback* callback) const override; | 70 SkPicture::AbortCallback* callback) const override; |
68 void AsValueInto(const gfx::Rect& visual_rect, | 71 void AsValueInto(const gfx::Rect& visual_rect, |
69 base::trace_event::TracedValue* array) const override; | 72 base::trace_event::TracedValue* array) const override; |
70 size_t ExternalMemoryUsage() const override; | 73 size_t ExternalMemoryUsage() const override; |
71 | 74 |
72 int ApproximateOpCount() const { return 0; } | 75 int ApproximateOpCount() const { return 0; } |
73 bool IsSuitableForGpuRasterization() const { return true; } | 76 bool IsSuitableForGpuRasterization() const { return true; } |
74 }; | 77 }; |
75 | 78 |
76 } // namespace cc | 79 } // namespace cc |
77 | 80 |
78 #endif // CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ | 81 #endif // CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ |
OLD | NEW |