| 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 | 517 |
| 518 tilings_->CloneAll(*other->tilings_, MinimumContentsScale()); | 518 tilings_->CloneAll(*other->tilings_, MinimumContentsScale()); |
| 519 DCHECK(bounds() == tilings_->layer_bounds()); | 519 DCHECK(bounds() == tilings_->layer_bounds()); |
| 520 } | 520 } |
| 521 | 521 |
| 522 void PictureLayerImpl::SyncTiling( | 522 void PictureLayerImpl::SyncTiling( |
| 523 const PictureLayerTiling* tiling) { | 523 const PictureLayerTiling* tiling) { |
| 524 if (!DrawsContent() || tiling->contents_scale() < MinimumContentsScale()) | 524 if (!DrawsContent() || tiling->contents_scale() < MinimumContentsScale()) |
| 525 return; | 525 return; |
| 526 tilings_->Clone(tiling); | 526 tilings_->Clone(tiling); |
| 527 |
| 528 // If this tree needs update draw properties, then the tiling will |
| 529 // get updated prior to drawing or activation. If this tree does not |
| 530 // need update draw properties, then its transforms are up to date and |
| 531 // we can create tiles for this tiling immediately. |
| 532 if (!layer_tree_impl()->needs_update_draw_properties()) |
| 533 UpdateTilePriorities(); |
| 527 } | 534 } |
| 528 | 535 |
| 529 void PictureLayerImpl::SetIsMask(bool is_mask) { | 536 void PictureLayerImpl::SetIsMask(bool is_mask) { |
| 530 if (is_mask_ == is_mask) | 537 if (is_mask_ == is_mask) |
| 531 return; | 538 return; |
| 532 is_mask_ = is_mask; | 539 is_mask_ = is_mask; |
| 533 if (tilings_) | 540 if (tilings_) |
| 534 tilings_->RemoveAllTiles(); | 541 tilings_->RemoveAllTiles(); |
| 535 } | 542 } |
| 536 | 543 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 550 // Masks only supported if they fit on exactly one tile. | 557 // Masks only supported if they fit on exactly one tile. |
| 551 if (iter.geometry_rect() != content_rect) | 558 if (iter.geometry_rect() != content_rect) |
| 552 return 0; | 559 return 0; |
| 553 return iter->drawing_info().get_resource_id(); | 560 return iter->drawing_info().get_resource_id(); |
| 554 } | 561 } |
| 555 return 0; | 562 return 0; |
| 556 } | 563 } |
| 557 | 564 |
| 558 bool PictureLayerImpl::AreVisibleResourcesReady() const { | 565 bool PictureLayerImpl::AreVisibleResourcesReady() const { |
| 559 DCHECK(layer_tree_impl()->IsPendingTree()); | 566 DCHECK(layer_tree_impl()->IsPendingTree()); |
| 567 DCHECK(!layer_tree_impl()->needs_update_draw_properties()); |
| 560 DCHECK(ideal_contents_scale_); | 568 DCHECK(ideal_contents_scale_); |
| 561 | 569 |
| 562 if (!tilings_->num_tilings()) | 570 if (!tilings_->num_tilings()) |
| 563 return true; | 571 return true; |
| 564 | 572 |
| 565 gfx::Rect rect(visible_content_rect()); | 573 gfx::Rect rect(visible_content_rect()); |
| 566 | 574 |
| 567 float min_acceptable_scale = | 575 float min_acceptable_scale = |
| 568 std::min(raster_contents_scale_, ideal_contents_scale_); | 576 std::min(raster_contents_scale_, ideal_contents_scale_); |
| 569 | 577 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 581 // called for active twin. | 589 // called for active twin. |
| 582 if (twin_min_acceptable_scale != 0.0f) { | 590 if (twin_min_acceptable_scale != 0.0f) { |
| 583 min_acceptable_scale = | 591 min_acceptable_scale = |
| 584 std::min(min_acceptable_scale, twin_min_acceptable_scale); | 592 std::min(min_acceptable_scale, twin_min_acceptable_scale); |
| 585 } | 593 } |
| 586 } | 594 } |
| 587 | 595 |
| 588 Region missing_region = rect; | 596 Region missing_region = rect; |
| 589 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 597 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 590 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 598 PictureLayerTiling* tiling = tilings_->tiling_at(i); |
| 599 DCHECK(tiling->has_ever_been_updated()); |
| 591 | 600 |
| 592 if (tiling->contents_scale() < min_acceptable_scale) | 601 if (tiling->contents_scale() < min_acceptable_scale) |
| 593 continue; | 602 continue; |
| 594 | 603 |
| 595 for (PictureLayerTiling::CoverageIterator iter(tiling, | 604 for (PictureLayerTiling::CoverageIterator iter(tiling, |
| 596 contents_scale_x(), | 605 contents_scale_x(), |
| 597 rect); | 606 rect); |
| 598 iter; | 607 iter; |
| 599 ++iter) { | 608 ++iter) { |
| 600 if (should_force_uploads && *iter) | 609 if (should_force_uploads && *iter) |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { | 920 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { |
| 912 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 921 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 913 LayerImpl::AsValueInto(state.get()); | 922 LayerImpl::AsValueInto(state.get()); |
| 914 | 923 |
| 915 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); | 924 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); |
| 916 state->Set("tilings", tilings_->AsValue().release()); | 925 state->Set("tilings", tilings_->AsValue().release()); |
| 917 return state.PassAs<base::Value>(); | 926 return state.PassAs<base::Value>(); |
| 918 } | 927 } |
| 919 | 928 |
| 920 } // namespace cc | 929 } // namespace cc |
| OLD | NEW |