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.
7 import "mojo/services/public/interfaces/geometry/geometry.mojom";
8 import "mojo/services/public/interfaces/surfaces/surface_id.mojom";
14 // TODO(jamesr): Populate subtype fields.
15 struct CheckerboardQuadState {};
17 struct DebugBorderQuadState {};
19 struct IoSurfaceContentQuadState {};
26 struct RenderPassQuadState {
27 RenderPassId render_pass_id;
29 // If nonzero, resource id of mask to use when drawing this pass.
30 uint32 mask_resource_id;
32 Size mask_texture_size;
34 // Post-processing filters, applied to the pixels in the render pass' texture.
35 // TODO(jamesr): Support
36 // FilterOperations filters;
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.
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;
50 struct SolidColorQuadState {
52 bool force_anti_aliasing_off;
55 struct SurfaceQuadState {
59 struct TextureQuadState {
61 bool premultiplied_alpha;
63 PointF uv_bottom_right;
64 Color background_color;
65 array<float, 4> vertex_opacity;
69 struct TileQuadState {
72 bool swizzle_contents;
76 struct StreamVideoQuadState {};
79 REC_601, // SDTV standard with restricted "studio swing" color range.
80 REC_601_JPEG, // Full color range [0, 255] variant of the above.
83 struct YUVVideoQuadState {
85 uint32 y_plane_resource_id;
86 uint32 u_plane_resource_id;
87 uint32 v_plane_resource_id;
88 uint32 a_plane_resource_id;
89 YUVColorSpace color_space;
109 // This rect, after applying the quad_transform(), gives the geometry that
110 // this quad should draw to. This rect lives in content space.
113 // This specifies the region of the quad that is opaque. This rect lives in
117 // Allows changing the rect that gets drawn to make it smaller. This value
118 // should be clipped to |rect|. This rect lives in content space.
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.
125 // Index into the containing pass' shared quad state array which has state
126 // (transforms etc) shared by multiple quads.
127 uint32 shared_quad_state_index;
129 // Only one of the following will be set, depending on the material.
130 CheckerboardQuadState? checkerboard_quad_state;
131 DebugBorderQuadState? debug_border_quad_state;
132 IoSurfaceContentQuadState? io_surface_quad_state;
133 RenderPassQuadState? render_pass_quad_state;
134 SolidColorQuadState? solid_color_quad_state;
135 SurfaceQuadState? surface_quad_state;
136 TextureQuadState? texture_quad_state;
137 TileQuadState? tile_quad_state;
138 StreamVideoQuadState? stream_video_quad_state;
139 YUVVideoQuadState? yuv_video_quad_state;
143 kClear_Mode = 0, //!< [0, 0]
144 kSrc_Mode, //!< [Sa, Sc]
145 kDst_Mode, //!< [Da, Dc]
146 kSrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc]
147 kDstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc]
148 kSrcIn_Mode, //!< [Sa * Da, Sc * Da]
149 kDstIn_Mode, //!< [Sa * Da, Sa * Dc]
150 kSrcOut_Mode, //!< [Sa * (1 - Da), Sc * (1 - Da)]
151 kDstOut_Mode, //!< [Da * (1 - Sa), Dc * (1 - Sa)]
152 kSrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc]
153 kDstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)]
154 kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
155 kPlus_Mode, //!< [Sa + Da, Sc + Dc]
156 kModulate_Mode, // multiplies all components (= alpha and color)
158 // Following blend modes are defined in the CSS Compositing standard:
159 // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending
161 kLastCoeffMode = kScreen_Mode,
173 kLastSeparableMode = kMultiply_Mode,
179 kLastMode = kLuminosity_Mode
182 struct SharedQuadState {
183 // Transforms from quad's original content space to its target content space.
184 Transform content_to_target_transform;
186 // This size lives in the content space for the quad's originating layer.
189 // This rect lives in the content space for the quad's originating layer.
190 Rect visible_content_rect;
192 // This rect lives in the target content space.
197 SkXfermode blend_mode;
198 int32 sorting_context_id;
205 Transform transform_to_root_target;
206 bool has_transparent_background;
208 array<SharedQuadState> shared_quad_states;