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