| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 TEST_F(SoftwareRendererTest, TileQuad) { | 118 TEST_F(SoftwareRendererTest, TileQuad) { |
| 119 gfx::Size outer_size(100, 100); | 119 gfx::Size outer_size(100, 100); |
| 120 gfx::Size inner_size(98, 98); | 120 gfx::Size inner_size(98, 98); |
| 121 gfx::Rect outer_rect(outer_size); | 121 gfx::Rect outer_rect(outer_size); |
| 122 gfx::Rect inner_rect(gfx::Point(1, 1), inner_size); | 122 gfx::Rect inner_rect(gfx::Point(1, 1), inner_size); |
| 123 set_viewport(gfx::Rect(outer_size)); | 123 set_viewport(gfx::Rect(outer_size)); |
| 124 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice)); | 124 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice)); |
| 125 | 125 |
| 126 ResourceProvider::ResourceId resource_yellow = | 126 ResourceProvider::ResourceId resource_yellow = |
| 127 resource_provider()->CreateResource( | 127 resource_provider()->CreateResource(outer_size, |
| 128 outer_size, GL_RGBA, GL_CLAMP_TO_EDGE, | 128 GL_CLAMP_TO_EDGE, |
| 129 ResourceProvider::TextureUsageAny); | 129 ResourceProvider::TextureUsageAny, |
| 130 ResourceProvider::RGBA_8888); |
| 130 ResourceProvider::ResourceId resource_cyan = | 131 ResourceProvider::ResourceId resource_cyan = |
| 131 resource_provider()->CreateResource( | 132 resource_provider()->CreateResource(inner_size, |
| 132 inner_size, GL_RGBA, GL_CLAMP_TO_EDGE, | 133 GL_CLAMP_TO_EDGE, |
| 133 ResourceProvider::TextureUsageAny); | 134 ResourceProvider::TextureUsageAny, |
| 135 ResourceProvider::RGBA_8888); |
| 134 | 136 |
| 135 SkBitmap yellow_tile; | 137 SkBitmap yellow_tile; |
| 136 yellow_tile.setConfig( | 138 yellow_tile.setConfig( |
| 137 SkBitmap::kARGB_8888_Config, outer_size.width(), outer_size.height()); | 139 SkBitmap::kARGB_8888_Config, outer_size.width(), outer_size.height()); |
| 138 yellow_tile.allocPixels(); | 140 yellow_tile.allocPixels(); |
| 139 yellow_tile.eraseColor(SK_ColorYELLOW); | 141 yellow_tile.eraseColor(SK_ColorYELLOW); |
| 140 | 142 |
| 141 SkBitmap cyan_tile; | 143 SkBitmap cyan_tile; |
| 142 cyan_tile.setConfig( | 144 cyan_tile.setConfig( |
| 143 SkBitmap::kARGB_8888_Config, inner_size.width(), inner_size.height()); | 145 SkBitmap::kARGB_8888_Config, inner_size.width(), inner_size.height()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 209 |
| 208 TEST_F(SoftwareRendererTest, TileQuadVisibleRect) { | 210 TEST_F(SoftwareRendererTest, TileQuadVisibleRect) { |
| 209 gfx::Size tile_size(100, 100); | 211 gfx::Size tile_size(100, 100); |
| 210 gfx::Rect tile_rect(tile_size); | 212 gfx::Rect tile_rect(tile_size); |
| 211 gfx::Rect visible_rect = tile_rect; | 213 gfx::Rect visible_rect = tile_rect; |
| 212 visible_rect.Inset(1, 2, 3, 4); | 214 visible_rect.Inset(1, 2, 3, 4); |
| 213 set_viewport(gfx::Rect(tile_size)); | 215 set_viewport(gfx::Rect(tile_size)); |
| 214 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice)); | 216 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice)); |
| 215 | 217 |
| 216 ResourceProvider::ResourceId resource_cyan = | 218 ResourceProvider::ResourceId resource_cyan = |
| 217 resource_provider()->CreateResource( | 219 resource_provider()->CreateResource(tile_size, |
| 218 tile_size, GL_RGBA, GL_CLAMP_TO_EDGE, | 220 GL_CLAMP_TO_EDGE, |
| 219 ResourceProvider::TextureUsageAny); | 221 ResourceProvider::TextureUsageAny, |
| 222 ResourceProvider::RGBA_8888); |
| 220 | 223 |
| 221 SkBitmap cyan_tile; // The lowest five rows are yellow. | 224 SkBitmap cyan_tile; // The lowest five rows are yellow. |
| 222 cyan_tile.setConfig( | 225 cyan_tile.setConfig( |
| 223 SkBitmap::kARGB_8888_Config, tile_size.width(), tile_size.height()); | 226 SkBitmap::kARGB_8888_Config, tile_size.width(), tile_size.height()); |
| 224 cyan_tile.allocPixels(); | 227 cyan_tile.allocPixels(); |
| 225 cyan_tile.eraseColor(SK_ColorCYAN); | 228 cyan_tile.eraseColor(SK_ColorCYAN); |
| 226 cyan_tile.eraseArea( | 229 cyan_tile.eraseArea( |
| 227 SkIRect::MakeLTRB( | 230 SkIRect::MakeLTRB( |
| 228 0, visible_rect.bottom() - 1, tile_rect.width(), tile_rect.bottom()), | 231 0, visible_rect.bottom() - 1, tile_rect.width(), tile_rect.bottom()), |
| 229 SK_ColorYELLOW); | 232 SK_ColorYELLOW); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 EXPECT_EQ( | 396 EXPECT_EQ( |
| 394 SK_ColorMAGENTA, | 397 SK_ColorMAGENTA, |
| 395 output.getColor(interior_visible_rect.x(), interior_visible_rect.y())); | 398 output.getColor(interior_visible_rect.x(), interior_visible_rect.y())); |
| 396 EXPECT_EQ(SK_ColorMAGENTA, | 399 EXPECT_EQ(SK_ColorMAGENTA, |
| 397 output.getColor(interior_visible_rect.right() - 1, | 400 output.getColor(interior_visible_rect.right() - 1, |
| 398 interior_visible_rect.bottom() - 1)); | 401 interior_visible_rect.bottom() - 1)); |
| 399 } | 402 } |
| 400 | 403 |
| 401 } // namespace | 404 } // namespace |
| 402 } // namespace cc | 405 } // namespace cc |
| OLD | NEW |