OLD | NEW |
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" |
(...skipping 19 matching lines...) Expand all Loading... |
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(scoped_ptr<SoftwareO
utputDevice>(new FakeSoftwareOutputDevice)); |
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, resourceProvider(), software
Device()); |
38 } | 38 } |
39 | 39 |
40 SoftwareOutputDevice* softwareDevice() const { return m_outputSurface->Softw
areDevice(); } | 40 SoftwareOutputDevice* softwareDevice() const { return m_outputSurface->softw
are_device(); } |
41 FakeOutputSurface* outputSurface() const { return m_outputSurface.get(); } | 41 FakeOutputSurface* outputSurface() const { return m_outputSurface.get(); } |
42 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } | 42 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } |
43 SoftwareRenderer* renderer() const { return m_renderer.get(); } | 43 SoftwareRenderer* renderer() const { return m_renderer.get(); } |
44 void setViewportSize(const gfx::Size& viewportSize) { m_viewportSize = viewp
ortSize; } | 44 void setViewportSize(const gfx::Size& viewportSize) { m_viewportSize = viewp
ortSize; } |
45 void setShouldClearRootRenderPass(bool clearRootRenderPass) { m_shouldClearR
ootRenderPass = clearRootRenderPass; } | 45 void setShouldClearRootRenderPass(bool clearRootRenderPass) { m_shouldClearR
ootRenderPass = clearRootRenderPass; } |
46 | 46 |
47 // RendererClient implementation. | 47 // RendererClient implementation. |
48 virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_view
portSize; } | 48 virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_view
portSize; } |
49 virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settin
gs; } | 49 virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settin
gs; } |
50 virtual void didLoseOutputSurface() OVERRIDE { } | 50 virtual void didLoseOutputSurface() OVERRIDE { } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // If we didn't clear, the borders should still be green. | 200 // If we didn't clear, the borders should still be green. |
201 EXPECT_EQ(SK_ColorGREEN, pixels[0]); | 201 EXPECT_EQ(SK_ColorGREEN, pixels[0]); |
202 EXPECT_EQ(SK_ColorGREEN, pixels[viewportPixels - 1]); | 202 EXPECT_EQ(SK_ColorGREEN, pixels[viewportPixels - 1]); |
203 | 203 |
204 EXPECT_EQ(SK_ColorMAGENTA, pixels[smallerRect.y() * viewportRect.width() + s
mallerRect.x()]); | 204 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]); | 205 EXPECT_EQ(SK_ColorMAGENTA, pixels[(smallerRect.bottom() - 1) * viewportRect.
width() + smallerRect.right() - 1]); |
206 } | 206 } |
207 | 207 |
208 } // namespace | 208 } // namespace |
209 } // namespace cc | 209 } // namespace cc |
OLD | NEW |