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