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

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

Issue 1321503002: cc: Do not create separate tilings for almost equal scale factors. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved roundto function to ideal scales. Created 5 years, 1 month 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/base/math_util_unittest.cc ('k') | no next file » | 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 <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 30 matching lines...) Expand all
41 41
42 // 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
43 // 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
44 // 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.
45 const int kMinHeightForGpuRasteredTile = 256; 45 const int kMinHeightForGpuRasteredTile = 256;
46 46
47 // 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
48 // of using the same tile size. 48 // of using the same tile size.
49 const int kTileRoundUp = 64; 49 const int kTileRoundUp = 64;
50 50
51 // The precision value for rounding floating points values of scale factors.
52 // With this scale factors will be having 3 digits fractional part, which will
53 // make almost equal (having smaller difference by some magnitude of floating
54 // point epsilon) scale factors to be considered as same.
55 const int kScalePrecision = 4;
56
51 } // namespace 57 } // namespace
52 58
53 namespace cc { 59 namespace cc {
54 60
55 PictureLayerImpl::PictureLayerImpl( 61 PictureLayerImpl::PictureLayerImpl(
56 LayerTreeImpl* tree_impl, 62 LayerTreeImpl* tree_impl,
57 int id, 63 int id,
58 bool is_mask, 64 bool is_mask,
59 scoped_refptr<SyncedScrollOffset> scroll_offset) 65 scoped_refptr<SyncedScrollOffset> scroll_offset)
60 : LayerImpl(tree_impl, id, scroll_offset), 66 : LayerImpl(tree_impl, id, scroll_offset),
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 : settings.skewport_target_time_in_seconds, 1186 : settings.skewport_target_time_in_seconds,
1181 settings.skewport_extrapolation_limit_in_content_pixels); 1187 settings.skewport_extrapolation_limit_in_content_pixels);
1182 } 1188 }
1183 1189
1184 void PictureLayerImpl::UpdateIdealScales() { 1190 void PictureLayerImpl::UpdateIdealScales() {
1185 DCHECK(CanHaveTilings()); 1191 DCHECK(CanHaveTilings());
1186 1192
1187 float min_contents_scale = MinimumContentsScale(); 1193 float min_contents_scale = MinimumContentsScale();
1188 DCHECK_GT(min_contents_scale, 0.f); 1194 DCHECK_GT(min_contents_scale, 0.f);
1189 1195
1190 ideal_page_scale_ = IsAffectedByPageScale() 1196 ideal_page_scale_ =
1191 ? layer_tree_impl()->current_page_scale_factor() 1197 IsAffectedByPageScale()
1192 : 1.f; 1198 ? MathUtil::RoundToFixedPrecision(
1199 layer_tree_impl()->current_page_scale_factor(), kScalePrecision)
1200 : 1.f;
1193 ideal_device_scale_ = layer_tree_impl()->device_scale_factor(); 1201 ideal_device_scale_ = layer_tree_impl()->device_scale_factor();
1194 ideal_contents_scale_ = std::max(GetIdealContentsScale(), min_contents_scale); 1202 ideal_contents_scale_ = MathUtil::RoundToFixedPrecision(
1203 std::max(GetIdealContentsScale(), min_contents_scale), kScalePrecision);
prashant.n 2015/10/26 16:35:04 Modifying ideal page and contents scales are neede
1195 ideal_source_scale_ = 1204 ideal_source_scale_ =
1196 ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_; 1205 ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_;
1197 } 1206 }
1198 1207
1199 void PictureLayerImpl::GetDebugBorderProperties( 1208 void PictureLayerImpl::GetDebugBorderProperties(
1200 SkColor* color, 1209 SkColor* color,
1201 float* width) const { 1210 float* width) const {
1202 *color = DebugColors::TiledContentLayerBorderColor(); 1211 *color = DebugColors::TiledContentLayerBorderColor();
1203 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); 1212 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl());
1204 } 1213 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 1272
1264 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { 1273 bool PictureLayerImpl::IsOnActiveOrPendingTree() const {
1265 return !layer_tree_impl()->IsRecycleTree(); 1274 return !layer_tree_impl()->IsRecycleTree();
1266 } 1275 }
1267 1276
1268 bool PictureLayerImpl::HasValidTilePriorities() const { 1277 bool PictureLayerImpl::HasValidTilePriorities() const {
1269 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); 1278 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember();
1270 } 1279 }
1271 1280
1272 } // namespace cc 1281 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/math_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698