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

Unified Diff: cc/layer_tree_host_impl.cc

Issue 11377068: ui: Make gfx::Size::Scale() mutate the class. Add gfx::ScaleSize() similar to Rect/Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseTOGO 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/contents_scaling_layer.cc ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 9568bd19247f3f6ff6f397de288b58ca0e3d2ed4..43c0a449de34401b5f756b7d622947e03dae6c2c 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -299,10 +299,9 @@ void LayerTreeHostImpl::startPageScaleAnimation(gfx::Vector2d targetPosition, bo
gfx::SizeF scaledContentSize = contentSize();
if (!Settings::pageScalePinchZoomEnabled()) {
scrollTotal.Scale(1 / m_pinchZoomViewport.pageScaleFactor());
- scaledContentSize = scaledContentSize.Scale(1 / m_pinchZoomViewport.pageScaleFactor());
+ scaledContentSize.Scale(1 / m_pinchZoomViewport.pageScaleFactor());
}
- gfx::SizeF viewportSize = m_deviceViewportSize;
- viewportSize = viewportSize.Scale(1 / m_deviceScaleFactor);
+ gfx::SizeF viewportSize = gfx::ScaleSize(m_deviceViewportSize, 1 / m_deviceScaleFactor);
double startTimeSeconds = (startTime - base::TimeTicks()).InSecondsF();
m_pageScaleAnimation = PageScaleAnimation::create(scrollTotal, m_pinchZoomViewport.totalPageScaleFactor(), viewportSize, scaledContentSize, startTimeSeconds);
@@ -985,10 +984,8 @@ void LayerTreeHostImpl::updateMaxScrollOffset()
gfx::SizeF viewBounds = m_deviceViewportSize;
if (LayerImpl* clipLayer = m_rootScrollLayerImpl->parent()) {
// Compensate for non-overlay scrollbars.
- if (clipLayer->masksToBounds()) {
- viewBounds = clipLayer->bounds();
- viewBounds = viewBounds.Scale(m_deviceScaleFactor);
- }
+ if (clipLayer->masksToBounds())
+ viewBounds = gfx::ScaleSize(clipLayer->bounds(), m_deviceScaleFactor);
}
gfx::Size contentBounds = contentSize();
@@ -1000,7 +997,7 @@ void LayerTreeHostImpl::updateMaxScrollOffset()
contentBounds.set_width(contentBounds.width() / pageScaleFactor);
contentBounds.set_height(contentBounds.height() / pageScaleFactor);
} else {
- viewBounds = viewBounds.Scale(1 / m_pinchZoomViewport.pageScaleDelta());
+ viewBounds.Scale(1 / m_pinchZoomViewport.pageScaleDelta());
}
gfx::Vector2dF maxScroll = BottomRight(gfx::Rect(contentBounds)) - BottomRight(gfx::RectF(viewBounds));
@@ -1290,7 +1287,7 @@ void LayerTreeHostImpl::computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo)
scrollBegin.Scale(m_pinchZoomViewport.pageScaleDelta());
float scaleBegin = m_pinchZoomViewport.totalPageScaleFactor();
float pageScaleDeltaToSend = m_pinchZoomViewport.minPageScaleFactor() / m_pinchZoomViewport.pageScaleFactor();
- gfx::SizeF scaledContentsSize = contentSize().Scale(pageScaleDeltaToSend);
+ gfx::SizeF scaledContentsSize = gfx::ScaleSize(contentSize(), pageScaleDeltaToSend);
gfx::Vector2d anchorOffset = m_previousPinchAnchor.OffsetFromOrigin();
gfx::Vector2dF scrollEnd = scrollBegin + anchorOffset;
« no previous file with comments | « cc/contents_scaling_layer.cc ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698