| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 list.push_back(root_render_pass.PassAs<RenderPass>()); | 91 list.push_back(root_render_pass.PassAs<RenderPass>()); |
| 92 renderer()->DrawFrame(list); | 92 renderer()->DrawFrame(list); |
| 93 | 93 |
| 94 scoped_array<SkColor> pixels(new SkColor[DeviceViewportSize().width() * Devi
ceViewportSize().height()]); | 94 scoped_array<SkColor> pixels(new SkColor[DeviceViewportSize().width() * Devi
ceViewportSize().height()]); |
| 95 renderer()->GetFramebufferPixels(pixels.get(), outerRect); | 95 renderer()->GetFramebufferPixels(pixels.get(), outerRect); |
| 96 | 96 |
| 97 // FIXME: This fails on Android. Endianness maybe? | 97 // FIXME: This fails on Android. Endianness maybe? |
| 98 // Yellow: expects 0xFFFFFF00, was 0xFF00FFFF on android. | 98 // Yellow: expects 0xFFFFFF00, was 0xFF00FFFF on android. |
| 99 // Cyan: expects 0xFF00FFFF, was 0xFFFFFF00 on android. | 99 // Cyan: expects 0xFF00FFFF, was 0xFFFFFF00 on android. |
| 100 // http://crbug.com/154528 | 100 // http://crbug.com/154528 |
| 101 #ifndef OS_ANDROID | 101 #if !defined(OS_ANDROID) |
| 102 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); | 102 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); |
| 103 EXPECT_EQ(SK_ColorYELLOW, pixels[outerPixels - 1]); | 103 EXPECT_EQ(SK_ColorYELLOW, pixels[outerPixels - 1]); |
| 104 EXPECT_EQ(SK_ColorCYAN, pixels[outerSize.width() + 1]); | 104 EXPECT_EQ(SK_ColorCYAN, pixels[outerSize.width() + 1]); |
| 105 EXPECT_EQ(SK_ColorCYAN, pixels[outerPixels - outerSize.width() - 2]); | 105 EXPECT_EQ(SK_ColorCYAN, pixels[outerPixels - outerSize.width() - 2]); |
| 106 #endif | 106 #endif |
| 107 } | 107 } |
| 108 | 108 |
| 109 TEST_F(SoftwareRendererTest, tileQuad) | 109 TEST_F(SoftwareRendererTest, tileQuad) |
| 110 { | 110 { |
| 111 gfx::Size outerSize(100, 100); | 111 gfx::Size outerSize(100, 100); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // If we didn't clear, the borders should still be green. | 198 // If we didn't clear, the borders should still be green. |
| 199 EXPECT_EQ(SK_ColorGREEN, pixels[0]); | 199 EXPECT_EQ(SK_ColorGREEN, pixels[0]); |
| 200 EXPECT_EQ(SK_ColorGREEN, pixels[viewportPixels - 1]); | 200 EXPECT_EQ(SK_ColorGREEN, pixels[viewportPixels - 1]); |
| 201 | 201 |
| 202 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()]); |
| 203 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]); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace | 206 } // namespace |
| 207 } // namespace cc | 207 } // namespace cc |
| OLD | NEW |