| OLD | NEW |
| 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 #include "cc/ipc/render_pass_struct_traits.h" | 5 #include "cc/ipc/render_pass_struct_traits.h" |
| 6 | 6 |
| 7 #include "base/numerics/safe_conversions.h" | 7 #include "base/numerics/safe_conversions.h" |
| 8 #include "cc/ipc/shared_quad_state_struct_traits.h" | 8 #include "cc/ipc/shared_quad_state_struct_traits.h" |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| 11 | 11 |
| 12 // static | 12 // static |
| 13 bool StructTraits<cc::mojom::RenderPassDataView, | 13 bool StructTraits<cc::mojom::RenderPassDataView, |
| 14 std::unique_ptr<cc::RenderPass>>:: | 14 std::unique_ptr<cc::RenderPass>>:: |
| 15 Read(cc::mojom::RenderPassDataView data, | 15 Read(cc::mojom::RenderPassDataView data, |
| 16 std::unique_ptr<cc::RenderPass>* out) { | 16 std::unique_ptr<cc::RenderPass>* out) { |
| 17 *out = cc::RenderPass::Create(); | 17 *out = cc::RenderPass::Create(); |
| 18 if (!data.ReadOutputRect(&(*out)->output_rect) || | 18 if (!data.ReadOutputRect(&(*out)->output_rect) || |
| 19 !data.ReadDamageRect(&(*out)->damage_rect) || | 19 !data.ReadDamageRect(&(*out)->damage_rect) || |
| 20 !data.ReadTransformToRootTarget(&(*out)->transform_to_root_target) || | 20 !data.ReadTransformToRootTarget(&(*out)->transform_to_root_target) || |
| 21 !data.ReadFilters(&(*out)->filters) || | 21 !data.ReadFilters(&(*out)->filters) || |
| 22 !data.ReadBackgroundFilters(&(*out)->background_filters)) { | 22 !data.ReadBackgroundFilters(&(*out)->background_filters) || |
| 23 !data.ReadColorSpace(&(*out)->color_space)) { |
| 23 return false; | 24 return false; |
| 24 } | 25 } |
| 25 (*out)->id = data.id(); | 26 (*out)->id = data.id(); |
| 26 // RenderPass ids are never zero. | 27 // RenderPass ids are never zero. |
| 27 if (!(*out)->id) | 28 if (!(*out)->id) |
| 28 return false; | 29 return false; |
| 29 (*out)->has_transparent_background = data.has_transparent_background(); | 30 (*out)->has_transparent_background = data.has_transparent_background(); |
| 30 | 31 |
| 31 mojo::ArrayDataView<cc::mojom::DrawQuadDataView> quads; | 32 mojo::ArrayDataView<cc::mojom::DrawQuadDataView> quads; |
| 32 data.GetQuadListDataView(&quads); | 33 data.GetQuadListDataView(&quads); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 55 return false; | 56 return false; |
| 56 } | 57 } |
| 57 quad->shared_quad_state = last_sqs; | 58 quad->shared_quad_state = last_sqs; |
| 58 if (!quad->shared_quad_state) | 59 if (!quad->shared_quad_state) |
| 59 return false; | 60 return false; |
| 60 } | 61 } |
| 61 return true; | 62 return true; |
| 62 } | 63 } |
| 63 | 64 |
| 64 } // namespace mojo | 65 } // namespace mojo |
| OLD | NEW |