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 module mojo; | |
6 | |
7 import "mojo/services/public/interfaces/geometry/geometry.mojom"; | |
8 import "mojo/services/public/interfaces/surfaces/surface_id.mojom"; | |
9 | |
10 struct Color { | |
11 uint32 rgba; | |
12 }; | |
13 | |
14 // TODO(jamesr): Populate subtype fields. | |
15 struct CheckerboardQuadState {}; | |
16 | |
17 struct DebugBorderQuadState {}; | |
18 | |
19 struct IoSurfaceContentQuadState {}; | |
20 | |
21 struct RenderPassId { | |
22 int32 layer_id; | |
23 int32 index; | |
24 }; | |
25 | |
26 struct RenderPassQuadState { | |
27 RenderPassId render_pass_id; | |
28 | |
29 // If nonzero, resource id of mask to use when drawing this pass. | |
30 uint32 mask_resource_id; | |
31 PointF mask_uv_scale; | |
32 Size mask_texture_size; | |
33 | |
34 // Post-processing filters, applied to the pixels in the render pass' texture. | |
35 // TODO(jamesr): Support | |
36 // FilterOperations filters; | |
37 | |
38 // The scale from layer space of the root layer of the render pass to | |
39 // the render pass physical pixels. This scale is applied to the filter | |
40 // parameters for pixel-moving filters. This scale should include | |
41 // content-to-target-space scale, and device pixel ratio. | |
42 PointF filters_scale; | |
43 | |
44 // Post-processing filters, applied to the pixels showing through the | |
45 // background of the render pass, from behind it. | |
46 // TODO(jamesr): Support | |
47 // FilterOperations background_filters; | |
48 }; | |
49 | |
50 struct SolidColorQuadState { | |
51 Color color; | |
52 bool force_anti_aliasing_off; | |
53 }; | |
54 | |
55 struct SurfaceQuadState { | |
56 SurfaceId surface; | |
57 }; | |
58 | |
59 struct TextureQuadState { | |
60 uint32 resource_id; | |
61 bool premultiplied_alpha; | |
62 PointF uv_top_left; | |
63 PointF uv_bottom_right; | |
64 Color background_color; | |
65 array<float, 4> vertex_opacity; | |
66 bool flipped; | |
67 bool nearest_neighbor; | |
68 }; | |
69 | |
70 struct TileQuadState { | |
71 RectF tex_coord_rect; | |
72 Size texture_size; | |
73 bool swizzle_contents; | |
74 uint32 resource_id; | |
75 }; | |
76 | |
77 struct StreamVideoQuadState {}; | |
78 | |
79 enum YUVColorSpace { | |
80 REC_601, // SDTV standard with restricted "studio swing" color range. | |
81 REC_601_JPEG, // Full color range [0, 255] variant of the above. | |
82 }; | |
83 | |
84 struct YUVVideoQuadState { | |
85 RectF tex_coord_rect; | |
86 uint32 y_plane_resource_id; | |
87 uint32 u_plane_resource_id; | |
88 uint32 v_plane_resource_id; | |
89 uint32 a_plane_resource_id; | |
90 YUVColorSpace color_space; | |
91 }; | |
92 | |
93 enum Material { | |
94 CHECKERBOARD = 1, | |
95 DEBUG_BORDER, | |
96 IO_SURFACE_CONTENT, | |
97 PICTURE_CONTENT, | |
98 RENDER_PASS, | |
99 SOLID_COLOR, | |
100 STREAM_VIDEO_CONTENT, | |
101 SURFACE_CONTENT, | |
102 TEXTURE_CONTENT, | |
103 TILED_CONTENT, | |
104 YUV_VIDEO_CONTENT, | |
105 }; | |
106 | |
107 struct Quad { | |
108 Material material; | |
109 | |
110 // This rect, after applying the quad_transform(), gives the geometry that | |
111 // this quad should draw to. This rect lives in content space. | |
112 Rect rect; | |
113 | |
114 // This specifies the region of the quad that is opaque. This rect lives in | |
115 // content space. | |
116 Rect opaque_rect; | |
117 | |
118 // Allows changing the rect that gets drawn to make it smaller. This value | |
119 // should be clipped to |rect|. This rect lives in content space. | |
120 Rect visible_rect; | |
121 | |
122 // Allows changing the rect that gets drawn to make it smaller. This value | |
123 // should be clipped to |rect|. This rect lives in content space. | |
124 bool needs_blending; | |
125 | |
126 // Index into the containing pass' shared quad state array which has state | |
127 // (transforms etc) shared by multiple quads. | |
128 uint32 shared_quad_state_index; | |
129 | |
130 // Only one of the following will be set, depending on the material. | |
131 CheckerboardQuadState? checkerboard_quad_state; | |
132 DebugBorderQuadState? debug_border_quad_state; | |
133 IoSurfaceContentQuadState? io_surface_quad_state; | |
134 RenderPassQuadState? render_pass_quad_state; | |
135 SolidColorQuadState? solid_color_quad_state; | |
136 SurfaceQuadState? surface_quad_state; | |
137 TextureQuadState? texture_quad_state; | |
138 TileQuadState? tile_quad_state; | |
139 StreamVideoQuadState? stream_video_quad_state; | |
140 YUVVideoQuadState? yuv_video_quad_state; | |
141 }; | |
142 | |
143 enum SkXfermode { | |
144 kClear_Mode = 0, //!< [0, 0] | |
145 kSrc_Mode, //!< [Sa, Sc] | |
146 kDst_Mode, //!< [Da, Dc] | |
147 kSrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc] | |
148 kDstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc] | |
149 kSrcIn_Mode, //!< [Sa * Da, Sc * Da] | |
150 kDstIn_Mode, //!< [Sa * Da, Sa * Dc] | |
151 kSrcOut_Mode, //!< [Sa * (1 - Da), Sc * (1 - Da)] | |
152 kDstOut_Mode, //!< [Da * (1 - Sa), Dc * (1 - Sa)] | |
153 kSrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc] | |
154 kDstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)] | |
155 kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc] | |
156 kPlus_Mode, //!< [Sa + Da, Sc + Dc] | |
157 kModulate_Mode, // multiplies all components (= alpha and color) | |
158 | |
159 // Following blend modes are defined in the CSS Compositing standard: | |
160 // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending | |
161 kScreen_Mode, | |
162 kLastCoeffMode = kScreen_Mode, | |
163 | |
164 kOverlay_Mode, | |
165 kDarken_Mode, | |
166 kLighten_Mode, | |
167 kColorDodge_Mode, | |
168 kColorBurn_Mode, | |
169 kHardLight_Mode, | |
170 kSoftLight_Mode, | |
171 kDifference_Mode, | |
172 kExclusion_Mode, | |
173 kMultiply_Mode, | |
174 kLastSeparableMode = kMultiply_Mode, | |
175 | |
176 kHue_Mode, | |
177 kSaturation_Mode, | |
178 kColor_Mode, | |
179 kLuminosity_Mode, | |
180 kLastMode = kLuminosity_Mode | |
181 }; | |
182 | |
183 struct SharedQuadState { | |
184 // Transforms from quad's original content space to its target content space. | |
185 Transform content_to_target_transform; | |
186 | |
187 // This size lives in the content space for the quad's originating layer. | |
188 Size content_bounds; | |
189 | |
190 // This rect lives in the content space for the quad's originating layer. | |
191 Rect visible_content_rect; | |
192 | |
193 // This rect lives in the target content space. | |
194 Rect clip_rect; | |
195 | |
196 bool is_clipped; | |
197 float opacity; | |
198 SkXfermode blend_mode; | |
199 int32 sorting_context_id; | |
200 }; | |
201 | |
202 struct Pass { | |
203 int32 id; | |
204 Rect output_rect; | |
205 Rect damage_rect; | |
206 Transform transform_to_root_target; | |
207 bool has_transparent_background; | |
208 array<Quad> quads; | |
209 array<SharedQuadState> shared_quad_states; | |
210 }; | |
OLD | NEW |