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

Side by Side Diff: cc/test/fake_picture_pile.cc

Issue 1061203002: cc: Remove invalidation history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address vmpstr comments Created 5 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
« no previous file with comments | « cc/test/fake_picture_pile.h ('k') | cc/test/fake_picture_pile_impl.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/test/fake_picture_pile.h" 5 #include "cc/test/fake_picture_pile.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/test/fake_picture_pile_impl.h" 9 #include "cc/test/fake_picture_pile_impl.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 EXPECT_LT(y, tiling_.num_tiles_y()); 61 EXPECT_LT(y, tiling_.num_tiles_y());
62 62
63 if (HasRecordingAt(x, y)) 63 if (HasRecordingAt(x, y))
64 return; 64 return;
65 gfx::Rect bounds(tiling().TileBounds(x, y)); 65 gfx::Rect bounds(tiling().TileBounds(x, y));
66 bounds.Inset(-buffer_pixels(), -buffer_pixels()); 66 bounds.Inset(-buffer_pixels(), -buffer_pixels());
67 67
68 scoped_refptr<Picture> picture( 68 scoped_refptr<Picture> picture(
69 Picture::Create(bounds, &client_, tile_grid_size_, gather_pixel_refs_, 69 Picture::Create(bounds, &client_, tile_grid_size_, gather_pixel_refs_,
70 RecordingSource::RECORD_NORMALLY)); 70 RecordingSource::RECORD_NORMALLY));
71 picture_map_[std::pair<int, int>(x, y)].SetPicture(picture); 71 picture_map_[std::pair<int, int>(x, y)] = picture;
72 EXPECT_TRUE(HasRecordingAt(x, y)); 72 EXPECT_TRUE(HasRecordingAt(x, y));
73 73
74 has_any_recordings_ = true; 74 has_any_recordings_ = true;
75 } 75 }
76 76
77 void FakePicturePile::RemoveRecordingAt(int x, int y) { 77 void FakePicturePile::RemoveRecordingAt(int x, int y) {
78 EXPECT_GE(x, 0); 78 EXPECT_GE(x, 0);
79 EXPECT_GE(y, 0); 79 EXPECT_GE(y, 0);
80 EXPECT_LT(x, tiling_.num_tiles_x()); 80 EXPECT_LT(x, tiling_.num_tiles_x());
81 EXPECT_LT(y, tiling_.num_tiles_y()); 81 EXPECT_LT(y, tiling_.num_tiles_y());
82 82
83 if (!HasRecordingAt(x, y)) 83 if (!HasRecordingAt(x, y))
84 return; 84 return;
85 picture_map_.erase(std::pair<int, int>(x, y)); 85 picture_map_.erase(std::pair<int, int>(x, y));
86 EXPECT_FALSE(HasRecordingAt(x, y)); 86 EXPECT_FALSE(HasRecordingAt(x, y));
87 } 87 }
88 88
89 bool FakePicturePile::HasRecordingAt(int x, int y) const { 89 bool FakePicturePile::HasRecordingAt(int x, int y) const {
90 PictureMap::const_iterator found = picture_map_.find(PictureMapKey(x, y)); 90 PictureMap::const_iterator found = picture_map_.find(PictureMapKey(x, y));
91 if (found == picture_map_.end()) 91 return found != picture_map_.end();
92 return false;
93 return !!found->second.GetPicture();
94 } 92 }
95 93
96 void FakePicturePile::Rerecord() { 94 void FakePicturePile::Rerecord() {
97 for (int y = 0; y < num_tiles_y(); ++y) { 95 for (int y = 0; y < num_tiles_y(); ++y) {
98 for (int x = 0; x < num_tiles_x(); ++x) { 96 for (int x = 0; x < num_tiles_x(); ++x) {
99 RemoveRecordingAt(x, y); 97 RemoveRecordingAt(x, y);
100 AddRecordingAt(x, y); 98 AddRecordingAt(x, y);
101 } 99 }
102 } 100 }
103 } 101 }
104 102
105 } // namespace cc 103 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_picture_pile.h ('k') | cc/test/fake_picture_pile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698