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

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

Issue 1591513002: cc: Early out of UpdateTiles for resoureceless draw (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix perftests Created 4 years, 11 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
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 on_demand_missing_tile_count); 405 on_demand_missing_tile_count);
406 } 406 }
407 407
408 // Aggressively remove any tilings that are not seen to save memory. Note 408 // Aggressively remove any tilings that are not seen to save memory. Note
409 // that this is at the expense of doing cause more frequent re-painting. A 409 // that this is at the expense of doing cause more frequent re-painting. A
410 // better scheme would be to maintain a tighter visible_layer_rect for the 410 // better scheme would be to maintain a tighter visible_layer_rect for the
411 // finer tilings. 411 // finer tilings.
412 CleanUpTilingsOnActiveLayer(last_append_quads_tilings_); 412 CleanUpTilingsOnActiveLayer(last_append_quads_tilings_);
413 } 413 }
414 414
415 bool PictureLayerImpl::UpdateTiles(bool resourceless_software_draw) { 415 bool PictureLayerImpl::UpdateTiles() {
416 if (!resourceless_software_draw) {
417 visible_rect_for_tile_priority_ = visible_layer_rect();
418 screen_space_transform_for_tile_priority_ = ScreenSpaceTransform();
419 }
420
421 if (!CanHaveTilings()) { 416 if (!CanHaveTilings()) {
422 ideal_page_scale_ = 0.f; 417 ideal_page_scale_ = 0.f;
423 ideal_device_scale_ = 0.f; 418 ideal_device_scale_ = 0.f;
424 ideal_contents_scale_ = 0.f; 419 ideal_contents_scale_ = 0.f;
425 ideal_source_scale_ = 0.f; 420 ideal_source_scale_ = 0.f;
426 SanityCheckTilingState(); 421 SanityCheckTilingState();
427 return false; 422 return false;
428 } 423 }
429 424
430 // Remove any non-ideal tilings that were not used last time we generated 425 // Remove any non-ideal tilings that were not used last time we generated
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 // Pass |occlusion_in_content_space| for |occlusion_in_layer_space| since 482 // Pass |occlusion_in_content_space| for |occlusion_in_layer_space| since
488 // they are the same space in picture layer, as contents scale is always 1. 483 // they are the same space in picture layer, as contents scale is always 1.
489 bool updated = tilings_->UpdateTilePriorities( 484 bool updated = tilings_->UpdateTilePriorities(
490 viewport_rect_for_tile_priority_in_content_space_, ideal_contents_scale_, 485 viewport_rect_for_tile_priority_in_content_space_, ideal_contents_scale_,
491 current_frame_time_in_seconds, occlusion_in_content_space, 486 current_frame_time_in_seconds, occlusion_in_content_space,
492 can_require_tiles_for_activation); 487 can_require_tiles_for_activation);
493 return updated; 488 return updated;
494 } 489 }
495 490
496 void PictureLayerImpl::UpdateViewportRectForTilePriorityInContentSpace() { 491 void PictureLayerImpl::UpdateViewportRectForTilePriorityInContentSpace() {
497 // If visible_rect_for_tile_priority_ is empty or 492 // If visible_layer_rect() is empty or viewport_rect_for_tile_priority is
498 // viewport_rect_for_tile_priority is set to be different from the device 493 // set to be different from the device viewport, try to inverse project the
499 // viewport, try to inverse project the viewport into layer space and use 494 // viewport into layer space and use that. Otherwise just use
500 // that. Otherwise just use visible_rect_for_tile_priority_ 495 // visible_layer_rect().
501 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; 496 gfx::Rect visible_rect_in_content_space = visible_layer_rect();
502 gfx::Rect viewport_rect_for_tile_priority = 497 gfx::Rect viewport_rect_for_tile_priority =
503 layer_tree_impl()->ViewportRectForTilePriority(); 498 layer_tree_impl()->ViewportRectForTilePriority();
504 if (visible_rect_in_content_space.IsEmpty() || 499 if (visible_rect_in_content_space.IsEmpty() ||
505 layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority) { 500 layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority) {
506 gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization); 501 gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization);
507 if (screen_space_transform_for_tile_priority_.GetInverse(&view_to_layer)) { 502 if (ScreenSpaceTransform().GetInverse(&view_to_layer)) {
508 // Transform from view space to content space. 503 // Transform from view space to content space.
509 visible_rect_in_content_space = MathUtil::ProjectEnclosingClippedRect( 504 visible_rect_in_content_space = MathUtil::ProjectEnclosingClippedRect(
510 view_to_layer, viewport_rect_for_tile_priority); 505 view_to_layer, viewport_rect_for_tile_priority);
511 506
512 // We have to allow for a viewport that is outside of the layer bounds in 507 // We have to allow for a viewport that is outside of the layer bounds in
513 // order to compute tile priorities correctly for offscreen content that 508 // order to compute tile priorities correctly for offscreen content that
514 // is going to make it on screen. However, we also have to limit the 509 // is going to make it on screen. However, we also have to limit the
515 // viewport since it can be very large due to screen_space_transforms. As 510 // viewport since it can be very large due to screen_space_transforms. As
516 // a heuristic, we clip to bounds padded by skewport_extrapolation_limit * 511 // a heuristic, we clip to bounds padded by skewport_extrapolation_limit *
517 // maximum tiling scale, since this should allow sufficient room for 512 // maximum tiling scale, since this should allow sufficient room for
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 1256
1262 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { 1257 bool PictureLayerImpl::IsOnActiveOrPendingTree() const {
1263 return !layer_tree_impl()->IsRecycleTree(); 1258 return !layer_tree_impl()->IsRecycleTree();
1264 } 1259 }
1265 1260
1266 bool PictureLayerImpl::HasValidTilePriorities() const { 1261 bool PictureLayerImpl::HasValidTilePriorities() const {
1267 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); 1262 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember();
1268 } 1263 }
1269 1264
1270 } // namespace cc 1265 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698