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

Side by Side Diff: cc/layer_tree_host_common.cc

Issue 11377088: cc: Prevent small scale factors (below 1) from being used or saved as the layer's rasterScale. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: smallpsf Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/layer_tree_host_common_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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/layer_tree_host_common.h" 7 #include "cc/layer_tree_host_common.h"
8 8
9 #include "cc/layer.h" 9 #include "cc/layer.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 float rasterScale = layer->rasterScale(); 356 float rasterScale = layer->rasterScale();
357 if (!rasterScale) { 357 if (!rasterScale) {
358 rasterScale = 1; 358 rasterScale = 1;
359 359
360 if (!animatingTransformToScreen && layer->automaticallyComputeRasterScal e()) { 360 if (!animatingTransformToScreen && layer->automaticallyComputeRasterScal e()) {
361 gfx::Vector2dF transformScale = MathUtil::computeTransform2dScaleCom ponents(combinedTransform); 361 gfx::Vector2dF transformScale = MathUtil::computeTransform2dScaleCom ponents(combinedTransform);
362 float combinedScale = std::max(transformScale.x(), transformScale.y( )); 362 float combinedScale = std::max(transformScale.x(), transformScale.y( ));
363 rasterScale = combinedScale / deviceScaleFactor; 363 rasterScale = combinedScale / deviceScaleFactor;
364 if (!layer->boundsContainPageScale()) 364 if (!layer->boundsContainPageScale())
365 rasterScale /= pageScaleFactor; 365 rasterScale /= pageScaleFactor;
366 layer->setRasterScale(rasterScale); 366 // Prevent scale factors below 1 from being used or saved.
367 if (rasterScale < 1)
368 rasterScale = 1;
369 else
370 layer->setRasterScale(rasterScale);
367 } 371 }
368 } 372 }
369 373
370 float contentsScale = rasterScale * deviceScaleFactor; 374 float contentsScale = rasterScale * deviceScaleFactor;
371 if (!layer->boundsContainPageScale()) 375 if (!layer->boundsContainPageScale())
372 contentsScale *= pageScaleFactor; 376 contentsScale *= pageScaleFactor;
373 layer->setContentsScale(contentsScale); 377 layer->setContentsScale(contentsScale);
374 378
375 Layer* maskLayer = layer->maskLayer(); 379 Layer* maskLayer = layer->maskLayer();
376 if (maskLayer) 380 if (maskLayer)
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 928
925 foundLayer = currentLayer; 929 foundLayer = currentLayer;
926 break; 930 break;
927 } 931 }
928 932
929 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer. 933 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer.
930 return foundLayer; 934 return foundLayer;
931 } 935 }
932 936
933 } // namespace cc 937 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698