| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 TEST_F(SoftwareRendererTest, TileQuad) { | 139 TEST_F(SoftwareRendererTest, TileQuad) { |
| 140 gfx::Size outer_size(100, 100); | 140 gfx::Size outer_size(100, 100); |
| 141 gfx::Size inner_size(98, 98); | 141 gfx::Size inner_size(98, 98); |
| 142 gfx::Rect outer_rect(outer_size); | 142 gfx::Rect outer_rect(outer_size); |
| 143 gfx::Rect inner_rect(gfx::Point(1, 1), inner_size); | 143 gfx::Rect inner_rect(gfx::Point(1, 1), inner_size); |
| 144 set_viewport(gfx::Rect(outer_size)); | 144 set_viewport(gfx::Rect(outer_size)); |
| 145 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice)); | 145 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice)); |
| 146 | 146 |
| 147 ResourceProvider::ResourceId resource_yellow = | 147 ResourceProvider::ResourceId resource_yellow = |
| 148 resource_provider()->CreateResource( | 148 resource_provider()->CreateResource( |
| 149 outer_size, GL_RGBA, ResourceProvider::TextureUsageAny); | 149 outer_size, GL_RGBA, GL_CLAMP_TO_EDGE, |
| 150 ResourceProvider::TextureUsageAny); |
| 150 ResourceProvider::ResourceId resource_cyan = | 151 ResourceProvider::ResourceId resource_cyan = |
| 151 resource_provider()->CreateResource( | 152 resource_provider()->CreateResource( |
| 152 inner_size, GL_RGBA, ResourceProvider::TextureUsageAny); | 153 inner_size, GL_RGBA, GL_CLAMP_TO_EDGE, |
| 154 ResourceProvider::TextureUsageAny); |
| 153 | 155 |
| 154 SkBitmap yellow_tile; | 156 SkBitmap yellow_tile; |
| 155 yellow_tile.setConfig( | 157 yellow_tile.setConfig( |
| 156 SkBitmap::kARGB_8888_Config, outer_size.width(), outer_size.height()); | 158 SkBitmap::kARGB_8888_Config, outer_size.width(), outer_size.height()); |
| 157 yellow_tile.allocPixels(); | 159 yellow_tile.allocPixels(); |
| 158 yellow_tile.eraseColor(SK_ColorYELLOW); | 160 yellow_tile.eraseColor(SK_ColorYELLOW); |
| 159 | 161 |
| 160 SkBitmap cyan_tile; | 162 SkBitmap cyan_tile; |
| 161 cyan_tile.setConfig( | 163 cyan_tile.setConfig( |
| 162 SkBitmap::kARGB_8888_Config, inner_size.width(), inner_size.height()); | 164 SkBitmap::kARGB_8888_Config, inner_size.width(), inner_size.height()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 TEST_F(SoftwareRendererTest, TileQuadVisibleRect) { | 227 TEST_F(SoftwareRendererTest, TileQuadVisibleRect) { |
| 226 gfx::Size tile_size(100, 100); | 228 gfx::Size tile_size(100, 100); |
| 227 gfx::Rect tile_rect(tile_size); | 229 gfx::Rect tile_rect(tile_size); |
| 228 gfx::Rect visible_rect = tile_rect; | 230 gfx::Rect visible_rect = tile_rect; |
| 229 visible_rect.Inset(1, 2, 3, 4); | 231 visible_rect.Inset(1, 2, 3, 4); |
| 230 set_viewport(gfx::Rect(tile_size)); | 232 set_viewport(gfx::Rect(tile_size)); |
| 231 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice)); | 233 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice)); |
| 232 | 234 |
| 233 ResourceProvider::ResourceId resource_cyan = | 235 ResourceProvider::ResourceId resource_cyan = |
| 234 resource_provider()->CreateResource( | 236 resource_provider()->CreateResource( |
| 235 tile_size, GL_RGBA, ResourceProvider::TextureUsageAny); | 237 tile_size, GL_RGBA, GL_CLAMP_TO_EDGE, |
| 238 ResourceProvider::TextureUsageAny); |
| 236 | 239 |
| 237 SkBitmap cyan_tile; // The lowest five rows are yellow. | 240 SkBitmap cyan_tile; // The lowest five rows are yellow. |
| 238 cyan_tile.setConfig( | 241 cyan_tile.setConfig( |
| 239 SkBitmap::kARGB_8888_Config, tile_size.width(), tile_size.height()); | 242 SkBitmap::kARGB_8888_Config, tile_size.width(), tile_size.height()); |
| 240 cyan_tile.allocPixels(); | 243 cyan_tile.allocPixels(); |
| 241 cyan_tile.eraseColor(SK_ColorCYAN); | 244 cyan_tile.eraseColor(SK_ColorCYAN); |
| 242 cyan_tile.eraseArea( | 245 cyan_tile.eraseArea( |
| 243 SkIRect::MakeLTRB( | 246 SkIRect::MakeLTRB( |
| 244 0, visible_rect.bottom() - 1, tile_rect.width(), tile_rect.bottom()), | 247 0, visible_rect.bottom() - 1, tile_rect.width(), tile_rect.bottom()), |
| 245 SK_ColorYELLOW); | 248 SK_ColorYELLOW); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 EXPECT_EQ( | 407 EXPECT_EQ( |
| 405 SK_ColorMAGENTA, | 408 SK_ColorMAGENTA, |
| 406 output.getColor(interior_visible_rect.x(), interior_visible_rect.y())); | 409 output.getColor(interior_visible_rect.x(), interior_visible_rect.y())); |
| 407 EXPECT_EQ(SK_ColorMAGENTA, | 410 EXPECT_EQ(SK_ColorMAGENTA, |
| 408 output.getColor(interior_visible_rect.right() - 1, | 411 output.getColor(interior_visible_rect.right() - 1, |
| 409 interior_visible_rect.bottom() - 1)); | 412 interior_visible_rect.bottom() - 1)); |
| 410 } | 413 } |
| 411 | 414 |
| 412 } // namespace | 415 } // namespace |
| 413 } // namespace cc | 416 } // namespace cc |
| OLD | NEW |