Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: cc/render_pass_draw_quad.cc

Issue 11344050: Fix DrawQuad copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/render_pass_draw_quad.h ('k') | cc/yuv_video_draw_quad.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « cc/render_pass_draw_quad.h ('k') | cc/yuv_video_draw_quad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698