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

Side by Side Diff: cc/picture_layer_impl.cc

Issue 12328153: Merge 184464 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1410/src/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/picture_layer_impl.h ('k') | cc/test/geometry_test_utils.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 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/picture_layer_impl.h" 5 #include "cc/picture_layer_impl.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "cc/append_quads_data.h" 8 #include "cc/append_quads_data.h"
9 #include "cc/checkerboard_draw_quad.h" 9 #include "cc/checkerboard_draw_quad.h"
10 #include "cc/debug_border_draw_quad.h" 10 #include "cc/debug_border_draw_quad.h"
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 587
588 void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) { 588 void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) {
589 DCHECK(ideal_contents_scale_); 589 DCHECK(ideal_contents_scale_);
590 DCHECK(ideal_page_scale_); 590 DCHECK(ideal_page_scale_);
591 DCHECK(ideal_device_scale_); 591 DCHECK(ideal_device_scale_);
592 DCHECK(ideal_source_scale_); 592 DCHECK(ideal_source_scale_);
593 593
594 if (pile_->recorded_region().IsEmpty()) 594 if (pile_->recorded_region().IsEmpty())
595 return; 595 return;
596 596
597 float low_res_factor = layerTreeImpl()->settings().lowResContentsScaleFactor;
598
599 bool is_active_layer = layerTreeImpl()->IsActiveTree(); 597 bool is_active_layer = layerTreeImpl()->IsActiveTree();
600 bool is_pinching = layerTreeImpl()->PinchGestureActive(); 598 bool is_pinching = layerTreeImpl()->PinchGestureActive();
601 599
602 bool change_target_tiling = false; 600 bool change_target_tiling = false;
603 601
604 if (!raster_page_scale_ || !raster_device_scale_ || !raster_source_scale_) 602 if (!raster_page_scale_ || !raster_device_scale_ || !raster_source_scale_)
605 change_target_tiling = true; 603 change_target_tiling = true;
606 604
607 // TODO(danakj): Adjust raster_source_scale_ closer to ideal_source_scale_ at 605 // TODO(danakj): Adjust raster_source_scale_ closer to ideal_source_scale_ at
608 // a throttled rate. Possibly make use of invalidation_.IsEmpty() on pending 606 // a throttled rate. Possibly make use of invalidation_.IsEmpty() on pending
(...skipping 24 matching lines...) Expand all
633 if (raster_device_scale_ != ideal_device_scale_) 631 if (raster_device_scale_ != ideal_device_scale_)
634 change_target_tiling = true; 632 change_target_tiling = true;
635 633
636 if (!change_target_tiling) 634 if (!change_target_tiling)
637 return; 635 return;
638 636
639 raster_page_scale_ = ideal_page_scale_; 637 raster_page_scale_ = ideal_page_scale_;
640 raster_device_scale_ = ideal_device_scale_; 638 raster_device_scale_ = ideal_device_scale_;
641 raster_source_scale_ = ideal_source_scale_; 639 raster_source_scale_ = ideal_source_scale_;
642 640
643 float raster_contents_scale = ideal_contents_scale_; 641 float raster_contents_scale;
644 642 float low_res_raster_contents_scale;
645 // Don't allow animating CSS scales to drop below 1. 643 CalculateRasterContentsScale(animating_transform_to_screen,
646 if (animating_transform_to_screen) { 644 &raster_contents_scale,
647 raster_contents_scale = std::max( 645 &low_res_raster_contents_scale);
648 raster_contents_scale, 1.f * ideal_page_scale_ * ideal_device_scale_);
649 }
650
651 float low_res_raster_contents_scale = std::max(
652 raster_contents_scale * low_res_factor,
653 layerTreeImpl()->settings().minimumContentsScale);
654 646
655 PictureLayerTiling* high_res = NULL; 647 PictureLayerTiling* high_res = NULL;
656 PictureLayerTiling* low_res = NULL; 648 PictureLayerTiling* low_res = NULL;
657 649
658 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 650 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
659 PictureLayerTiling* tiling = tilings_->tiling_at(i); 651 PictureLayerTiling* tiling = tilings_->tiling_at(i);
660 if (tiling->contents_scale() == raster_contents_scale) 652 if (tiling->contents_scale() == raster_contents_scale)
661 high_res = tiling; 653 high_res = tiling;
662 if (tiling->contents_scale() == low_res_raster_contents_scale) 654 if (tiling->contents_scale() == low_res_raster_contents_scale)
663 low_res = tiling; 655 low_res = tiling;
664 656
665 // Reset all tilings to non-ideal until the end of this function. 657 // Reset all tilings to non-ideal until the end of this function.
666 tiling->set_resolution(NON_IDEAL_RESOLUTION); 658 tiling->set_resolution(NON_IDEAL_RESOLUTION);
667 } 659 }
668 660
669 if (!high_res) 661 if (!high_res) {
670 high_res = AddTiling(raster_contents_scale); 662 high_res = AddTiling(raster_contents_scale);
663 if (raster_contents_scale == low_res_raster_contents_scale)
664 low_res = high_res;
665 }
671 if (!low_res && low_res != high_res) 666 if (!low_res && low_res != high_res)
672 low_res = AddTiling(low_res_raster_contents_scale); 667 low_res = AddTiling(low_res_raster_contents_scale);
673 668
674 if (high_res) 669 if (high_res)
675 high_res->set_resolution(HIGH_RESOLUTION); 670 high_res->set_resolution(HIGH_RESOLUTION);
676 if (low_res && low_res != high_res) 671 if (low_res && low_res != high_res)
677 low_res->set_resolution(LOW_RESOLUTION); 672 low_res->set_resolution(LOW_RESOLUTION);
678 } 673 }
679 674
675 void PictureLayerImpl::CalculateRasterContentsScale(
676 bool animating_transform_to_screen,
677 float* raster_contents_scale,
678 float* low_res_raster_contents_scale) {
679 *raster_contents_scale = ideal_contents_scale_;
680
681 // Don't allow animating CSS scales to drop below 1.
682 if (animating_transform_to_screen) {
683 *raster_contents_scale = std::max(
684 *raster_contents_scale, 1.f * ideal_page_scale_ * ideal_device_scale_);
685 }
686
687 float low_res_factor = layerTreeImpl()->settings().lowResContentsScaleFactor;
688 *low_res_raster_contents_scale = std::max(
689 *raster_contents_scale * low_res_factor,
690 layerTreeImpl()->settings().minimumContentsScale);
691 }
692
680 void PictureLayerImpl::CleanUpTilingsOnActiveLayer( 693 void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
681 std::vector<PictureLayerTiling*> used_tilings) { 694 std::vector<PictureLayerTiling*> used_tilings) {
682 DCHECK(layerTreeImpl()->IsActiveTree()); 695 DCHECK(layerTreeImpl()->IsActiveTree());
683 696
684 float raster_contents_scale = 697 float raster_contents_scale =
685 raster_page_scale_ * raster_device_scale_ * raster_source_scale_; 698 raster_page_scale_ * raster_device_scale_ * raster_source_scale_;
686 699
687 float min_acceptable_high_res_scale = std::min( 700 float min_acceptable_high_res_scale = std::min(
688 raster_contents_scale, ideal_contents_scale_); 701 raster_contents_scale, ideal_contents_scale_);
689 float max_acceptable_high_res_scale = std::max( 702 float max_acceptable_high_res_scale = std::max(
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 return twin; 771 return twin;
759 } 772 }
760 773
761 void PictureLayerImpl::getDebugBorderProperties( 774 void PictureLayerImpl::getDebugBorderProperties(
762 SkColor* color, float* width) const { 775 SkColor* color, float* width) const {
763 *color = DebugColors::TiledContentLayerBorderColor(); 776 *color = DebugColors::TiledContentLayerBorderColor();
764 *width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl()); 777 *width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl());
765 } 778 }
766 779
767 } // namespace cc 780 } // namespace cc
OLDNEW
« no previous file with comments | « cc/picture_layer_impl.h ('k') | cc/test/geometry_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698