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 "components/mus/public/interfaces/surface_id.mojom";
8 import "ui/mojo/geometry/geometry.mojom";
14 struct CheckerboardQuadState {
15 // Checkerboard color.
18 // The scale factor of checkers. Chromium uses device scale factor for
23 struct DebugBorderQuadState {
24 // Debug border color.
27 // Debug border width.
31 // TODO(jamesr): Populate subtype fields.
32 struct IoSurfaceContentQuadState {};
39 struct RenderPassQuadState {
40 RenderPassId render_pass_id;
42 // If nonzero, resource id of mask to use when drawing this pass.
43 uint32 mask_resource_id;
45 Size mask_texture_size;
47 // Post-processing filters, applied to the pixels in the render pass' texture.
48 // TODO(jamesr): Support
49 // FilterOperations filters;
51 // The scale from layer space of the root layer of the render pass to
52 // the render pass physical pixels. This scale is applied to the filter
53 // parameters for pixel-moving filters. This scale should include
54 // content-to-target-space scale, and device pixel ratio.
57 // Post-processing filters, applied to the pixels showing through the
58 // background of the render pass, from behind it.
59 // TODO(jamesr): Support
60 // FilterOperations background_filters;
63 struct SolidColorQuadState {
65 bool force_anti_aliasing_off;
68 struct SurfaceQuadState {
72 struct TextureQuadState {
74 bool premultiplied_alpha;
76 PointF uv_bottom_right;
77 Color background_color;
78 array<float, 4> vertex_opacity;
80 bool nearest_neighbor;
83 struct TileQuadState {
86 bool swizzle_contents;
88 bool nearest_neighbor;
91 struct StreamVideoQuadState {};
94 REC_601, // SDTV standard with restricted "studio swing" color range.
95 REC_709, // HDTV standard with restricted "studio swing" color range.
96 JPEG, // Full color range [0, 255] JPEG color space.
99 struct YUVVideoQuadState {
100 RectF ya_tex_coord_rect;
101 RectF uv_tex_coord_rect;
104 uint32 y_plane_resource_id;
105 uint32 u_plane_resource_id;
106 uint32 v_plane_resource_id;
107 uint32 a_plane_resource_id;
108 YUVColorSpace color_space;
117 STREAM_VIDEO_CONTENT,
127 // This rect, after applying the quad_transform(), gives the geometry that
128 // this quad should draw to. This rect lives in content space.
131 // This specifies the region of the quad that is opaque. This rect lives in
135 // Allows changing the rect that gets drawn to make it smaller. This value
136 // should be clipped to |rect|. This rect lives in content space.
139 // Allows changing the rect that gets drawn to make it smaller. This value
140 // should be clipped to |rect|. This rect lives in content space.
143 // Index into the containing pass' shared quad state array which has state
144 // (transforms etc) shared by multiple quads.
145 uint32 shared_quad_state_index;
147 // Only one of the following will be set, depending on the material.
148 CheckerboardQuadState? checkerboard_quad_state;
149 DebugBorderQuadState? debug_border_quad_state;
150 IoSurfaceContentQuadState? io_surface_quad_state;
151 RenderPassQuadState? render_pass_quad_state;
152 SolidColorQuadState? solid_color_quad_state;
153 SurfaceQuadState? surface_quad_state;
154 TextureQuadState? texture_quad_state;
155 TileQuadState? tile_quad_state;
156 StreamVideoQuadState? stream_video_quad_state;
157 YUVVideoQuadState? yuv_video_quad_state;
161 kClear_Mode = 0, //!< [0, 0]
162 kSrc_Mode, //!< [Sa, Sc]
163 kDst_Mode, //!< [Da, Dc]
164 kSrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc]
165 kDstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc]
166 kSrcIn_Mode, //!< [Sa * Da, Sc * Da]
167 kDstIn_Mode, //!< [Sa * Da, Sa * Dc]
168 kSrcOut_Mode, //!< [Sa * (1 - Da), Sc * (1 - Da)]
169 kDstOut_Mode, //!< [Da * (1 - Sa), Dc * (1 - Sa)]
170 kSrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc]
171 kDstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)]
172 kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
173 kPlus_Mode, //!< [Sa + Da, Sc + Dc]
174 kModulate_Mode, // multiplies all components (= alpha and color)
176 // Following blend modes are defined in the CSS Compositing standard:
177 // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending
179 kLastCoeffMode = kScreen_Mode,
191 kLastSeparableMode = kMultiply_Mode,
197 kLastMode = kLuminosity_Mode
200 struct SharedQuadState {
201 // Transforms quad rects into the target content space.
202 Transform quad_to_target_transform;
204 // The size of the quads' originating layer in the space of the quad rects.
205 Size quad_layer_bounds;
207 // The size of the visible area in the quads' originating layer, in the space
208 // of the quad rects.
209 Rect visible_quad_layer_rect;
211 // This rect lives in the target content space.
216 SkXfermode blend_mode;
217 int32 sorting_context_id;
224 Transform transform_to_root_target;
225 bool has_transparent_background;
227 array<SharedQuadState> shared_quad_states;