| 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 "components/view_manager/public/interfaces/surface_id.mojom"; | |
| 8 import "ui/mojo/geometry/geometry.mojom"; | |
| 9 | |
| 10 struct Color { | |
| 11 uint32 rgba; | |
| 12 }; | |
| 13 | |
| 14 struct CheckerboardQuadState { | |
| 15 // Checkerboard color. | |
| 16 Color color; | |
| 17 | |
| 18 // The scale factor of checkers. Chromium uses device scale factor for | |
| 19 // it. | |
| 20 float scale; | |
| 21 }; | |
| 22 | |
| 23 struct DebugBorderQuadState { | |
| 24 // Debug border color. | |
| 25 Color color; | |
| 26 | |
| 27 // Debug border width. | |
| 28 int32 width; | |
| 29 }; | |
| 30 | |
| 31 // TODO(jamesr): Populate subtype fields. | |
| 32 struct IoSurfaceContentQuadState {}; | |
| 33 | |
| 34 struct RenderPassId { | |
| 35 int32 layer_id; | |
| 36 uint32 index; | |
| 37 }; | |
| 38 | |
| 39 struct RenderPassQuadState { | |
| 40 RenderPassId render_pass_id; | |
| 41 | |
| 42 // If nonzero, resource id of mask to use when drawing this pass. | |
| 43 uint32 mask_resource_id; | |
| 44 PointF mask_uv_scale; | |
| 45 Size mask_texture_size; | |
| 46 | |
| 47 // Post-processing filters, applied to the pixels in the render pass' texture. | |
| 48 // TODO(jamesr): Support | |
| 49 // FilterOperations filters; | |
| 50 | |
| 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. | |
| 55 PointF filters_scale; | |
| 56 | |
| 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; | |
| 61 }; | |
| 62 | |
| 63 struct SolidColorQuadState { | |
| 64 Color color; | |
| 65 bool force_anti_aliasing_off; | |
| 66 }; | |
| 67 | |
| 68 struct SurfaceQuadState { | |
| 69 SurfaceId surface; | |
| 70 }; | |
| 71 | |
| 72 struct TextureQuadState { | |
| 73 uint32 resource_id; | |
| 74 bool premultiplied_alpha; | |
| 75 PointF uv_top_left; | |
| 76 PointF uv_bottom_right; | |
| 77 Color background_color; | |
| 78 array<float, 4> vertex_opacity; | |
| 79 bool y_flipped; | |
| 80 bool nearest_neighbor; | |
| 81 }; | |
| 82 | |
| 83 struct TileQuadState { | |
| 84 RectF tex_coord_rect; | |
| 85 Size texture_size; | |
| 86 bool swizzle_contents; | |
| 87 uint32 resource_id; | |
| 88 bool nearest_neighbor; | |
| 89 }; | |
| 90 | |
| 91 struct StreamVideoQuadState {}; | |
| 92 | |
| 93 enum YUVColorSpace { | |
| 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. | |
| 97 }; | |
| 98 | |
| 99 struct YUVVideoQuadState { | |
| 100 RectF ya_tex_coord_rect; | |
| 101 RectF uv_tex_coord_rect; | |
| 102 Size ya_tex_size; | |
| 103 Size uv_tex_size; | |
| 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; | |
| 109 }; | |
| 110 | |
| 111 enum Material { | |
| 112 DEBUG_BORDER = 1, | |
| 113 IO_SURFACE_CONTENT, | |
| 114 PICTURE_CONTENT, | |
| 115 RENDER_PASS, | |
| 116 SOLID_COLOR, | |
| 117 STREAM_VIDEO_CONTENT, | |
| 118 SURFACE_CONTENT, | |
| 119 TEXTURE_CONTENT, | |
| 120 TILED_CONTENT, | |
| 121 YUV_VIDEO_CONTENT, | |
| 122 }; | |
| 123 | |
| 124 struct Quad { | |
| 125 Material material; | |
| 126 | |
| 127 // This rect, after applying the quad_transform(), gives the geometry that | |
| 128 // this quad should draw to. This rect lives in content space. | |
| 129 Rect rect; | |
| 130 | |
| 131 // This specifies the region of the quad that is opaque. This rect lives in | |
| 132 // content space. | |
| 133 Rect opaque_rect; | |
| 134 | |
| 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. | |
| 137 Rect visible_rect; | |
| 138 | |
| 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. | |
| 141 bool needs_blending; | |
| 142 | |
| 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; | |
| 146 | |
| 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; | |
| 158 }; | |
| 159 | |
| 160 enum SkXfermode { | |
| 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) | |
| 175 | |
| 176 // Following blend modes are defined in the CSS Compositing standard: | |
| 177 // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending | |
| 178 kScreen_Mode, | |
| 179 kLastCoeffMode = kScreen_Mode, | |
| 180 | |
| 181 kOverlay_Mode, | |
| 182 kDarken_Mode, | |
| 183 kLighten_Mode, | |
| 184 kColorDodge_Mode, | |
| 185 kColorBurn_Mode, | |
| 186 kHardLight_Mode, | |
| 187 kSoftLight_Mode, | |
| 188 kDifference_Mode, | |
| 189 kExclusion_Mode, | |
| 190 kMultiply_Mode, | |
| 191 kLastSeparableMode = kMultiply_Mode, | |
| 192 | |
| 193 kHue_Mode, | |
| 194 kSaturation_Mode, | |
| 195 kColor_Mode, | |
| 196 kLuminosity_Mode, | |
| 197 kLastMode = kLuminosity_Mode | |
| 198 }; | |
| 199 | |
| 200 struct SharedQuadState { | |
| 201 // Transforms quad rects into the target content space. | |
| 202 Transform quad_to_target_transform; | |
| 203 | |
| 204 // The size of the quads' originating layer in the space of the quad rects. | |
| 205 Size quad_layer_bounds; | |
| 206 | |
| 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; | |
| 210 | |
| 211 // This rect lives in the target content space. | |
| 212 Rect clip_rect; | |
| 213 | |
| 214 bool is_clipped; | |
| 215 float opacity; | |
| 216 SkXfermode blend_mode; | |
| 217 int32 sorting_context_id; | |
| 218 }; | |
| 219 | |
| 220 struct Pass { | |
| 221 RenderPassId id; | |
| 222 Rect output_rect; | |
| 223 Rect damage_rect; | |
| 224 Transform transform_to_root_target; | |
| 225 bool has_transparent_background; | |
| 226 array<Quad> quads; | |
| 227 array<SharedQuadState> shared_quad_states; | |
| 228 }; | |
| OLD | NEW |