OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 import "mojo/services/public/interfaces/geometry/geometry.mojom" | 5 import "mojo/services/public/interfaces/geometry/geometry.mojom" |
6 import "mojo/services/public/interfaces/surfaces/surface_id.mojom" | 6 import "mojo/services/public/interfaces/surfaces/surface_id.mojom" |
7 | 7 |
8 module mojo { | 8 module mojo { |
9 | 9 |
10 struct Color { | 10 struct Color { |
11 uint32 rgba; | 11 uint32 rgba; |
12 }; | 12 }; |
13 | 13 |
14 // TODO(jamesr): Populate subtype fields. | 14 // TODO(jamesr): Populate subtype fields. |
15 struct CheckerboardQuadState {}; | 15 struct CheckerboardQuadState {}; |
16 | 16 |
17 struct DebugBorderQuadState {}; | 17 struct DebugBorderQuadState {}; |
18 | 18 |
19 struct IoSurfaceContentQuadState {}; | 19 struct IoSurfaceContentQuadState {}; |
20 | 20 |
21 struct RenderPassQuadState {}; | 21 struct RenderPassId { |
| 22 int32 layer_id; |
| 23 int32 index; |
| 24 }; |
| 25 |
| 26 struct RenderPassQuadState { |
| 27 RenderPassId render_pass_id; |
| 28 |
| 29 // If nonzero, resource id of mask to use when drawing this pass. |
| 30 uint32 mask_resource_id; |
| 31 RectF mask_uv_rect; |
| 32 |
| 33 // Post-processing filters, applied to the pixels in the render pass' texture. |
| 34 // TODO(jamesr): Support |
| 35 // FilterOperations filters; |
| 36 |
| 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. |
| 41 PointF filters_scale; |
| 42 |
| 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; |
| 47 }; |
22 | 48 |
23 struct SolidColorQuadState { | 49 struct SolidColorQuadState { |
24 Color color; | 50 Color color; |
25 bool force_anti_aliasing_off; | 51 bool force_anti_aliasing_off; |
26 }; | 52 }; |
27 | 53 |
28 struct SurfaceQuadState { | 54 struct SurfaceQuadState { |
29 SurfaceId surface; | 55 SurfaceId surface; |
30 }; | 56 }; |
31 | 57 |
32 struct TextureQuadState { | 58 struct TextureQuadState { |
33 uint32 resource_id; | 59 uint32 resource_id; |
34 bool premultiplied_alpha; | 60 bool premultiplied_alpha; |
35 mojo.PointF uv_top_left; | 61 PointF uv_top_left; |
36 mojo.PointF uv_bottom_right; | 62 PointF uv_bottom_right; |
37 Color background_color; | 63 Color background_color; |
38 float[4] vertex_opacity; | 64 float[4] vertex_opacity; |
39 bool flipped; | 65 bool flipped; |
40 }; | 66 }; |
41 | 67 |
42 struct TiledContentQuadState {}; | 68 struct TileQuadState { |
| 69 RectF tex_coord_rect; |
| 70 Size texture_size; |
| 71 bool swizzle_contents; |
| 72 uint32 resource_id; |
| 73 }; |
43 | 74 |
44 struct StreamVideoQuadState {}; | 75 struct StreamVideoQuadState {}; |
45 | 76 |
46 struct YUVVideoQuadState {}; | 77 struct YUVVideoQuadState {}; |
47 | 78 |
48 enum Material { | 79 enum Material { |
49 CHECKERBOARD = 1, | 80 CHECKERBOARD = 1, |
50 DEBUG_BORDER, | 81 DEBUG_BORDER, |
51 IO_SURFACE_CONTENT, | 82 IO_SURFACE_CONTENT, |
52 PICTURE_CONTENT, | 83 PICTURE_CONTENT, |
53 RENDER_PASS, | 84 RENDER_PASS, |
54 SOLID_COLOR, | 85 SOLID_COLOR, |
55 STREAM_VIDEO_CONTENT, | 86 STREAM_VIDEO_CONTENT, |
56 SURFACE_CONTENT, | 87 SURFACE_CONTENT, |
57 TEXTURE_CONTENT, | 88 TEXTURE_CONTENT, |
58 TILED_CONTENT, | 89 TILED_CONTENT, |
59 YUV_VIDEO_CONTENT, | 90 YUV_VIDEO_CONTENT, |
60 }; | 91 }; |
61 | 92 |
62 struct Quad { | 93 struct Quad { |
63 Material material; | 94 Material material; |
64 | 95 |
65 // This rect, after applying the quad_transform(), gives the geometry that | 96 // This rect, after applying the quad_transform(), gives the geometry that |
66 // this quad should draw to. This rect lives in content space. | 97 // this quad should draw to. This rect lives in content space. |
67 mojo.Rect rect; | 98 Rect rect; |
68 | 99 |
69 // This specifies the region of the quad that is opaque. This rect lives in | 100 // This specifies the region of the quad that is opaque. This rect lives in |
70 // content space. | 101 // content space. |
71 mojo.Rect opaque_rect; | 102 Rect opaque_rect; |
72 | 103 |
73 // Allows changing the rect that gets drawn to make it smaller. This value | 104 // Allows changing the rect that gets drawn to make it smaller. This value |
74 // should be clipped to |rect|. This rect lives in content space. | 105 // should be clipped to |rect|. This rect lives in content space. |
75 mojo.Rect visible_rect; | 106 Rect visible_rect; |
76 | 107 |
77 // Allows changing the rect that gets drawn to make it smaller. This value | 108 // Allows changing the rect that gets drawn to make it smaller. This value |
78 // should be clipped to |rect|. This rect lives in content space. | 109 // should be clipped to |rect|. This rect lives in content space. |
79 bool needs_blending; | 110 bool needs_blending; |
80 | 111 |
81 // Index into the containing pass' shared quad state array which has state | 112 // Index into the containing pass' shared quad state array which has state |
82 // (transforms etc) shared by multiple quads. | 113 // (transforms etc) shared by multiple quads. |
83 int32 shared_quad_state_index; | 114 int32 shared_quad_state_index; |
84 | 115 |
85 // Only one of the following will be set, depending on the material. | 116 // Only one of the following will be set, depending on the material. |
86 CheckerboardQuadState? checkerboard_quad_state; | 117 CheckerboardQuadState? checkerboard_quad_state; |
87 DebugBorderQuadState? debug_border_quad_state; | 118 DebugBorderQuadState? debug_border_quad_state; |
88 IoSurfaceContentQuadState? io_surface_quad_state; | 119 IoSurfaceContentQuadState? io_surface_quad_state; |
89 RenderPassQuadState? render_pass_quad_state; | 120 RenderPassQuadState? render_pass_quad_state; |
90 SolidColorQuadState? solid_color_quad_state; | 121 SolidColorQuadState? solid_color_quad_state; |
91 SurfaceQuadState? surface_quad_state; | 122 SurfaceQuadState? surface_quad_state; |
92 TextureQuadState? texture_quad_state; | 123 TextureQuadState? texture_quad_state; |
93 TiledContentQuadState? tiled_content_quad_state; | 124 TileQuadState? tile_quad_state; |
94 StreamVideoQuadState? stream_video_quad_state; | 125 StreamVideoQuadState? stream_video_quad_state; |
95 YUVVideoQuadState? yuv_video_quad_state; | 126 YUVVideoQuadState? yuv_video_quad_state; |
96 }; | 127 }; |
97 | 128 |
98 enum SkXfermode { | 129 enum SkXfermode { |
99 kClear_Mode = 0, //!< [0, 0] | 130 kClear_Mode = 0, //!< [0, 0] |
100 kSrc_Mode, //!< [Sa, Sc] | 131 kSrc_Mode, //!< [Sa, Sc] |
101 kDst_Mode, //!< [Da, Dc] | 132 kDst_Mode, //!< [Da, Dc] |
102 kSrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc] | 133 kSrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc] |
103 kDstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc] | 134 kDstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc] |
(...skipping 26 matching lines...) Expand all Loading... |
130 | 161 |
131 kHue_Mode, | 162 kHue_Mode, |
132 kSaturation_Mode, | 163 kSaturation_Mode, |
133 kColor_Mode, | 164 kColor_Mode, |
134 kLuminosity_Mode, | 165 kLuminosity_Mode, |
135 kLastMode = kLuminosity_Mode | 166 kLastMode = kLuminosity_Mode |
136 }; | 167 }; |
137 | 168 |
138 struct SharedQuadState { | 169 struct SharedQuadState { |
139 // Transforms from quad's original content space to its target content space. | 170 // Transforms from quad's original content space to its target content space. |
140 mojo.Transform content_to_target_transform; | 171 Transform content_to_target_transform; |
141 | 172 |
142 // This size lives in the content space for the quad's originating layer. | 173 // This size lives in the content space for the quad's originating layer. |
143 mojo.Size content_bounds; | 174 Size content_bounds; |
144 | 175 |
145 // This rect lives in the content space for the quad's originating layer. | 176 // This rect lives in the content space for the quad's originating layer. |
146 mojo.Rect visible_content_rect; | 177 Rect visible_content_rect; |
147 | 178 |
148 // This rect lives in the target content space. | 179 // This rect lives in the target content space. |
149 mojo.Rect clip_rect; | 180 Rect clip_rect; |
150 | 181 |
151 bool is_clipped; | 182 bool is_clipped; |
152 float opacity; | 183 float opacity; |
153 SkXfermode blend_mode; | 184 SkXfermode blend_mode; |
154 int32 sorting_context_id; | 185 int32 sorting_context_id; |
155 }; | 186 }; |
156 | 187 |
157 struct Pass { | 188 struct Pass { |
158 int32 id; | 189 int32 id; |
159 mojo.Rect output_rect; | 190 Rect output_rect; |
160 mojo.Rect damage_rect; | 191 Rect damage_rect; |
161 mojo.Transform transform_to_root_target; | 192 Transform transform_to_root_target; |
162 bool has_transparent_background; | 193 bool has_transparent_background; |
163 Quad[] quads; | 194 Quad[] quads; |
164 SharedQuadState[] shared_quad_states; | 195 SharedQuadState[] shared_quad_states; |
165 }; | 196 }; |
166 | 197 |
167 } | 198 } |
OLD | NEW |