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

Side by Side Diff: cc/render_surface_unittest.cc

Issue 11280263: Organize internal properties of cc/ layer types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed all feedback so far Created 8 years 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
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 "cc/render_surface_impl.h" 5 #include "cc/render_surface_impl.h"
6 6
7 #include "cc/append_quads_data.h" 7 #include "cc/append_quads_data.h"
8 #include "cc/layer_impl.h" 8 #include "cc/layer_impl.h"
9 #include "cc/render_pass_sink.h" 9 #include "cc/render_pass_sink.h"
10 #include "cc/scoped_ptr_vector.h" 10 #include "cc/scoped_ptr_vector.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->clearLayerLists()); 67 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->clearLayerLists());
68 } 68 }
69 69
70 TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) 70 TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState)
71 { 71 {
72 scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1); 72 scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1);
73 73
74 scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(2); 74 scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(2);
75 owningLayer->createRenderSurface(); 75 owningLayer->createRenderSurface();
76 ASSERT_TRUE(owningLayer->renderSurface()); 76 ASSERT_TRUE(owningLayer->renderSurface());
77 owningLayer->setRenderTarget(owningLayer.get()); 77 owningLayer->drawProperties().render_target = owningLayer.get();
78 RenderSurfaceImpl* renderSurface = owningLayer->renderSurface(); 78 RenderSurfaceImpl* renderSurface = owningLayer->renderSurface();
79 79
80 rootLayer->addChild(owningLayer.Pass()); 80 rootLayer->addChild(owningLayer.Pass());
81 81
82 gfx::Rect contentRect = gfx::Rect(gfx::Point(), gfx::Size(50, 50)); 82 gfx::Rect contentRect = gfx::Rect(gfx::Point(), gfx::Size(50, 50));
83 gfx::Rect clipRect = gfx::Rect(gfx::Point(5, 5), gfx::Size(40, 40)); 83 gfx::Rect clipRect = gfx::Rect(gfx::Point(5, 5), gfx::Size(40, 40));
84 gfx::Transform origin; 84 gfx::Transform origin;
85 85
86 origin.Translate(30, 40); 86 origin.Translate(30, 40);
87 87
(...skipping 29 matching lines...) Expand all
117 ScopedPtrVector<RenderPass> m_renderPasses; 117 ScopedPtrVector<RenderPass> m_renderPasses;
118 }; 118 };
119 119
120 TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectRenderPass) 120 TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectRenderPass)
121 { 121 {
122 scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1); 122 scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1);
123 123
124 scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(2); 124 scoped_ptr<LayerImpl> owningLayer = LayerImpl::create(2);
125 owningLayer->createRenderSurface(); 125 owningLayer->createRenderSurface();
126 ASSERT_TRUE(owningLayer->renderSurface()); 126 ASSERT_TRUE(owningLayer->renderSurface());
127 owningLayer->setRenderTarget(owningLayer.get()); 127 owningLayer->drawProperties().render_target = owningLayer.get();
128 RenderSurfaceImpl* renderSurface = owningLayer->renderSurface(); 128 RenderSurfaceImpl* renderSurface = owningLayer->renderSurface();
129 129
130 rootLayer->addChild(owningLayer.Pass()); 130 rootLayer->addChild(owningLayer.Pass());
131 131
132 gfx::Rect contentRect = gfx::Rect(gfx::Point(), gfx::Size(50, 50)); 132 gfx::Rect contentRect = gfx::Rect(gfx::Point(), gfx::Size(50, 50));
133 gfx::Transform origin; 133 gfx::Transform origin;
134 origin.Translate(30, 40); 134 origin.Translate(30, 40);
135 135
136 renderSurface->setScreenSpaceTransform(origin); 136 renderSurface->setScreenSpaceTransform(origin);
137 renderSurface->setContentRect(contentRect); 137 renderSurface->setContentRect(contentRect);
138 138
139 TestRenderPassSink passSink; 139 TestRenderPassSink passSink;
140 140
141 renderSurface->appendRenderPasses(passSink); 141 renderSurface->appendRenderPasses(passSink);
142 142
143 ASSERT_EQ(1u, passSink.renderPasses().size()); 143 ASSERT_EQ(1u, passSink.renderPasses().size());
144 RenderPass* pass = passSink.renderPasses()[0]; 144 RenderPass* pass = passSink.renderPasses()[0];
145 145
146 EXPECT_EQ(RenderPass::Id(2, 0), pass->id); 146 EXPECT_EQ(RenderPass::Id(2, 0), pass->id);
147 EXPECT_RECT_EQ(contentRect, pass->output_rect); 147 EXPECT_RECT_EQ(contentRect, pass->output_rect);
148 EXPECT_EQ(origin, pass->transform_to_root_target); 148 EXPECT_EQ(origin, pass->transform_to_root_target);
149 } 149 }
150 150
151 } // namespace 151 } // namespace
152 } // namespace cc 152 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698