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

Side by Side Diff: cc/layer_tree_host_impl.cc

Issue 11358240: ui: Add methods to Rect classes to get points at each of the rect's corners. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update cc 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 | « cc/layer_impl.cc ('k') | cc/layer_tree_host_impl_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 "cc/layer_tree_host_impl.h" 5 #include "cc/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
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"
11 #include "cc/append_quads_data.h" 11 #include "cc/append_quads_data.h"
12 #include "cc/damage_tracker.h" 12 #include "cc/damage_tracker.h"
13 #include "cc/debug_rect_history.h" 13 #include "cc/debug_rect_history.h"
14 #include "cc/delay_based_time_source.h" 14 #include "cc/delay_based_time_source.h"
15 #include "cc/font_atlas.h" 15 #include "cc/font_atlas.h"
16 #include "cc/frame_rate_counter.h" 16 #include "cc/frame_rate_counter.h"
17 #include "cc/geometry.h"
18 #include "cc/gl_renderer.h" 17 #include "cc/gl_renderer.h"
19 #include "cc/heads_up_display_layer_impl.h" 18 #include "cc/heads_up_display_layer_impl.h"
20 #include "cc/layer_iterator.h" 19 #include "cc/layer_iterator.h"
21 #include "cc/layer_tree_host.h" 20 #include "cc/layer_tree_host.h"
22 #include "cc/layer_tree_host_common.h" 21 #include "cc/layer_tree_host_common.h"
23 #include "cc/math_util.h" 22 #include "cc/math_util.h"
24 #include "cc/overdraw_metrics.h" 23 #include "cc/overdraw_metrics.h"
25 #include "cc/page_scale_animation.h" 24 #include "cc/page_scale_animation.h"
26 #include "cc/prioritized_resource_manager.h" 25 #include "cc/prioritized_resource_manager.h"
27 #include "cc/render_pass_draw_quad.h" 26 #include "cc/render_pass_draw_quad.h"
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 // Pinch with pageScale scrolls entirely in layout space. contentSize 1008 // Pinch with pageScale scrolls entirely in layout space. contentSize
1010 // returns the bounds including the page scale factor, so calculate the 1009 // returns the bounds including the page scale factor, so calculate the
1011 // pre page-scale layout size here. 1010 // pre page-scale layout size here.
1012 float pageScaleFactor = m_pinchZoomViewport.pageScaleFactor(); 1011 float pageScaleFactor = m_pinchZoomViewport.pageScaleFactor();
1013 contentBounds.set_width(contentBounds.width() / pageScaleFactor); 1012 contentBounds.set_width(contentBounds.width() / pageScaleFactor);
1014 contentBounds.set_height(contentBounds.height() / pageScaleFactor); 1013 contentBounds.set_height(contentBounds.height() / pageScaleFactor);
1015 } else { 1014 } else {
1016 viewBounds.Scale(1 / m_pinchZoomViewport.pageScaleDelta()); 1015 viewBounds.Scale(1 / m_pinchZoomViewport.pageScaleDelta());
1017 } 1016 }
1018 1017
1019 gfx::Vector2dF maxScroll = BottomRight(gfx::Rect(contentBounds)) - BottomRig ht(gfx::RectF(viewBounds)); 1018 gfx::Vector2dF maxScroll = gfx::Rect(contentBounds).bottom_right() - gfx::Re ctF(viewBounds).bottom_right();
1020 maxScroll.Scale(1 / m_deviceScaleFactor); 1019 maxScroll.Scale(1 / m_deviceScaleFactor);
1021 1020
1022 // The viewport may be larger than the contents in some cases, such as 1021 // The viewport may be larger than the contents in some cases, such as
1023 // having a vertical scrollbar but no horizontal overflow. 1022 // having a vertical scrollbar but no horizontal overflow.
1024 maxScroll.ClampToMin(gfx::Vector2dF()); 1023 maxScroll.ClampToMin(gfx::Vector2dF());
1025 1024
1026 m_rootScrollLayerImpl->setMaxScrollOffset(gfx::ToFlooredVector2d(maxScroll)) ; 1025 m_rootScrollLayerImpl->setMaxScrollOffset(gfx::ToFlooredVector2d(maxScroll)) ;
1027 } 1026 }
1028 1027
1029 void LayerTreeHostImpl::setNeedsRedraw() 1028 void LayerTreeHostImpl::setNeedsRedraw()
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 gfx::Vector2dF scrollBegin = m_rootScrollLayerImpl->scrollOffset() + m_rootS crollLayerImpl->scrollDelta(); 1301 gfx::Vector2dF scrollBegin = m_rootScrollLayerImpl->scrollOffset() + m_rootS crollLayerImpl->scrollDelta();
1303 scrollBegin.Scale(m_pinchZoomViewport.pageScaleDelta()); 1302 scrollBegin.Scale(m_pinchZoomViewport.pageScaleDelta());
1304 float scaleBegin = m_pinchZoomViewport.totalPageScaleFactor(); 1303 float scaleBegin = m_pinchZoomViewport.totalPageScaleFactor();
1305 float pageScaleDeltaToSend = m_pinchZoomViewport.minPageScaleFactor() / m_pi nchZoomViewport.pageScaleFactor(); 1304 float pageScaleDeltaToSend = m_pinchZoomViewport.minPageScaleFactor() / m_pi nchZoomViewport.pageScaleFactor();
1306 gfx::SizeF scaledContentsSize = gfx::ScaleSize(contentSize(), pageScaleDelta ToSend); 1305 gfx::SizeF scaledContentsSize = gfx::ScaleSize(contentSize(), pageScaleDelta ToSend);
1307 1306
1308 gfx::Vector2d anchorOffset = m_previousPinchAnchor.OffsetFromOrigin(); 1307 gfx::Vector2d anchorOffset = m_previousPinchAnchor.OffsetFromOrigin();
1309 gfx::Vector2dF scrollEnd = scrollBegin + anchorOffset; 1308 gfx::Vector2dF scrollEnd = scrollBegin + anchorOffset;
1310 scrollEnd.Scale(m_pinchZoomViewport.minPageScaleFactor() / scaleBegin); 1309 scrollEnd.Scale(m_pinchZoomViewport.minPageScaleFactor() / scaleBegin);
1311 scrollEnd -= anchorOffset; 1310 scrollEnd -= anchorOffset;
1312 scrollEnd.ClampToMax(BottomRight(gfx::RectF(scaledContentsSize)) - BottomRig ht(gfx::Rect(m_deviceViewportSize))); 1311 scrollEnd.ClampToMax(gfx::RectF(scaledContentsSize).bottom_right() - gfx::Re ct(m_deviceViewportSize).bottom_right());
1313 scrollEnd.ClampToMin(gfx::Vector2d()); 1312 scrollEnd.ClampToMin(gfx::Vector2d());
1314 scrollEnd.Scale(1 / pageScaleDeltaToSend); 1313 scrollEnd.Scale(1 / pageScaleDeltaToSend);
1315 scrollEnd.Scale(m_deviceScaleFactor); 1314 scrollEnd.Scale(m_deviceScaleFactor);
1316 1315
1317 makeScrollAndScaleSet(scrollInfo, gfx::ToRoundedVector2d(scrollEnd), m_pinch ZoomViewport.minPageScaleFactor()); 1316 makeScrollAndScaleSet(scrollInfo, gfx::ToRoundedVector2d(scrollEnd), m_pinch ZoomViewport.minPageScaleFactor());
1318 } 1317 }
1319 1318
1320 void LayerTreeHostImpl::makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx ::Vector2d scrollOffset, float pageScale) 1319 void LayerTreeHostImpl::makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx ::Vector2d scrollOffset, float pageScale)
1321 { 1320 {
1322 if (!m_rootScrollLayerImpl) 1321 if (!m_rootScrollLayerImpl)
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController(); 1505 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController();
1507 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); 1506 double monotonicTime = (time - base::TimeTicks()).InSecondsF();
1508 if (scrollbarController && scrollbarController->animate(monotonicTime)) 1507 if (scrollbarController && scrollbarController->animate(monotonicTime))
1509 m_client->setNeedsRedrawOnImplThread(); 1508 m_client->setNeedsRedrawOnImplThread();
1510 1509
1511 for (size_t i = 0; i < layer->children().size(); ++i) 1510 for (size_t i = 0; i < layer->children().size(); ++i)
1512 animateScrollbarsRecursive(layer->children()[i], time); 1511 animateScrollbarsRecursive(layer->children()[i], time);
1513 } 1512 }
1514 1513
1515 } // namespace cc 1514 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_impl.cc ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698