OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/resources/picture_pile.h" | 5 #include "cc/resources/picture_pile.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 int right = left + tiling_.TileSizeX(min_toss_x); | 316 int right = left + tiling_.TileSizeX(min_toss_x); |
317 int top = old_tiling_rect_over_tiles.y(); | 317 int top = old_tiling_rect_over_tiles.y(); |
318 int bottom = old_tiling_rect_over_tiles.bottom(); | 318 int bottom = old_tiling_rect_over_tiles.bottom(); |
319 | 319 |
320 int left_until = std::min(interest_rect_over_tiles.x(), right); | 320 int left_until = std::min(interest_rect_over_tiles.x(), right); |
321 int right_until = std::max(interest_rect_over_tiles.right(), left); | 321 int right_until = std::max(interest_rect_over_tiles.right(), left); |
322 int top_until = std::min(interest_rect_over_tiles.y(), bottom); | 322 int top_until = std::min(interest_rect_over_tiles.y(), bottom); |
323 int bottom_until = std::max(interest_rect_over_tiles.bottom(), top); | 323 int bottom_until = std::max(interest_rect_over_tiles.bottom(), top); |
324 | 324 |
325 int exposed_left = old_tiling_size.width(); | 325 int exposed_left = old_tiling_size.width(); |
326 int exposed_left_until = right; | 326 int exposed_left_until = tiling_size().width(); |
| 327 int exposed_top = top; |
| 328 int exposed_bottom = tiling_size().height(); |
327 DCHECK_GE(exposed_left, left); | 329 DCHECK_GE(exposed_left, left); |
328 | 330 |
329 gfx::Rect left_rect(left, top, left_until - left, bottom - top); | 331 gfx::Rect left_rect(left, top, left_until - left, bottom - top); |
330 gfx::Rect right_rect(right_until, top, right - right_until, bottom - top); | 332 gfx::Rect right_rect(right_until, top, right - right_until, bottom - top); |
331 gfx::Rect top_rect(left, top, right - left, top_until - top); | 333 gfx::Rect top_rect(left, top, right - left, top_until - top); |
332 gfx::Rect bottom_rect( | 334 gfx::Rect bottom_rect( |
333 left, bottom_until, right - left, bottom - bottom_until); | 335 left, bottom_until, right - left, bottom - bottom_until); |
334 gfx::Rect exposed_rect( | 336 gfx::Rect exposed_rect(exposed_left, |
335 exposed_left, top, exposed_left_until - exposed_left, bottom - top); | 337 exposed_top, |
| 338 exposed_left_until - exposed_left, |
| 339 exposed_bottom - exposed_top); |
336 resize_invalidation.Union(left_rect); | 340 resize_invalidation.Union(left_rect); |
337 resize_invalidation.Union(right_rect); | 341 resize_invalidation.Union(right_rect); |
338 resize_invalidation.Union(top_rect); | 342 resize_invalidation.Union(top_rect); |
339 resize_invalidation.Union(bottom_rect); | 343 resize_invalidation.Union(bottom_rect); |
340 resize_invalidation.Union(exposed_rect); | 344 resize_invalidation.Union(exposed_rect); |
341 } | 345 } |
342 if (min_toss_y < tiling_.num_tiles_y()) { | 346 if (min_toss_y < tiling_.num_tiles_y()) { |
343 // The same thing occurs here as in the case above, but the invalidation | 347 // The same thing occurs here as in the case above, but the invalidation |
344 // rect is the bounding box around the bottom row of tiles in the old | 348 // rect is the bounding box around the bottom row of tiles in the old |
345 // pile. This would be tiles {o,r,u,x,a,d,g,j} in the above picture. | 349 // pile. This would be tiles {o,r,u,x,a,d,g,j} in the above picture. |
346 | 350 |
347 int top = tiling_.TilePositionY(min_toss_y); | 351 int top = tiling_.TilePositionY(min_toss_y); |
348 int bottom = top + tiling_.TileSizeY(min_toss_y); | 352 int bottom = top + tiling_.TileSizeY(min_toss_y); |
349 int left = old_tiling_rect_over_tiles.x(); | 353 int left = old_tiling_rect_over_tiles.x(); |
350 int right = old_tiling_rect_over_tiles.right(); | 354 int right = old_tiling_rect_over_tiles.right(); |
351 | 355 |
352 int top_until = std::min(interest_rect_over_tiles.y(), bottom); | 356 int top_until = std::min(interest_rect_over_tiles.y(), bottom); |
353 int bottom_until = std::max(interest_rect_over_tiles.bottom(), top); | 357 int bottom_until = std::max(interest_rect_over_tiles.bottom(), top); |
354 int left_until = std::min(interest_rect_over_tiles.x(), right); | 358 int left_until = std::min(interest_rect_over_tiles.x(), right); |
355 int right_until = std::max(interest_rect_over_tiles.right(), left); | 359 int right_until = std::max(interest_rect_over_tiles.right(), left); |
356 | 360 |
357 int exposed_top = old_tiling_size.height(); | 361 int exposed_top = old_tiling_size.height(); |
358 int exposed_top_until = bottom; | 362 int exposed_top_until = tiling_size().height(); |
| 363 int exposed_left = left; |
| 364 int exposed_right = tiling_size().width(); |
359 DCHECK_GE(exposed_top, top); | 365 DCHECK_GE(exposed_top, top); |
360 | 366 |
361 gfx::Rect left_rect(left, top, left_until - left, bottom - top); | 367 gfx::Rect left_rect(left, top, left_until - left, bottom - top); |
362 gfx::Rect right_rect(right_until, top, right - right_until, bottom - top); | 368 gfx::Rect right_rect(right_until, top, right - right_until, bottom - top); |
363 gfx::Rect top_rect(left, top, right - left, top_until - top); | 369 gfx::Rect top_rect(left, top, right - left, top_until - top); |
364 gfx::Rect bottom_rect( | 370 gfx::Rect bottom_rect( |
365 left, bottom_until, right - left, bottom - bottom_until); | 371 left, bottom_until, right - left, bottom - bottom_until); |
366 gfx::Rect exposed_rect( | 372 gfx::Rect exposed_rect(exposed_left, |
367 left, exposed_top, right - left, exposed_top_until - exposed_top); | 373 exposed_top, |
| 374 exposed_right - exposed_left, |
| 375 exposed_top_until - exposed_top); |
368 resize_invalidation.Union(left_rect); | 376 resize_invalidation.Union(left_rect); |
369 resize_invalidation.Union(right_rect); | 377 resize_invalidation.Union(right_rect); |
370 resize_invalidation.Union(top_rect); | 378 resize_invalidation.Union(top_rect); |
371 resize_invalidation.Union(bottom_rect); | 379 resize_invalidation.Union(bottom_rect); |
372 resize_invalidation.Union(exposed_rect); | 380 resize_invalidation.Union(exposed_rect); |
373 } | 381 } |
374 } | 382 } |
375 | 383 |
376 Region invalidation_expanded_to_full_tiles; | 384 Region invalidation_expanded_to_full_tiles; |
377 for (Region::Iterator i(*invalidation); i.has_rect(); i.next()) { | 385 for (Region::Iterator i(*invalidation); i.has_rect(); i.next()) { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 if (it->second.GetPicture() != picture) | 557 if (it->second.GetPicture() != picture) |
550 return; | 558 return; |
551 } | 559 } |
552 skia::AnalysisCanvas canvas(recorded_viewport_.width(), | 560 skia::AnalysisCanvas canvas(recorded_viewport_.width(), |
553 recorded_viewport_.height()); | 561 recorded_viewport_.height()); |
554 picture->Raster(&canvas, NULL, Region(), 1.0f); | 562 picture->Raster(&canvas, NULL, Region(), 1.0f); |
555 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); | 563 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); |
556 } | 564 } |
557 | 565 |
558 } // namespace cc | 566 } // namespace cc |
OLD | NEW |