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

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 787803004: Update from https://crrev.com/307664 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase. Created 6 years 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
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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
(...skipping 21 matching lines...) Expand all
32 32
33 namespace { 33 namespace {
34 // This must be > 1 as we multiply or divide by this to find a new raster 34 // This must be > 1 as we multiply or divide by this to find a new raster
35 // scale during pinch. 35 // scale during pinch.
36 const float kMaxScaleRatioDuringPinch = 2.0f; 36 const float kMaxScaleRatioDuringPinch = 2.0f;
37 37
38 // When creating a new tiling during pinch, snap to an existing 38 // When creating a new tiling during pinch, snap to an existing
39 // tiling's scale if the desired scale is within this ratio. 39 // tiling's scale if the desired scale is within this ratio.
40 const float kSnapToExistingTilingRatio = 1.2f; 40 const float kSnapToExistingTilingRatio = 1.2f;
41 41
42 // Estimate skewport 60 frames ahead for pre-rasterization on the CPU.
43 const float kCpuSkewportTargetTimeInFrames = 60.0f;
44
45 // Don't pre-rasterize on the GPU (except for kBackflingGuardDistancePixels in
46 // TileManager::BinFromTilePriority).
47 const float kGpuSkewportTargetTimeInFrames = 0.0f;
48
49 // Even for really wide viewports, at some point GPU raster should use 42 // Even for really wide viewports, at some point GPU raster should use
50 // less than 4 tiles to fill the viewport. This is set to 256 as a 43 // less than 4 tiles to fill the viewport. This is set to 256 as a
51 // sane minimum for now, but we might want to tune this for low-end. 44 // sane minimum for now, but we might want to tune this for low-end.
52 const int kMinHeightForGpuRasteredTile = 256; 45 const int kMinHeightForGpuRasteredTile = 256;
53 46
54 // When making odd-sized tiles, round them up to increase the chances 47 // When making odd-sized tiles, round them up to increase the chances
55 // of using the same tile size. 48 // of using the same tile size.
56 const int kTileRoundUp = 64; 49 const int kTileRoundUp = 64;
57 50
58 } // namespace 51 } // namespace
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 } 616 }
624 617
625 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, 618 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling,
626 const gfx::Rect& content_rect) { 619 const gfx::Rect& content_rect) {
627 DCHECK(!raster_source_->IsSolidColor()); 620 DCHECK(!raster_source_->IsSolidColor());
628 if (!raster_source_->CoversRect(content_rect, tiling->contents_scale())) 621 if (!raster_source_->CoversRect(content_rect, tiling->contents_scale()))
629 return scoped_refptr<Tile>(); 622 return scoped_refptr<Tile>();
630 623
631 int flags = 0; 624 int flags = 0;
632 625
633 // TODO(vmpstr): Revisit this. For now, enabling analysis means that we get as 626 // We don't handle solid color masks, so we shouldn't bother analyzing those.
634 // much savings on memory as we can. However, for some cases like ganesh or 627 // Otherwise, always analyze to maximize memory savings.
635 // small layers, the amount of time we spend analyzing might not justify
636 // memory savings that we can get. Note that we don't handle solid color
637 // masks, so we shouldn't bother analyzing those.
638 // Bugs: crbug.com/397198, crbug.com/396908
639 if (!is_mask_) 628 if (!is_mask_)
640 flags = Tile::USE_PICTURE_ANALYSIS; 629 flags = Tile::USE_PICTURE_ANALYSIS;
641 630
642 return layer_tree_impl()->tile_manager()->CreateTile( 631 return layer_tree_impl()->tile_manager()->CreateTile(
643 raster_source_.get(), content_rect.size(), content_rect, 632 raster_source_.get(), content_rect.size(), content_rect,
644 tiling->contents_scale(), id(), layer_tree_impl()->source_frame_number(), 633 tiling->contents_scale(), id(), layer_tree_impl()->source_frame_number(),
645 flags); 634 flags);
646 } 635 }
647 636
648 const Region* PictureLayerImpl::GetPendingInvalidation() { 637 const Region* PictureLayerImpl::GetPendingInvalidation() {
(...skipping 28 matching lines...) Expand all
677 if (!HasValidTilePriorities()) 666 if (!HasValidTilePriorities())
678 return TilePriority::EVENTUALLY; 667 return TilePriority::EVENTUALLY;
679 return TilePriority::NOW; 668 return TilePriority::NOW;
680 } 669 }
681 670
682 size_t PictureLayerImpl::GetMaxTilesForInterestArea() const { 671 size_t PictureLayerImpl::GetMaxTilesForInterestArea() const {
683 return layer_tree_impl()->settings().max_tiles_for_interest_area; 672 return layer_tree_impl()->settings().max_tiles_for_interest_area;
684 } 673 }
685 674
686 float PictureLayerImpl::GetSkewportTargetTimeInSeconds() const { 675 float PictureLayerImpl::GetSkewportTargetTimeInSeconds() const {
687 float skewport_target_time_in_frames = 676 return layer_tree_impl()->use_gpu_rasterization()
688 layer_tree_impl()->use_gpu_rasterization() 677 ? 0.f
689 ? kGpuSkewportTargetTimeInFrames 678 : layer_tree_impl()->settings().skewport_target_time_in_seconds;
690 : kCpuSkewportTargetTimeInFrames;
691 return skewport_target_time_in_frames *
692 layer_tree_impl()->begin_impl_frame_interval().InSecondsF() *
693 layer_tree_impl()->settings().skewport_target_time_multiplier;
694 } 679 }
695 680
696 int PictureLayerImpl::GetSkewportExtrapolationLimitInContentPixels() const { 681 int PictureLayerImpl::GetSkewportExtrapolationLimitInContentPixels() const {
697 return layer_tree_impl() 682 return layer_tree_impl()
698 ->settings() 683 ->settings()
699 .skewport_extrapolation_limit_in_content_pixels; 684 .skewport_extrapolation_limit_in_content_pixels;
700 } 685 }
701 686
702 bool PictureLayerImpl::RequiresHighResToDraw() const { 687 bool PictureLayerImpl::RequiresHighResToDraw() const {
703 return layer_tree_impl()->RequiresHighResToDraw(); 688 return layer_tree_impl()->RequiresHighResToDraw();
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 1355
1371 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { 1356 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const {
1372 if (!layer_tree_impl()->IsActiveTree()) 1357 if (!layer_tree_impl()->IsActiveTree())
1373 return true; 1358 return true;
1374 1359
1375 return AllTilesRequiredAreReadyToDraw( 1360 return AllTilesRequiredAreReadyToDraw(
1376 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); 1361 &PictureLayerTiling::IsTileRequiredForDrawIfVisible);
1377 } 1362 }
1378 1363
1379 } // namespace cc 1364 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug/rasterize_and_record_benchmark_impl.cc ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698