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