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

Side by Side Diff: cc/layer_tree_host_impl.cc

Issue 11276060: Pass accurate contentsScale to LayerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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_impl.h" 7 #include "cc/layer_tree_host_impl.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 FloatPoint localStartPoint = MathUtil::projectPoint(inverseScreenSpaceTransf orm, screenSpacePoint, startClipped); 1096 FloatPoint localStartPoint = MathUtil::projectPoint(inverseScreenSpaceTransf orm, screenSpacePoint, startClipped);
1097 FloatPoint localEndPoint = MathUtil::projectPoint(inverseScreenSpaceTransfor m, screenSpaceEndPoint, endClipped); 1097 FloatPoint localEndPoint = MathUtil::projectPoint(inverseScreenSpaceTransfor m, screenSpaceEndPoint, endClipped);
1098 1098
1099 // In general scroll point coordinates should not get clipped. 1099 // In general scroll point coordinates should not get clipped.
1100 DCHECK(!startClipped); 1100 DCHECK(!startClipped);
1101 DCHECK(!endClipped); 1101 DCHECK(!endClipped);
1102 if (startClipped || endClipped) 1102 if (startClipped || endClipped)
1103 return FloatSize(); 1103 return FloatSize();
1104 1104
1105 // localStartPoint and localEndPoint are in content space but we want to mov e them to layer space for scrolling. 1105 // localStartPoint and localEndPoint are in content space but we want to mov e them to layer space for scrolling.
1106 float widthScale = 1; 1106 float widthScale = 1.0 / layerImpl.contentsScaleX();
1107 float heightScale = 1; 1107 float heightScale = 1.0 / layerImpl.contentsScaleY();
1108 if (!layerImpl.contentBounds().isEmpty() && !layerImpl.bounds().isEmpty()) {
1109 widthScale = layerImpl.bounds().width() / static_cast<float>(layerImpl.c ontentBounds().width());
1110 heightScale = layerImpl.bounds().height() / static_cast<float>(layerImpl .contentBounds().height());
1111 }
1112 localStartPoint.scale(widthScale, heightScale); 1108 localStartPoint.scale(widthScale, heightScale);
1113 localEndPoint.scale(widthScale, heightScale); 1109 localEndPoint.scale(widthScale, heightScale);
1114 1110
1115 // Apply the scroll delta. 1111 // Apply the scroll delta.
1116 FloatSize previousDelta(layerImpl.scrollDelta()); 1112 FloatSize previousDelta(layerImpl.scrollDelta());
1117 FloatSize unscrolled = layerImpl.scrollBy(localEndPoint - localStartPoint); 1113 FloatSize unscrolled = layerImpl.scrollBy(localEndPoint - localStartPoint);
1118 1114
1119 if (viewport) 1115 if (viewport)
1120 viewport->applyScroll(unscrolled); 1116 viewport->applyScroll(unscrolled);
1121 1117
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 1480
1485 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController(); 1481 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController();
1486 if (scrollbarController && scrollbarController->animate(monotonicTime)) 1482 if (scrollbarController && scrollbarController->animate(monotonicTime))
1487 m_client->setNeedsRedrawOnImplThread(); 1483 m_client->setNeedsRedrawOnImplThread();
1488 1484
1489 for (size_t i = 0; i < layer->children().size(); ++i) 1485 for (size_t i = 0; i < layer->children().size(); ++i)
1490 animateScrollbarsRecursive(layer->children()[i], monotonicTime); 1486 animateScrollbarsRecursive(layer->children()[i], monotonicTime);
1491 } 1487 }
1492 1488
1493 } // namespace cc 1489 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698