Chromium Code Reviews| 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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); | 329 WriteParam(m, p.filters); |
| 330 WriteParam(m, p.background_filters); | 330 WriteParam(m, p.background_filters); |
| 331 WriteParam(m, p.color_space); | |
| 331 WriteParam(m, p.has_transparent_background); | 332 WriteParam(m, p.has_transparent_background); |
| 332 WriteParam(m, base::checked_cast<uint32_t>(p.quad_list.size())); | 333 WriteParam(m, base::checked_cast<uint32_t>(p.quad_list.size())); |
| 333 | 334 |
| 334 cc::SharedQuadStateList::ConstIterator shared_quad_state_iter = | 335 cc::SharedQuadStateList::ConstIterator shared_quad_state_iter = |
| 335 p.shared_quad_state_list.begin(); | 336 p.shared_quad_state_list.begin(); |
| 336 cc::SharedQuadStateList::ConstIterator last_shared_quad_state_iter = | 337 cc::SharedQuadStateList::ConstIterator last_shared_quad_state_iter = |
| 337 p.shared_quad_state_list.end(); | 338 p.shared_quad_state_list.end(); |
| 338 for (auto* quad : p.quad_list) { | 339 for (auto* quad : p.quad_list) { |
| 339 DCHECK(quad->rect.Contains(quad->visible_rect)) | 340 DCHECK(quad->rect.Contains(quad->visible_rect)) |
| 340 << quad->material << " rect: " << quad->rect.ToString() | 341 << quad->material << " rect: " << quad->rect.ToString() |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 | 431 |
| 431 bool ParamTraits<cc::RenderPass>::Read(const base::Pickle* m, | 432 bool ParamTraits<cc::RenderPass>::Read(const base::Pickle* m, |
| 432 base::PickleIterator* iter, | 433 base::PickleIterator* iter, |
| 433 param_type* p) { | 434 param_type* p) { |
| 434 int id; | 435 int id; |
| 435 gfx::Rect output_rect; | 436 gfx::Rect output_rect; |
| 436 gfx::Rect damage_rect; | 437 gfx::Rect damage_rect; |
| 437 gfx::Transform transform_to_root_target; | 438 gfx::Transform transform_to_root_target; |
| 438 cc::FilterOperations filters; | 439 cc::FilterOperations filters; |
| 439 cc::FilterOperations background_filters; | 440 cc::FilterOperations background_filters; |
| 441 gfx::ColorSpace color_space; | |
| 440 bool has_transparent_background; | 442 bool has_transparent_background; |
| 441 uint32_t quad_list_size; | 443 uint32_t quad_list_size; |
| 442 | 444 |
| 443 if (!ReadParam(m, iter, &id) || !ReadParam(m, iter, &output_rect) || | 445 if (!ReadParam(m, iter, &id) || !ReadParam(m, iter, &output_rect) || |
| 444 !ReadParam(m, iter, &damage_rect) || | 446 !ReadParam(m, iter, &damage_rect) || |
| 445 !ReadParam(m, iter, &transform_to_root_target) || | 447 !ReadParam(m, iter, &transform_to_root_target) || |
| 446 !ReadParam(m, iter, &filters) || | 448 !ReadParam(m, iter, &filters) || |
| 447 !ReadParam(m, iter, &background_filters) || | 449 !ReadParam(m, iter, &background_filters) || |
| 450 !ReadParam(m, iter, &color_space) || | |
| 448 !ReadParam(m, iter, &has_transparent_background) || | 451 !ReadParam(m, iter, &has_transparent_background) || |
| 449 !ReadParam(m, iter, &quad_list_size)) | 452 !ReadParam(m, iter, &quad_list_size)) |
| 450 return false; | 453 return false; |
| 451 | 454 |
| 452 p->SetAll(id, output_rect, damage_rect, transform_to_root_target, filters, | 455 p->SetAll(id, output_rect, damage_rect, transform_to_root_target, filters, |
| 453 background_filters, has_transparent_background); | 456 background_filters, color_space, has_transparent_background); |
|
dcheng
2017/02/13 22:47:45
Just curious, but how come ParamTraits uses SetAll
| |
| 454 | 457 |
| 455 for (uint32_t i = 0; i < quad_list_size; ++i) { | 458 for (uint32_t i = 0; i < quad_list_size; ++i) { |
| 456 cc::DrawQuad::Material material; | 459 cc::DrawQuad::Material material; |
| 457 base::PickleIterator temp_iter = *iter; | 460 base::PickleIterator temp_iter = *iter; |
| 458 if (!ReadParam(m, &temp_iter, &material)) | 461 if (!ReadParam(m, &temp_iter, &material)) |
| 459 return false; | 462 return false; |
| 460 | 463 |
| 461 cc::DrawQuad* draw_quad = NULL; | 464 cc::DrawQuad* draw_quad = NULL; |
| 462 switch (material) { | 465 switch (material) { |
| 463 case cc::DrawQuad::DEBUG_BORDER: | 466 case cc::DrawQuad::DEBUG_BORDER: |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 530 LogParam(p.output_rect, l); | 533 LogParam(p.output_rect, l); |
| 531 l->append(", "); | 534 l->append(", "); |
| 532 LogParam(p.damage_rect, l); | 535 LogParam(p.damage_rect, l); |
| 533 l->append(", "); | 536 l->append(", "); |
| 534 LogParam(p.transform_to_root_target, l); | 537 LogParam(p.transform_to_root_target, l); |
| 535 l->append(", "); | 538 l->append(", "); |
| 536 LogParam(p.filters, l); | 539 LogParam(p.filters, l); |
| 537 l->append(", "); | 540 l->append(", "); |
| 538 LogParam(p.background_filters, l); | 541 LogParam(p.background_filters, l); |
| 539 l->append(", "); | 542 l->append(", "); |
| 543 LogParam(p.color_space, l); | |
| 544 l->append(", "); | |
| 540 LogParam(p.has_transparent_background, l); | 545 LogParam(p.has_transparent_background, l); |
| 541 l->append(", "); | 546 l->append(", "); |
| 542 | 547 |
| 543 l->append("["); | 548 l->append("["); |
| 544 for (auto* shared_quad_state : p.shared_quad_state_list) { | 549 for (auto* shared_quad_state : p.shared_quad_state_list) { |
| 545 if (shared_quad_state != p.shared_quad_state_list.front()) | 550 if (shared_quad_state != p.shared_quad_state_list.front()) |
| 546 l->append(", "); | 551 l->append(", "); |
| 547 LogParam(*shared_quad_state, l); | 552 LogParam(*shared_quad_state, l); |
| 548 } | 553 } |
| 549 l->append("], ["); | 554 l->append("], ["); |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 910 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 915 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ |
| 911 #include "cc/ipc/cc_param_traits_macros.h" | 916 #include "cc/ipc/cc_param_traits_macros.h" |
| 912 } // namespace IPC | 917 } // namespace IPC |
| 913 | 918 |
| 914 // Generate param traits log methods. | 919 // Generate param traits log methods. |
| 915 #include "ipc/param_traits_log_macros.h" | 920 #include "ipc/param_traits_log_macros.h" |
| 916 namespace IPC { | 921 namespace IPC { |
| 917 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 922 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ |
| 918 #include "cc/ipc/cc_param_traits_macros.h" | 923 #include "cc/ipc/cc_param_traits_macros.h" |
| 919 } // namespace IPC | 924 } // namespace IPC |
| OLD | NEW |