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