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

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

Issue 12457031: cc: Changed total_pixels_rasterized to be a return value (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | « no previous file | cc/resources/picture_pile_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 "cc/layers/picture_layer.h" 7 #include "cc/layers/picture_layer.h"
8 #include "cc/test/fake_content_layer_client.h" 8 #include "cc/test/fake_content_layer_client.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 active_pile->add_draw_rect(rect); 247 active_pile->add_draw_rect(rect);
248 rects.push_back(SkRect::MakeXYWH(rect.x(), rect.y(), 1, 1)); 248 rects.push_back(SkRect::MakeXYWH(rect.x(), rect.y(), 1, 1));
249 } 249 }
250 // Force re-record with newly injected content 250 // Force re-record with newly injected content
251 active_pile->RemoveRecordingAt(0, 0); 251 active_pile->RemoveRecordingAt(0, 0);
252 active_pile->AddRecordingAt(0, 0); 252 active_pile->AddRecordingAt(0, 0);
253 253
254 SkBitmap store; 254 SkBitmap store;
255 store.setConfig(SkBitmap::kNo_Config, 1000, 1000); 255 store.setConfig(SkBitmap::kNo_Config, 1000, 1000);
256 SkDevice device(store); 256 SkDevice device(store);
257 int64 pixels_rasterized;
258 257
259 std::vector<SkRect>::const_iterator rect_iter = rects.begin(); 258 std::vector<SkRect>::const_iterator rect_iter = rects.begin();
260 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { 259 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) {
261 MockCanvas mock_canvas(&device); 260 MockCanvas mock_canvas(&device);
262 active_pile->Raster(&mock_canvas, (*tile_iter)->content_rect(), 261 active_pile->Raster(&mock_canvas, (*tile_iter)->content_rect(), 1.0f);
263 1.0f, &pixels_rasterized);
264 262
265 // This test verifies that when drawing the contents of a specific tile 263 // This test verifies that when drawing the contents of a specific tile
266 // at content scale 1.0, the playback canvas never receives content from 264 // at content scale 1.0, the playback canvas never receives content from
267 // neighboring tiles which indicates that the tile grid embedded in 265 // neighboring tiles which indicates that the tile grid embedded in
268 // SkPicture is perfectly aligned with the compositor's tiles. 266 // SkPicture is perfectly aligned with the compositor's tiles.
269 // Note: There are two rects: the initial clear and the explicitly 267 // Note: There are two rects: the initial clear and the explicitly
270 // recorded rect. We only care about the second one. 268 // recorded rect. We only care about the second one.
271 EXPECT_EQ(2, mock_canvas.rects_.size()); 269 EXPECT_EQ(2, mock_canvas.rects_.size());
272 EXPECT_EQ(*rect_iter, mock_canvas.rects_[1]); 270 EXPECT_EQ(*rect_iter, mock_canvas.rects_[1]);
273 rect_iter++; 271 rect_iter++;
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 used_tilings.push_back(active_layer_->tilings().tiling_at(1)); 692 used_tilings.push_back(active_layer_->tilings().tiling_at(1));
695 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 693 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
696 ASSERT_EQ(3u, active_layer_->tilings().num_tilings()); 694 ASSERT_EQ(3u, active_layer_->tilings().num_tilings());
697 used_tilings.clear(); 695 used_tilings.clear();
698 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 696 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
699 ASSERT_EQ(2u, active_layer_->tilings().num_tilings()); 697 ASSERT_EQ(2u, active_layer_->tilings().num_tilings());
700 } 698 }
701 699
702 } // namespace 700 } // namespace
703 } // namespace cc 701 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/picture_pile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698