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

Side by Side Diff: cc/software_renderer_unittest.cc

Issue 12379055: Changed SoftwareOutputDevice interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 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/software_renderer.h" 5 #include "cc/software_renderer.h"
6 6
7 #include "cc/compositor_frame_metadata.h" 7 #include "cc/compositor_frame_metadata.h"
8 #include "cc/quad_sink.h" 8 #include "cc/quad_sink.h"
9 #include "cc/render_pass.h" 9 #include "cc/render_pass.h"
10 #include "cc/render_pass_draw_quad.h" 10 #include "cc/render_pass_draw_quad.h"
11 #include "cc/software_output_device.h"
11 #include "cc/solid_color_draw_quad.h" 12 #include "cc/solid_color_draw_quad.h"
12 #include "cc/test/animation_test_common.h" 13 #include "cc/test/animation_test_common.h"
13 #include "cc/test/fake_output_surface.h" 14 #include "cc/test/fake_output_surface.h"
14 #include "cc/test/fake_software_output_device.h"
15 #include "cc/test/geometry_test_utils.h" 15 #include "cc/test/geometry_test_utils.h"
16 #include "cc/test/render_pass_test_common.h" 16 #include "cc/test/render_pass_test_common.h"
17 #include "cc/test/render_pass_test_utils.h" 17 #include "cc/test/render_pass_test_utils.h"
18 #include "cc/tile_draw_quad.h" 18 #include "cc/tile_draw_quad.h"
19 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 using namespace WebKit; 22 using namespace WebKit;
23 23
24 namespace cc { 24 namespace cc {
25 namespace { 25 namespace {
26 26
27 class SoftwareRendererTest : public testing::Test, public RendererClient { 27 class SoftwareRendererTest : public testing::Test, public RendererClient {
28 public: 28 public:
29 SoftwareRendererTest() 29 SoftwareRendererTest()
30 : m_shouldClearRootRenderPass(true) 30 : m_shouldClearRootRenderPass(true)
31 { 31 {
32 } 32 }
33 33
34 void initializeRenderer() { 34 void initializeRenderer() {
35 m_outputSurface = FakeOutputSurface::CreateSoftware(scoped_ptr<SoftwareO utputDevice>(new FakeSoftwareOutputDevice)); 35 m_outputSurface = FakeOutputSurface::CreateSoftware(make_scoped_ptr(new SoftwareOutputDevice));
36 m_resourceProvider = ResourceProvider::create(m_outputSurface.get()); 36 m_resourceProvider = ResourceProvider::create(m_outputSurface.get());
37 m_renderer = SoftwareRenderer::create(this, resourceProvider(), software Device()); 37 m_renderer = SoftwareRenderer::create(this, m_outputSurface.get(), resou rceProvider());
38 } 38 }
39 39
40 SoftwareOutputDevice* softwareDevice() const { return m_outputSurface->softw are_device(); }
41 FakeOutputSurface* outputSurface() const { return m_outputSurface.get(); }
42 ResourceProvider* resourceProvider() const { return m_resourceProvider.get() ; } 40 ResourceProvider* resourceProvider() const { return m_resourceProvider.get() ; }
43 SoftwareRenderer* renderer() const { return m_renderer.get(); } 41 SoftwareRenderer* renderer() const { return m_renderer.get(); }
44 void setViewportSize(const gfx::Size& viewportSize) { m_viewportSize = viewp ortSize; } 42 void setViewportSize(const gfx::Size& viewportSize) { m_viewportSize = viewp ortSize; }
45 void setShouldClearRootRenderPass(bool clearRootRenderPass) { m_shouldClearR ootRenderPass = clearRootRenderPass; } 43 void setShouldClearRootRenderPass(bool clearRootRenderPass) { m_shouldClearR ootRenderPass = clearRootRenderPass; }
46 44
47 // RendererClient implementation. 45 // RendererClient implementation.
48 virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_view portSize; } 46 virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_view portSize; }
49 virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settin gs; } 47 virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settin gs; }
50 virtual void didLoseOutputSurface() OVERRIDE { } 48 virtual void didLoseOutputSurface() OVERRIDE { }
51 virtual void onSwapBuffersComplete() OVERRIDE { } 49 virtual void onSwapBuffersComplete() OVERRIDE { }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // If we didn't clear, the borders should still be green. 198 // If we didn't clear, the borders should still be green.
201 EXPECT_EQ(SK_ColorGREEN, pixels[0]); 199 EXPECT_EQ(SK_ColorGREEN, pixels[0]);
202 EXPECT_EQ(SK_ColorGREEN, pixels[viewportPixels - 1]); 200 EXPECT_EQ(SK_ColorGREEN, pixels[viewportPixels - 1]);
203 201
204 EXPECT_EQ(SK_ColorMAGENTA, pixels[smallerRect.y() * viewportRect.width() + s mallerRect.x()]); 202 EXPECT_EQ(SK_ColorMAGENTA, pixels[smallerRect.y() * viewportRect.width() + s mallerRect.x()]);
205 EXPECT_EQ(SK_ColorMAGENTA, pixels[(smallerRect.bottom() - 1) * viewportRect. width() + smallerRect.right() - 1]); 203 EXPECT_EQ(SK_ColorMAGENTA, pixels[(smallerRect.bottom() - 1) * viewportRect. width() + smallerRect.right() - 1]);
206 } 204 }
207 205
208 } // namespace 206 } // namespace
209 } // namespace cc 207 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698