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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 12642010: Implement on demand quad rasterization for PicturePiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix. Created 7 years, 9 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
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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after
2634 scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::Create(m _hostImpl->active_tree(), 5); 2634 scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::Create(m _hostImpl->active_tree(), 5);
2635 ioSurfaceLayer->SetBounds(gfx::Size(10, 10)); 2635 ioSurfaceLayer->SetBounds(gfx::Size(10, 10));
2636 ioSurfaceLayer->SetAnchorPoint(gfx::PointF(0, 0)); 2636 ioSurfaceLayer->SetAnchorPoint(gfx::PointF(0, 0));
2637 ioSurfaceLayer->SetContentBounds(gfx::Size(10, 10)); 2637 ioSurfaceLayer->SetContentBounds(gfx::Size(10, 10));
2638 ioSurfaceLayer->SetDrawsContent(true); 2638 ioSurfaceLayer->SetDrawsContent(true);
2639 ioSurfaceLayer->SetIOSurfaceProperties(1, gfx::Size(10, 10)); 2639 ioSurfaceLayer->SetIOSurfaceProperties(1, gfx::Size(10, 10));
2640 rootLayer->AddChild(ioSurfaceLayer.PassAs<LayerImpl>()); 2640 rootLayer->AddChild(ioSurfaceLayer.PassAs<LayerImpl>());
2641 2641
2642 m_hostImpl->active_tree()->SetRootLayer(rootLayer.Pass()); 2642 m_hostImpl->active_tree()->SetRootLayer(rootLayer.Pass());
2643 2643
2644 EXPECT_EQ(0u, context3d->NumTextures()); 2644 // An auxiliary texture is created for on-demand rasterization.
nduca 2013/03/21 02:22:48 This smells. Can we create the texture only when i
Leandro Graciá Gil 2013/03/21 03:35:50 I agree. I think we should be able to create it wh
Leandro Graciá Gil 2013/03/21 16:42:48 Done.
2645 EXPECT_EQ(1u, context3d->NumTextures());
2645 2646
2646 LayerTreeHostImpl::FrameData frame; 2647 LayerTreeHostImpl::FrameData frame;
2647 EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame)); 2648 EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
2648 m_hostImpl->DrawLayers(&frame, base::TimeTicks::Now()); 2649 m_hostImpl->DrawLayers(&frame, base::TimeTicks::Now());
2649 m_hostImpl->DidDrawAllLayers(frame); 2650 m_hostImpl->DidDrawAllLayers(frame);
2650 m_hostImpl->SwapBuffers(); 2651 m_hostImpl->SwapBuffers();
2651 2652
2652 EXPECT_GT(context3d->NumTextures(), 0u); 2653 EXPECT_GT(context3d->NumTextures(), 1u);
2653 2654
2654 // Kill the layer tree. 2655 // Kill the layer tree.
2655 m_hostImpl->active_tree()->SetRootLayer(LayerImpl::Create(m_hostImpl->active _tree(), 100)); 2656 m_hostImpl->active_tree()->SetRootLayer(LayerImpl::Create(m_hostImpl->active _tree(), 100));
2656 // There should be no textures left in use after. 2657 // There should be no textures left in use after.
2657 EXPECT_EQ(0u, context3d->NumTextures()); 2658 EXPECT_EQ(1u, context3d->NumTextures());
2658 } 2659 }
2659 2660
2660 class MockDrawQuadsToFillScreenContext : public TestWebGraphicsContext3D { 2661 class MockDrawQuadsToFillScreenContext : public TestWebGraphicsContext3D {
2661 public: 2662 public:
2662 MOCK_METHOD1(useProgram, void(WebKit::WebGLId program)); 2663 MOCK_METHOD1(useProgram, void(WebKit::WebGLId program));
2663 MOCK_METHOD4(drawElements, void(WebKit::WGC3Denum mode, WebKit::WGC3Dsizei c ount, WebKit::WGC3Denum type, WebKit::WGC3Dintptr offset)); 2664 MOCK_METHOD4(drawElements, void(WebKit::WGC3Denum mode, WebKit::WGC3Dsizei c ount, WebKit::WGC3Denum type, WebKit::WGC3Dintptr offset));
2664 }; 2665 };
2665 2666
2666 TEST_F(LayerTreeHostImplTest, hasTransparentBackground) 2667 TEST_F(LayerTreeHostImplTest, hasTransparentBackground)
2667 { 2668 {
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after
4342 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), renderPassQuad->rect.ToS tring()); 4343 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), renderPassQuad->rect.ToS tring());
4343 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), renderPassQuad->mas k_uv_rect.ToString()); 4344 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), renderPassQuad->mas k_uv_rect.ToString());
4344 4345
4345 m_hostImpl->DrawLayers(&frame, base::TimeTicks::Now()); 4346 m_hostImpl->DrawLayers(&frame, base::TimeTicks::Now());
4346 m_hostImpl->DidDrawAllLayers(frame); 4347 m_hostImpl->DidDrawAllLayers(frame);
4347 } 4348 }
4348 } 4349 }
4349 4350
4350 } // namespace 4351 } // namespace
4351 } // namespace cc 4352 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698