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.
5 #ifndef CC_RESOURCES_COMPOSITING_DISPLAY_ITEM_H_
6 #define CC_RESOURCES_COMPOSITING_DISPLAY_ITEM_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/cc_export.h"
10 #include "cc/resources/display_item.h"
11 #include "skia/ext/refptr.h"
12 #include "third_party/skia/include/core/SkColorFilter.h"
13 #include "third_party/skia/include/core/SkRect.h"
14 #include "third_party/skia/include/core/SkXfermode.h"
15 #include "ui/gfx/geometry/rect_f.h"
18 class SkDrawPictureCallback
;
22 class CC_EXPORT CompositingDisplayItem
: public DisplayItem
{
24 ~CompositingDisplayItem() override
;
26 static scoped_ptr
<CompositingDisplayItem
> Create(
28 SkXfermode::Mode xfermode
,
30 skia::RefPtr
<SkColorFilter
> color_filter
) {
31 return make_scoped_ptr(
32 new CompositingDisplayItem(opacity
, xfermode
, bounds
, color_filter
));
35 void Raster(SkCanvas
* canvas
, SkDrawPictureCallback
* callback
) const override
;
37 bool IsSuitableForGpuRasterization() const override
;
38 int ApproximateOpCount() const override
;
39 size_t PictureMemoryUsage() const override
;
40 void AsValueInto(base::trace_event::TracedValue
* array
) const override
;
43 CompositingDisplayItem(float opacity
,
46 skia::RefPtr
<SkColorFilter
>);
50 SkXfermode::Mode xfermode_
;
53 skia::RefPtr
<SkColorFilter
> color_filter_
;
56 class CC_EXPORT EndCompositingDisplayItem
: public DisplayItem
{
58 ~EndCompositingDisplayItem() override
;
60 static scoped_ptr
<EndCompositingDisplayItem
> Create() {
61 return make_scoped_ptr(new EndCompositingDisplayItem());
64 void Raster(SkCanvas
* canvas
, SkDrawPictureCallback
* callback
) const override
;
66 bool IsSuitableForGpuRasterization() const override
;
67 int ApproximateOpCount() const override
;
68 size_t PictureMemoryUsage() const override
;
69 void AsValueInto(base::trace_event::TracedValue
* array
) const override
;
72 EndCompositingDisplayItem();
77 #endif // CC_RESOURCES_COMPOSITING_DISPLAY_ITEM_H_