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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 13206004: cc: Fix build issues for adding ‘chromium_code’: 1 to cc.gyp and cc_tests.gyp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/nine_patch_layer_unittest.cc ('k') | cc/layers/scrollbar_layer_impl.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/layers/picture_layer.h" 9 #include "cc/layers/picture_layer.h"
10 #include "cc/test/fake_content_layer_client.h" 10 #include "cc/test/fake_content_layer_client.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 host_impl_.active_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, 1.f); 227 host_impl_.active_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, 1.f);
228 float result_scale_x, result_scale_y; 228 float result_scale_x, result_scale_y;
229 gfx::Size result_bounds; 229 gfx::Size result_bounds;
230 active_layer_->CalculateContentsScale( 230 active_layer_->CalculateContentsScale(
231 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 231 1.f, false, &result_scale_x, &result_scale_y, &result_bounds);
232 232
233 // Add 1x1 rects at the centers of each tile, then re-record pile contents 233 // Add 1x1 rects at the centers of each tile, then re-record pile contents
234 std::vector<Tile*> tiles = 234 std::vector<Tile*> tiles =
235 active_layer_->tilings().tiling_at(0)->AllTilesForTesting(); 235 active_layer_->tilings().tiling_at(0)->AllTilesForTesting();
236 EXPECT_EQ(16, tiles.size()); 236 EXPECT_EQ(16u, tiles.size());
237 std::vector<SkRect> rects; 237 std::vector<SkRect> rects;
238 std::vector<Tile*>::const_iterator tile_iter; 238 std::vector<Tile*>::const_iterator tile_iter;
239 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { 239 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) {
240 gfx::Point tile_center = (*tile_iter)->content_rect().CenterPoint(); 240 gfx::Point tile_center = (*tile_iter)->content_rect().CenterPoint();
241 gfx::Rect rect(tile_center.x(), tile_center.y(), 1, 1); 241 gfx::Rect rect(tile_center.x(), tile_center.y(), 1, 1);
242 active_pile->add_draw_rect(rect); 242 active_pile->add_draw_rect(rect);
243 rects.push_back(SkRect::MakeXYWH(rect.x(), rect.y(), 1, 1)); 243 rects.push_back(SkRect::MakeXYWH(rect.x(), rect.y(), 1, 1));
244 } 244 }
245 // Force re-record with newly injected content 245 // Force re-record with newly injected content
246 active_pile->RemoveRecordingAt(0, 0); 246 active_pile->RemoveRecordingAt(0, 0);
247 active_pile->AddRecordingAt(0, 0); 247 active_pile->AddRecordingAt(0, 0);
248 248
249 SkBitmap store; 249 SkBitmap store;
250 store.setConfig(SkBitmap::kNo_Config, 1000, 1000); 250 store.setConfig(SkBitmap::kNo_Config, 1000, 1000);
251 SkDevice device(store); 251 SkDevice device(store);
252 252
253 std::vector<SkRect>::const_iterator rect_iter = rects.begin(); 253 std::vector<SkRect>::const_iterator rect_iter = rects.begin();
254 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { 254 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) {
255 MockCanvas mock_canvas(&device); 255 MockCanvas mock_canvas(&device);
256 active_pile->Raster(&mock_canvas, (*tile_iter)->content_rect(), 1.0f); 256 active_pile->Raster(&mock_canvas, (*tile_iter)->content_rect(), 1.0f);
257 257
258 // This test verifies that when drawing the contents of a specific tile 258 // This test verifies that when drawing the contents of a specific tile
259 // at content scale 1.0, the playback canvas never receives content from 259 // at content scale 1.0, the playback canvas never receives content from
260 // neighboring tiles which indicates that the tile grid embedded in 260 // neighboring tiles which indicates that the tile grid embedded in
261 // SkPicture is perfectly aligned with the compositor's tiles. 261 // SkPicture is perfectly aligned with the compositor's tiles.
262 // Note: There are two rects: the initial clear and the explicitly 262 // Note: There are two rects: the initial clear and the explicitly
263 // recorded rect. We only care about the second one. 263 // recorded rect. We only care about the second one.
264 EXPECT_EQ(2, mock_canvas.rects_.size()); 264 EXPECT_EQ(2u, mock_canvas.rects_.size());
265 EXPECT_EQ(*rect_iter, mock_canvas.rects_[1]); 265 EXPECT_EQ(*rect_iter, mock_canvas.rects_[1]);
266 rect_iter++; 266 rect_iter++;
267 } 267 }
268 } 268 }
269 269
270 FakeImplProxy proxy_; 270 FakeImplProxy proxy_;
271 FakeLayerTreeHostImpl host_impl_; 271 FakeLayerTreeHostImpl host_impl_;
272 int id_; 272 int id_;
273 TestablePictureLayerImpl* pending_layer_; 273 TestablePictureLayerImpl* pending_layer_;
274 TestablePictureLayerImpl* active_layer_; 274 TestablePictureLayerImpl* active_layer_;
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 used_tilings.push_back(active_layer_->tilings().tiling_at(1)); 687 used_tilings.push_back(active_layer_->tilings().tiling_at(1));
688 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 688 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
689 ASSERT_EQ(3u, active_layer_->tilings().num_tilings()); 689 ASSERT_EQ(3u, active_layer_->tilings().num_tilings());
690 used_tilings.clear(); 690 used_tilings.clear();
691 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 691 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
692 ASSERT_EQ(2u, active_layer_->tilings().num_tilings()); 692 ASSERT_EQ(2u, active_layer_->tilings().num_tilings());
693 } 693 }
694 694
695 } // namespace 695 } // namespace
696 } // namespace cc 696 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/nine_patch_layer_unittest.cc ('k') | cc/layers/scrollbar_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698