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

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

Issue 2235623003: cc: Add gfx::ColorSpace to cc::ResourceProvider resource creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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/raster/raster_buffer_provider_perftest.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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 144
145 TEST_F(SoftwareRendererTest, TileQuad) { 145 TEST_F(SoftwareRendererTest, TileQuad) {
146 gfx::Size outer_size(100, 100); 146 gfx::Size outer_size(100, 100);
147 gfx::Size inner_size(98, 98); 147 gfx::Size inner_size(98, 98);
148 gfx::Rect outer_rect(outer_size); 148 gfx::Rect outer_rect(outer_size);
149 gfx::Rect inner_rect(gfx::Point(1, 1), inner_size); 149 gfx::Rect inner_rect(gfx::Point(1, 1), inner_size);
150 InitializeRenderer(base::WrapUnique(new SoftwareOutputDevice)); 150 InitializeRenderer(base::WrapUnique(new SoftwareOutputDevice));
151 151
152 ResourceId resource_yellow = resource_provider()->CreateResource( 152 ResourceId resource_yellow = resource_provider()->CreateResource(
153 outer_size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); 153 outer_size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888,
154 gfx::ColorSpace());
154 ResourceId resource_cyan = resource_provider()->CreateResource( 155 ResourceId resource_cyan = resource_provider()->CreateResource(
155 inner_size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); 156 inner_size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888,
157 gfx::ColorSpace());
156 158
157 SkBitmap yellow_tile; 159 SkBitmap yellow_tile;
158 yellow_tile.allocN32Pixels(outer_size.width(), outer_size.height()); 160 yellow_tile.allocN32Pixels(outer_size.width(), outer_size.height());
159 yellow_tile.eraseColor(SK_ColorYELLOW); 161 yellow_tile.eraseColor(SK_ColorYELLOW);
160 162
161 SkBitmap cyan_tile; 163 SkBitmap cyan_tile;
162 cyan_tile.allocN32Pixels(inner_size.width(), inner_size.height()); 164 cyan_tile.allocN32Pixels(inner_size.width(), inner_size.height());
163 cyan_tile.eraseColor(SK_ColorCYAN); 165 cyan_tile.eraseColor(SK_ColorCYAN);
164 166
165 resource_provider()->CopyToResource( 167 resource_provider()->CopyToResource(
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 216 }
215 217
216 TEST_F(SoftwareRendererTest, TileQuadVisibleRect) { 218 TEST_F(SoftwareRendererTest, TileQuadVisibleRect) {
217 gfx::Size tile_size(100, 100); 219 gfx::Size tile_size(100, 100);
218 gfx::Rect tile_rect(tile_size); 220 gfx::Rect tile_rect(tile_size);
219 gfx::Rect visible_rect = tile_rect; 221 gfx::Rect visible_rect = tile_rect;
220 visible_rect.Inset(1, 2, 3, 4); 222 visible_rect.Inset(1, 2, 3, 4);
221 InitializeRenderer(base::WrapUnique(new SoftwareOutputDevice)); 223 InitializeRenderer(base::WrapUnique(new SoftwareOutputDevice));
222 224
223 ResourceId resource_cyan = resource_provider()->CreateResource( 225 ResourceId resource_cyan = resource_provider()->CreateResource(
224 tile_size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); 226 tile_size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888,
227 gfx::ColorSpace());
225 228
226 SkBitmap cyan_tile; // The lowest five rows are yellow. 229 SkBitmap cyan_tile; // The lowest five rows are yellow.
227 cyan_tile.allocN32Pixels(tile_size.width(), tile_size.height()); 230 cyan_tile.allocN32Pixels(tile_size.width(), tile_size.height());
228 cyan_tile.eraseColor(SK_ColorCYAN); 231 cyan_tile.eraseColor(SK_ColorCYAN);
229 cyan_tile.eraseArea( 232 cyan_tile.eraseArea(
230 SkIRect::MakeLTRB( 233 SkIRect::MakeLTRB(
231 0, visible_rect.bottom() - 1, tile_rect.width(), tile_rect.bottom()), 234 0, visible_rect.bottom() - 1, tile_rect.width(), tile_rect.bottom()),
232 SK_ColorYELLOW); 235 SK_ColorYELLOW);
233 236
234 resource_provider()->CopyToResource( 237 resource_provider()->CopyToResource(
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 viewport_rect, clip_rect); 450 viewport_rect, clip_rect);
448 451
449 // The damage rect should be reported to the SoftwareOutputDevice. 452 // The damage rect should be reported to the SoftwareOutputDevice.
450 EXPECT_EQ(gfx::Rect(2, 2, 3, 3), device->damage_rect_at_start()); 453 EXPECT_EQ(gfx::Rect(2, 2, 3, 3), device->damage_rect_at_start());
451 // The SkCanvas should be clipped to the damage rect. 454 // The SkCanvas should be clipped to the damage rect.
452 EXPECT_EQ(gfx::Rect(2, 2, 3, 3), device->clip_rect_at_end()); 455 EXPECT_EQ(gfx::Rect(2, 2, 3, 3), device->clip_rect_at_end());
453 } 456 }
454 457
455 } // namespace 458 } // namespace
456 } // namespace cc 459 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/renderer_pixeltest.cc ('k') | cc/raster/raster_buffer_provider_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698