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