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

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

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/software_renderer.cc ('k') | cc/quads/draw_polygon.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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 TEST_F(SoftwareRendererTest, TileQuad) { 149 TEST_F(SoftwareRendererTest, TileQuad) {
150 gfx::Size outer_size(100, 100); 150 gfx::Size outer_size(100, 100);
151 gfx::Size inner_size(98, 98); 151 gfx::Size inner_size(98, 98);
152 gfx::Rect outer_rect(outer_size); 152 gfx::Rect outer_rect(outer_size);
153 gfx::Rect inner_rect(gfx::Point(1, 1), inner_size); 153 gfx::Rect inner_rect(gfx::Point(1, 1), inner_size);
154 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice)); 154 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice));
155 155
156 ResourceProvider::ResourceId resource_yellow = 156 ResourceProvider::ResourceId resource_yellow =
157 resource_provider()->CreateResource( 157 resource_provider()->CreateResource(
158 outer_size, GL_CLAMP_TO_EDGE, 158 outer_size,
159 ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); 159 GL_CLAMP_TO_EDGE,
160 ResourceProvider::TextureHintImmutable,
161 RGBA_8888);
160 ResourceProvider::ResourceId resource_cyan = 162 ResourceProvider::ResourceId resource_cyan =
161 resource_provider()->CreateResource( 163 resource_provider()->CreateResource(
162 inner_size, GL_CLAMP_TO_EDGE, 164 inner_size,
163 ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); 165 GL_CLAMP_TO_EDGE,
166 ResourceProvider::TextureHintImmutable,
167 RGBA_8888);
164 168
165 SkBitmap yellow_tile; 169 SkBitmap yellow_tile;
166 yellow_tile.allocN32Pixels(outer_size.width(), outer_size.height()); 170 yellow_tile.allocN32Pixels(outer_size.width(), outer_size.height());
167 yellow_tile.eraseColor(SK_ColorYELLOW); 171 yellow_tile.eraseColor(SK_ColorYELLOW);
168 172
169 SkBitmap cyan_tile; 173 SkBitmap cyan_tile;
170 cyan_tile.allocN32Pixels(inner_size.width(), inner_size.height()); 174 cyan_tile.allocN32Pixels(inner_size.width(), inner_size.height());
171 cyan_tile.eraseColor(SK_ColorCYAN); 175 cyan_tile.eraseColor(SK_ColorCYAN);
172 176
173 resource_provider()->CopyToResource( 177 resource_provider()->SetPixels(
174 resource_yellow, static_cast<uint8_t*>(yellow_tile.getPixels()), 178 resource_yellow,
175 outer_size); 179 static_cast<uint8_t*>(yellow_tile.getPixels()),
176 resource_provider()->CopyToResource( 180 gfx::Rect(outer_size),
177 resource_cyan, static_cast<uint8_t*>(cyan_tile.getPixels()), inner_size); 181 gfx::Rect(outer_size),
182 gfx::Vector2d());
183 resource_provider()->SetPixels(resource_cyan,
184 static_cast<uint8_t*>(cyan_tile.getPixels()),
185 gfx::Rect(inner_size),
186 gfx::Rect(inner_size),
187 gfx::Vector2d());
178 188
179 gfx::Rect root_rect = outer_rect; 189 gfx::Rect root_rect = outer_rect;
180 190
181 RenderPassId root_render_pass_id = RenderPassId(1, 1); 191 RenderPassId root_render_pass_id = RenderPassId(1, 1);
182 scoped_ptr<TestRenderPass> root_render_pass = TestRenderPass::Create(); 192 scoped_ptr<TestRenderPass> root_render_pass = TestRenderPass::Create();
183 root_render_pass->SetNew( 193 root_render_pass->SetNew(
184 root_render_pass_id, root_rect, root_rect, gfx::Transform()); 194 root_render_pass_id, root_rect, root_rect, gfx::Transform());
185 SharedQuadState* shared_quad_state = 195 SharedQuadState* shared_quad_state =
186 root_render_pass->CreateAndAppendSharedQuadState(); 196 root_render_pass->CreateAndAppendSharedQuadState();
187 shared_quad_state->SetAll(gfx::Transform(), 197 shared_quad_state->SetAll(gfx::Transform(),
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 245
236 TEST_F(SoftwareRendererTest, TileQuadVisibleRect) { 246 TEST_F(SoftwareRendererTest, TileQuadVisibleRect) {
237 gfx::Size tile_size(100, 100); 247 gfx::Size tile_size(100, 100);
238 gfx::Rect tile_rect(tile_size); 248 gfx::Rect tile_rect(tile_size);
239 gfx::Rect visible_rect = tile_rect; 249 gfx::Rect visible_rect = tile_rect;
240 visible_rect.Inset(1, 2, 3, 4); 250 visible_rect.Inset(1, 2, 3, 4);
241 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice)); 251 InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice));
242 252
243 ResourceProvider::ResourceId resource_cyan = 253 ResourceProvider::ResourceId resource_cyan =
244 resource_provider()->CreateResource( 254 resource_provider()->CreateResource(
245 tile_size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, 255 tile_size,
256 GL_CLAMP_TO_EDGE,
257 ResourceProvider::TextureHintImmutable,
246 RGBA_8888); 258 RGBA_8888);
247 259
248 SkBitmap cyan_tile; // The lowest five rows are yellow. 260 SkBitmap cyan_tile; // The lowest five rows are yellow.
249 cyan_tile.allocN32Pixels(tile_size.width(), tile_size.height()); 261 cyan_tile.allocN32Pixels(tile_size.width(), tile_size.height());
250 cyan_tile.eraseColor(SK_ColorCYAN); 262 cyan_tile.eraseColor(SK_ColorCYAN);
251 cyan_tile.eraseArea( 263 cyan_tile.eraseArea(
252 SkIRect::MakeLTRB( 264 SkIRect::MakeLTRB(
253 0, visible_rect.bottom() - 1, tile_rect.width(), tile_rect.bottom()), 265 0, visible_rect.bottom() - 1, tile_rect.width(), tile_rect.bottom()),
254 SK_ColorYELLOW); 266 SK_ColorYELLOW);
255 267
256 resource_provider()->CopyToResource( 268 resource_provider()->SetPixels(resource_cyan,
257 resource_cyan, static_cast<uint8_t*>(cyan_tile.getPixels()), tile_size); 269 static_cast<uint8_t*>(cyan_tile.getPixels()),
270 gfx::Rect(tile_size),
271 gfx::Rect(tile_size),
272 gfx::Vector2d());
258 273
259 gfx::Rect root_rect(tile_size); 274 gfx::Rect root_rect(tile_size);
260 275
261 RenderPassId root_render_pass_id = RenderPassId(1, 1); 276 RenderPassId root_render_pass_id = RenderPassId(1, 1);
262 scoped_ptr<TestRenderPass> root_render_pass = TestRenderPass::Create(); 277 scoped_ptr<TestRenderPass> root_render_pass = TestRenderPass::Create();
263 root_render_pass->SetNew( 278 root_render_pass->SetNew(
264 root_render_pass_id, root_rect, root_rect, gfx::Transform()); 279 root_render_pass_id, root_rect, root_rect, gfx::Transform());
265 SharedQuadState* shared_quad_state = 280 SharedQuadState* shared_quad_state =
266 root_render_pass->CreateAndAppendSharedQuadState(); 281 root_render_pass->CreateAndAppendSharedQuadState();
267 shared_quad_state->SetAll(gfx::Transform(), 282 shared_quad_state->SetAll(gfx::Transform(),
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 EXPECT_EQ( 434 EXPECT_EQ(
420 SK_ColorMAGENTA, 435 SK_ColorMAGENTA,
421 output->getColor(interior_visible_rect.x(), interior_visible_rect.y())); 436 output->getColor(interior_visible_rect.x(), interior_visible_rect.y()));
422 EXPECT_EQ(SK_ColorMAGENTA, 437 EXPECT_EQ(SK_ColorMAGENTA,
423 output->getColor(interior_visible_rect.right() - 1, 438 output->getColor(interior_visible_rect.right() - 1,
424 interior_visible_rect.bottom() - 1)); 439 interior_visible_rect.bottom() - 1));
425 } 440 }
426 441
427 } // namespace 442 } // namespace
428 } // namespace cc 443 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/software_renderer.cc ('k') | cc/quads/draw_polygon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698