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

Side by Side Diff: cc/delegated_renderer_layer_impl_unittest.cc

Issue 11929045: cc: DelegatedRenderer layer needs a surface if rotated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months 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 | « no previous file | cc/layer_tree_host_common.cc » ('j') | cc/layer_tree_host_common.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/delegated_renderer_layer_impl.h" 5 #include "cc/delegated_renderer_layer_impl.h"
6 6
7 #include "cc/append_quads_data.h" 7 #include "cc/append_quads_data.h"
8 #include "cc/layer_tree_host_impl.h" 8 #include "cc/layer_tree_host_impl.h"
9 #include "cc/layer_tree_impl.h" 9 #include "cc/layer_tree_impl.h"
10 #include "cc/quad_sink.h" 10 #include "cc/quad_sink.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); 231 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
232 232
233 // If the DelegatedRendererLayer is axis aligned and has opacity 1, then 233 // If the DelegatedRendererLayer is axis aligned and has opacity 1, then
234 // it has no need to be a renderSurface for the quads it carries. 234 // it has no need to be a renderSurface for the quads it carries.
235 EXPECT_FALSE(m_delegatedRendererLayerPtr->renderSurface()); 235 EXPECT_FALSE(m_delegatedRendererLayerPtr->renderSurface());
236 236
237 m_hostImpl->drawLayers(frame); 237 m_hostImpl->drawLayers(frame);
238 m_hostImpl->didDrawAllLayers(frame); 238 m_hostImpl->didDrawAllLayers(frame);
239 } 239 }
240 240
241 TEST_F(DelegatedRendererLayerImplTestSimple, DoesOwnARenderSurface) 241 TEST_F(DelegatedRendererLayerImplTestSimple, DoesOwnARenderSurfaceForOpacity)
242 { 242 {
243 m_delegatedRendererLayerPtr->setOpacity(0.5f); 243 m_delegatedRendererLayerPtr->setOpacity(0.5f);
244 244
245 LayerTreeHostImpl::FrameData frame; 245 LayerTreeHostImpl::FrameData frame;
246 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); 246 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
247 247
248 // This test case has quads from multiple layers in the delegated renderer, 248 // This test case has quads from multiple layers in the delegated renderer,
249 // so if the DelegatedRendererLayer has opacity < 1, it should end up with 249 // so if the DelegatedRendererLayer has opacity < 1, it should end up with
250 // a render surface. 250 // a render surface.
251 EXPECT_TRUE(m_delegatedRendererLayerPtr->renderSurface()); 251 EXPECT_TRUE(m_delegatedRendererLayerPtr->renderSurface());
252 252
253 m_hostImpl->drawLayers(frame); 253 m_hostImpl->drawLayers(frame);
254 m_hostImpl->didDrawAllLayers(frame); 254 m_hostImpl->didDrawAllLayers(frame);
255 } 255 }
256 256
257 TEST_F(DelegatedRendererLayerImplTestSimple, DoesOwnARenderSurfaceForTransform)
258 {
259 gfx::Transform rotation;
260 rotation.RotateAboutZAxis(30.0);
261 m_delegatedRendererLayerPtr->setTransform(rotation);
262
263 LayerTreeHostImpl::FrameData frame;
264 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
265
266 // This test case has quads from multiple layers in the delegated renderer,
267 // so if the DelegatedRendererLayer has opacity < 1, it should end up with
268 // a render surface.
269 EXPECT_TRUE(m_delegatedRendererLayerPtr->renderSurface());
270
271 m_hostImpl->drawLayers(frame);
272 m_hostImpl->didDrawAllLayers(frame);
273 }
274
257 class DelegatedRendererLayerImplTestOwnSurface : public DelegatedRendererLayerIm plTestSimple { 275 class DelegatedRendererLayerImplTestOwnSurface : public DelegatedRendererLayerIm plTestSimple {
258 public: 276 public:
259 DelegatedRendererLayerImplTestOwnSurface() 277 DelegatedRendererLayerImplTestOwnSurface()
260 : DelegatedRendererLayerImplTestSimple() 278 : DelegatedRendererLayerImplTestSimple()
261 { 279 {
262 m_delegatedRendererLayerPtr->setForceRenderSurface(true); 280 m_delegatedRendererLayerPtr->setForceRenderSurface(true);
263 } 281 }
264 }; 282 };
265 283
266 TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsRenderPasses) 284 TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsRenderPasses)
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 expected.Scale(1.5, 1.5); 485 expected.Scale(1.5, 1.5);
468 expected.Translate(7.0, 7.0); 486 expected.Translate(7.0, 7.0);
469 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, sharedState->content_to_target_tra nsform); 487 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, sharedState->content_to_target_tra nsform);
470 488
471 m_hostImpl->drawLayers(frame); 489 m_hostImpl->drawLayers(frame);
472 m_hostImpl->didDrawAllLayers(frame); 490 m_hostImpl->didDrawAllLayers(frame);
473 } 491 }
474 492
475 } // namespace 493 } // namespace
476 } // namespace cc 494 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layer_tree_host_common.cc » ('j') | cc/layer_tree_host_common.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698