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

Unified Diff: cc/test/fake_picture_pile_impl.cc

Issue 14205005: cc: Only consider layer clipped content rect for analysis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: linker fixes on windows 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/fake_picture_pile_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/fake_picture_pile_impl.cc
diff --git a/cc/test/fake_picture_pile_impl.cc b/cc/test/fake_picture_pile_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..70d0a8d3d90a02e2447cc5f4ac99fc32a3d9d387
--- /dev/null
+++ b/cc/test/fake_picture_pile_impl.cc
@@ -0,0 +1,76 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/test/fake_picture_pile_impl.h"
+
+#include <utility>
+
+#include "cc/test/impl_side_painting_settings.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace cc {
+
+FakePicturePileImpl::FakePicturePileImpl()
+ : PicturePileImpl(false) {}
+
+FakePicturePileImpl::~FakePicturePileImpl() {}
+
+scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile(
+ gfx::Size tile_size,
+ gfx::Size layer_bounds) {
+ scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl());
+ pile->tiling().SetTotalSize(layer_bounds);
+ pile->tiling().SetMaxTextureSize(tile_size);
+ pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size);
+ for (int x = 0; x < pile->tiling().num_tiles_x(); ++x) {
+ for (int y = 0; y < pile->tiling().num_tiles_y(); ++y)
+ pile->AddRecordingAt(x, y);
+ }
+ pile->UpdateRecordedRegion();
+ return pile;
+}
+
+scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile(
+ gfx::Size tile_size,
+ gfx::Size layer_bounds) {
+ scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl());
+ pile->tiling().SetTotalSize(layer_bounds);
+ pile->tiling().SetMaxTextureSize(tile_size);
+ pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size);
+ pile->UpdateRecordedRegion();
+ return pile;
+}
+
+void FakePicturePileImpl::AddRecordingAt(int x, int y) {
+ EXPECT_GE(x, 0);
+ EXPECT_GE(y, 0);
+ EXPECT_LT(x, tiling_.num_tiles_x());
+ EXPECT_LT(y, tiling_.num_tiles_y());
+
+ if (HasRecordingAt(x, y))
+ return;
+ gfx::Rect bounds(tiling().TileBounds(x, y));
+ scoped_refptr<Picture> picture(Picture::Create(bounds));
+ picture->Record(&client_, NULL, tile_grid_info_);
+ picture_list_map_[std::pair<int, int>(x, y)].push_back(picture);
+ EXPECT_TRUE(HasRecordingAt(x, y));
+
+ UpdateRecordedRegion();
+}
+
+void FakePicturePileImpl::RemoveRecordingAt(int x, int y) {
+ EXPECT_GE(x, 0);
+ EXPECT_GE(y, 0);
+ EXPECT_LT(x, tiling_.num_tiles_x());
+ EXPECT_LT(y, tiling_.num_tiles_y());
+
+ if (!HasRecordingAt(x, y))
+ return;
+ picture_list_map_.erase(std::pair<int, int>(x, y));
+ EXPECT_FALSE(HasRecordingAt(x, y));
+
+ UpdateRecordedRegion();
+}
+
+} // namespace cc
« no previous file with comments | « cc/test/fake_picture_pile_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698