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

Side by Side Diff: cc/resources/picture_pile_unittest.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/resources/picture_pile_impl.cc ('k') | cc/resources/recording_source.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 <map> 5 #include <map>
6 #include <utility> 6 #include <utility>
7 7
8 #include "cc/resources/picture_pile.h" 8 #include "cc/resources/picture_pile.h"
9 #include "cc/test/fake_content_layer_client.h" 9 #include "cc/test/fake_content_layer_client.h"
10 #include "cc/test/fake_picture_pile.h" 10 #include "cc/test/fake_picture_pile.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 TEST_F(PicturePileTest, SmallInvalidateInflated) { 145 TEST_F(PicturePileTest, SmallInvalidateInflated) {
146 // Invalidate something inside a tile. 146 // Invalidate something inside a tile.
147 Region invalidate_rect(gfx::Rect(50, 50, 1, 1)); 147 Region invalidate_rect(gfx::Rect(50, 50, 1, 1));
148 UpdateAndExpandInvalidation(&invalidate_rect, tiling_size(), tiling_rect()); 148 UpdateAndExpandInvalidation(&invalidate_rect, tiling_size(), tiling_rect());
149 EXPECT_EQ(gfx::Rect(50, 50, 1, 1).ToString(), invalidate_rect.ToString()); 149 EXPECT_EQ(gfx::Rect(50, 50, 1, 1).ToString(), invalidate_rect.ToString());
150 150
151 EXPECT_EQ(1, pile_.tiling().num_tiles_x()); 151 EXPECT_EQ(1, pile_.tiling().num_tiles_x());
152 EXPECT_EQ(1, pile_.tiling().num_tiles_y()); 152 EXPECT_EQ(1, pile_.tiling().num_tiles_y());
153 153
154 FakePicturePile::PictureInfo& picture_info = 154 PicturePile::PictureMapKey key = FakePicturePile::PictureMapKey(0, 0);
155 pile_.picture_map().find(FakePicturePile::PictureMapKey(0, 0))->second; 155 PicturePile::PictureMap::iterator it = pile_.picture_map().find(key);
156 // We should have a picture. 156 EXPECT_TRUE(it != pile_.picture_map().end());
157 EXPECT_TRUE(!!picture_info.GetPicture()); 157 const Picture* picture = it->second.get();
158 gfx::Rect picture_rect = gfx::ScaleToEnclosedRect( 158 EXPECT_TRUE(picture);
159 picture_info.GetPicture()->LayerRect(), min_scale_); 159
160 gfx::Rect picture_rect =
161 gfx::ScaleToEnclosedRect(picture->LayerRect(), min_scale_);
160 162
161 // The the picture should be large enough that scaling it never makes a rect 163 // The the picture should be large enough that scaling it never makes a rect
162 // smaller than 1 px wide or tall. 164 // smaller than 1 px wide or tall.
163 EXPECT_FALSE(picture_rect.IsEmpty()) << "Picture rect " << 165 EXPECT_FALSE(picture_rect.IsEmpty()) << "Picture rect "
164 picture_rect.ToString(); 166 << picture_rect.ToString();
165 } 167 }
166 168
167 TEST_F(PicturePileTest, LargeInvalidateInflated) { 169 TEST_F(PicturePileTest, LargeInvalidateInflated) {
168 // Invalidate something inside a tile. 170 // Invalidate something inside a tile.
169 Region invalidate_rect(gfx::Rect(50, 50, 100, 100)); 171 Region invalidate_rect(gfx::Rect(50, 50, 100, 100));
170 UpdateAndExpandInvalidation(&invalidate_rect, tiling_size(), tiling_rect()); 172 UpdateAndExpandInvalidation(&invalidate_rect, tiling_size(), tiling_rect());
171 EXPECT_EQ(gfx::Rect(50, 50, 100, 100).ToString(), invalidate_rect.ToString()); 173 EXPECT_EQ(gfx::Rect(50, 50, 100, 100).ToString(), invalidate_rect.ToString());
172 174
173 EXPECT_EQ(1, pile_.tiling().num_tiles_x()); 175 EXPECT_EQ(1, pile_.tiling().num_tiles_x());
174 EXPECT_EQ(1, pile_.tiling().num_tiles_y()); 176 EXPECT_EQ(1, pile_.tiling().num_tiles_y());
175 177
176 FakePicturePile::PictureInfo& picture_info = 178 PicturePile::PictureMapKey key = FakePicturePile::PictureMapKey(0, 0);
177 pile_.picture_map().find(FakePicturePile::PictureMapKey(0, 0))->second; 179 PicturePile::PictureMap::iterator it = pile_.picture_map().find(key);
178 EXPECT_TRUE(!!picture_info.GetPicture()); 180 EXPECT_TRUE(it != pile_.picture_map().end());
181 const Picture* picture = it->second.get();
182 EXPECT_TRUE(picture);
179 183
180 int expected_inflation = pile_.buffer_pixels(); 184 int expected_inflation = pile_.buffer_pixels();
181 185
182 const Picture* base_picture = picture_info.GetPicture();
183 gfx::Rect base_picture_rect(tiling_size()); 186 gfx::Rect base_picture_rect(tiling_size());
184 base_picture_rect.Inset(-expected_inflation, -expected_inflation); 187 base_picture_rect.Inset(-expected_inflation, -expected_inflation);
185 EXPECT_EQ(base_picture_rect.ToString(), 188 EXPECT_EQ(base_picture_rect.ToString(), picture->LayerRect().ToString());
186 base_picture->LayerRect().ToString());
187 }
188
189 TEST_F(PicturePileTest, InvalidateOnTileBoundaryInflated) {
190 gfx::Size new_tiling_size =
191 gfx::ToCeiledSize(gfx::ScaleSize(tiling_size(), 2.f));
192 // This creates initial pictures.
193 SetTilingSize(new_tiling_size);
194
195 // Due to border pixels, we should have 3 tiles.
196 EXPECT_EQ(3, pile_.tiling().num_tiles_x());
197 EXPECT_EQ(3, pile_.tiling().num_tiles_y());
198
199 // We should have 1/.125 - 1 = 7 border pixels.
200 EXPECT_EQ(7, pile_.buffer_pixels());
201 EXPECT_EQ(7, pile_.tiling().border_texels());
202
203 // Invalidate everything to have a non zero invalidation frequency.
204 UpdateWholePile();
205
206 // Invalidate something just over a tile boundary by a single pixel.
207 // This will invalidate the tile (1, 1), as well as 1 row of pixels in (1, 0).
208 Region invalidate_rect(
209 gfx::Rect(pile_.tiling().TileBoundsWithBorder(0, 0).right(),
210 pile_.tiling().TileBoundsWithBorder(0, 0).bottom() - 1,
211 50,
212 50));
213 Region expected_invalidation = invalidate_rect;
214 UpdateAndExpandInvalidation(&invalidate_rect, tiling_size(), tiling_rect());
215 EXPECT_EQ(expected_invalidation.ToString(), invalidate_rect.ToString());
216
217 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
218 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
219 FakePicturePile::PictureInfo& picture_info =
220 pile_.picture_map()
221 .find(FakePicturePile::PictureMapKey(i, j))
222 ->second;
223
224 // Expect (1, 1) and (1, 0) to be invalidated once more
225 // than the rest of the tiles.
226 if (i == 1 && (j == 0 || j == 1)) {
227 EXPECT_FLOAT_EQ(
228 2.0f / FakePicturePile::PictureInfo::INVALIDATION_FRAMES_TRACKED,
229 picture_info.GetInvalidationFrequencyForTesting());
230 } else {
231 EXPECT_FLOAT_EQ(
232 1.0f / FakePicturePile::PictureInfo::INVALIDATION_FRAMES_TRACKED,
233 picture_info.GetInvalidationFrequencyForTesting());
234 }
235 }
236 }
237 }
238
239 TEST_F(PicturePileTest, InvalidateOnFullLayer) {
240 UpdateWholePile();
241
242 // Everything was invalidated once so far.
243 for (auto& it : pile_.picture_map()) {
244 EXPECT_FLOAT_EQ(
245 1.0f / FakePicturePile::PictureInfo::INVALIDATION_FRAMES_TRACKED,
246 it.second.GetInvalidationFrequencyForTesting());
247 }
248
249 // Invalidate everything,
250 Region invalidation = tiling_rect();
251 UpdateAndExpandInvalidation(&invalidation, tiling_size(), tiling_rect());
252
253 // Everything was invalidated again.
254 for (auto& it : pile_.picture_map()) {
255 EXPECT_FLOAT_EQ(
256 2.0f / FakePicturePile::PictureInfo::INVALIDATION_FRAMES_TRACKED,
257 it.second.GetInvalidationFrequencyForTesting());
258 }
259 }
260
261 TEST_F(PicturePileTest, StopRecordingOffscreenInvalidations) {
262 gfx::Size new_tiling_size =
263 gfx::ToCeiledSize(gfx::ScaleSize(tiling_size(), 4.f));
264 SetTilingSize(new_tiling_size);
265
266 gfx::Rect viewport(tiling_size().width(), 1);
267
268 // Update the whole pile until the invalidation frequency is high.
269 for (int frame = 0; frame < 33; ++frame) {
270 UpdateWholePile();
271 }
272
273 // Make sure we have a high invalidation frequency.
274 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
275 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
276 FakePicturePile::PictureInfo& picture_info =
277 pile_.picture_map()
278 .find(FakePicturePile::PictureMapKey(i, j))
279 ->second;
280 EXPECT_FLOAT_EQ(1.0f, picture_info.GetInvalidationFrequencyForTesting())
281 << "i " << i << " j " << j;
282 }
283 }
284
285 // Update once more with a small viewport.
286 Region invalidation(tiling_rect());
287 UpdateAndExpandInvalidation(&invalidation, tiling_size(), viewport);
288 EXPECT_EQ(tiling_rect().ToString(), invalidation.ToString());
289
290 bool had_tiles_with_no_pictures = false;
291 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
292 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
293 FakePicturePile::PictureInfo& picture_info =
294 pile_.picture_map()
295 .find(FakePicturePile::PictureMapKey(i, j))
296 ->second;
297 EXPECT_FLOAT_EQ(1.0f, picture_info.GetInvalidationFrequencyForTesting());
298
299 // If the y far enough away we expect to find no picture (no re-recording
300 // happened). For close y, the picture should change.
301 if (j >= 3) {
302 EXPECT_FALSE(picture_info.GetPicture()) << "i " << i << " j " << j;
303 had_tiles_with_no_pictures = true;
304 } else {
305 EXPECT_TRUE(picture_info.GetPicture()) << "i " << i << " j " << j;
306 }
307 }
308 }
309
310 EXPECT_TRUE(had_tiles_with_no_pictures);
311
312 // Update a partial tile that doesn't get recorded. We should expand the
313 // invalidation to the entire tiles that overlap it.
314 Region small_invalidation =
315 gfx::Rect(pile_.tiling().TileBounds(3, 4).x(),
316 pile_.tiling().TileBounds(3, 4).y() + 10,
317 1,
318 1);
319 UpdateAndExpandInvalidation(&small_invalidation, tiling_size(), viewport);
320 EXPECT_TRUE(small_invalidation.Contains(gfx::UnionRects(
321 pile_.tiling().TileBounds(2, 4), pile_.tiling().TileBounds(3, 4))))
322 << small_invalidation.ToString();
323
324 // Now update with no invalidation and full viewport
325 Region empty_invalidation;
326 UpdateAndExpandInvalidation(&empty_invalidation, tiling_size(),
327 tiling_rect());
328 EXPECT_EQ(Region().ToString(), empty_invalidation.ToString());
329
330 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
331 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
332 FakePicturePile::PictureInfo& picture_info =
333 pile_.picture_map()
334 .find(FakePicturePile::PictureMapKey(i, j))
335 ->second;
336 // Expect the invalidation frequency to be less than 1, since we just
337 // updated with no invalidations.
338 EXPECT_LT(picture_info.GetInvalidationFrequencyForTesting(), 1.f);
339
340 // We expect that there are pictures everywhere now.
341 EXPECT_TRUE(picture_info.GetPicture()) << "i " << i << " j " << j;
342 }
343 }
344 } 189 }
345 190
346 TEST_F(PicturePileTest, ClearingInvalidatesRecordedRect) { 191 TEST_F(PicturePileTest, ClearingInvalidatesRecordedRect) {
347 gfx::Rect rect(0, 0, 5, 5); 192 gfx::Rect rect(0, 0, 5, 5);
348 EXPECT_TRUE(pile_.CanRasterLayerRect(rect)); 193 EXPECT_TRUE(pile_.CanRasterLayerRect(rect));
349 EXPECT_TRUE(pile_.CanRasterSlowTileCheck(rect)); 194 EXPECT_TRUE(pile_.CanRasterSlowTileCheck(rect));
350 195
351 pile_.Clear(); 196 pile_.Clear();
352 197
353 // Make sure both the cache-aware check (using recorded region) and the normal 198 // Make sure both the cache-aware check (using recorded region) and the normal
354 // check are both false after clearing. 199 // check are both false after clearing.
355 EXPECT_FALSE(pile_.CanRasterLayerRect(rect)); 200 EXPECT_FALSE(pile_.CanRasterLayerRect(rect));
356 EXPECT_FALSE(pile_.CanRasterSlowTileCheck(rect)); 201 EXPECT_FALSE(pile_.CanRasterSlowTileCheck(rect));
357 } 202 }
358 203
359 TEST_F(PicturePileTest, FrequentInvalidationCanRaster) {
360 // This test makes sure that if part of the page is frequently invalidated
361 // and doesn't get re-recorded, then CanRaster is not true for any
362 // tiles touching it, but is true for adjacent tiles, even if it
363 // overlaps on borders (edge case).
364 gfx::Size new_tiling_size =
365 gfx::ToCeiledSize(gfx::ScaleSize(tiling_size(), 4.f));
366 SetTilingSize(new_tiling_size);
367
368 gfx::Rect tile02_borders = pile_.tiling().TileBoundsWithBorder(0, 2);
369 gfx::Rect tile03_borders = pile_.tiling().TileBoundsWithBorder(0, 3);
370 gfx::Rect tile02_noborders = pile_.tiling().TileBounds(0, 2);
371 gfx::Rect tile03_noborders = pile_.tiling().TileBounds(0, 3);
372
373 // Sanity check these two tiles are overlapping with borders, since this is
374 // what the test is trying to repro.
375 EXPECT_TRUE(tile02_borders.Intersects(tile03_borders));
376 EXPECT_FALSE(tile02_noborders.Intersects(tile03_noborders));
377 UpdateWholePile();
378 EXPECT_TRUE(pile_.CanRasterLayerRect(tile02_noborders));
379 EXPECT_TRUE(pile_.CanRasterSlowTileCheck(tile02_noborders));
380 EXPECT_TRUE(pile_.CanRasterLayerRect(tile03_noborders));
381 EXPECT_TRUE(pile_.CanRasterSlowTileCheck(tile03_noborders));
382 // Sanity check that an initial paint goes down the fast path of having
383 // a valid recorded viewport.
384 EXPECT_TRUE(!pile_.recorded_viewport().IsEmpty());
385
386 // Update the whole layer until the invalidation frequency is high.
387 for (int frame = 0; frame < 33; ++frame) {
388 UpdateWholePile();
389 }
390
391 // Update once more with a small viewport.
392 gfx::Rect viewport(tiling_size().width(), 1);
393 Region invalidation(tiling_rect());
394 UpdateAndExpandInvalidation(&invalidation, tiling_size(), viewport);
395 EXPECT_EQ(tiling_rect().ToString(), invalidation.ToString());
396
397 // Sanity check some pictures exist and others don't.
398 EXPECT_TRUE(pile_.picture_map()
399 .find(FakePicturePile::PictureMapKey(0, 2))
400 ->second.GetPicture());
401 EXPECT_FALSE(pile_.picture_map()
402 .find(FakePicturePile::PictureMapKey(0, 3))
403 ->second.GetPicture());
404
405 EXPECT_TRUE(pile_.CanRasterLayerRect(tile02_noborders));
406 EXPECT_TRUE(pile_.CanRasterSlowTileCheck(tile02_noborders));
407 EXPECT_FALSE(pile_.CanRasterLayerRect(tile03_noborders));
408 EXPECT_FALSE(pile_.CanRasterSlowTileCheck(tile03_noborders));
409 }
410
411 TEST_F(PicturePileTest, NoInvalidationValidViewport) { 204 TEST_F(PicturePileTest, NoInvalidationValidViewport) {
412 // This test validates that the recorded_viewport cache of full tiles 205 // This test validates that the recorded_viewport cache of full tiles
413 // is still valid for some use cases. If it's not, it's a performance 206 // is still valid for some use cases. If it's not, it's a performance
414 // issue because CanRaster checks will go down the slow path. 207 // issue because CanRaster checks will go down the slow path.
415 EXPECT_TRUE(!pile_.recorded_viewport().IsEmpty()); 208 EXPECT_TRUE(!pile_.recorded_viewport().IsEmpty());
416 209
417 // No invalidation, same viewport. 210 // No invalidation, same viewport.
418 Region invalidation; 211 Region invalidation;
419 UpdateAndExpandInvalidation(&invalidation, tiling_size(), tiling_rect()); 212 UpdateAndExpandInvalidation(&invalidation, tiling_size(), tiling_rect());
420 EXPECT_TRUE(!pile_.recorded_viewport().IsEmpty()); 213 EXPECT_TRUE(!pile_.recorded_viewport().IsEmpty());
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 SetTilingSize(base_tiling_size); 367 SetTilingSize(base_tiling_size);
575 368
576 // We should have a recording for every tile. 369 // We should have a recording for every tile.
577 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 370 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
578 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 371 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
579 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 372 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
580 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 373 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
581 FakePicturePile::PictureMapKey key(i, j); 374 FakePicturePile::PictureMapKey key(i, j);
582 FakePicturePile::PictureMap& map = pile_.picture_map(); 375 FakePicturePile::PictureMap& map = pile_.picture_map();
583 FakePicturePile::PictureMap::iterator it = map.find(key); 376 FakePicturePile::PictureMap::iterator it = map.find(key);
584 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 377 EXPECT_TRUE(it != map.end() && it->second.get());
585 } 378 }
586 } 379 }
587 380
588 UpdateAndExpandInvalidation( 381 UpdateAndExpandInvalidation(
589 &invalidation, 382 &invalidation,
590 grow_down_tiling_size, 383 grow_down_tiling_size,
591 CornerSinglePixelRect(corner, grow_down_tiling_size)); 384 CornerSinglePixelRect(corner, grow_down_tiling_size));
592 385
593 // We should have lost all of the recordings in the bottom row as none of them 386 // We should have lost all of the recordings in the bottom row as none of them
594 // are in the current interest rect (which is either the above or below it). 387 // are in the current interest rect (which is either the above or below it).
595 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 388 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
596 EXPECT_EQ(8, pile_.tiling().num_tiles_y()); 389 EXPECT_EQ(8, pile_.tiling().num_tiles_y());
597 for (int i = 0; i < 6; ++i) { 390 for (int i = 0; i < 6; ++i) {
598 for (int j = 0; j < 6; ++j) { 391 for (int j = 0; j < 6; ++j) {
599 FakePicturePile::PictureMapKey key(i, j); 392 FakePicturePile::PictureMapKey key(i, j);
600 FakePicturePile::PictureMap& map = pile_.picture_map(); 393 FakePicturePile::PictureMap& map = pile_.picture_map();
601 FakePicturePile::PictureMap::iterator it = map.find(key); 394 FakePicturePile::PictureMap::iterator it = map.find(key);
602 EXPECT_EQ(j < 5, it != map.end() && it->second.GetPicture()); 395 EXPECT_EQ(j < 5, it != map.end() && it->second.get());
603 } 396 }
604 } 397 }
605 398
606 // We invalidated all new pixels in the recording. 399 // We invalidated all new pixels in the recording.
607 expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size), 400 expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size),
608 gfx::Rect(base_tiling_size)); 401 gfx::Rect(base_tiling_size));
609 // But the new pixels don't cover the whole bottom row. 402 // But the new pixels don't cover the whole bottom row.
610 gfx::Rect bottom_row = gfx::UnionRects(pile_.tiling().TileBounds(0, 5), 403 gfx::Rect bottom_row = gfx::UnionRects(pile_.tiling().TileBounds(0, 5),
611 pile_.tiling().TileBounds(5, 5)); 404 pile_.tiling().TileBounds(5, 5));
612 EXPECT_FALSE(expected_invalidation.Contains(bottom_row)); 405 EXPECT_FALSE(expected_invalidation.Contains(bottom_row));
(...skipping 24 matching lines...) Expand all
637 break; 430 break;
638 case BOTTOM_LEFT: 431 case BOTTOM_LEFT:
639 // The interest rect in the bottom left tile means we'll record it. 432 // The interest rect in the bottom left tile means we'll record it.
640 expect_tile = j < 5 || (j == 5 && i == 0); 433 expect_tile = j < 5 || (j == 5 && i == 0);
641 break; 434 break;
642 case BOTTOM_RIGHT: 435 case BOTTOM_RIGHT:
643 // The interest rect in the bottom right tile means we'll record it. 436 // The interest rect in the bottom right tile means we'll record it.
644 expect_tile = j < 5 || (j == 5 && i == 5); 437 expect_tile = j < 5 || (j == 5 && i == 5);
645 break; 438 break;
646 } 439 }
647 EXPECT_EQ(expect_tile, it != map.end() && it->second.GetPicture()); 440 EXPECT_EQ(expect_tile, it != map.end() && it->second.get());
648 } 441 }
649 } 442 }
650 443
651 // When shrinking, the previously exposed region is invalidated. 444 // When shrinking, the previously exposed region is invalidated.
652 expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size), 445 expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size),
653 gfx::Rect(base_tiling_size)); 446 gfx::Rect(base_tiling_size));
654 // The whole bottom row of tiles (except any with the interest rect) are 447 // The whole bottom row of tiles (except any with the interest rect) are
655 // dropped. 448 // dropped.
656 gfx::Rect bottom_row_minus_existing_corner = gfx::UnionRects( 449 gfx::Rect bottom_row_minus_existing_corner = gfx::UnionRects(
657 pile_.tiling().TileBounds(0, 5), pile_.tiling().TileBounds(5, 5)); 450 pile_.tiling().TileBounds(0, 5), pile_.tiling().TileBounds(5, 5));
(...skipping 26 matching lines...) Expand all
684 // We should have lost all of the recordings in the right column as none of 477 // We should have lost all of the recordings in the right column as none of
685 // them are in the current interest rect (which is either entirely left or 478 // them are in the current interest rect (which is either entirely left or
686 // right of it). 479 // right of it).
687 EXPECT_EQ(8, pile_.tiling().num_tiles_x()); 480 EXPECT_EQ(8, pile_.tiling().num_tiles_x());
688 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 481 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
689 for (int i = 0; i < 6; ++i) { 482 for (int i = 0; i < 6; ++i) {
690 for (int j = 0; j < 6; ++j) { 483 for (int j = 0; j < 6; ++j) {
691 FakePicturePile::PictureMapKey key(i, j); 484 FakePicturePile::PictureMapKey key(i, j);
692 FakePicturePile::PictureMap& map = pile_.picture_map(); 485 FakePicturePile::PictureMap& map = pile_.picture_map();
693 FakePicturePile::PictureMap::iterator it = map.find(key); 486 FakePicturePile::PictureMap::iterator it = map.find(key);
694 EXPECT_EQ(i < 5, it != map.end() && it->second.GetPicture()); 487 EXPECT_EQ(i < 5, it != map.end() && it->second.get());
695 } 488 }
696 } 489 }
697 490
698 // We invalidated all new pixels in the recording. 491 // We invalidated all new pixels in the recording.
699 expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size), 492 expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size),
700 gfx::Rect(base_tiling_size)); 493 gfx::Rect(base_tiling_size));
701 // But the new pixels don't cover the whole right_column. 494 // But the new pixels don't cover the whole right_column.
702 gfx::Rect right_column = gfx::UnionRects(pile_.tiling().TileBounds(5, 0), 495 gfx::Rect right_column = gfx::UnionRects(pile_.tiling().TileBounds(5, 0),
703 pile_.tiling().TileBounds(5, 5)); 496 pile_.tiling().TileBounds(5, 5));
704 EXPECT_FALSE(expected_invalidation.Contains(right_column)); 497 EXPECT_FALSE(expected_invalidation.Contains(right_column));
(...skipping 26 matching lines...) Expand all
731 break; 524 break;
732 case TOP_RIGHT: 525 case TOP_RIGHT:
733 // The interest rect in the top right tile means we'll record it. 526 // The interest rect in the top right tile means we'll record it.
734 expect_tile = i < 5 || (j == 0 && i == 5); 527 expect_tile = i < 5 || (j == 0 && i == 5);
735 break; 528 break;
736 case BOTTOM_RIGHT: 529 case BOTTOM_RIGHT:
737 // The interest rect in the bottom right tile means we'll record it. 530 // The interest rect in the bottom right tile means we'll record it.
738 expect_tile = i < 5 || (j == 5 && i == 5); 531 expect_tile = i < 5 || (j == 5 && i == 5);
739 break; 532 break;
740 } 533 }
741 EXPECT_EQ(expect_tile, it != map.end() && it->second.GetPicture()); 534 EXPECT_EQ(expect_tile, it != map.end() && it->second.get());
742 } 535 }
743 } 536 }
744 537
745 // When shrinking, the previously exposed region is invalidated. 538 // When shrinking, the previously exposed region is invalidated.
746 expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size), 539 expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size),
747 gfx::Rect(base_tiling_size)); 540 gfx::Rect(base_tiling_size));
748 // The whole right column of tiles (except for ones with the interest rect) 541 // The whole right column of tiles (except for ones with the interest rect)
749 // are dropped. 542 // are dropped.
750 gfx::Rect right_column_minus_existing_corner = gfx::UnionRects( 543 gfx::Rect right_column_minus_existing_corner = gfx::UnionRects(
751 pile_.tiling().TileBounds(5, 0), pile_.tiling().TileBounds(5, 5)); 544 pile_.tiling().TileBounds(5, 0), pile_.tiling().TileBounds(5, 5));
(...skipping 21 matching lines...) Expand all
773 CornerSinglePixelRect(corner, grow_both_tiling_size)); 566 CornerSinglePixelRect(corner, grow_both_tiling_size));
774 567
775 // We should have lost the recordings in the right column and bottom row. 568 // We should have lost the recordings in the right column and bottom row.
776 EXPECT_EQ(8, pile_.tiling().num_tiles_x()); 569 EXPECT_EQ(8, pile_.tiling().num_tiles_x());
777 EXPECT_EQ(8, pile_.tiling().num_tiles_y()); 570 EXPECT_EQ(8, pile_.tiling().num_tiles_y());
778 for (int i = 0; i < 6; ++i) { 571 for (int i = 0; i < 6; ++i) {
779 for (int j = 0; j < 6; ++j) { 572 for (int j = 0; j < 6; ++j) {
780 FakePicturePile::PictureMapKey key(i, j); 573 FakePicturePile::PictureMapKey key(i, j);
781 FakePicturePile::PictureMap& map = pile_.picture_map(); 574 FakePicturePile::PictureMap& map = pile_.picture_map();
782 FakePicturePile::PictureMap::iterator it = map.find(key); 575 FakePicturePile::PictureMap::iterator it = map.find(key);
783 EXPECT_EQ(i < 5 && j < 5, it != map.end() && it->second.GetPicture()); 576 EXPECT_EQ(i < 5 && j < 5, it != map.end() && it->second.get());
784 } 577 }
785 } 578 }
786 579
787 // We invalidated all new pixels in the recording. 580 // We invalidated all new pixels in the recording.
788 expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size), 581 expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size),
789 gfx::Rect(base_tiling_size)); 582 gfx::Rect(base_tiling_size));
790 // But the new pixels don't cover the whole right column or bottom row. 583 // But the new pixels don't cover the whole right column or bottom row.
791 Region right_column_and_bottom_row = 584 Region right_column_and_bottom_row =
792 UnionRegions(gfx::UnionRects(pile_.tiling().TileBounds(5, 0), 585 UnionRegions(gfx::UnionRects(pile_.tiling().TileBounds(5, 0),
793 pile_.tiling().TileBounds(5, 5)), 586 pile_.tiling().TileBounds(5, 5)),
(...skipping 29 matching lines...) Expand all
823 break; 616 break;
824 case BOTTOM_LEFT: 617 case BOTTOM_LEFT:
825 // The interest rect in the bottom left tile means we'll record it. 618 // The interest rect in the bottom left tile means we'll record it.
826 expect_tile = (i < 5 && j < 5) || (j == 5 && i == 0); 619 expect_tile = (i < 5 && j < 5) || (j == 5 && i == 0);
827 break; 620 break;
828 case BOTTOM_RIGHT: 621 case BOTTOM_RIGHT:
829 // The interest rect in the bottom right tile means we'll record it. 622 // The interest rect in the bottom right tile means we'll record it.
830 expect_tile = (i < 5 && j < 5) || (j == 5 && i == 5); 623 expect_tile = (i < 5 && j < 5) || (j == 5 && i == 5);
831 break; 624 break;
832 } 625 }
833 EXPECT_EQ(expect_tile, it != map.end() && it->second.GetPicture()) 626 EXPECT_EQ(expect_tile, it != map.end() && it->second.get()) << i << ","
834 << i << "," << j; 627 << j;
835 } 628 }
836 } 629 }
837 630
838 // We invalidated all previous pixels in the recording. 631 // We invalidated all previous pixels in the recording.
839 expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size), 632 expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size),
840 gfx::Rect(base_tiling_size)); 633 gfx::Rect(base_tiling_size));
841 // The whole right column and bottom row of tiles (except for ones with the 634 // The whole right column and bottom row of tiles (except for ones with the
842 // interest rect) are dropped. 635 // interest rect) are dropped.
843 Region right_column_and_bottom_row_minus_existing_corner = 636 Region right_column_and_bottom_row_minus_existing_corner =
844 right_column_and_bottom_row; 637 right_column_and_bottom_row;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 SetTilingSize(base_tiling_size); 681 SetTilingSize(base_tiling_size);
889 682
890 // We should have a recording for every tile. 683 // We should have a recording for every tile.
891 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 684 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
892 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 685 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
893 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 686 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
894 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 687 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
895 FakePicturePile::PictureMapKey key(i, j); 688 FakePicturePile::PictureMapKey key(i, j);
896 FakePicturePile::PictureMap& map = pile_.picture_map(); 689 FakePicturePile::PictureMap& map = pile_.picture_map();
897 FakePicturePile::PictureMap::iterator it = map.find(key); 690 FakePicturePile::PictureMap::iterator it = map.find(key);
898 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 691 EXPECT_TRUE(it != map.end() && it->second.get());
899 } 692 }
900 } 693 }
901 694
902 // In this test (unlike the large resize test), as all growing and shrinking 695 // In this test (unlike the large resize test), as all growing and shrinking
903 // happens within tiles, the resulting invalidation is symmetrical, so use 696 // happens within tiles, the resulting invalidation is symmetrical, so use
904 // this enum to repeat the test both ways. 697 // this enum to repeat the test both ways.
905 enum ChangeDirection { GROW, SHRINK, LAST_DIRECTION = SHRINK }; 698 enum ChangeDirection { GROW, SHRINK, LAST_DIRECTION = SHRINK };
906 699
907 // Grow downward. 700 // Grow downward.
908 for (int dir = 0; dir <= LAST_DIRECTION; ++dir) { 701 for (int dir = 0; dir <= LAST_DIRECTION; ++dir) {
(...skipping 20 matching lines...) Expand all
929 break; 722 break;
930 case BOTTOM_LEFT: 723 case BOTTOM_LEFT:
931 // The interest rect in the bottom left tile means we'll record it. 724 // The interest rect in the bottom left tile means we'll record it.
932 expect_tile = j < 5 || (j == 5 && i == 0); 725 expect_tile = j < 5 || (j == 5 && i == 0);
933 break; 726 break;
934 case BOTTOM_RIGHT: 727 case BOTTOM_RIGHT:
935 // The interest rect in the bottom right tile means we'll record it. 728 // The interest rect in the bottom right tile means we'll record it.
936 expect_tile = j < 5 || (j == 5 && i == 5); 729 expect_tile = j < 5 || (j == 5 && i == 5);
937 break; 730 break;
938 } 731 }
939 EXPECT_EQ(expect_tile, it != map.end() && it->second.GetPicture()); 732 EXPECT_EQ(expect_tile, it != map.end() && it->second.get());
940 } 733 }
941 } 734 }
942 735
943 // We invalidated the bottom row outside the new interest rect. The tile 736 // We invalidated the bottom row outside the new interest rect. The tile
944 // that insects the interest rect in invalidated only on its newly 737 // that insects the interest rect in invalidated only on its newly
945 // exposed or previously exposed pixels. 738 // exposed or previously exposed pixels.
946 if (dir == GROW) { 739 if (dir == GROW) {
947 // Only calculate the expected invalidation while growing, as the tile 740 // Only calculate the expected invalidation while growing, as the tile
948 // bounds post-growing is the newly exposed / previously exposed sizes. 741 // bounds post-growing is the newly exposed / previously exposed sizes.
949 // Post-shrinking, the tile bounds are smaller, so can't be used. 742 // Post-shrinking, the tile bounds are smaller, so can't be used.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 break; 788 break;
996 case TOP_RIGHT: 789 case TOP_RIGHT:
997 // The interest rect in the top right tile means we'll record it. 790 // The interest rect in the top right tile means we'll record it.
998 expect_tile = i < 5 || (j == 0 && i == 5); 791 expect_tile = i < 5 || (j == 0 && i == 5);
999 break; 792 break;
1000 case BOTTOM_RIGHT: 793 case BOTTOM_RIGHT:
1001 // The interest rect in the bottom right tile means we'll record it. 794 // The interest rect in the bottom right tile means we'll record it.
1002 expect_tile = i < 5 || (j == 5 && i == 5); 795 expect_tile = i < 5 || (j == 5 && i == 5);
1003 break; 796 break;
1004 } 797 }
1005 EXPECT_EQ(expect_tile, it != map.end() && it->second.GetPicture()); 798 EXPECT_EQ(expect_tile, it != map.end() && it->second.get());
1006 } 799 }
1007 } 800 }
1008 801
1009 // We invalidated the right column outside the new interest rect. The tile 802 // We invalidated the right column outside the new interest rect. The tile
1010 // that insects the interest rect in invalidated only on its new or 803 // that insects the interest rect in invalidated only on its new or
1011 // previously exposed pixels. 804 // previously exposed pixels.
1012 if (dir == GROW) { 805 if (dir == GROW) {
1013 // Calculate the expected invalidation the first time through the loop. 806 // Calculate the expected invalidation the first time through the loop.
1014 switch (corner) { 807 switch (corner) {
1015 case TOP_LEFT: 808 case TOP_LEFT:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 break; 857 break;
1065 case BOTTOM_LEFT: 858 case BOTTOM_LEFT:
1066 // The interest rect in the bottom left tile means we'll record it. 859 // The interest rect in the bottom left tile means we'll record it.
1067 expect_tile = (i < 5 && j < 5) || (j == 5 && i == 0); 860 expect_tile = (i < 5 && j < 5) || (j == 5 && i == 0);
1068 break; 861 break;
1069 case BOTTOM_RIGHT: 862 case BOTTOM_RIGHT:
1070 // The interest rect in the bottom right tile means we'll record it. 863 // The interest rect in the bottom right tile means we'll record it.
1071 expect_tile = (i < 5 && j < 5) || (j == 5 && i == 5); 864 expect_tile = (i < 5 && j < 5) || (j == 5 && i == 5);
1072 break; 865 break;
1073 } 866 }
1074 EXPECT_EQ(expect_tile, it != map.end() && it->second.GetPicture()) 867 EXPECT_EQ(expect_tile, it != map.end() && it->second.get()) << i << ","
1075 << i << "," << j; 868 << j;
1076 } 869 }
1077 } 870 }
1078 871
1079 // We invalidated the right column and the bottom row outside the new 872 // We invalidated the right column and the bottom row outside the new
1080 // interest rect. The tile that insects the interest rect in invalidated 873 // interest rect. The tile that insects the interest rect in invalidated
1081 // only on its new or previous exposed pixels. 874 // only on its new or previous exposed pixels.
1082 if (dir == GROW) { 875 if (dir == GROW) {
1083 // Calculate the expected invalidation the first time through the loop. 876 // Calculate the expected invalidation the first time through the loop.
1084 switch (corner) { 877 switch (corner) {
1085 case TOP_LEFT: 878 case TOP_LEFT:
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 SetTilingSize(base_tiling_size); 938 SetTilingSize(base_tiling_size);
1146 939
1147 // We should have a recording for every tile. 940 // We should have a recording for every tile.
1148 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 941 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
1149 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 942 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
1150 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 943 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1151 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 944 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1152 FakePicturePile::PictureMapKey key(i, j); 945 FakePicturePile::PictureMapKey key(i, j);
1153 FakePicturePile::PictureMap& map = pile_.picture_map(); 946 FakePicturePile::PictureMap& map = pile_.picture_map();
1154 FakePicturePile::PictureMap::iterator it = map.find(key); 947 FakePicturePile::PictureMap::iterator it = map.find(key);
1155 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 948 EXPECT_TRUE(it != map.end() && it->second.get());
1156 } 949 }
1157 } 950 }
1158 951
1159 UpdateAndExpandInvalidation( 952 UpdateAndExpandInvalidation(
1160 &invalidation, grow_down_tiling_size, gfx::Rect(1, 1)); 953 &invalidation, grow_down_tiling_size, gfx::Rect(1, 1));
1161 954
1162 // We should have a recording for every tile. 955 // We should have a recording for every tile.
1163 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 956 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
1164 EXPECT_EQ(8, pile_.tiling().num_tiles_y()); 957 EXPECT_EQ(8, pile_.tiling().num_tiles_y());
1165 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 958 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1166 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 959 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1167 FakePicturePile::PictureMapKey key(i, j); 960 FakePicturePile::PictureMapKey key(i, j);
1168 FakePicturePile::PictureMap& map = pile_.picture_map(); 961 FakePicturePile::PictureMap& map = pile_.picture_map();
1169 FakePicturePile::PictureMap::iterator it = map.find(key); 962 FakePicturePile::PictureMap::iterator it = map.find(key);
1170 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 963 EXPECT_TRUE(it != map.end() && it->second.get());
1171 } 964 }
1172 } 965 }
1173 966
1174 // We invalidated the newly exposed pixels on the bottom row of tiles. 967 // We invalidated the newly exposed pixels on the bottom row of tiles.
1175 expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size), 968 expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size),
1176 gfx::Rect(base_tiling_size)); 969 gfx::Rect(base_tiling_size));
1177 Region bottom_row_new_pixels = 970 Region bottom_row_new_pixels =
1178 SubtractRegions(gfx::UnionRects(pile_.tiling().TileBounds(0, 5), 971 SubtractRegions(gfx::UnionRects(pile_.tiling().TileBounds(0, 5),
1179 pile_.tiling().TileBounds(5, 5)), 972 pile_.tiling().TileBounds(5, 5)),
1180 gfx::Rect(base_tiling_size)); 973 gfx::Rect(base_tiling_size));
1181 EXPECT_TRUE(expected_invalidation.Contains(bottom_row_new_pixels)); 974 EXPECT_TRUE(expected_invalidation.Contains(bottom_row_new_pixels));
1182 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString()); 975 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
1183 invalidation.Clear(); 976 invalidation.Clear();
1184 977
1185 UpdateWholePile(); 978 UpdateWholePile();
1186 UpdateAndExpandInvalidation(&invalidation, base_tiling_size, gfx::Rect(1, 1)); 979 UpdateAndExpandInvalidation(&invalidation, base_tiling_size, gfx::Rect(1, 1));
1187 980
1188 // We should have a recording for every tile. 981 // We should have a recording for every tile.
1189 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 982 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
1190 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 983 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
1191 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 984 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1192 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 985 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1193 FakePicturePile::PictureMapKey key(i, j); 986 FakePicturePile::PictureMapKey key(i, j);
1194 FakePicturePile::PictureMap& map = pile_.picture_map(); 987 FakePicturePile::PictureMap& map = pile_.picture_map();
1195 FakePicturePile::PictureMap::iterator it = map.find(key); 988 FakePicturePile::PictureMap::iterator it = map.find(key);
1196 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 989 EXPECT_TRUE(it != map.end() && it->second.get());
1197 } 990 }
1198 } 991 }
1199 992
1200 // We invalidated the previously exposed pixels on the bottom row of tiles. 993 // We invalidated the previously exposed pixels on the bottom row of tiles.
1201 expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size), 994 expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size),
1202 gfx::Rect(base_tiling_size)); 995 gfx::Rect(base_tiling_size));
1203 EXPECT_TRUE(expected_invalidation.Contains(bottom_row_new_pixels)); 996 EXPECT_TRUE(expected_invalidation.Contains(bottom_row_new_pixels));
1204 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString()); 997 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
1205 invalidation.Clear(); 998 invalidation.Clear();
1206 999
1207 UpdateWholePile(); 1000 UpdateWholePile();
1208 UpdateAndExpandInvalidation( 1001 UpdateAndExpandInvalidation(
1209 &invalidation, grow_right_tiling_size, gfx::Rect(1, 1)); 1002 &invalidation, grow_right_tiling_size, gfx::Rect(1, 1));
1210 1003
1211 // We should have a recording for every tile. 1004 // We should have a recording for every tile.
1212 EXPECT_EQ(8, pile_.tiling().num_tiles_x()); 1005 EXPECT_EQ(8, pile_.tiling().num_tiles_x());
1213 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 1006 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
1214 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 1007 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1215 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 1008 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1216 FakePicturePile::PictureMapKey key(i, j); 1009 FakePicturePile::PictureMapKey key(i, j);
1217 FakePicturePile::PictureMap& map = pile_.picture_map(); 1010 FakePicturePile::PictureMap& map = pile_.picture_map();
1218 FakePicturePile::PictureMap::iterator it = map.find(key); 1011 FakePicturePile::PictureMap::iterator it = map.find(key);
1219 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 1012 EXPECT_TRUE(it != map.end() && it->second.get());
1220 } 1013 }
1221 } 1014 }
1222 1015
1223 // We invalidated the newly exposed pixels on the right column of tiles. 1016 // We invalidated the newly exposed pixels on the right column of tiles.
1224 expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size), 1017 expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size),
1225 gfx::Rect(base_tiling_size)); 1018 gfx::Rect(base_tiling_size));
1226 Region right_column_new_pixels = 1019 Region right_column_new_pixels =
1227 SubtractRegions(gfx::UnionRects(pile_.tiling().TileBounds(5, 0), 1020 SubtractRegions(gfx::UnionRects(pile_.tiling().TileBounds(5, 0),
1228 pile_.tiling().TileBounds(5, 5)), 1021 pile_.tiling().TileBounds(5, 5)),
1229 gfx::Rect(base_tiling_size)); 1022 gfx::Rect(base_tiling_size));
1230 EXPECT_TRUE(expected_invalidation.Contains(right_column_new_pixels)); 1023 EXPECT_TRUE(expected_invalidation.Contains(right_column_new_pixels));
1231 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString()); 1024 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
1232 invalidation.Clear(); 1025 invalidation.Clear();
1233 1026
1234 UpdateWholePile(); 1027 UpdateWholePile();
1235 UpdateAndExpandInvalidation(&invalidation, base_tiling_size, gfx::Rect(1, 1)); 1028 UpdateAndExpandInvalidation(&invalidation, base_tiling_size, gfx::Rect(1, 1));
1236 1029
1237 // We should have lost the recordings that are now outside the tiling only. 1030 // We should have lost the recordings that are now outside the tiling only.
1238 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 1031 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
1239 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 1032 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
1240 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 1033 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1241 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 1034 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1242 FakePicturePile::PictureMapKey key(i, j); 1035 FakePicturePile::PictureMapKey key(i, j);
1243 FakePicturePile::PictureMap& map = pile_.picture_map(); 1036 FakePicturePile::PictureMap& map = pile_.picture_map();
1244 FakePicturePile::PictureMap::iterator it = map.find(key); 1037 FakePicturePile::PictureMap::iterator it = map.find(key);
1245 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 1038 EXPECT_TRUE(it != map.end() && it->second.get());
1246 } 1039 }
1247 } 1040 }
1248 1041
1249 // We invalidated the previously exposed pixels on the right column of tiles. 1042 // We invalidated the previously exposed pixels on the right column of tiles.
1250 expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size), 1043 expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size),
1251 gfx::Rect(base_tiling_size)); 1044 gfx::Rect(base_tiling_size));
1252 EXPECT_TRUE(expected_invalidation.Contains(right_column_new_pixels)); 1045 EXPECT_TRUE(expected_invalidation.Contains(right_column_new_pixels));
1253 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString()); 1046 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
1254 invalidation.Clear(); 1047 invalidation.Clear();
1255 1048
1256 UpdateWholePile(); 1049 UpdateWholePile();
1257 UpdateAndExpandInvalidation( 1050 UpdateAndExpandInvalidation(
1258 &invalidation, grow_both_tiling_size, gfx::Rect(1, 1)); 1051 &invalidation, grow_both_tiling_size, gfx::Rect(1, 1));
1259 1052
1260 // We should have a recording for every tile. 1053 // We should have a recording for every tile.
1261 EXPECT_EQ(8, pile_.tiling().num_tiles_x()); 1054 EXPECT_EQ(8, pile_.tiling().num_tiles_x());
1262 EXPECT_EQ(8, pile_.tiling().num_tiles_y()); 1055 EXPECT_EQ(8, pile_.tiling().num_tiles_y());
1263 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 1056 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1264 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 1057 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1265 FakePicturePile::PictureMapKey key(i, j); 1058 FakePicturePile::PictureMapKey key(i, j);
1266 FakePicturePile::PictureMap& map = pile_.picture_map(); 1059 FakePicturePile::PictureMap& map = pile_.picture_map();
1267 FakePicturePile::PictureMap::iterator it = map.find(key); 1060 FakePicturePile::PictureMap::iterator it = map.find(key);
1268 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 1061 EXPECT_TRUE(it != map.end() && it->second.get());
1269 } 1062 }
1270 } 1063 }
1271 1064
1272 // We invalidated the newly exposed pixels on the bottom row and right column 1065 // We invalidated the newly exposed pixels on the bottom row and right column
1273 // of tiles. 1066 // of tiles.
1274 expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size), 1067 expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size),
1275 gfx::Rect(base_tiling_size)); 1068 gfx::Rect(base_tiling_size));
1276 Region bottom_row_and_right_column_new_pixels = SubtractRegions( 1069 Region bottom_row_and_right_column_new_pixels = SubtractRegions(
1277 UnionRegions(gfx::UnionRects(pile_.tiling().TileBounds(0, 5), 1070 UnionRegions(gfx::UnionRects(pile_.tiling().TileBounds(0, 5),
1278 pile_.tiling().TileBounds(5, 5)), 1071 pile_.tiling().TileBounds(5, 5)),
1279 gfx::UnionRects(pile_.tiling().TileBounds(5, 0), 1072 gfx::UnionRects(pile_.tiling().TileBounds(5, 0),
1280 pile_.tiling().TileBounds(5, 5))), 1073 pile_.tiling().TileBounds(5, 5))),
1281 gfx::Rect(base_tiling_size)); 1074 gfx::Rect(base_tiling_size));
1282 EXPECT_TRUE( 1075 EXPECT_TRUE(
1283 expected_invalidation.Contains(bottom_row_and_right_column_new_pixels)); 1076 expected_invalidation.Contains(bottom_row_and_right_column_new_pixels));
1284 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString()); 1077 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
1285 invalidation.Clear(); 1078 invalidation.Clear();
1286 1079
1287 UpdateWholePile(); 1080 UpdateWholePile();
1288 UpdateAndExpandInvalidation(&invalidation, base_tiling_size, gfx::Rect()); 1081 UpdateAndExpandInvalidation(&invalidation, base_tiling_size, gfx::Rect());
1289 1082
1290 // We should have lost the recordings that are now outside the tiling only. 1083 // We should have lost the recordings that are now outside the tiling only.
1291 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 1084 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
1292 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 1085 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
1293 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 1086 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1294 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 1087 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1295 FakePicturePile::PictureMapKey key(i, j); 1088 FakePicturePile::PictureMapKey key(i, j);
1296 FakePicturePile::PictureMap& map = pile_.picture_map(); 1089 FakePicturePile::PictureMap& map = pile_.picture_map();
1297 FakePicturePile::PictureMap::iterator it = map.find(key); 1090 FakePicturePile::PictureMap::iterator it = map.find(key);
1298 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 1091 EXPECT_TRUE(it != map.end() && it->second.get());
1299 } 1092 }
1300 } 1093 }
1301 1094
1302 // We invalidated the previously exposed pixels on the bottom row and right 1095 // We invalidated the previously exposed pixels on the bottom row and right
1303 // column of tiles. 1096 // column of tiles.
1304 expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size), 1097 expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size),
1305 gfx::Rect(base_tiling_size)); 1098 gfx::Rect(base_tiling_size));
1306 EXPECT_TRUE( 1099 EXPECT_TRUE(
1307 expected_invalidation.Contains(bottom_row_and_right_column_new_pixels)); 1100 expected_invalidation.Contains(bottom_row_and_right_column_new_pixels));
1308 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString()); 1101 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
(...skipping 17 matching lines...) Expand all
1326 SetTilingSize(base_tiling_size); 1119 SetTilingSize(base_tiling_size);
1327 1120
1328 // We should have a recording for every tile. 1121 // We should have a recording for every tile.
1329 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 1122 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
1330 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 1123 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
1331 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 1124 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1332 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 1125 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1333 FakePicturePile::PictureMapKey key(i, j); 1126 FakePicturePile::PictureMapKey key(i, j);
1334 FakePicturePile::PictureMap& map = pile_.picture_map(); 1127 FakePicturePile::PictureMap& map = pile_.picture_map();
1335 FakePicturePile::PictureMap::iterator it = map.find(key); 1128 FakePicturePile::PictureMap::iterator it = map.find(key);
1336 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 1129 EXPECT_TRUE(it != map.end() && it->second.get());
1337 } 1130 }
1338 } 1131 }
1339 1132
1340 UpdateAndExpandInvalidation( 1133 UpdateAndExpandInvalidation(
1341 &invalidation, grow_down_tiling_size, gfx::Rect(1, 1)); 1134 &invalidation, grow_down_tiling_size, gfx::Rect(1, 1));
1342 1135
1343 // We should have a recording for every tile. 1136 // We should have a recording for every tile.
1344 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 1137 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
1345 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 1138 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
1346 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 1139 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1347 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 1140 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1348 FakePicturePile::PictureMapKey key(i, j); 1141 FakePicturePile::PictureMapKey key(i, j);
1349 FakePicturePile::PictureMap& map = pile_.picture_map(); 1142 FakePicturePile::PictureMap& map = pile_.picture_map();
1350 FakePicturePile::PictureMap::iterator it = map.find(key); 1143 FakePicturePile::PictureMap::iterator it = map.find(key);
1351 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 1144 EXPECT_TRUE(it != map.end() && it->second.get());
1352 } 1145 }
1353 } 1146 }
1354 1147
1355 // We invalidated the newly exposed pixels. 1148 // We invalidated the newly exposed pixels.
1356 expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size), 1149 expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size),
1357 gfx::Rect(base_tiling_size)); 1150 gfx::Rect(base_tiling_size));
1358 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString()); 1151 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
1359 invalidation.Clear(); 1152 invalidation.Clear();
1360 1153
1361 UpdateWholePile(); 1154 UpdateWholePile();
1362 UpdateAndExpandInvalidation(&invalidation, base_tiling_size, gfx::Rect(1, 1)); 1155 UpdateAndExpandInvalidation(&invalidation, base_tiling_size, gfx::Rect(1, 1));
1363 1156
1364 // We should have a recording for every tile. 1157 // We should have a recording for every tile.
1365 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 1158 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
1366 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 1159 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
1367 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 1160 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1368 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 1161 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1369 FakePicturePile::PictureMapKey key(i, j); 1162 FakePicturePile::PictureMapKey key(i, j);
1370 FakePicturePile::PictureMap& map = pile_.picture_map(); 1163 FakePicturePile::PictureMap& map = pile_.picture_map();
1371 FakePicturePile::PictureMap::iterator it = map.find(key); 1164 FakePicturePile::PictureMap::iterator it = map.find(key);
1372 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 1165 EXPECT_TRUE(it != map.end() && it->second.get());
1373 } 1166 }
1374 } 1167 }
1375 1168
1376 // We invalidated the previously exposed pixels. 1169 // We invalidated the previously exposed pixels.
1377 expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size), 1170 expected_invalidation = SubtractRegions(gfx::Rect(grow_down_tiling_size),
1378 gfx::Rect(base_tiling_size)); 1171 gfx::Rect(base_tiling_size));
1379 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString()); 1172 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
1380 invalidation.Clear(); 1173 invalidation.Clear();
1381 1174
1382 UpdateWholePile(); 1175 UpdateWholePile();
1383 UpdateAndExpandInvalidation( 1176 UpdateAndExpandInvalidation(
1384 &invalidation, grow_right_tiling_size, gfx::Rect(1, 1)); 1177 &invalidation, grow_right_tiling_size, gfx::Rect(1, 1));
1385 1178
1386 // We should have a recording for every tile. 1179 // We should have a recording for every tile.
1387 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 1180 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
1388 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 1181 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
1389 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 1182 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1390 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 1183 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1391 FakePicturePile::PictureMapKey key(i, j); 1184 FakePicturePile::PictureMapKey key(i, j);
1392 FakePicturePile::PictureMap& map = pile_.picture_map(); 1185 FakePicturePile::PictureMap& map = pile_.picture_map();
1393 FakePicturePile::PictureMap::iterator it = map.find(key); 1186 FakePicturePile::PictureMap::iterator it = map.find(key);
1394 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 1187 EXPECT_TRUE(it != map.end() && it->second.get());
1395 } 1188 }
1396 } 1189 }
1397 1190
1398 // We invalidated the newly exposed pixels. 1191 // We invalidated the newly exposed pixels.
1399 expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size), 1192 expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size),
1400 gfx::Rect(base_tiling_size)); 1193 gfx::Rect(base_tiling_size));
1401 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString()); 1194 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
1402 invalidation.Clear(); 1195 invalidation.Clear();
1403 1196
1404 UpdateWholePile(); 1197 UpdateWholePile();
1405 UpdateAndExpandInvalidation(&invalidation, base_tiling_size, gfx::Rect(1, 1)); 1198 UpdateAndExpandInvalidation(&invalidation, base_tiling_size, gfx::Rect(1, 1));
1406 1199
1407 // We should have lost the recordings that are now outside the tiling only. 1200 // We should have lost the recordings that are now outside the tiling only.
1408 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 1201 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
1409 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 1202 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
1410 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 1203 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1411 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 1204 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1412 FakePicturePile::PictureMapKey key(i, j); 1205 FakePicturePile::PictureMapKey key(i, j);
1413 FakePicturePile::PictureMap& map = pile_.picture_map(); 1206 FakePicturePile::PictureMap& map = pile_.picture_map();
1414 FakePicturePile::PictureMap::iterator it = map.find(key); 1207 FakePicturePile::PictureMap::iterator it = map.find(key);
1415 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 1208 EXPECT_TRUE(it != map.end() && it->second.get());
1416 } 1209 }
1417 } 1210 }
1418 1211
1419 // We invalidated the previously exposed pixels. 1212 // We invalidated the previously exposed pixels.
1420 expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size), 1213 expected_invalidation = SubtractRegions(gfx::Rect(grow_right_tiling_size),
1421 gfx::Rect(base_tiling_size)); 1214 gfx::Rect(base_tiling_size));
1422 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString()); 1215 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
1423 invalidation.Clear(); 1216 invalidation.Clear();
1424 1217
1425 UpdateWholePile(); 1218 UpdateWholePile();
1426 UpdateAndExpandInvalidation( 1219 UpdateAndExpandInvalidation(
1427 &invalidation, grow_both_tiling_size, gfx::Rect(1, 1)); 1220 &invalidation, grow_both_tiling_size, gfx::Rect(1, 1));
1428 1221
1429 // We should have a recording for every tile. 1222 // We should have a recording for every tile.
1430 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 1223 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
1431 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 1224 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
1432 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 1225 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1433 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 1226 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1434 FakePicturePile::PictureMapKey key(i, j); 1227 FakePicturePile::PictureMapKey key(i, j);
1435 FakePicturePile::PictureMap& map = pile_.picture_map(); 1228 FakePicturePile::PictureMap& map = pile_.picture_map();
1436 FakePicturePile::PictureMap::iterator it = map.find(key); 1229 FakePicturePile::PictureMap::iterator it = map.find(key);
1437 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 1230 EXPECT_TRUE(it != map.end() && it->second.get());
1438 } 1231 }
1439 } 1232 }
1440 1233
1441 // We invalidated the newly exposed pixels. 1234 // We invalidated the newly exposed pixels.
1442 expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size), 1235 expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size),
1443 gfx::Rect(base_tiling_size)); 1236 gfx::Rect(base_tiling_size));
1444 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString()); 1237 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
1445 invalidation.Clear(); 1238 invalidation.Clear();
1446 1239
1447 UpdateWholePile(); 1240 UpdateWholePile();
1448 UpdateAndExpandInvalidation(&invalidation, base_tiling_size, gfx::Rect()); 1241 UpdateAndExpandInvalidation(&invalidation, base_tiling_size, gfx::Rect());
1449 1242
1450 // We should have lost the recordings that are now outside the tiling only. 1243 // We should have lost the recordings that are now outside the tiling only.
1451 EXPECT_EQ(6, pile_.tiling().num_tiles_x()); 1244 EXPECT_EQ(6, pile_.tiling().num_tiles_x());
1452 EXPECT_EQ(6, pile_.tiling().num_tiles_y()); 1245 EXPECT_EQ(6, pile_.tiling().num_tiles_y());
1453 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) { 1246 for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
1454 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) { 1247 for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
1455 FakePicturePile::PictureMapKey key(i, j); 1248 FakePicturePile::PictureMapKey key(i, j);
1456 FakePicturePile::PictureMap& map = pile_.picture_map(); 1249 FakePicturePile::PictureMap& map = pile_.picture_map();
1457 FakePicturePile::PictureMap::iterator it = map.find(key); 1250 FakePicturePile::PictureMap::iterator it = map.find(key);
1458 EXPECT_TRUE(it != map.end() && it->second.GetPicture()); 1251 EXPECT_TRUE(it != map.end() && it->second.get());
1459 } 1252 }
1460 } 1253 }
1461 1254
1462 // We invalidated the previously exposed pixels. 1255 // We invalidated the previously exposed pixels.
1463 expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size), 1256 expected_invalidation = SubtractRegions(gfx::Rect(grow_both_tiling_size),
1464 gfx::Rect(base_tiling_size)); 1257 gfx::Rect(base_tiling_size));
1465 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString()); 1258 EXPECT_EQ(expected_invalidation.ToString(), invalidation.ToString());
1466 invalidation.Clear(); 1259 invalidation.Clear();
1467 } 1260 }
1468 1261
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 EXPECT_TRUE(pile_.HasRecordings()); 1336 EXPECT_TRUE(pile_.HasRecordings());
1544 pile_.SetEmptyBounds(); 1337 pile_.SetEmptyBounds();
1545 EXPECT_FALSE(pile_.is_solid_color()); 1338 EXPECT_FALSE(pile_.is_solid_color());
1546 EXPECT_TRUE(pile_.GetSize().IsEmpty()); 1339 EXPECT_TRUE(pile_.GetSize().IsEmpty());
1547 EXPECT_TRUE(pile_.picture_map().empty()); 1340 EXPECT_TRUE(pile_.picture_map().empty());
1548 EXPECT_FALSE(pile_.HasRecordings()); 1341 EXPECT_FALSE(pile_.HasRecordings());
1549 } 1342 }
1550 1343
1551 } // namespace 1344 } // namespace
1552 } // namespace cc 1345 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile_impl.cc ('k') | cc/resources/recording_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698