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.
5 import "mojo/services/public/interfaces/geometry/geometry.mojom"
6 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;
33 // Post-processing filters, applied to the pixels in the render pass' texture.
34 // TODO(jamesr): Support
35 // FilterOperations filters;
37 // The scale from layer space of the root layer of the render pass to
38 // the render pass physical pixels. This scale is applied to the filter
39 // parameters for pixel-moving filters. This scale should include
40 // content-to-target-space scale, and device pixel ratio.
43 // Post-processing filters, applied to the pixels showing through the
44 // background of the render pass, from behind it.
45 // TODO(jamesr): Support
46 // FilterOperations background_filters;
49 struct SolidColorQuadState {
51 bool force_anti_aliasing_off;
54 struct SurfaceQuadState {
58 struct TextureQuadState {
60 bool premultiplied_alpha;
62 PointF uv_bottom_right;
63 Color background_color;
64 float[4] vertex_opacity;
68 struct TileQuadState {
71 bool swizzle_contents;
75 struct StreamVideoQuadState {};
78 REC_601, // SDTV standard with restricted "studio swing" color range.
79 REC_601_JPEG, // Full color range [0, 255] variant of the above.
82 struct YUVVideoQuadState {
84 uint32 y_plane_resource_id;
85 uint32 u_plane_resource_id;
86 uint32 v_plane_resource_id;
87 uint32 a_plane_resource_id;
88 YUVColorSpace color_space;
108 // This rect, after applying the quad_transform(), gives the geometry that
109 // this quad should draw to. This rect lives in content space.
112 // This specifies the region of the quad that is opaque. This rect lives in
116 // Allows changing the rect that gets drawn to make it smaller. This value
117 // should be clipped to |rect|. This rect lives in content space.
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.
124 // Index into the containing pass' shared quad state array which has state
125 // (transforms etc) shared by multiple quads.
126 int32 shared_quad_state_index;
128 // Only one of the following will be set, depending on the material.
129 CheckerboardQuadState? checkerboard_quad_state;
130 DebugBorderQuadState? debug_border_quad_state;
131 IoSurfaceContentQuadState? io_surface_quad_state;
132 RenderPassQuadState? render_pass_quad_state;
133 SolidColorQuadState? solid_color_quad_state;
134 SurfaceQuadState? surface_quad_state;
135 TextureQuadState? texture_quad_state;
136 TileQuadState? tile_quad_state;
137 StreamVideoQuadState? stream_video_quad_state;
138 YUVVideoQuadState? yuv_video_quad_state;
142 kClear_Mode = 0, //!< [0, 0]
143 kSrc_Mode, //!< [Sa, Sc]
144 kDst_Mode, //!< [Da, Dc]
145 kSrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc]
146 kDstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc]
147 kSrcIn_Mode, //!< [Sa * Da, Sc * Da]
148 kDstIn_Mode, //!< [Sa * Da, Sa * Dc]
149 kSrcOut_Mode, //!< [Sa * (1 - Da), Sc * (1 - Da)]
150 kDstOut_Mode, //!< [Da * (1 - Sa), Dc * (1 - Sa)]
151 kSrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc]
152 kDstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)]
153 kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
154 kPlus_Mode, //!< [Sa + Da, Sc + Dc]
155 kModulate_Mode, // multiplies all components (= alpha and color)
157 // Following blend modes are defined in the CSS Compositing standard:
158 // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending
160 kLastCoeffMode = kScreen_Mode,
172 kLastSeparableMode = kMultiply_Mode,
178 kLastMode = kLuminosity_Mode
181 struct SharedQuadState {
182 // Transforms from quad's original content space to its target content space.
183 Transform content_to_target_transform;
185 // This size lives in the content space for the quad's originating layer.
188 // This rect lives in the content space for the quad's originating layer.
189 Rect visible_content_rect;
191 // This rect lives in the target content space.
196 SkXfermode blend_mode;
197 int32 sorting_context_id;
204 Transform transform_to_root_target;
205 bool has_transparent_background;
207 SharedQuadState[] shared_quad_states;