// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. module viz.mojom; import "services/viz/public/interfaces/compositing/surface_id.mojom"; import "services/viz/public/interfaces/compositing/shared_quad_state.mojom"; import "ui/gfx/geometry/mojo/geometry.mojom"; import "ui/gfx/mojo/color_space.mojom"; import "ui/gfx/mojo/transform.mojom"; struct DebugBorderQuadState { // Debug border color. uint32 color; // Debug border width. int32 width; }; struct RenderPassQuadState { uint64 render_pass_id; // If nonzero, resource id of mask to use when drawing this pass. uint32 mask_resource_id; // Render surface's normalized mask texture rect. gfx.mojom.RectF mask_uv_rect; gfx.mojom.Size mask_texture_size; // The scale from layer space of the root layer of the render pass to // the render pass physical pixels. This scale is applied to the filter // parameters for pixel-moving filters. This scale should include // content-to-target-space scale, and device pixel ratio. gfx.mojom.Vector2dF filters_scale; // The offset from the bounds of the root layer to the origin of the // original primitive. This used to correctly position crop rects, lights, // etc. gfx.mojom.PointF filters_origin; // Render surface's non-normalized texture rect. gfx.mojom.RectF tex_coord_rect; bool force_anti_aliasing_off; }; struct SolidColorQuadState { uint32 color; bool force_anti_aliasing_off; }; struct StreamVideoQuadState { uint32 resource_id; gfx.mojom.Size resource_size_in_pixels; gfx.mojom.Transform matrix; }; enum SurfaceDrawQuadType { PRIMARY, FALLBACK, }; struct SurfaceQuadState { SurfaceId surface; SurfaceDrawQuadType surface_draw_quad_type; uint32 default_background_color; }; struct TextureQuadState { uint32 resource_id; gfx.mojom.Size resource_size_in_pixels; bool premultiplied_alpha; gfx.mojom.PointF uv_top_left; gfx.mojom.PointF uv_bottom_right; uint32 background_color; array vertex_opacity; bool y_flipped; bool nearest_neighbor; bool secure_output_only; }; struct TileQuadState { gfx.mojom.RectF tex_coord_rect; gfx.mojom.Size texture_size; bool swizzle_contents; uint32 resource_id; bool nearest_neighbor; bool force_anti_aliasing_off; }; enum YUVColorSpace { REC_601, // SDTV standard with restricted "studio swing" color range. REC_709, // HDTV standard with restricted "studio swing" color range. JPEG, // Full color range [0, 255] JPEG color space. }; struct YUVVideoQuadState { gfx.mojom.RectF ya_tex_coord_rect; gfx.mojom.RectF uv_tex_coord_rect; gfx.mojom.Size ya_tex_size; gfx.mojom.Size uv_tex_size; uint32 y_plane_resource_id; uint32 u_plane_resource_id; uint32 v_plane_resource_id; uint32 a_plane_resource_id; YUVColorSpace color_space; float resource_offset; float resource_multiplier; uint32 bits_per_channel; gfx.mojom.ColorSpace video_color_space; bool require_overlay; }; union DrawQuadState { DebugBorderQuadState debug_border_quad_state; RenderPassQuadState render_pass_quad_state; SolidColorQuadState solid_color_quad_state; StreamVideoQuadState stream_video_quad_state; SurfaceQuadState surface_quad_state; TextureQuadState texture_quad_state; TileQuadState tile_quad_state; YUVVideoQuadState yuv_video_quad_state; }; struct DrawQuad { // This rect, after applying the quad_transform(), gives the geometry that // this quad should draw to. This rect lives in content space. gfx.mojom.Rect rect; // Allows changing the rect that gets drawn to make it smaller. This value // should be clipped to |rect|. This rect lives in content space. gfx.mojom.Rect visible_rect; // Allows changing the rect that gets drawn to make it smaller. This value // should be clipped to |rect|. This rect lives in content space. bool needs_blending; // Optionally holds a SharedQuadState (transforms etc) shared by multiple // quads. SharedQuadState? sqs; DrawQuadState draw_quad_state; };