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 "geometry/public/interfaces/geometry.mojom"; | |
8 import "surfaces/public/interfaces/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 bool nearest_neighbor; | |
76 }; | |
77 | |
78 struct StreamVideoQuadState {}; | |
79 | |
80 enum YUVColorSpace { | |
81 REC_601, // SDTV standard with restricted "studio swing" color range. | |
82 REC_601_JPEG, // Full color range [0, 255] variant of the above. | |
83 }; | |
84 | |
85 struct YUVVideoQuadState { | |
86 RectF tex_coord_rect; | |
87 uint32 y_plane_resource_id; | |
88 uint32 u_plane_resource_id; | |
89 uint32 v_plane_resource_id; | |
90 uint32 a_plane_resource_id; | |
91 YUVColorSpace color_space; | |
92 }; | |
93 | |
94 enum Material { | |
95 CHECKERBOARD = 1, | |
96 DEBUG_BORDER, | |
97 IO_SURFACE_CONTENT, | |
98 PICTURE_CONTENT, | |
99 RENDER_PASS, | |
100 SOLID_COLOR, | |
101 STREAM_VIDEO_CONTENT, | |
102 SURFACE_CONTENT, | |
103 TEXTURE_CONTENT, | |
104 TILED_CONTENT, | |
105 YUV_VIDEO_CONTENT, | |
106 }; | |
107 | |
108 struct Quad { | |
109 Material material; | |
110 | |
111 // This rect, after applying the quad_transform(), gives the geometry that | |
112 // this quad should draw to. This rect lives in content space. | |
113 Rect rect; | |
114 | |
115 // This specifies the region of the quad that is opaque. This rect lives in | |
116 // content space. | |
117 Rect opaque_rect; | |
118 | |
119 // Allows changing the rect that gets drawn to make it smaller. This value | |
120 // should be clipped to |rect|. This rect lives in content space. | |
121 Rect visible_rect; | |
122 | |
123 // Allows changing the rect that gets drawn to make it smaller. This value | |
124 // should be clipped to |rect|. This rect lives in content space. | |
125 bool needs_blending; | |
126 | |
127 // Index into the containing pass' shared quad state array which has state | |
128 // (transforms etc) shared by multiple quads. | |
129 uint32 shared_quad_state_index; | |
130 | |
131 // Only one of the following will be set, depending on the material. | |
132 CheckerboardQuadState? checkerboard_quad_state; | |
133 DebugBorderQuadState? debug_border_quad_state; | |
134 IoSurfaceContentQuadState? io_surface_quad_state; | |
135 RenderPassQuadState? render_pass_quad_state; | |
136 SolidColorQuadState? solid_color_quad_state; | |
137 SurfaceQuadState? surface_quad_state; | |
138 TextureQuadState? texture_quad_state; | |
139 TileQuadState? tile_quad_state; | |
140 StreamVideoQuadState? stream_video_quad_state; | |
141 YUVVideoQuadState? yuv_video_quad_state; | |
142 }; | |
143 | |
144 enum SkXfermode { | |
145 kClear_Mode = 0, //!< [0, 0] | |
146 kSrc_Mode, //!< [Sa, Sc] | |
147 kDst_Mode, //!< [Da, Dc] | |
148 kSrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc] | |
149 kDstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc] | |
150 kSrcIn_Mode, //!< [Sa * Da, Sc * Da] | |
151 kDstIn_Mode, //!< [Sa * Da, Sa * Dc] | |
152 kSrcOut_Mode, //!< [Sa * (1 - Da), Sc * (1 - Da)] | |
153 kDstOut_Mode, //!< [Da * (1 - Sa), Dc * (1 - Sa)] | |
154 kSrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc] | |
155 kDstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)] | |
156 kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc] | |
157 kPlus_Mode, //!< [Sa + Da, Sc + Dc] | |
158 kModulate_Mode, // multiplies all components (= alpha and color) | |
159 | |
160 // Following blend modes are defined in the CSS Compositing standard: | |
161 // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending | |
162 kScreen_Mode, | |
163 kLastCoeffMode = kScreen_Mode, | |
164 | |
165 kOverlay_Mode, | |
166 kDarken_Mode, | |
167 kLighten_Mode, | |
168 kColorDodge_Mode, | |
169 kColorBurn_Mode, | |
170 kHardLight_Mode, | |
171 kSoftLight_Mode, | |
172 kDifference_Mode, | |
173 kExclusion_Mode, | |
174 kMultiply_Mode, | |
175 kLastSeparableMode = kMultiply_Mode, | |
176 | |
177 kHue_Mode, | |
178 kSaturation_Mode, | |
179 kColor_Mode, | |
180 kLuminosity_Mode, | |
181 kLastMode = kLuminosity_Mode | |
182 }; | |
183 | |
184 struct SharedQuadState { | |
185 // Transforms from quad's original content space to its target content space. | |
186 Transform content_to_target_transform; | |
187 | |
188 // This size lives in the content space for the quad's originating layer. | |
189 Size content_bounds; | |
190 | |
191 // This rect lives in the content space for the quad's originating layer. | |
192 Rect visible_content_rect; | |
193 | |
194 // This rect lives in the target content space. | |
195 Rect clip_rect; | |
196 | |
197 bool is_clipped; | |
198 float opacity; | |
199 SkXfermode blend_mode; | |
200 int32 sorting_context_id; | |
201 }; | |
202 | |
203 struct Pass { | |
204 int32 id; | |
205 Rect output_rect; | |
206 Rect damage_rect; | |
207 Transform transform_to_root_target; | |
208 bool has_transparent_background; | |
209 array<Quad> quads; | |
210 array<SharedQuadState> shared_quad_states; | |
211 }; | |
OLD | NEW |