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/output/software_renderer.h" | 5 #include "cc/output/software_renderer.h" |
6 | 6 |
7 #include "cc/layers/quad_sink.h" | 7 #include "cc/layers/quad_sink.h" |
8 #include "cc/output/compositor_frame_metadata.h" | 8 #include "cc/output/compositor_frame_metadata.h" |
9 #include "cc/output/software_output_device.h" | 9 #include "cc/output/software_output_device.h" |
10 #include "cc/quads/render_pass.h" | 10 #include "cc/quads/render_pass.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 DeviceViewportSize().height()]); | 199 DeviceViewportSize().height()]); |
200 renderer()->GetFramebufferPixels(pixels.get(), outer_rect); | 200 renderer()->GetFramebufferPixels(pixels.get(), outer_rect); |
201 | 201 |
202 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); | 202 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); |
203 EXPECT_EQ(SK_ColorYELLOW, pixels[outer_pixels - 1]); | 203 EXPECT_EQ(SK_ColorYELLOW, pixels[outer_pixels - 1]); |
204 EXPECT_EQ(SK_ColorCYAN, pixels[outer_size.width() + 1]); | 204 EXPECT_EQ(SK_ColorCYAN, pixels[outer_size.width() + 1]); |
205 EXPECT_EQ(SK_ColorCYAN, pixels[outer_pixels - outer_size.width() - 2]); | 205 EXPECT_EQ(SK_ColorCYAN, pixels[outer_pixels - outer_size.width() - 2]); |
206 } | 206 } |
207 | 207 |
208 TEST_F(SoftwareRendererTest, ShouldClearRootRenderPass) { | 208 TEST_F(SoftwareRendererTest, ShouldClearRootRenderPass) { |
209 gfx::Rect viewport_rect(gfx::Size(100, 100)); | 209 gfx::Rect viewport_rect(0, 0, 100, 100); |
210 size_t viewport_pixels = viewport_rect.width() * viewport_rect.height(); | 210 size_t viewport_pixels = viewport_rect.width() * viewport_rect.height(); |
211 set_viewport_size(viewport_rect.size()); | 211 set_viewport_size(viewport_rect.size()); |
212 set_should_clear_root_render_pass(false); | 212 set_should_clear_root_render_pass(false); |
213 InitializeRenderer(); | 213 InitializeRenderer(); |
214 | 214 |
215 RenderPassList list; | 215 RenderPassList list; |
216 scoped_array<SkColor> pixels(new SkColor[viewport_pixels]); | 216 scoped_array<SkColor> pixels(new SkColor[viewport_pixels]); |
217 | 217 |
218 // Draw a fullscreen green quad in a first frame. | 218 // Draw a fullscreen green quad in a first frame. |
219 RenderPass::Id root_clear_pass_id(1, 0); | 219 RenderPass::Id root_clear_pass_id(1, 0); |
(...skipping 30 matching lines...) Expand all Loading... |
250 EXPECT_EQ( | 250 EXPECT_EQ( |
251 SK_ColorMAGENTA, | 251 SK_ColorMAGENTA, |
252 pixels[smaller_rect.y() * viewport_rect.width() + smaller_rect.x()]); | 252 pixels[smaller_rect.y() * viewport_rect.width() + smaller_rect.x()]); |
253 EXPECT_EQ(SK_ColorMAGENTA, | 253 EXPECT_EQ(SK_ColorMAGENTA, |
254 pixels[(smaller_rect.bottom() - 1) * viewport_rect.width() + | 254 pixels[(smaller_rect.bottom() - 1) * viewport_rect.width() + |
255 smaller_rect.right() - 1]); | 255 smaller_rect.right() - 1]); |
256 } | 256 } |
257 | 257 |
258 } // namespace | 258 } // namespace |
259 } // namespace cc | 259 } // namespace cc |
OLD | NEW |