Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: cc/output/software_renderer_unittest.cc

Issue 486853002: cc: Use a normal texture for background texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits in unittests Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/renderer_pixeltest.cc ('k') | cc/resources/prioritized_resource_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "cc/output/compositor_frame_metadata.h" 8 #include "cc/output/compositor_frame_metadata.h"
9 #include "cc/output/copy_output_request.h" 9 #include "cc/output/copy_output_request.h"
10 #include "cc/output/copy_output_result.h" 10 #include "cc/output/copy_output_result.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 TEST_F(SoftwareRendererTest, TileQuad) { 146 TEST_F(SoftwareRendererTest, TileQuad) {
147 gfx::Size outer_size(100, 100); 147 gfx::Size outer_size(100, 100);
148 gfx::Size inner_size(98, 98); 148 gfx::Size inner_size(98, 98);
149 gfx::Rect outer_rect(outer_size); 149 gfx::Rect outer_rect(outer_size);
150 gfx::Rect inner_rect(gfx::Point(1, 1), inner_size); 150 gfx::Rect inner_rect(gfx::Point(1, 1), inner_size);
151 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice)); 151 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice));
152 152
153 ResourceProvider::ResourceId resource_yellow = 153 ResourceProvider::ResourceId resource_yellow =
154 resource_provider()->CreateResource(outer_size, 154 resource_provider()->CreateResource(
155 GL_CLAMP_TO_EDGE, 155 outer_size,
156 ResourceProvider::TextureUsageAny, 156 GL_CLAMP_TO_EDGE,
157 RGBA_8888); 157 ResourceProvider::TextureHintImmutable,
158 RGBA_8888);
158 ResourceProvider::ResourceId resource_cyan = 159 ResourceProvider::ResourceId resource_cyan =
159 resource_provider()->CreateResource(inner_size, 160 resource_provider()->CreateResource(
160 GL_CLAMP_TO_EDGE, 161 inner_size,
161 ResourceProvider::TextureUsageAny, 162 GL_CLAMP_TO_EDGE,
162 RGBA_8888); 163 ResourceProvider::TextureHintImmutable,
164 RGBA_8888);
163 165
164 SkBitmap yellow_tile; 166 SkBitmap yellow_tile;
165 yellow_tile.allocN32Pixels(outer_size.width(), outer_size.height()); 167 yellow_tile.allocN32Pixels(outer_size.width(), outer_size.height());
166 yellow_tile.eraseColor(SK_ColorYELLOW); 168 yellow_tile.eraseColor(SK_ColorYELLOW);
167 169
168 SkBitmap cyan_tile; 170 SkBitmap cyan_tile;
169 cyan_tile.allocN32Pixels(inner_size.width(), inner_size.height()); 171 cyan_tile.allocN32Pixels(inner_size.width(), inner_size.height());
170 cyan_tile.eraseColor(SK_ColorCYAN); 172 cyan_tile.eraseColor(SK_ColorCYAN);
171 173
172 resource_provider()->SetPixels( 174 resource_provider()->SetPixels(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 239 }
238 240
239 TEST_F(SoftwareRendererTest, TileQuadVisibleRect) { 241 TEST_F(SoftwareRendererTest, TileQuadVisibleRect) {
240 gfx::Size tile_size(100, 100); 242 gfx::Size tile_size(100, 100);
241 gfx::Rect tile_rect(tile_size); 243 gfx::Rect tile_rect(tile_size);
242 gfx::Rect visible_rect = tile_rect; 244 gfx::Rect visible_rect = tile_rect;
243 visible_rect.Inset(1, 2, 3, 4); 245 visible_rect.Inset(1, 2, 3, 4);
244 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice)); 246 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice));
245 247
246 ResourceProvider::ResourceId resource_cyan = 248 ResourceProvider::ResourceId resource_cyan =
247 resource_provider()->CreateResource(tile_size, 249 resource_provider()->CreateResource(
248 GL_CLAMP_TO_EDGE, 250 tile_size,
249 ResourceProvider::TextureUsageAny, 251 GL_CLAMP_TO_EDGE,
250 RGBA_8888); 252 ResourceProvider::TextureHintImmutable,
253 RGBA_8888);
251 254
252 SkBitmap cyan_tile; // The lowest five rows are yellow. 255 SkBitmap cyan_tile; // The lowest five rows are yellow.
253 cyan_tile.allocN32Pixels(tile_size.width(), tile_size.height()); 256 cyan_tile.allocN32Pixels(tile_size.width(), tile_size.height());
254 cyan_tile.eraseColor(SK_ColorCYAN); 257 cyan_tile.eraseColor(SK_ColorCYAN);
255 cyan_tile.eraseArea( 258 cyan_tile.eraseArea(
256 SkIRect::MakeLTRB( 259 SkIRect::MakeLTRB(
257 0, visible_rect.bottom() - 1, tile_rect.width(), tile_rect.bottom()), 260 0, visible_rect.bottom() - 1, tile_rect.width(), tile_rect.bottom()),
258 SK_ColorYELLOW); 261 SK_ColorYELLOW);
259 262
260 resource_provider()->SetPixels(resource_cyan, 263 resource_provider()->SetPixels(resource_cyan,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 EXPECT_EQ( 428 EXPECT_EQ(
426 SK_ColorMAGENTA, 429 SK_ColorMAGENTA,
427 output->getColor(interior_visible_rect.x(), interior_visible_rect.y())); 430 output->getColor(interior_visible_rect.x(), interior_visible_rect.y()));
428 EXPECT_EQ(SK_ColorMAGENTA, 431 EXPECT_EQ(SK_ColorMAGENTA,
429 output->getColor(interior_visible_rect.right() - 1, 432 output->getColor(interior_visible_rect.right() - 1,
430 interior_visible_rect.bottom() - 1)); 433 interior_visible_rect.bottom() - 1));
431 } 434 }
432 435
433 } // namespace 436 } // namespace
434 } // namespace cc 437 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/renderer_pixeltest.cc ('k') | cc/resources/prioritized_resource_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698