1 // Copyright 2014 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 PPAPI_SHARED_IMPL_COMPOSITOR_LAYER_DATA_H_
6 #define PPAPI_SHARED_IMPL_COMPOSITOR_LAYER_DATA_H_
10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "gpu/command_buffer/common/mailbox.h"
13 #include "ppapi/c/ppb_compositor_layer.h"
14 #include "ppapi/shared_impl/host_resource.h"
15 #include "ppapi/shared_impl/ppapi_shared_export.h"
19 struct PPAPI_SHARED_EXPORT CompositorLayerData
{
46 : size(PP_MakeSize(0, 0)),
47 clip_rect(PP_MakeRectFromXYWH(0, 0, 0, 0)),
48 blend_mode(PP_BLENDMODE_SRC_OVER
),
56 PP_BlendMode blend_mode
;
62 ColorLayer() : red(0.0f
), green(0.0f
), blue(0.0f
), alpha(0.0f
) {}
73 source_rect(PP_MakeFloatRectFromXYWH(0.0f
, 0.0f
, 0.0f
, 0.0f
)) {}
76 PP_FloatRect source_rect
;
83 source_rect(PP_MakeFloatRectFromXYWH(0.0f
, 0.0f
, 1.0f
, 1.0f
)),
84 premult_alpha(true) {}
89 PP_FloatRect source_rect
;
93 CompositorLayerData() {}
95 CompositorLayerData(const CompositorLayerData
& other
) {
99 bool is_null() const {
100 return !(color
|| texture
|| image
);
103 bool is_valid() const {
111 const CompositorLayerData
& operator=(const CompositorLayerData
& other
);
114 scoped_ptr
<ColorLayer
> color
;
115 scoped_ptr
<TextureLayer
> texture
;
116 scoped_ptr
<ImageLayer
> image
;
121 #endif // PPAPI_SHARED_IMPL_COMPOSITOR_LAYER_DATA_H_