OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/tiled_layer.h" | 5 #include "cc/layers/tiled_layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 // side effect of disabling compositing, which causes our reference to the | 486 // side effect of disabling compositing, which causes our reference to the |
487 // texture updater to be deleted. However, we can't free the memory backing | 487 // texture updater to be deleted. However, we can't free the memory backing |
488 // the SkCanvas until the paint finishes, so we grab a local reference here to | 488 // the SkCanvas until the paint finishes, so we grab a local reference here to |
489 // hold the updater alive until the paint completes. | 489 // hold the updater alive until the paint completes. |
490 scoped_refptr<LayerUpdater> protector(Updater()); | 490 scoped_refptr<LayerUpdater> protector(Updater()); |
491 gfx::Rect painted_opaque_rect; | 491 gfx::Rect painted_opaque_rect; |
492 Updater()->PrepareToUpdate(paint_rect, | 492 Updater()->PrepareToUpdate(paint_rect, |
493 tiler_->tile_size(), | 493 tiler_->tile_size(), |
494 1.f / width_scale, | 494 1.f / width_scale, |
495 1.f / height_scale, | 495 1.f / height_scale, |
496 &painted_opaque_rect, | 496 &painted_opaque_rect); |
497 stats); | |
498 | 497 |
499 for (int j = top; j <= bottom; ++j) { | 498 for (int j = top; j <= bottom; ++j) { |
500 for (int i = left; i <= right; ++i) { | 499 for (int i = left; i <= right; ++i) { |
501 UpdatableTile* tile = TileAt(i, j); | 500 UpdatableTile* tile = TileAt(i, j); |
502 DCHECK(tile); // Did SetTexturePriorites get skipped? | 501 DCHECK(tile); // Did SetTexturePriorites get skipped? |
503 // FIXME: This should not ever be null. | 502 // FIXME: This should not ever be null. |
504 if (!tile) | 503 if (!tile) |
505 continue; | 504 continue; |
506 | 505 |
507 gfx::Rect tile_rect = tiler_->tile_bounds(i, j); | 506 gfx::Rect tile_rect = tiler_->tile_bounds(i, j); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 CHECK_GE(dest_offset.y(), 0); | 552 CHECK_GE(dest_offset.y(), 0); |
554 | 553 |
555 // Offset from paint rectangle to this tile's dirty rectangle. | 554 // Offset from paint rectangle to this tile's dirty rectangle. |
556 gfx::Vector2d paint_offset = source_rect.origin() - paint_rect.origin(); | 555 gfx::Vector2d paint_offset = source_rect.origin() - paint_rect.origin(); |
557 CHECK_GE(paint_offset.x(), 0); | 556 CHECK_GE(paint_offset.x(), 0); |
558 CHECK_GE(paint_offset.y(), 0); | 557 CHECK_GE(paint_offset.y(), 0); |
559 CHECK_LE(paint_offset.x() + source_rect.width(), paint_rect.width()); | 558 CHECK_LE(paint_offset.x() + source_rect.width(), paint_rect.width()); |
560 CHECK_LE(paint_offset.y() + source_rect.height(), paint_rect.height()); | 559 CHECK_LE(paint_offset.y() + source_rect.height(), paint_rect.height()); |
561 | 560 |
562 tile->updater_resource()->Update( | 561 tile->updater_resource()->Update( |
563 queue, source_rect, dest_offset, tile->partial_update, stats); | 562 queue, source_rect, dest_offset, tile->partial_update); |
564 if (occlusion) { | 563 if (occlusion) { |
565 occlusion->overdraw_metrics()-> | 564 occlusion->overdraw_metrics()-> |
566 DidUpload(gfx::Transform(), source_rect, tile->opaque_rect()); | 565 DidUpload(gfx::Transform(), source_rect, tile->opaque_rect()); |
567 } | 566 } |
568 } | 567 } |
569 } | 568 } |
570 } | 569 } |
571 | 570 |
572 // This picks a small animated layer to be anything less than one viewport. This | 571 // This picks a small animated layer to be anything less than one viewport. This |
573 // is specifically for page transitions which are viewport-sized layers. The | 572 // is specifically for page transitions which are viewport-sized layers. The |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 gfx::Rect prepaint_rect = visible_content_rect(); | 889 gfx::Rect prepaint_rect = visible_content_rect(); |
891 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, | 890 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, |
892 -tiler_->tile_size().height() * kPrepaintRows); | 891 -tiler_->tile_size().height() * kPrepaintRows); |
893 gfx::Rect content_rect(content_bounds()); | 892 gfx::Rect content_rect(content_bounds()); |
894 prepaint_rect.Intersect(content_rect); | 893 prepaint_rect.Intersect(content_rect); |
895 | 894 |
896 return prepaint_rect; | 895 return prepaint_rect; |
897 } | 896 } |
898 | 897 |
899 } // namespace cc | 898 } // namespace cc |
OLD | NEW |