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

Side by Side Diff: cc/gl_renderer_unittest.cc

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScaleAsVector 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/gl_renderer.cc ('k') | cc/heads_up_display_layer_impl.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 "config.h" 5 #include "config.h"
6 #include "cc/gl_renderer.h" 6 #include "cc/gl_renderer.h"
7 7
8 #include "cc/draw_quad.h" 8 #include "cc/draw_quad.h"
9 #include "cc/prioritized_texture_manager.h" 9 #include "cc/prioritized_texture_manager.h"
10 #include "cc/resource_provider.h" 10 #include "cc/resource_provider.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 class FakeRendererClient : public RendererClient { 56 class FakeRendererClient : public RendererClient {
57 public: 57 public:
58 FakeRendererClient() 58 FakeRendererClient()
59 : m_setFullRootLayerDamageCount(0) 59 : m_setFullRootLayerDamageCount(0)
60 , m_lastCallWasSetVisibility(0) 60 , m_lastCallWasSetVisibility(0)
61 , m_rootLayer(LayerImpl::create(1)) 61 , m_rootLayer(LayerImpl::create(1))
62 , m_memoryAllocationLimitBytes(PrioritizedTextureManager::defaultMemoryA llocationLimit()) 62 , m_memoryAllocationLimitBytes(PrioritizedTextureManager::defaultMemoryA llocationLimit())
63 { 63 {
64 m_rootLayer->createRenderSurface(); 64 m_rootLayer->createRenderSurface();
65 RenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId (); 65 RenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId ();
66 scoped_ptr<RenderPass> rootRenderPass = RenderPass::create(renderPassId, IntRect(), WebTransformationMatrix()); 66 scoped_ptr<RenderPass> rootRenderPass = RenderPass::create(renderPassId, gfx::Rect(), WebTransformationMatrix());
67 m_renderPassesInDrawOrder.push_back(rootRenderPass.get()); 67 m_renderPassesInDrawOrder.push_back(rootRenderPass.get());
68 m_renderPasses.set(renderPassId, rootRenderPass.Pass()); 68 m_renderPasses.set(renderPassId, rootRenderPass.Pass());
69 } 69 }
70 70
71 // RendererClient methods. 71 // RendererClient methods.
72 virtual const IntSize& deviceViewportSize() const OVERRIDE { static IntSize fakeSize(1, 1); return fakeSize; } 72 virtual const gfx::Size& deviceViewportSize() const OVERRIDE { static gfx::S ize fakeSize(1, 1); return fakeSize; }
73 virtual const LayerTreeSettings& settings() const OVERRIDE { static LayerTre eSettings fakeSettings; return fakeSettings; } 73 virtual const LayerTreeSettings& settings() const OVERRIDE { static LayerTre eSettings fakeSettings; return fakeSettings; }
74 virtual void didLoseContext() OVERRIDE { } 74 virtual void didLoseContext() OVERRIDE { }
75 virtual void onSwapBuffersComplete() OVERRIDE { } 75 virtual void onSwapBuffersComplete() OVERRIDE { }
76 virtual void setFullRootLayerDamage() OVERRIDE { m_setFullRootLayerDamageCou nt++; } 76 virtual void setFullRootLayerDamage() OVERRIDE { m_setFullRootLayerDamageCou nt++; }
77 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR IDE { m_memoryAllocationLimitBytes = policy.bytesLimitWhenVisible; } 77 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR IDE { m_memoryAllocationLimitBytes = policy.bytesLimitWhenVisible; }
78 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O VERRIDE { if (m_lastCallWasSetVisibility) *m_lastCallWasSetVisibility = false; } 78 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O VERRIDE { if (m_lastCallWasSetVisibility) *m_lastCallWasSetVisibility = false; }
79 79
80 // Methods added for test. 80 // Methods added for test.
81 int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCou nt; } 81 int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCou nt; }
82 void setLastCallWasSetVisibilityPointer(bool* lastCallWasSetVisibility) { m_ lastCallWasSetVisibility = lastCallWasSetVisibility; } 82 void setLastCallWasSetVisibilityPointer(bool* lastCallWasSetVisibility) { m_ lastCallWasSetVisibility = lastCallWasSetVisibility; }
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 // process, after glFlush is called, and after the RendererClient's enforceM anagedMemoryPolicy 476 // process, after glFlush is called, and after the RendererClient's enforceM anagedMemoryPolicy
477 // is called. Plumb this tracking between both the RenderClient and the Cont ext by giving 477 // is called. Plumb this tracking between both the RenderClient and the Cont ext by giving
478 // them both a pointer to a variable on the stack. 478 // them both a pointer to a variable on the stack.
479 context->setLastCallWasSetVisibilityPointer(&lastCallWasSetVisiblity); 479 context->setLastCallWasSetVisibilityPointer(&lastCallWasSetVisiblity);
480 mockClient.setLastCallWasSetVisibilityPointer(&lastCallWasSetVisiblity); 480 mockClient.setLastCallWasSetVisibilityPointer(&lastCallWasSetVisiblity);
481 renderer.setVisible(true); 481 renderer.setVisible(true);
482 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa sses()); 482 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa sses());
483 renderer.setVisible(false); 483 renderer.setVisible(false);
484 EXPECT_TRUE(lastCallWasSetVisiblity); 484 EXPECT_TRUE(lastCallWasSetVisiblity);
485 } 485 }
OLDNEW
« no previous file with comments | « cc/gl_renderer.cc ('k') | cc/heads_up_display_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698