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

Side by Side Diff: cc/gl_renderer_unittest.cc

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing 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
« no previous file with comments | « cc/gl_renderer.cc ('k') | cc/heads_up_display_layer.cc » ('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 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/gl_renderer.h" 5 #include "cc/gl_renderer.h"
6 6
7 #include "cc/draw_quad.h" 7 #include "cc/draw_quad.h"
8 #include "cc/prioritized_resource_manager.h" 8 #include "cc/prioritized_resource_manager.h"
9 #include "cc/resource_provider.h" 9 #include "cc/resource_provider.h"
10 #include "cc/test/fake_web_compositor_output_surface.h" 10 #include "cc/test/fake_web_compositor_output_surface.h"
11 #include "cc/test/fake_web_graphics_context_3d.h" 11 #include "cc/test/fake_web_graphics_context_3d.h"
12 #include "cc/test/render_pass_test_common.h" 12 #include "cc/test/render_pass_test_common.h"
13 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "third_party/khronos/GLES2/gl2.h" 15 #include "third_party/khronos/GLES2/gl2.h"
16 #include <public/WebTransformationMatrix.h> 16 #include "ui/gfx/transform.h"
17 17
18 using namespace WebKit; 18 using namespace WebKit;
19 using namespace WebKitTests; 19 using namespace WebKitTests;
20 20
21 namespace cc { 21 namespace cc {
22 namespace { 22 namespace {
23 23
24 class FrameCountingMemoryAllocationSettingContext : public FakeWebGraphicsContex t3D { 24 class FrameCountingMemoryAllocationSettingContext : public FakeWebGraphicsContex t3D {
25 public: 25 public:
26 FrameCountingMemoryAllocationSettingContext() : m_frame(0) { } 26 FrameCountingMemoryAllocationSettingContext() : m_frame(0) { }
(...skipping 26 matching lines...) Expand all
53 public: 53 public:
54 FakeRendererClient() 54 FakeRendererClient()
55 : m_setFullRootLayerDamageCount(0) 55 : m_setFullRootLayerDamageCount(0)
56 , m_lastCallWasSetVisibility(0) 56 , m_lastCallWasSetVisibility(0)
57 , m_rootLayer(LayerImpl::create(1)) 57 , m_rootLayer(LayerImpl::create(1))
58 , m_memoryAllocationLimitBytes(PrioritizedResourceManager::defaultMemory AllocationLimit()) 58 , m_memoryAllocationLimitBytes(PrioritizedResourceManager::defaultMemory AllocationLimit())
59 { 59 {
60 m_rootLayer->createRenderSurface(); 60 m_rootLayer->createRenderSurface();
61 RenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId (); 61 RenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId ();
62 scoped_ptr<RenderPass> rootRenderPass = RenderPass::Create(); 62 scoped_ptr<RenderPass> rootRenderPass = RenderPass::Create();
63 rootRenderPass->SetNew(renderPassId, gfx::Rect(), gfx::Rect(), WebTransf ormationMatrix()); 63 rootRenderPass->SetNew(renderPassId, gfx::Rect(), gfx::Rect(), gfx::Tran sform());
64 m_renderPassesInDrawOrder.push_back(rootRenderPass.get()); 64 m_renderPassesInDrawOrder.push_back(rootRenderPass.get());
65 m_renderPasses.set(renderPassId, rootRenderPass.Pass()); 65 m_renderPasses.set(renderPassId, rootRenderPass.Pass());
66 } 66 }
67 67
68 // RendererClient methods. 68 // RendererClient methods.
69 virtual const gfx::Size& deviceViewportSize() const OVERRIDE { static gfx::S ize fakeSize(1, 1); return fakeSize; } 69 virtual const gfx::Size& deviceViewportSize() const OVERRIDE { static gfx::S ize fakeSize(1, 1); return fakeSize; }
70 virtual const LayerTreeSettings& settings() const OVERRIDE { static LayerTre eSettings fakeSettings; return fakeSettings; } 70 virtual const LayerTreeSettings& settings() const OVERRIDE { static LayerTre eSettings fakeSettings; return fakeSettings; }
71 virtual void didLoseContext() OVERRIDE { } 71 virtual void didLoseContext() OVERRIDE { }
72 virtual void onSwapBuffersComplete() OVERRIDE { } 72 virtual void onSwapBuffersComplete() OVERRIDE { }
73 virtual void setFullRootLayerDamage() OVERRIDE { m_setFullRootLayerDamageCou nt++; } 73 virtual void setFullRootLayerDamage() OVERRIDE { m_setFullRootLayerDamageCou nt++; }
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 FakeRendererClient fakeClient; 524 FakeRendererClient fakeClient;
525 scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::cr eate(scoped_ptr<WebKit::WebGraphicsContext3D>(new TextureStateTrackingContext))) ; 525 scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::cr eate(scoped_ptr<WebKit::WebGraphicsContext3D>(new TextureStateTrackingContext))) ;
526 TextureStateTrackingContext* context = static_cast<TextureStateTrackingConte xt*>(outputSurface->context3D()); 526 TextureStateTrackingContext* context = static_cast<TextureStateTrackingConte xt*>(outputSurface->context3D());
527 scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outpu tSurface.get())); 527 scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outpu tSurface.get()));
528 FakeRendererGL renderer(&fakeClient, resourceProvider.get()); 528 FakeRendererGL renderer(&fakeClient, resourceProvider.get());
529 529
530 EXPECT_TRUE(renderer.initialize()); 530 EXPECT_TRUE(renderer.initialize());
531 531
532 cc::RenderPass::Id id(1, 1); 532 cc::RenderPass::Id id(1, 1);
533 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); 533 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create();
534 pass->SetNew(id, gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 100, 100), WebTr ansformationMatrix()); 534 pass->SetNew(id, gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 100, 100), gfx:: Transform());
535 pass->AppendOneOfEveryQuadType(resourceProvider.get()); 535 pass->AppendOneOfEveryQuadType(resourceProvider.get());
536 536
537 context->setInDraw(); 537 context->setInDraw();
538 538
539 cc::DirectRenderer::DrawingFrame drawingFrame; 539 cc::DirectRenderer::DrawingFrame drawingFrame;
540 renderer.beginDrawingFrame(drawingFrame); 540 renderer.beginDrawingFrame(drawingFrame);
541 EXPECT_EQ(context->activeTexture(), GL_TEXTURE0); 541 EXPECT_EQ(context->activeTexture(), GL_TEXTURE0);
542 542
543 for (cc::QuadList::backToFrontIterator it = pass->quad_list.backToFrontBegin (); 543 for (cc::QuadList::backToFrontIterator it = pass->quad_list.backToFrontBegin ();
544 it != pass->quad_list.backToFrontEnd(); ++it) { 544 it != pass->quad_list.backToFrontEnd(); ++it) {
545 renderer.drawQuad(drawingFrame, *it); 545 renderer.drawQuad(drawingFrame, *it);
546 } 546 }
547 EXPECT_EQ(context->activeTexture(), GL_TEXTURE0); 547 EXPECT_EQ(context->activeTexture(), GL_TEXTURE0);
548 } 548 }
549 549
550 } // namespace 550 } // namespace
551 } // namespace cc 551 } // namespace cc
OLDNEW
« no previous file with comments | « cc/gl_renderer.cc ('k') | cc/heads_up_display_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698