OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/quads/render_pass.h" | 5 #include "cc/quads/render_pass.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 std::unique_ptr<RenderPass> RenderPass::Create( | 57 std::unique_ptr<RenderPass> RenderPass::Create( |
58 size_t shared_quad_state_list_size, | 58 size_t shared_quad_state_list_size, |
59 size_t quad_list_size) { | 59 size_t quad_list_size) { |
60 return base::WrapUnique( | 60 return base::WrapUnique( |
61 new RenderPass(shared_quad_state_list_size, quad_list_size)); | 61 new RenderPass(shared_quad_state_list_size, quad_list_size)); |
62 } | 62 } |
63 | 63 |
64 RenderPass::RenderPass() | 64 RenderPass::RenderPass() |
65 : quad_list(kDefaultNumQuadsToReserve), | 65 : quad_list(kDefaultNumQuadsToReserve), |
66 shared_quad_state_list(ALIGNOF(SharedQuadState), | 66 shared_quad_state_list(alignof(SharedQuadState), |
67 sizeof(SharedQuadState), | 67 sizeof(SharedQuadState), |
68 kDefaultNumSharedQuadStatesToReserve) {} | 68 kDefaultNumSharedQuadStatesToReserve) {} |
69 | 69 |
70 // Each layer usually produces one shared quad state, so the number of layers | 70 // Each layer usually produces one shared quad state, so the number of layers |
71 // is a good hint for what to reserve here. | 71 // is a good hint for what to reserve here. |
72 RenderPass::RenderPass(size_t num_layers) | 72 RenderPass::RenderPass(size_t num_layers) |
73 : has_transparent_background(true), | 73 : has_transparent_background(true), |
74 quad_list(kDefaultNumQuadsToReserve), | 74 quad_list(kDefaultNumQuadsToReserve), |
75 shared_quad_state_list(ALIGNOF(SharedQuadState), | 75 shared_quad_state_list(alignof(SharedQuadState), |
76 sizeof(SharedQuadState), | 76 sizeof(SharedQuadState), |
77 num_layers) {} | 77 num_layers) {} |
78 | 78 |
79 RenderPass::RenderPass(size_t shared_quad_state_list_size, | 79 RenderPass::RenderPass(size_t shared_quad_state_list_size, |
80 size_t quad_list_size) | 80 size_t quad_list_size) |
81 : has_transparent_background(true), | 81 : has_transparent_background(true), |
82 quad_list(quad_list_size), | 82 quad_list(quad_list_size), |
83 shared_quad_state_list(ALIGNOF(SharedQuadState), | 83 shared_quad_state_list(alignof(SharedQuadState), |
84 sizeof(SharedQuadState), | 84 sizeof(SharedQuadState), |
85 shared_quad_state_list_size) {} | 85 shared_quad_state_list_size) {} |
86 | 86 |
87 RenderPass::~RenderPass() { | 87 RenderPass::~RenderPass() { |
88 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 88 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
89 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), "cc::RenderPass", | 89 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), "cc::RenderPass", |
90 reinterpret_cast<void*>(id)); | 90 reinterpret_cast<void*>(id)); |
91 } | 91 } |
92 | 92 |
93 std::unique_ptr<RenderPass> RenderPass::Copy(int new_id) const { | 93 std::unique_ptr<RenderPass> RenderPass::Copy(int new_id) const { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 case DrawQuad::RENDER_PASS: | 271 case DrawQuad::RENDER_PASS: |
272 case DrawQuad::INVALID: | 272 case DrawQuad::INVALID: |
273 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; | 273 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; |
274 break; | 274 break; |
275 } | 275 } |
276 quad_list.back()->shared_quad_state = shared_quad_state; | 276 quad_list.back()->shared_quad_state = shared_quad_state; |
277 return quad_list.back(); | 277 return quad_list.back(); |
278 } | 278 } |
279 | 279 |
280 } // namespace cc | 280 } // namespace cc |
OLD | NEW |