Chromium Code Reviews| Index: ppapi/shared_impl/compositor_layer.h |
| diff --git a/ppapi/shared_impl/compositor_layer.h b/ppapi/shared_impl/compositor_layer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b507e4195d45f27e63b310639179efe1f0933bec |
| --- /dev/null |
| +++ b/ppapi/shared_impl/compositor_layer.h |
| @@ -0,0 +1,96 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef PPAPI_SHARED_IMPL_COMPOSITOR_LAYER_H_ |
| +#define PPAPI_SHARED_IMPL_COMPOSITOR_LAYER_H_ |
| + |
| +#include <string.h> |
| + |
| +#include <vector> |
|
raymes
2014/06/02 03:51:08
is this needed?
Peng
2014/06/02 19:01:55
Done.
|
| + |
| +#include "base/memory/scoped_ptr.h" |
|
raymes
2014/06/02 03:51:08
Is this needed?
Peng
2014/06/02 19:01:55
Done.
|
| +#include "gpu/command_buffer/common/mailbox.h" |
| +#include "ppapi/c/ppb_compositor_layer.h" |
| +#include "ppapi/shared_impl/host_resource.h" |
| +#include "ppapi/shared_impl/ppapi_shared_export.h" |
|
raymes
2014/06/02 03:51:08
Is this needed?
Peng
2014/06/02 19:01:55
Done.
|
| + |
| +namespace ppapi { |
| + |
| +struct CompositorLayer { |
|
raymes
2014/06/02 03:51:08
Could we call this CompositorLayerData. This would
Peng
2014/06/02 19:01:55
Done.
|
| + typedef int8_t Mailbox[GL_MAILBOX_SIZE_CHROMIUM]; |
| + |
| + enum Type { |
| + TYPE_UNKNOWN = 0, |
| + TYPE_COLOR, |
| + TYPE_TEXTURE, |
| + TYPE_IMAGE, |
| + TYPE_LAST = TYPE_IMAGE, |
| + }; |
| + |
| + CompositorLayer() |
| + : type(TYPE_UNKNOWN), |
| + size(PP_MakeSize(0, 0)), |
| + clip_rect(PP_MakeRectFromXYWH(0, 0, 0, 0)), |
| + blend_mode(PP_BLENDMODE_SRC_OVER), |
| + opacity(255) { |
| + transform[0] = 1.0f; |
| + transform[1] = 0.0f; |
| + transform[2] = 0.0f; |
| + transform[3] = 0.0f; |
| + transform[4] = 0.0f; |
| + transform[5] = 1.0f; |
| + transform[6] = 0.0f; |
| + transform[7] = 0.0f; |
| + transform[8] = 0.0f; |
| + transform[9] = 0.0f; |
| + transform[10] = 1.0f; |
| + transform[11] = 0.0f; |
| + transform[12] = 0.0f; |
| + transform[13] = 0.0f; |
| + transform[14] = 0.0f; |
| + transform[15] = 1.0f; |
| + |
| + // Becasue texture is the biggest struct in the union, so |
| + // we only need set it to 0. |
| + memset(&texture, 0, sizeof(texture)); |
| + } |
| + |
| + Type type; |
| + PP_Size size; |
| + PP_Rect clip_rect; |
| + float transform[16]; |
| + PP_BlendMode blend_mode; |
| + uint8_t opacity; |
| + |
| + union { |
| + // Properties for a color layer. |
| + struct { |
| + uint8_t red; |
| + uint8_t green; |
| + uint8_t blue; |
| + uint8_t alpha; |
| + } color; |
| + |
| + // Properties for a texture layer. |
| + struct { |
| + int32_t id; |
| + Mailbox mailbox; |
| + uint32_t sync_point; |
| + PP_FloatRect source_rect; |
| + bool premult_alpha; |
| + } texture; |
| + |
| + // Properties for an image layer |
| + struct { |
| + int32_t id; |
| + PP_Instance instance; |
| + PP_Resource host_resource; |
| + PP_FloatRect source_rect; |
| + } image; |
| + }; |
| +}; |
| + |
| +} // namespace ppapi |
| + |
| +#endif // PPAPI_SHARED_IMPL_COMPOSITOR_LAYER_H_ |