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