Chromium Code Reviews| 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 "base/time.h" | 7 #include "base/time.h" |
| 8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
| 9 #include "cc/base/util.h" | 9 #include "cc/base/util.h" |
| 10 #include "cc/debug/debug_colors.h" | 10 #include "cc/debug/debug_colors.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 namespace cc { | 26 namespace cc { |
| 27 | 27 |
| 28 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, int id) | 28 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, int id) |
| 29 : LayerImpl(tree_impl, id), | 29 : LayerImpl(tree_impl, id), |
| 30 pile_(PicturePileImpl::Create()), | 30 pile_(PicturePileImpl::Create()), |
| 31 last_content_scale_(0), | 31 last_content_scale_(0), |
| 32 ideal_contents_scale_(0), | 32 ideal_contents_scale_(0), |
| 33 is_mask_(false), | 33 is_mask_(false), |
| 34 ideal_page_scale_(0.f), | 34 ideal_page_scale_(0.f), |
| 35 ideal_device_scale_(0.f), | 35 ideal_device_scale_(0.f), |
| 36 ideal_source_scale_(0.f), | |
| 37 raster_page_scale_(0.f), | 36 raster_page_scale_(0.f), |
| 38 raster_device_scale_(0.f), | 37 raster_device_scale_(0.f), |
| 39 raster_source_scale_(0.f), | 38 raster_contents_scale_(0.f), |
| 39 low_res_raster_contents_scale_(0.f), | |
| 40 raster_source_scale_was_animating_(false) { | 40 raster_source_scale_was_animating_(false) { |
| 41 } | 41 } |
| 42 | 42 |
| 43 PictureLayerImpl::~PictureLayerImpl() { | 43 PictureLayerImpl::~PictureLayerImpl() { |
| 44 } | 44 } |
| 45 | 45 |
| 46 const char* PictureLayerImpl::LayerTypeAsString() const { | 46 const char* PictureLayerImpl::LayerTypeAsString() const { |
| 47 return "PictureLayer"; | 47 return "PictureLayer"; |
| 48 } | 48 } |
| 49 | 49 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 71 | 71 |
| 72 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); | 72 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
| 73 | 73 |
| 74 layer_impl->SetIsMask(is_mask_); | 74 layer_impl->SetIsMask(is_mask_); |
| 75 layer_impl->TransferTilingSet(tilings_.Pass()); | 75 layer_impl->TransferTilingSet(tilings_.Pass()); |
| 76 layer_impl->pile_ = pile_; | 76 layer_impl->pile_ = pile_; |
| 77 pile_ = PicturePileImpl::Create(); | 77 pile_ = PicturePileImpl::Create(); |
| 78 | 78 |
| 79 layer_impl->raster_page_scale_ = raster_page_scale_; | 79 layer_impl->raster_page_scale_ = raster_page_scale_; |
| 80 layer_impl->raster_device_scale_ = raster_device_scale_; | 80 layer_impl->raster_device_scale_ = raster_device_scale_; |
| 81 layer_impl->raster_source_scale_ = raster_source_scale_; | 81 layer_impl->raster_contents_scale_ = raster_contents_scale_; |
| 82 } | 82 } |
| 83 | 83 |
| 84 | 84 |
| 85 void PictureLayerImpl::AppendQuads(QuadSink* quadSink, | 85 void PictureLayerImpl::AppendQuads(QuadSink* quadSink, |
| 86 AppendQuadsData* appendQuadsData) { | 86 AppendQuadsData* appendQuadsData) { |
| 87 const gfx::Rect& rect = visible_content_rect(); | 87 const gfx::Rect& rect = visible_content_rect(); |
| 88 gfx::Rect content_rect(content_bounds()); | 88 gfx::Rect content_rect(content_bounds()); |
| 89 | 89 |
| 90 SharedQuadState* sharedQuadState = | 90 SharedQuadState* sharedQuadState = |
| 91 quadSink->UseSharedQuadState(CreateSharedQuadState()); | 91 quadSink->UseSharedQuadState(CreateSharedQuadState()); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 float* contents_scale_y, | 275 float* contents_scale_y, |
| 276 gfx::Size* content_bounds) { | 276 gfx::Size* content_bounds) { |
| 277 if (!DrawsContent()) { | 277 if (!DrawsContent()) { |
| 278 DCHECK(!tilings_->num_tilings()); | 278 DCHECK(!tilings_->num_tilings()); |
| 279 return; | 279 return; |
| 280 } | 280 } |
| 281 | 281 |
| 282 float min_contents_scale = MinimumContentsScale(); | 282 float min_contents_scale = MinimumContentsScale(); |
| 283 float min_page_scale = layer_tree_impl()->min_page_scale_factor(); | 283 float min_page_scale = layer_tree_impl()->min_page_scale_factor(); |
| 284 float min_device_scale = 1.f; | 284 float min_device_scale = 1.f; |
| 285 float min_source_scale = | |
| 286 min_contents_scale / min_page_scale / min_device_scale; | |
| 287 | 285 |
| 288 float ideal_page_scale = layer_tree_impl()->total_page_scale_factor(); | 286 float ideal_page_scale = layer_tree_impl()->total_page_scale_factor(); |
| 289 float ideal_device_scale = layer_tree_impl()->device_scale_factor(); | 287 float ideal_device_scale = layer_tree_impl()->device_scale_factor(); |
| 290 float ideal_source_scale = | |
| 291 ideal_contents_scale / ideal_page_scale / ideal_device_scale; | |
| 292 | 288 |
| 293 ideal_contents_scale_ = std::max(ideal_contents_scale, min_contents_scale); | 289 ideal_contents_scale_ = std::max(ideal_contents_scale, min_contents_scale); |
| 294 ideal_page_scale_ = ideal_page_scale; | 290 ideal_page_scale_ = ideal_page_scale; |
| 295 ideal_device_scale_ = ideal_device_scale; | 291 ideal_device_scale_ = ideal_device_scale; |
| 296 ideal_source_scale_ = std::max(ideal_source_scale, min_source_scale); | |
| 297 | 292 |
| 298 ManageTilings(animating_transform_to_screen); | 293 ManageTilings(animating_transform_to_screen); |
| 299 | 294 |
| 300 // The content scale and bounds for a PictureLayerImpl is somewhat fictitious. | 295 // The content scale and bounds for a PictureLayerImpl is somewhat fictitious. |
| 301 // There are (usually) several tilings at different scales. However, the | 296 // There are (usually) several tilings at different scales. However, the |
| 302 // content bounds is the (integer!) space in which quads are generated. | 297 // content bounds is the (integer!) space in which quads are generated. |
| 303 // In order to guarantee that we can fill this integer space with any set of | 298 // In order to guarantee that we can fill this integer space with any set of |
| 304 // tilings (and then map back to floating point texture coordinates), the | 299 // tilings (and then map back to floating point texture coordinates), the |
| 305 // contents scale must be at least as large as the largest of the tilings. | 300 // contents scale must be at least as large as the largest of the tilings. |
| 306 float max_contents_scale = min_contents_scale; | 301 float max_contents_scale = min_contents_scale; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 | 379 |
| 385 return default_tile_size; | 380 return default_tile_size; |
| 386 } | 381 } |
| 387 | 382 |
| 388 void PictureLayerImpl::SyncFromActiveLayer() { | 383 void PictureLayerImpl::SyncFromActiveLayer() { |
| 389 DCHECK(layer_tree_impl()->IsPendingTree()); | 384 DCHECK(layer_tree_impl()->IsPendingTree()); |
| 390 | 385 |
| 391 if (!DrawsContent()) { | 386 if (!DrawsContent()) { |
| 392 raster_page_scale_ = 0; | 387 raster_page_scale_ = 0; |
| 393 raster_device_scale_ = 0; | 388 raster_device_scale_ = 0; |
| 394 raster_source_scale_ = 0; | 389 raster_contents_scale_ = 0; |
| 395 return; | 390 return; |
| 396 } | 391 } |
| 397 | 392 |
| 398 // If there is an active tree version of this layer, get a copy of its | 393 // If there is an active tree version of this layer, get a copy of its |
| 399 // tiles. This needs to be done last, after setting invalidation and the | 394 // tiles. This needs to be done last, after setting invalidation and the |
| 400 // pile. | 395 // pile. |
| 401 if (PictureLayerImpl* active_twin = ActiveTwin()) | 396 if (PictureLayerImpl* active_twin = ActiveTwin()) |
| 402 SyncFromActiveLayer(active_twin); | 397 SyncFromActiveLayer(active_twin); |
| 403 } | 398 } |
| 404 | 399 |
| 405 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { | 400 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { |
| 406 raster_page_scale_ = other->raster_page_scale_; | 401 raster_page_scale_ = other->raster_page_scale_; |
| 407 raster_device_scale_ = other->raster_device_scale_; | 402 raster_device_scale_ = other->raster_device_scale_; |
| 408 raster_source_scale_ = other->raster_source_scale_; | 403 raster_contents_scale_ = other->raster_contents_scale_; |
| 409 | 404 |
| 410 // Add synthetic invalidations for any recordings that were dropped. As | 405 // Add synthetic invalidations for any recordings that were dropped. As |
| 411 // tiles are updated to point to this new pile, this will force the dropping | 406 // tiles are updated to point to this new pile, this will force the dropping |
| 412 // of tiles that can no longer be rastered. This is not ideal, but is a | 407 // of tiles that can no longer be rastered. This is not ideal, but is a |
| 413 // trade-off for memory (use the same pile as much as possible, by switching | 408 // trade-off for memory (use the same pile as much as possible, by switching |
| 414 // during DidBecomeActive) and for time (don't bother checking every tile | 409 // during DidBecomeActive) and for time (don't bother checking every tile |
| 415 // during activation to see if the new pile can still raster it). | 410 // during activation to see if the new pile can still raster it). |
| 416 // | 411 // |
| 417 // TODO(enne): Clean up this double loop. | 412 // TODO(enne): Clean up this double loop. |
| 418 for (int x = 0; x < pile_->num_tiles_x(); ++x) { | 413 for (int x = 0; x < pile_->num_tiles_x(); ++x) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 481 } | 476 } |
| 482 return 0; | 477 return 0; |
| 483 } | 478 } |
| 484 | 479 |
| 485 bool PictureLayerImpl::AreVisibleResourcesReady() const { | 480 bool PictureLayerImpl::AreVisibleResourcesReady() const { |
| 486 DCHECK(layer_tree_impl()->IsPendingTree()); | 481 DCHECK(layer_tree_impl()->IsPendingTree()); |
| 487 DCHECK(ideal_contents_scale_); | 482 DCHECK(ideal_contents_scale_); |
| 488 | 483 |
| 489 const gfx::Rect& rect = visible_content_rect(); | 484 const gfx::Rect& rect = visible_content_rect(); |
| 490 | 485 |
| 491 float raster_contents_scale = | 486 float min_acceptable_scale = |
| 492 raster_page_scale_ * | 487 std::min(raster_contents_scale_, ideal_contents_scale_); |
| 493 raster_device_scale_ * | |
| 494 raster_source_scale_; | |
| 495 | 488 |
| 496 float min_acceptable_scale = | 489 TreePriority tree_priority = layer_tree_impl()->tile_manager()->GlobalState(). tree_priority; |
| 497 std::min(raster_contents_scale, ideal_contents_scale_); | |
| 498 | |
| 499 TreePriority tree_priority = | |
| 500 layer_tree_impl()->tile_manager()->GlobalState().tree_priority; | |
| 501 bool should_force_uploads = | 490 bool should_force_uploads = |
| 502 tree_priority != SMOOTHNESS_TAKES_PRIORITY && | 491 tree_priority != SMOOTHNESS_TAKES_PRIORITY && |
| 503 layer_tree_impl()->animationRegistrar()-> | 492 layer_tree_impl()->animationRegistrar()-> |
| 504 active_animation_controllers().empty(); | 493 active_animation_controllers().empty(); |
| 505 | 494 |
| 506 if (PictureLayerImpl* twin = ActiveTwin()) { | 495 if (PictureLayerImpl* twin = ActiveTwin()) { |
| 507 float twin_raster_contents_scale = | |
| 508 twin->raster_page_scale_ * | |
| 509 twin->raster_device_scale_ * | |
| 510 twin->raster_source_scale_; | |
| 511 | |
| 512 min_acceptable_scale = std::min( | 496 min_acceptable_scale = std::min( |
| 513 min_acceptable_scale, | 497 min_acceptable_scale, |
| 514 std::min(twin->ideal_contents_scale_, twin_raster_contents_scale)); | 498 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_)); |
| 515 } | 499 } |
| 516 | 500 |
| 517 Region missing_region = rect; | 501 Region missing_region = rect; |
| 518 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 502 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 519 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 503 PictureLayerTiling* tiling = tilings_->tiling_at(i); |
| 520 | 504 |
| 521 if (tiling->contents_scale() < min_acceptable_scale) | 505 if (tiling->contents_scale() < min_acceptable_scale) |
| 522 continue; | 506 continue; |
| 523 | 507 |
| 524 for (PictureLayerTiling::Iterator iter(tiling, contents_scale_x(), rect); | 508 for (PictureLayerTiling::Iterator iter(tiling, contents_scale_x(), rect); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 float ratio2 = PositiveRatio(layer2->contents_scale(), contents_scale); | 570 float ratio2 = PositiveRatio(layer2->contents_scale(), contents_scale); |
| 587 return ratio1 < ratio2; | 571 return ratio1 < ratio2; |
| 588 } | 572 } |
| 589 | 573 |
| 590 } // namespace | 574 } // namespace |
| 591 | 575 |
| 592 void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) { | 576 void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) { |
| 593 DCHECK(ideal_contents_scale_); | 577 DCHECK(ideal_contents_scale_); |
| 594 DCHECK(ideal_page_scale_); | 578 DCHECK(ideal_page_scale_); |
| 595 DCHECK(ideal_device_scale_); | 579 DCHECK(ideal_device_scale_); |
| 596 DCHECK(ideal_source_scale_); | |
| 597 | 580 |
| 598 if (pile_->recorded_region().IsEmpty()) | 581 if (pile_->recorded_region().IsEmpty()) |
| 599 return; | 582 return; |
| 600 | 583 |
| 601 bool is_active_layer = layer_tree_impl()->IsActiveTree(); | 584 bool is_active_layer = layer_tree_impl()->IsActiveTree(); |
| 602 bool is_pinching = layer_tree_impl()->PinchGestureActive(); | 585 bool is_pinching = layer_tree_impl()->PinchGestureActive(); |
| 603 | 586 |
| 604 bool change_target_tiling = false; | 587 bool change_target_tiling = false; |
| 605 | 588 |
| 606 if (!raster_page_scale_ || !raster_device_scale_ || !raster_source_scale_) | 589 if (!raster_page_scale_ || !raster_device_scale_ || !raster_contents_scale_) |
|
enne (OOO)
2013/03/23 00:47:32
I think this is wrong. The previous check was if
Xianzhu
2013/03/25 16:05:07
I'm confused. How did the previous check deal with
danakj
2013/03/25 16:44:44
It seems like you're just getting rid of raster so
| |
| 607 change_target_tiling = true; | 590 change_target_tiling = true; |
| 608 | 591 |
| 609 // TODO(danakj): Adjust raster_source_scale_ closer to ideal_source_scale_ at | 592 if (ShouldAdjustRasterSourceScale()) |
| 610 // a throttled rate. Possibly make use of invalidation_.IsEmpty() on pending | 593 change_target_tiling = true; |
| 611 // tree. This will allow CSS scale changes to get re-rastered at an | |
| 612 // appropriate rate. | |
| 613 | 594 |
| 614 if (is_active_layer) { | 595 if (is_active_layer) { |
| 615 if (raster_source_scale_was_animating_ && !animating_transform_to_screen) | 596 if (raster_source_scale_was_animating_ && !animating_transform_to_screen) |
| 616 change_target_tiling = true; | 597 change_target_tiling = true; |
| 617 raster_source_scale_was_animating_ = animating_transform_to_screen; | 598 raster_source_scale_was_animating_ = animating_transform_to_screen; |
| 618 } | 599 } |
| 619 | 600 |
| 620 if (is_active_layer && is_pinching && raster_page_scale_) { | 601 if (is_active_layer && is_pinching && raster_page_scale_) { |
| 621 // If the page scale diverges too far during pinch, change raster target to | 602 // If the page scale diverges too far during pinch, change raster target to |
| 622 // the current page scale. | 603 // the current page scale. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 633 | 614 |
| 634 // Always match the ideal device scale factor. | 615 // Always match the ideal device scale factor. |
| 635 if (raster_device_scale_ != ideal_device_scale_) | 616 if (raster_device_scale_ != ideal_device_scale_) |
| 636 change_target_tiling = true; | 617 change_target_tiling = true; |
| 637 | 618 |
| 638 if (!change_target_tiling) | 619 if (!change_target_tiling) |
| 639 return; | 620 return; |
| 640 | 621 |
| 641 raster_page_scale_ = ideal_page_scale_; | 622 raster_page_scale_ = ideal_page_scale_; |
| 642 raster_device_scale_ = ideal_device_scale_; | 623 raster_device_scale_ = ideal_device_scale_; |
| 643 raster_source_scale_ = ideal_source_scale_; | 624 CalculateRasterContentsScale(animating_transform_to_screen); |
|
enne (OOO)
2013/03/23 00:47:32
I like the previous version where rather you had a
| |
| 644 | |
| 645 float raster_contents_scale; | |
| 646 float low_res_raster_contents_scale; | |
| 647 CalculateRasterContentsScale(animating_transform_to_screen, | |
| 648 &raster_contents_scale, | |
| 649 &low_res_raster_contents_scale); | |
| 650 | 625 |
| 651 PictureLayerTiling* high_res = NULL; | 626 PictureLayerTiling* high_res = NULL; |
| 652 PictureLayerTiling* low_res = NULL; | 627 PictureLayerTiling* low_res = NULL; |
| 653 | 628 |
| 654 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 629 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 655 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 630 PictureLayerTiling* tiling = tilings_->tiling_at(i); |
| 656 if (tiling->contents_scale() == raster_contents_scale) | 631 if (tiling->contents_scale() == raster_contents_scale_) |
| 657 high_res = tiling; | 632 high_res = tiling; |
| 658 if (tiling->contents_scale() == low_res_raster_contents_scale) | 633 if (tiling->contents_scale() == low_res_raster_contents_scale_) |
| 659 low_res = tiling; | 634 low_res = tiling; |
| 660 | 635 |
| 661 // Reset all tilings to non-ideal until the end of this function. | 636 // Reset all tilings to non-ideal until the end of this function. |
| 662 tiling->set_resolution(NON_IDEAL_RESOLUTION); | 637 tiling->set_resolution(NON_IDEAL_RESOLUTION); |
| 663 } | 638 } |
| 664 | 639 |
| 665 if (!high_res) { | 640 if (!high_res) { |
| 666 high_res = AddTiling(raster_contents_scale); | 641 high_res = AddTiling(raster_contents_scale_); |
| 667 if (raster_contents_scale == low_res_raster_contents_scale) | 642 if (raster_contents_scale_ == low_res_raster_contents_scale_) |
| 668 low_res = high_res; | 643 low_res = high_res; |
| 669 } | 644 } |
| 670 if (!low_res && low_res != high_res) | 645 if (!low_res && low_res != high_res) |
| 671 low_res = AddTiling(low_res_raster_contents_scale); | 646 low_res = AddTiling(low_res_raster_contents_scale_); |
| 672 | 647 |
| 673 if (high_res) | 648 if (high_res) |
| 674 high_res->set_resolution(HIGH_RESOLUTION); | 649 high_res->set_resolution(HIGH_RESOLUTION); |
| 675 if (low_res && low_res != high_res) | 650 if (low_res && low_res != high_res) |
| 676 low_res->set_resolution(LOW_RESOLUTION); | 651 low_res->set_resolution(LOW_RESOLUTION); |
| 677 } | 652 } |
| 678 | 653 |
| 654 bool PictureLayerImpl::ShouldAdjustRasterSourceScale() const { | |
| 655 // TODO(danakj): Adjust raster source scale closer to ideal source scale at | |
| 656 // a throttled rate. Possibly make use of invalidation_.IsEmpty() on pending | |
| 657 // tree. This will allow CSS scale changes to get re-rastered at an | |
| 658 // appropriate rate. | |
| 659 return false; | |
| 660 } | |
| 661 | |
| 679 void PictureLayerImpl::CalculateRasterContentsScale( | 662 void PictureLayerImpl::CalculateRasterContentsScale( |
| 680 bool animating_transform_to_screen, | 663 bool animating_transform_to_screen) { |
| 681 float* raster_contents_scale, | 664 raster_contents_scale_ = ideal_contents_scale_; |
| 682 float* low_res_raster_contents_scale) { | |
| 683 *raster_contents_scale = ideal_contents_scale_; | |
| 684 | 665 |
| 685 // Don't allow animating CSS scales to drop below 1. | 666 // Don't allow animating CSS scales to drop below 1. |
| 686 if (animating_transform_to_screen) { | 667 if (animating_transform_to_screen) { |
| 687 *raster_contents_scale = std::max( | 668 raster_contents_scale_ = std::max( |
| 688 *raster_contents_scale, 1.f * ideal_page_scale_ * ideal_device_scale_); | 669 raster_contents_scale_, 1.f * ideal_page_scale_ * ideal_device_scale_); |
| 689 } | 670 } |
| 690 | 671 |
| 691 float low_res_factor = | 672 float low_res_factor = |
| 692 layer_tree_impl()->settings().low_res_contents_scale_factor; | 673 layer_tree_impl()->settings().low_res_contents_scale_factor; |
| 693 *low_res_raster_contents_scale = std::max( | 674 low_res_raster_contents_scale_ = std::max( |
| 694 *raster_contents_scale * low_res_factor, | 675 raster_contents_scale_ * low_res_factor, |
| 695 MinimumContentsScale()); | 676 MinimumContentsScale()); |
| 696 } | 677 } |
| 697 | 678 |
| 698 void PictureLayerImpl::CleanUpTilingsOnActiveLayer( | 679 void PictureLayerImpl::CleanUpTilingsOnActiveLayer( |
| 699 std::vector<PictureLayerTiling*> used_tilings) { | 680 std::vector<PictureLayerTiling*> used_tilings) { |
| 700 DCHECK(layer_tree_impl()->IsActiveTree()); | 681 DCHECK(layer_tree_impl()->IsActiveTree()); |
| 701 | 682 |
| 702 float raster_contents_scale = | |
| 703 raster_page_scale_ * raster_device_scale_ * raster_source_scale_; | |
| 704 | |
| 705 float min_acceptable_high_res_scale = std::min( | 683 float min_acceptable_high_res_scale = std::min( |
| 706 raster_contents_scale, ideal_contents_scale_); | 684 raster_contents_scale_, ideal_contents_scale_); |
| 707 float max_acceptable_high_res_scale = std::max( | 685 float max_acceptable_high_res_scale = std::max( |
| 708 raster_contents_scale, ideal_contents_scale_); | 686 raster_contents_scale_, ideal_contents_scale_); |
| 709 | 687 |
| 710 PictureLayerImpl* twin = PendingTwin(); | 688 PictureLayerImpl* twin = PendingTwin(); |
| 711 if (twin) { | 689 if (twin) { |
| 712 float twin_raster_contents_scale = | |
| 713 twin->raster_page_scale_ * | |
| 714 twin->raster_device_scale_ * | |
| 715 twin->raster_source_scale_; | |
| 716 | |
| 717 min_acceptable_high_res_scale = std::min( | 690 min_acceptable_high_res_scale = std::min( |
| 718 min_acceptable_high_res_scale, | 691 min_acceptable_high_res_scale, |
| 719 std::min(twin_raster_contents_scale, twin->ideal_contents_scale_)); | 692 std::min(twin->raster_contents_scale_, twin->ideal_contents_scale_)); |
| 720 max_acceptable_high_res_scale = std::max( | 693 max_acceptable_high_res_scale = std::max( |
| 721 max_acceptable_high_res_scale, | 694 max_acceptable_high_res_scale, |
| 722 std::max(twin_raster_contents_scale, twin->ideal_contents_scale_)); | 695 std::max(twin->raster_contents_scale_, twin->ideal_contents_scale_)); |
| 723 } | 696 } |
| 724 | 697 |
| 725 float low_res_factor = | 698 float low_res_factor = |
| 726 layer_tree_impl()->settings().low_res_contents_scale_factor; | 699 layer_tree_impl()->settings().low_res_contents_scale_factor; |
| 727 | 700 |
| 728 float min_acceptable_low_res_scale = | 701 float min_acceptable_low_res_scale = |
| 729 low_res_factor * min_acceptable_high_res_scale; | 702 low_res_factor * min_acceptable_high_res_scale; |
| 730 float max_acceptable_low_res_scale = | 703 float max_acceptable_low_res_scale = |
| 731 low_res_factor * max_acceptable_high_res_scale; | 704 low_res_factor * max_acceptable_high_res_scale; |
| 732 | 705 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 801 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { | 774 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { |
| 802 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 775 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 803 LayerImpl::AsValueInto(state.get()); | 776 LayerImpl::AsValueInto(state.get()); |
| 804 | 777 |
| 805 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); | 778 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); |
| 806 state->Set("tilings", tilings_->AsValue().release()); | 779 state->Set("tilings", tilings_->AsValue().release()); |
| 807 return state.PassAs<base::Value>(); | 780 return state.PassAs<base::Value>(); |
| 808 } | 781 } |
| 809 | 782 |
| 810 } // namespace cc | 783 } // namespace cc |
| OLD | NEW |