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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/render_pass_draw_quad.h" | 7 #include "cc/render_pass_draw_quad.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 const RenderPassDrawQuad* RenderPassDrawQuad::materialCast(const DrawQuad* quad) | 31 const RenderPassDrawQuad* RenderPassDrawQuad::materialCast(const DrawQuad* quad) |
32 { | 32 { |
33 DCHECK(quad->material() == DrawQuad::RenderPass); | 33 DCHECK(quad->material() == DrawQuad::RenderPass); |
34 return static_cast<const RenderPassDrawQuad*>(quad); | 34 return static_cast<const RenderPassDrawQuad*>(quad); |
35 } | 35 } |
36 | 36 |
37 scoped_ptr<RenderPassDrawQuad> RenderPassDrawQuad::copy(const SharedQuadState* c
opiedSharedQuadState, RenderPass::Id copiedRenderPassId) const | 37 scoped_ptr<RenderPassDrawQuad> RenderPassDrawQuad::copy(const SharedQuadState* c
opiedSharedQuadState, RenderPass::Id copiedRenderPassId) const |
38 { | 38 { |
39 unsigned bytes = size(); | 39 scoped_ptr<RenderPassDrawQuad> copyQuad(new RenderPassDrawQuad(*materialCast
(this))); |
40 DCHECK(bytes > 0); | |
41 | |
42 scoped_ptr<RenderPassDrawQuad> copyQuad(reinterpret_cast<RenderPassDrawQuad*
>(new char[bytes])); | |
43 memcpy(copyQuad.get(), this, bytes); | |
44 copyQuad->setSharedQuadState(copiedSharedQuadState); | 40 copyQuad->setSharedQuadState(copiedSharedQuadState); |
45 copyQuad->m_renderPassId = copiedRenderPassId; | 41 copyQuad->m_renderPassId = copiedRenderPassId; |
46 | |
47 return copyQuad.Pass(); | 42 return copyQuad.Pass(); |
48 } | 43 } |
49 | 44 |
50 } // namespace cc | 45 } // namespace cc |
OLD | NEW |