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 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 if (shared_quad_state_iter != last_shared_quad_state_iter) { | 390 if (shared_quad_state_iter != last_shared_quad_state_iter) { |
| 389 WriteParam(m, true); | 391 WriteParam(m, true); |
| 390 WriteParam(m, **shared_quad_state_iter); | 392 WriteParam(m, **shared_quad_state_iter); |
| 391 last_shared_quad_state_iter = shared_quad_state_iter; | 393 last_shared_quad_state_iter = shared_quad_state_iter; |
| 392 } else { | 394 } else { |
| 393 WriteParam(m, false); | 395 WriteParam(m, false); |
| 394 } | 396 } |
| 395 } | 397 } |
| 396 } | 398 } |
| 397 | 399 |
| 398 static size_t ReserveSizeForRenderPassWrite(const cc::RenderPass& p) { | 400 static size_t ReserveSizeForRenderPassWrite(const cc::RenderPass& p) { |
|
danakj
2016/12/01 01:50:46
This needs to be updated for the filters
ajuma
2016/12/13 15:08:11
Done.
| |
| 399 size_t to_reserve = sizeof(cc::RenderPass); | 401 size_t to_reserve = sizeof(cc::RenderPass); |
| 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. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 420 return quad; | 422 return quad; |
| 421 } | 423 } |
| 422 | 424 |
| 423 bool ParamTraits<cc::RenderPass>::Read(const base::Pickle* m, | 425 bool ParamTraits<cc::RenderPass>::Read(const base::Pickle* m, |
| 424 base::PickleIterator* iter, | 426 base::PickleIterator* iter, |
| 425 param_type* p) { | 427 param_type* p) { |
| 426 cc::RenderPassId id; | 428 cc::RenderPassId id; |
| 427 gfx::Rect output_rect; | 429 gfx::Rect output_rect; |
| 428 gfx::Rect damage_rect; | 430 gfx::Rect damage_rect; |
| 429 gfx::Transform transform_to_root_target; | 431 gfx::Transform transform_to_root_target; |
| 432 cc::FilterOperations filters; | |
| 433 cc::FilterOperations background_filters; | |
| 430 bool has_transparent_background; | 434 bool has_transparent_background; |
| 431 uint32_t quad_list_size; | 435 uint32_t quad_list_size; |
| 432 | 436 |
| 433 if (!ReadParam(m, iter, &id) || !ReadParam(m, iter, &output_rect) || | 437 if (!ReadParam(m, iter, &id) || !ReadParam(m, iter, &output_rect) || |
| 434 !ReadParam(m, iter, &damage_rect) || | 438 !ReadParam(m, iter, &damage_rect) || |
| 435 !ReadParam(m, iter, &transform_to_root_target) || | 439 !ReadParam(m, iter, &transform_to_root_target) || |
| 440 !ReadParam(m, iter, &filters) || | |
| 441 !ReadParam(m, iter, &background_filters) || | |
| 436 !ReadParam(m, iter, &has_transparent_background) || | 442 !ReadParam(m, iter, &has_transparent_background) || |
| 437 !ReadParam(m, iter, &quad_list_size)) | 443 !ReadParam(m, iter, &quad_list_size)) |
| 438 return false; | 444 return false; |
| 439 | 445 |
| 440 p->SetAll(id, output_rect, damage_rect, transform_to_root_target, | 446 p->SetAll(id, output_rect, damage_rect, transform_to_root_target, filters, |
| 441 has_transparent_background); | 447 background_filters, has_transparent_background); |
| 442 | 448 |
| 443 for (uint32_t i = 0; i < quad_list_size; ++i) { | 449 for (uint32_t i = 0; i < quad_list_size; ++i) { |
| 444 cc::DrawQuad::Material material; | 450 cc::DrawQuad::Material material; |
| 445 base::PickleIterator temp_iter = *iter; | 451 base::PickleIterator temp_iter = *iter; |
| 446 if (!ReadParam(m, &temp_iter, &material)) | 452 if (!ReadParam(m, &temp_iter, &material)) |
| 447 return false; | 453 return false; |
| 448 | 454 |
| 449 cc::DrawQuad* draw_quad = NULL; | 455 cc::DrawQuad* draw_quad = NULL; |
| 450 switch (material) { | 456 switch (material) { |
| 451 case cc::DrawQuad::DEBUG_BORDER: | 457 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) { | 520 void ParamTraits<cc::RenderPass>::Log(const param_type& p, std::string* l) { |
| 515 l->append("RenderPass(("); | 521 l->append("RenderPass(("); |
| 516 LogParam(p.id, l); | 522 LogParam(p.id, l); |
| 517 l->append("), "); | 523 l->append("), "); |
| 518 LogParam(p.output_rect, l); | 524 LogParam(p.output_rect, l); |
| 519 l->append(", "); | 525 l->append(", "); |
| 520 LogParam(p.damage_rect, l); | 526 LogParam(p.damage_rect, l); |
| 521 l->append(", "); | 527 l->append(", "); |
| 522 LogParam(p.transform_to_root_target, l); | 528 LogParam(p.transform_to_root_target, l); |
| 523 l->append(", "); | 529 l->append(", "); |
| 530 LogParam(p.filters, l); | |
| 531 l->append(", "); | |
| 532 LogParam(p.background_filters, l); | |
| 533 l->append(", "); | |
| 524 LogParam(p.has_transparent_background, l); | 534 LogParam(p.has_transparent_background, l); |
| 525 l->append(", "); | 535 l->append(", "); |
| 526 | 536 |
| 527 l->append("["); | 537 l->append("["); |
| 528 for (auto* shared_quad_state : p.shared_quad_state_list) { | 538 for (auto* shared_quad_state : p.shared_quad_state_list) { |
| 529 if (shared_quad_state != p.shared_quad_state_list.front()) | 539 if (shared_quad_state != p.shared_quad_state_list.front()) |
| 530 l->append(", "); | 540 l->append(", "); |
| 531 LogParam(*shared_quad_state, l); | 541 LogParam(*shared_quad_state, l); |
| 532 } | 542 } |
| 533 l->append("], ["); | 543 l->append("], ["); |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 972 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 982 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ |
| 973 #include "cc/ipc/cc_param_traits_macros.h" | 983 #include "cc/ipc/cc_param_traits_macros.h" |
| 974 } // namespace IPC | 984 } // namespace IPC |
| 975 | 985 |
| 976 // Generate param traits log methods. | 986 // Generate param traits log methods. |
| 977 #include "ipc/param_traits_log_macros.h" | 987 #include "ipc/param_traits_log_macros.h" |
| 978 namespace IPC { | 988 namespace IPC { |
| 979 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 989 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ |
| 980 #include "cc/ipc/cc_param_traits_macros.h" | 990 #include "cc/ipc/cc_param_traits_macros.h" |
| 981 } // namespace IPC | 991 } // namespace IPC |
| OLD | NEW |