OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "cc/ipc/cc_param_traits.h" | 5 #include "cc/ipc/cc_param_traits.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 l->append("("); | 319 l->append("("); |
320 LogParam(p.get() ? p->countInputs() : 0, l); | 320 LogParam(p.get() ? p->countInputs() : 0, l); |
321 l->append(")"); | 321 l->append(")"); |
322 } | 322 } |
323 | 323 |
324 void ParamTraits<cc::RenderPass>::Write(base::Pickle* m, const param_type& p) { | 324 void ParamTraits<cc::RenderPass>::Write(base::Pickle* m, const param_type& p) { |
325 WriteParam(m, p.id); | 325 WriteParam(m, p.id); |
326 WriteParam(m, p.output_rect); | 326 WriteParam(m, p.output_rect); |
327 WriteParam(m, p.damage_rect); | 327 WriteParam(m, p.damage_rect); |
328 WriteParam(m, p.transform_to_root_target); | 328 WriteParam(m, p.transform_to_root_target); |
| 329 WriteParam(m, p.filters); |
| 330 WriteParam(m, p.background_filters); |
329 WriteParam(m, p.has_transparent_background); | 331 WriteParam(m, p.has_transparent_background); |
330 WriteParam(m, base::checked_cast<uint32_t>(p.quad_list.size())); | 332 WriteParam(m, base::checked_cast<uint32_t>(p.quad_list.size())); |
331 | 333 |
332 cc::SharedQuadStateList::ConstIterator shared_quad_state_iter = | 334 cc::SharedQuadStateList::ConstIterator shared_quad_state_iter = |
333 p.shared_quad_state_list.begin(); | 335 p.shared_quad_state_list.begin(); |
334 cc::SharedQuadStateList::ConstIterator last_shared_quad_state_iter = | 336 cc::SharedQuadStateList::ConstIterator last_shared_quad_state_iter = |
335 p.shared_quad_state_list.end(); | 337 p.shared_quad_state_list.end(); |
336 for (auto* quad : p.quad_list) { | 338 for (auto* quad : p.quad_list) { |
337 DCHECK(quad->rect.Contains(quad->visible_rect)) | 339 DCHECK(quad->rect.Contains(quad->visible_rect)) |
338 << quad->material << " rect: " << quad->rect.ToString() | 340 << quad->material << " rect: " << quad->rect.ToString() |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 402 |
401 // Whether the quad points to a new shared quad state for each quad. | 403 // Whether the quad points to a new shared quad state for each quad. |
402 to_reserve += p.quad_list.size() * sizeof(bool); | 404 to_reserve += p.quad_list.size() * sizeof(bool); |
403 | 405 |
404 // Shared quad state is only written when a quad contains a shared quad state | 406 // Shared quad state is only written when a quad contains a shared quad state |
405 // that has not been written. | 407 // that has not been written. |
406 to_reserve += p.shared_quad_state_list.size() * sizeof(cc::SharedQuadState); | 408 to_reserve += p.shared_quad_state_list.size() * sizeof(cc::SharedQuadState); |
407 | 409 |
408 // The largest quad type, verified by a unit test. | 410 // The largest quad type, verified by a unit test. |
409 to_reserve += p.quad_list.size() * cc::LargestDrawQuadSize(); | 411 to_reserve += p.quad_list.size() * cc::LargestDrawQuadSize(); |
| 412 |
| 413 base::PickleSizer sizer; |
| 414 GetParamSize(&sizer, p.filters); |
| 415 GetParamSize(&sizer, p.background_filters); |
| 416 to_reserve += sizer.payload_size(); |
| 417 |
410 return to_reserve; | 418 return to_reserve; |
411 } | 419 } |
412 | 420 |
413 template <typename QuadType> | 421 template <typename QuadType> |
414 static cc::DrawQuad* ReadDrawQuad(const base::Pickle* m, | 422 static cc::DrawQuad* ReadDrawQuad(const base::Pickle* m, |
415 base::PickleIterator* iter, | 423 base::PickleIterator* iter, |
416 cc::RenderPass* render_pass) { | 424 cc::RenderPass* render_pass) { |
417 QuadType* quad = render_pass->CreateAndAppendDrawQuad<QuadType>(); | 425 QuadType* quad = render_pass->CreateAndAppendDrawQuad<QuadType>(); |
418 if (!ReadParam(m, iter, quad)) | 426 if (!ReadParam(m, iter, quad)) |
419 return NULL; | 427 return NULL; |
420 return quad; | 428 return quad; |
421 } | 429 } |
422 | 430 |
423 bool ParamTraits<cc::RenderPass>::Read(const base::Pickle* m, | 431 bool ParamTraits<cc::RenderPass>::Read(const base::Pickle* m, |
424 base::PickleIterator* iter, | 432 base::PickleIterator* iter, |
425 param_type* p) { | 433 param_type* p) { |
426 int id; | 434 int id; |
427 gfx::Rect output_rect; | 435 gfx::Rect output_rect; |
428 gfx::Rect damage_rect; | 436 gfx::Rect damage_rect; |
429 gfx::Transform transform_to_root_target; | 437 gfx::Transform transform_to_root_target; |
| 438 cc::FilterOperations filters; |
| 439 cc::FilterOperations background_filters; |
430 bool has_transparent_background; | 440 bool has_transparent_background; |
431 uint32_t quad_list_size; | 441 uint32_t quad_list_size; |
432 | 442 |
433 if (!ReadParam(m, iter, &id) || !ReadParam(m, iter, &output_rect) || | 443 if (!ReadParam(m, iter, &id) || !ReadParam(m, iter, &output_rect) || |
434 !ReadParam(m, iter, &damage_rect) || | 444 !ReadParam(m, iter, &damage_rect) || |
435 !ReadParam(m, iter, &transform_to_root_target) || | 445 !ReadParam(m, iter, &transform_to_root_target) || |
| 446 !ReadParam(m, iter, &filters) || |
| 447 !ReadParam(m, iter, &background_filters) || |
436 !ReadParam(m, iter, &has_transparent_background) || | 448 !ReadParam(m, iter, &has_transparent_background) || |
437 !ReadParam(m, iter, &quad_list_size)) | 449 !ReadParam(m, iter, &quad_list_size)) |
438 return false; | 450 return false; |
439 | 451 |
440 p->SetAll(id, output_rect, damage_rect, transform_to_root_target, | 452 p->SetAll(id, output_rect, damage_rect, transform_to_root_target, filters, |
441 has_transparent_background); | 453 background_filters, has_transparent_background); |
442 | 454 |
443 for (uint32_t i = 0; i < quad_list_size; ++i) { | 455 for (uint32_t i = 0; i < quad_list_size; ++i) { |
444 cc::DrawQuad::Material material; | 456 cc::DrawQuad::Material material; |
445 base::PickleIterator temp_iter = *iter; | 457 base::PickleIterator temp_iter = *iter; |
446 if (!ReadParam(m, &temp_iter, &material)) | 458 if (!ReadParam(m, &temp_iter, &material)) |
447 return false; | 459 return false; |
448 | 460 |
449 cc::DrawQuad* draw_quad = NULL; | 461 cc::DrawQuad* draw_quad = NULL; |
450 switch (material) { | 462 switch (material) { |
451 case cc::DrawQuad::DEBUG_BORDER: | 463 case cc::DrawQuad::DEBUG_BORDER: |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 void ParamTraits<cc::RenderPass>::Log(const param_type& p, std::string* l) { | 526 void ParamTraits<cc::RenderPass>::Log(const param_type& p, std::string* l) { |
515 l->append("RenderPass(("); | 527 l->append("RenderPass(("); |
516 LogParam(p.id, l); | 528 LogParam(p.id, l); |
517 l->append("), "); | 529 l->append("), "); |
518 LogParam(p.output_rect, l); | 530 LogParam(p.output_rect, l); |
519 l->append(", "); | 531 l->append(", "); |
520 LogParam(p.damage_rect, l); | 532 LogParam(p.damage_rect, l); |
521 l->append(", "); | 533 l->append(", "); |
522 LogParam(p.transform_to_root_target, l); | 534 LogParam(p.transform_to_root_target, l); |
523 l->append(", "); | 535 l->append(", "); |
| 536 LogParam(p.filters, l); |
| 537 l->append(", "); |
| 538 LogParam(p.background_filters, l); |
| 539 l->append(", "); |
524 LogParam(p.has_transparent_background, l); | 540 LogParam(p.has_transparent_background, l); |
525 l->append(", "); | 541 l->append(", "); |
526 | 542 |
527 l->append("["); | 543 l->append("["); |
528 for (auto* shared_quad_state : p.shared_quad_state_list) { | 544 for (auto* shared_quad_state : p.shared_quad_state_list) { |
529 if (shared_quad_state != p.shared_quad_state_list.front()) | 545 if (shared_quad_state != p.shared_quad_state_list.front()) |
530 l->append(", "); | 546 l->append(", "); |
531 LogParam(*shared_quad_state, l); | 547 LogParam(*shared_quad_state, l); |
532 } | 548 } |
533 l->append("], ["); | 549 l->append("], ["); |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 988 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ |
973 #include "cc/ipc/cc_param_traits_macros.h" | 989 #include "cc/ipc/cc_param_traits_macros.h" |
974 } // namespace IPC | 990 } // namespace IPC |
975 | 991 |
976 // Generate param traits log methods. | 992 // Generate param traits log methods. |
977 #include "ipc/param_traits_log_macros.h" | 993 #include "ipc/param_traits_log_macros.h" |
978 namespace IPC { | 994 namespace IPC { |
979 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 995 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ |
980 #include "cc/ipc/cc_param_traits_macros.h" | 996 #include "cc/ipc/cc_param_traits_macros.h" |
981 } // namespace IPC | 997 } // namespace IPC |
OLD | NEW |