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

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: nit. Created 5 years, 2 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
« cc/base/math_util_unittest.cc ('K') | « 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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 } 941 }
936 942
937 void PictureLayerImpl::RecalculateRasterScales() { 943 void PictureLayerImpl::RecalculateRasterScales() {
938 float old_raster_contents_scale = raster_contents_scale_; 944 float old_raster_contents_scale = raster_contents_scale_;
939 float old_raster_page_scale = raster_page_scale_; 945 float old_raster_page_scale = raster_page_scale_;
940 float old_raster_source_scale = raster_source_scale_; 946 float old_raster_source_scale = raster_source_scale_;
941 947
942 raster_device_scale_ = ideal_device_scale_; 948 raster_device_scale_ = ideal_device_scale_;
943 raster_page_scale_ = ideal_page_scale_; 949 raster_page_scale_ = ideal_page_scale_;
944 raster_source_scale_ = ideal_source_scale_; 950 raster_source_scale_ = ideal_source_scale_;
945 raster_contents_scale_ = ideal_contents_scale_; 951 // Get fixed precision scale to avoid creating extra tilings for scales
952 // which are almost equal.
953 raster_contents_scale_ =
954 MathUtil::RoundToFixedPrecision(ideal_contents_scale_, kScalePrecision);
vmpstr 2015/10/19 18:58:38 My understanding is that with this, something like
prashant.n 2015/10/20 18:45:24 We set scale precision as 4. This will give 4 digi
vmpstr 2015/10/20 18:55:23 Yeah you're probably right, but I'd still like to
946 955
947 // If we're not animating, or leaving an animation, and the 956 // If we're not animating, or leaving an animation, and the
948 // ideal_source_scale_ changes, then things are unpredictable, and we fix 957 // ideal_source_scale_ changes, then things are unpredictable, and we fix
949 // the raster_source_scale_ in place. 958 // the raster_source_scale_ in place.
950 if (old_raster_source_scale && 959 if (old_raster_source_scale &&
951 !draw_properties().screen_space_transform_is_animating && 960 !draw_properties().screen_space_transform_is_animating &&
952 !was_screen_space_transform_animating_ && 961 !was_screen_space_transform_animating_ &&
953 old_raster_source_scale != ideal_source_scale_) 962 old_raster_source_scale != ideal_source_scale_)
954 raster_source_scale_is_fixed_ = true; 963 raster_source_scale_is_fixed_ = true;
955 964
(...skipping 307 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
« cc/base/math_util_unittest.cc ('K') | « cc/base/math_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698