OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef PPAPI_SHARED_IMPL_COMPOSITOR_LAYER_H_ | |
6 #define PPAPI_SHARED_IMPL_COMPOSITOR_LAYER_H_ | |
7 | |
8 #include <string.h> | |
9 | |
10 #include <vector> | |
raymes
2014/06/02 03:51:08
is this needed?
Peng
2014/06/02 19:01:55
Done.
| |
11 | |
12 #include "base/memory/scoped_ptr.h" | |
raymes
2014/06/02 03:51:08
Is this needed?
Peng
2014/06/02 19:01:55
Done.
| |
13 #include "gpu/command_buffer/common/mailbox.h" | |
14 #include "ppapi/c/ppb_compositor_layer.h" | |
15 #include "ppapi/shared_impl/host_resource.h" | |
16 #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.
| |
17 | |
18 namespace ppapi { | |
19 | |
20 struct CompositorLayer { | |
raymes
2014/06/02 03:51:08
Could we call this CompositorLayerData. This would
Peng
2014/06/02 19:01:55
Done.
| |
21 typedef int8_t Mailbox[GL_MAILBOX_SIZE_CHROMIUM]; | |
22 | |
23 enum Type { | |
24 TYPE_UNKNOWN = 0, | |
25 TYPE_COLOR, | |
26 TYPE_TEXTURE, | |
27 TYPE_IMAGE, | |
28 TYPE_LAST = TYPE_IMAGE, | |
29 }; | |
30 | |
31 CompositorLayer() | |
32 : type(TYPE_UNKNOWN), | |
33 size(PP_MakeSize(0, 0)), | |
34 clip_rect(PP_MakeRectFromXYWH(0, 0, 0, 0)), | |
35 blend_mode(PP_BLENDMODE_SRC_OVER), | |
36 opacity(255) { | |
37 transform[0] = 1.0f; | |
38 transform[1] = 0.0f; | |
39 transform[2] = 0.0f; | |
40 transform[3] = 0.0f; | |
41 transform[4] = 0.0f; | |
42 transform[5] = 1.0f; | |
43 transform[6] = 0.0f; | |
44 transform[7] = 0.0f; | |
45 transform[8] = 0.0f; | |
46 transform[9] = 0.0f; | |
47 transform[10] = 1.0f; | |
48 transform[11] = 0.0f; | |
49 transform[12] = 0.0f; | |
50 transform[13] = 0.0f; | |
51 transform[14] = 0.0f; | |
52 transform[15] = 1.0f; | |
53 | |
54 // Becasue texture is the biggest struct in the union, so | |
55 // we only need set it to 0. | |
56 memset(&texture, 0, sizeof(texture)); | |
57 } | |
58 | |
59 Type type; | |
60 PP_Size size; | |
61 PP_Rect clip_rect; | |
62 float transform[16]; | |
63 PP_BlendMode blend_mode; | |
64 uint8_t opacity; | |
65 | |
66 union { | |
67 // Properties for a color layer. | |
68 struct { | |
69 uint8_t red; | |
70 uint8_t green; | |
71 uint8_t blue; | |
72 uint8_t alpha; | |
73 } color; | |
74 | |
75 // Properties for a texture layer. | |
76 struct { | |
77 int32_t id; | |
78 Mailbox mailbox; | |
79 uint32_t sync_point; | |
80 PP_FloatRect source_rect; | |
81 bool premult_alpha; | |
82 } texture; | |
83 | |
84 // Properties for an image layer | |
85 struct { | |
86 int32_t id; | |
87 PP_Instance instance; | |
88 PP_Resource host_resource; | |
89 PP_FloatRect source_rect; | |
90 } image; | |
91 }; | |
92 }; | |
93 | |
94 } // namespace ppapi | |
95 | |
96 #endif // PPAPI_SHARED_IMPL_COMPOSITOR_LAYER_H_ | |
OLD | NEW |