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