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_RESOURCES_COMPOSITING_DISPLAY_ITEM_H_ | 5 #ifndef CC_RESOURCES_COMPOSITING_DISPLAY_ITEM_H_ |
6 #define CC_RESOURCES_COMPOSITING_DISPLAY_ITEM_H_ | 6 #define CC_RESOURCES_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/resources/display_item.h" | 10 #include "cc/resources/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 class SkDrawPictureCallback; | 18 class SkDrawPictureCallback; |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 | 21 |
22 class CC_EXPORT CompositingDisplayItem : public DisplayItem { | 22 class CC_EXPORT CompositingDisplayItem : public DisplayItem { |
23 public: | 23 public: |
| 24 CompositingDisplayItem(); |
24 ~CompositingDisplayItem() override; | 25 ~CompositingDisplayItem() override; |
25 | 26 |
26 static scoped_ptr<CompositingDisplayItem> Create( | 27 void SetNew(uint8_t alpha, |
27 uint8_t alpha, | 28 SkXfermode::Mode xfermode, |
28 SkXfermode::Mode xfermode, | 29 SkRect* bounds, |
29 SkRect* bounds, | 30 skia::RefPtr<SkColorFilter> color_filter); |
30 skia::RefPtr<SkColorFilter> color_filter) { | |
31 return make_scoped_ptr( | |
32 new CompositingDisplayItem(alpha, xfermode, bounds, color_filter)); | |
33 } | |
34 | 31 |
35 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override; | 32 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override; |
36 | 33 |
37 bool IsSuitableForGpuRasterization() const override; | 34 bool IsSuitableForGpuRasterization() const override; |
38 int ApproximateOpCount() const override; | 35 int ApproximateOpCount() const override; |
39 size_t PictureMemoryUsage() const override; | 36 size_t PictureMemoryUsage() const override; |
40 void AsValueInto(base::trace_event::TracedValue* array) const override; | 37 void AsValueInto(base::trace_event::TracedValue* array) const override; |
41 | 38 |
42 protected: | 39 protected: |
43 CompositingDisplayItem(uint8_t alpha, | 40 CompositingDisplayItem(uint8_t alpha, |
44 SkXfermode::Mode, | 41 SkXfermode::Mode, |
45 SkRect* bounds, | 42 SkRect* bounds, |
46 skia::RefPtr<SkColorFilter>); | 43 skia::RefPtr<SkColorFilter>); |
47 | 44 |
48 private: | 45 private: |
49 uint8_t alpha_; | 46 uint8_t alpha_; |
50 SkXfermode::Mode xfermode_; | 47 SkXfermode::Mode xfermode_; |
51 bool has_bounds_; | 48 bool has_bounds_; |
52 SkRect bounds_; | 49 SkRect bounds_; |
53 skia::RefPtr<SkColorFilter> color_filter_; | 50 skia::RefPtr<SkColorFilter> color_filter_; |
54 }; | 51 }; |
55 | 52 |
56 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { | 53 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { |
57 public: | 54 public: |
| 55 EndCompositingDisplayItem(); |
58 ~EndCompositingDisplayItem() override; | 56 ~EndCompositingDisplayItem() override; |
59 | 57 |
60 static scoped_ptr<EndCompositingDisplayItem> Create() { | 58 static scoped_ptr<EndCompositingDisplayItem> Create() { |
61 return make_scoped_ptr(new EndCompositingDisplayItem()); | 59 return make_scoped_ptr(new EndCompositingDisplayItem()); |
62 } | 60 } |
63 | 61 |
64 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override; | 62 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override; |
65 | 63 |
66 bool IsSuitableForGpuRasterization() const override; | 64 bool IsSuitableForGpuRasterization() const override; |
67 int ApproximateOpCount() const override; | 65 int ApproximateOpCount() const override; |
68 size_t PictureMemoryUsage() const override; | 66 size_t PictureMemoryUsage() const override; |
69 void AsValueInto(base::trace_event::TracedValue* array) const override; | 67 void AsValueInto(base::trace_event::TracedValue* array) const override; |
70 | |
71 protected: | |
72 EndCompositingDisplayItem(); | |
73 }; | 68 }; |
74 | 69 |
75 } // namespace cc | 70 } // namespace cc |
76 | 71 |
77 #endif // CC_RESOURCES_COMPOSITING_DISPLAY_ITEM_H_ | 72 #endif // CC_RESOURCES_COMPOSITING_DISPLAY_ITEM_H_ |
OLD | NEW |