Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: cc/ipc/quads_struct_traits.h

Issue 2101543002: Implement StreamVideoDrawQuad StructTraits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/ipc/quads.mojom ('k') | cc/ipc/quads_struct_traits.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CC_IPC_QUADS_STRUCT_TRAITS_H_ 5 #ifndef CC_IPC_QUADS_STRUCT_TRAITS_H_
6 #define CC_IPC_QUADS_STRUCT_TRAITS_H_ 6 #define CC_IPC_QUADS_STRUCT_TRAITS_H_
7 7
8 #include "cc/ipc/filter_operation_struct_traits.h" 8 #include "cc/ipc/filter_operation_struct_traits.h"
9 #include "cc/ipc/filter_operations_struct_traits.h" 9 #include "cc/ipc/filter_operations_struct_traits.h"
10 #include "cc/ipc/quads.mojom.h" 10 #include "cc/ipc/quads.mojom.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 const cc::SolidColorDrawQuad* quad = 138 const cc::SolidColorDrawQuad* quad =
139 cc::SolidColorDrawQuad::MaterialCast(&input); 139 cc::SolidColorDrawQuad::MaterialCast(&input);
140 return quad->force_anti_aliasing_off; 140 return quad->force_anti_aliasing_off;
141 } 141 }
142 142
143 static bool Read(cc::mojom::SolidColorQuadStateDataView data, 143 static bool Read(cc::mojom::SolidColorQuadStateDataView data,
144 cc::DrawQuad* out); 144 cc::DrawQuad* out);
145 }; 145 };
146 146
147 template <> 147 template <>
148 struct StructTraits<cc::mojom::StreamVideoQuadState, cc::DrawQuad> {
149 static bool IsNull(const cc::DrawQuad& input) {
150 return input.material != cc::DrawQuad::STREAM_VIDEO_CONTENT;
151 }
152
153 static void SetToNull(cc::DrawQuad* output) {
154 // There is nothing to deserialize here if the DrawQuad is not a
155 // StreamVideoDrawQuad. If it is, then this should not be called.
156 DCHECK_NE(cc::DrawQuad::STREAM_VIDEO_CONTENT, output->material);
157 }
158
159 static uint32_t resource_id(const cc::DrawQuad& input) {
160 const cc::StreamVideoDrawQuad* quad =
161 cc::StreamVideoDrawQuad::MaterialCast(&input);
162 return quad->resources.ids[cc::StreamVideoDrawQuad::kResourceIdIndex];
163 }
164
165 static const gfx::Size& resource_size_in_pixels(const cc::DrawQuad& input) {
166 const cc::StreamVideoDrawQuad* quad =
167 cc::StreamVideoDrawQuad::MaterialCast(&input);
168 return quad->overlay_resources
169 .size_in_pixels[cc::StreamVideoDrawQuad::kResourceIdIndex];
170 }
171
172 static const gfx::Transform& matrix(const cc::DrawQuad& input) {
173 const cc::StreamVideoDrawQuad* quad =
174 cc::StreamVideoDrawQuad::MaterialCast(&input);
175 return quad->matrix;
176 }
177
178 static bool Read(cc::mojom::StreamVideoQuadStateDataView data,
179 cc::DrawQuad* out);
180 };
181
182 template <>
148 struct StructTraits<cc::mojom::SurfaceQuadState, cc::DrawQuad> { 183 struct StructTraits<cc::mojom::SurfaceQuadState, cc::DrawQuad> {
149 static bool IsNull(const cc::DrawQuad& input) { 184 static bool IsNull(const cc::DrawQuad& input) {
150 return input.material != cc::DrawQuad::SURFACE_CONTENT; 185 return input.material != cc::DrawQuad::SURFACE_CONTENT;
151 } 186 }
152 187
153 static void SetToNull(cc::DrawQuad* output) { 188 static void SetToNull(cc::DrawQuad* output) {
154 // There is nothing to deserialize here if the DrawQuad is not a 189 // There is nothing to deserialize here if the DrawQuad is not a
155 // SurfaceDrawQuad. If it is, then this should not be called. 190 // SurfaceDrawQuad. If it is, then this should not be called.
156 DCHECK_NE(cc::DrawQuad::SURFACE_CONTENT, output->material); 191 DCHECK_NE(cc::DrawQuad::SURFACE_CONTENT, output->material);
157 } 192 }
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 427 }
393 428
394 static const cc::DrawQuad& texture_quad_state(const cc::DrawQuad& quad) { 429 static const cc::DrawQuad& texture_quad_state(const cc::DrawQuad& quad) {
395 return quad; 430 return quad;
396 } 431 }
397 432
398 static const cc::DrawQuad& tile_quad_state(const cc::DrawQuad& quad) { 433 static const cc::DrawQuad& tile_quad_state(const cc::DrawQuad& quad) {
399 return quad; 434 return quad;
400 } 435 }
401 436
402 static cc::mojom::StreamVideoQuadStatePtr stream_video_quad_state( 437 static const cc::DrawQuad& stream_video_quad_state(const cc::DrawQuad& quad) {
403 const cc::DrawQuad& data) { 438 return quad;
404 return nullptr;
405 } 439 }
406 440
407 static const cc::DrawQuad& yuv_video_quad_state(const cc::DrawQuad& data) { 441 static const cc::DrawQuad& yuv_video_quad_state(const cc::DrawQuad& data) {
408 return data; 442 return data;
409 } 443 }
410 444
411 static bool Read(cc::mojom::DrawQuadDataView data, cc::DrawQuad* out); 445 static bool Read(cc::mojom::DrawQuadDataView data, cc::DrawQuad* out);
412 }; 446 };
413 447
414 struct QuadListArray { 448 struct QuadListArray {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 void* context); 482 void* context);
449 static QuadListArray quads(const cc::QuadList& quad_list) { 483 static QuadListArray quads(const cc::QuadList& quad_list) {
450 return {quad_list.size(), const_cast<cc::QuadList*>(&quad_list)}; 484 return {quad_list.size(), const_cast<cc::QuadList*>(&quad_list)};
451 } 485 }
452 static bool Read(cc::mojom::QuadListDataView data, cc::QuadList* out); 486 static bool Read(cc::mojom::QuadListDataView data, cc::QuadList* out);
453 }; 487 };
454 488
455 } // namespace mojo 489 } // namespace mojo
456 490
457 #endif // CC_IPC_QUADS_STRUCT_TRAITS_H_ 491 #endif // CC_IPC_QUADS_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « cc/ipc/quads.mojom ('k') | cc/ipc/quads_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698