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

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

Issue 1024633002: cc: Keep tilings texture size in sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address vmp's comments Created 5 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
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 <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 layer_impl->twin_layer_ = this; 123 layer_impl->twin_layer_ = this;
124 124
125 layer_impl->SetNearestNeighbor(nearest_neighbor_); 125 layer_impl->SetNearestNeighbor(nearest_neighbor_);
126 126
127 // Solid color layers have no tilings. 127 // Solid color layers have no tilings.
128 DCHECK_IMPLIES(raster_source_->IsSolidColor(), tilings_->num_tilings() == 0); 128 DCHECK_IMPLIES(raster_source_->IsSolidColor(), tilings_->num_tilings() == 0);
129 // The pending tree should only have a high res (and possibly low res) tiling. 129 // The pending tree should only have a high res (and possibly low res) tiling.
130 DCHECK_LE(tilings_->num_tilings(), 130 DCHECK_LE(tilings_->num_tilings(),
131 layer_tree_impl()->create_low_res_tiling() ? 2u : 1u); 131 layer_tree_impl()->create_low_res_tiling() ? 2u : 1u);
132 132
133 layer_impl->set_gpu_raster_max_texture_size(gpu_raster_max_texture_size_);
133 layer_impl->UpdateRasterSource(raster_source_, &invalidation_, 134 layer_impl->UpdateRasterSource(raster_source_, &invalidation_,
134 tilings_.get()); 135 tilings_.get());
135 DCHECK(invalidation_.IsEmpty()); 136 DCHECK(invalidation_.IsEmpty());
136 137
137 // After syncing a solid color layer, the active layer has no tilings. 138 // After syncing a solid color layer, the active layer has no tilings.
138 DCHECK_IMPLIES(raster_source_->IsSolidColor(), 139 DCHECK_IMPLIES(raster_source_->IsSolidColor(),
139 layer_impl->tilings_->num_tilings() == 0); 140 layer_impl->tilings_->num_tilings() == 0);
140 141
141 layer_impl->raster_page_scale_ = raster_page_scale_; 142 layer_impl->raster_page_scale_ = raster_page_scale_;
142 layer_impl->raster_device_scale_ = raster_device_scale_; 143 layer_impl->raster_device_scale_ = raster_device_scale_;
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 DCHECK_LE(content_bounds.height(), max_texture_size); 679 DCHECK_LE(content_bounds.height(), max_texture_size);
679 return content_bounds; 680 return content_bounds;
680 } 681 }
681 682
682 int default_tile_width = 0; 683 int default_tile_width = 0;
683 int default_tile_height = 0; 684 int default_tile_height = 0;
684 if (layer_tree_impl()->use_gpu_rasterization()) { 685 if (layer_tree_impl()->use_gpu_rasterization()) {
685 // For GPU rasterization, we pick an ideal tile size using the viewport 686 // For GPU rasterization, we pick an ideal tile size using the viewport
686 // so we don't need any settings. The current approach uses 4 tiles 687 // so we don't need any settings. The current approach uses 4 tiles
687 // to cover the viewport vertically. 688 // to cover the viewport vertically.
688 int viewport_width = layer_tree_impl()->device_viewport_size().width(); 689 int viewport_width = gpu_raster_max_texture_size_.width();
689 int viewport_height = layer_tree_impl()->device_viewport_size().height(); 690 int viewport_height = gpu_raster_max_texture_size_.height();
690 default_tile_width = viewport_width; 691 default_tile_width = viewport_width;
691 // Also, increase the height proportionally as the width decreases, and 692 // Also, increase the height proportionally as the width decreases, and
692 // pad by our border texels to make the tiles exactly match the viewport. 693 // pad by our border texels to make the tiles exactly match the viewport.
693 int divisor = 4; 694 int divisor = 4;
694 if (content_bounds.width() <= viewport_width / 2) 695 if (content_bounds.width() <= viewport_width / 2)
695 divisor = 2; 696 divisor = 2;
696 if (content_bounds.width() <= viewport_width / 4) 697 if (content_bounds.width() <= viewport_width / 4)
697 divisor = 1; 698 divisor = 1;
698 default_tile_height = RoundUp(viewport_height, divisor) / divisor; 699 default_tile_height = RoundUp(viewport_height, divisor) / divisor;
699 default_tile_height += 2 * PictureLayerTiling::kBorderTexels; 700 default_tile_height += 2 * PictureLayerTiling::kBorderTexels;
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 1229
1229 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { 1230 bool PictureLayerImpl::IsOnActiveOrPendingTree() const {
1230 return !layer_tree_impl()->IsRecycleTree(); 1231 return !layer_tree_impl()->IsRecycleTree();
1231 } 1232 }
1232 1233
1233 bool PictureLayerImpl::HasValidTilePriorities() const { 1234 bool PictureLayerImpl::HasValidTilePriorities() const {
1234 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); 1235 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember();
1235 } 1236 }
1236 1237
1237 } // namespace cc 1238 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698