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

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: 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 "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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 // Pinch with pageScale scrolls entirely in layout space. contentSize 990 // Pinch with pageScale scrolls entirely in layout space. contentSize
992 // returns the bounds including the page scale factor, so calculate the 991 // returns the bounds including the page scale factor, so calculate the
993 // pre page-scale layout size here. 992 // pre page-scale layout size here.
994 float pageScaleFactor = m_pinchZoomViewport.pageScaleFactor(); 993 float pageScaleFactor = m_pinchZoomViewport.pageScaleFactor();
995 contentBounds.set_width(contentBounds.width() / pageScaleFactor); 994 contentBounds.set_width(contentBounds.width() / pageScaleFactor);
996 contentBounds.set_height(contentBounds.height() / pageScaleFactor); 995 contentBounds.set_height(contentBounds.height() / pageScaleFactor);
997 } else { 996 } else {
998 viewBounds.Scale(1 / m_pinchZoomViewport.pageScaleDelta()); 997 viewBounds.Scale(1 / m_pinchZoomViewport.pageScaleDelta());
999 } 998 }
1000 999
1001 gfx::Vector2dF maxScroll = BottomRight(gfx::Rect(contentBounds)) - BottomRig ht(gfx::RectF(viewBounds)); 1000 gfx::Vector2dF maxScroll = gfx::Rect(contentBounds).BottomRight() - gfx::Rec tF(viewBounds).BottomRight();
1002 maxScroll.Scale(1 / m_deviceScaleFactor); 1001 maxScroll.Scale(1 / m_deviceScaleFactor);
1003 1002
1004 // The viewport may be larger than the contents in some cases, such as 1003 // The viewport may be larger than the contents in some cases, such as
1005 // having a vertical scrollbar but no horizontal overflow. 1004 // having a vertical scrollbar but no horizontal overflow.
1006 maxScroll.ClampToMin(gfx::Vector2dF()); 1005 maxScroll.ClampToMin(gfx::Vector2dF());
1007 1006
1008 m_rootScrollLayerImpl->setMaxScrollOffset(gfx::ToFlooredVector2d(maxScroll)) ; 1007 m_rootScrollLayerImpl->setMaxScrollOffset(gfx::ToFlooredVector2d(maxScroll)) ;
1009 } 1008 }
1010 1009
1011 void LayerTreeHostImpl::setNeedsRedraw() 1010 void LayerTreeHostImpl::setNeedsRedraw()
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 gfx::Vector2dF scrollBegin = m_rootScrollLayerImpl->scrollOffset() + m_rootS crollLayerImpl->scrollDelta(); 1283 gfx::Vector2dF scrollBegin = m_rootScrollLayerImpl->scrollOffset() + m_rootS crollLayerImpl->scrollDelta();
1285 scrollBegin.Scale(m_pinchZoomViewport.pageScaleDelta()); 1284 scrollBegin.Scale(m_pinchZoomViewport.pageScaleDelta());
1286 float scaleBegin = m_pinchZoomViewport.totalPageScaleFactor(); 1285 float scaleBegin = m_pinchZoomViewport.totalPageScaleFactor();
1287 float pageScaleDeltaToSend = m_pinchZoomViewport.minPageScaleFactor() / m_pi nchZoomViewport.pageScaleFactor(); 1286 float pageScaleDeltaToSend = m_pinchZoomViewport.minPageScaleFactor() / m_pi nchZoomViewport.pageScaleFactor();
1288 gfx::SizeF scaledContentsSize = gfx::ScaleSize(contentSize(), pageScaleDelta ToSend); 1287 gfx::SizeF scaledContentsSize = gfx::ScaleSize(contentSize(), pageScaleDelta ToSend);
1289 1288
1290 gfx::Vector2d anchorOffset = m_previousPinchAnchor.OffsetFromOrigin(); 1289 gfx::Vector2d anchorOffset = m_previousPinchAnchor.OffsetFromOrigin();
1291 gfx::Vector2dF scrollEnd = scrollBegin + anchorOffset; 1290 gfx::Vector2dF scrollEnd = scrollBegin + anchorOffset;
1292 scrollEnd.Scale(m_pinchZoomViewport.minPageScaleFactor() / scaleBegin); 1291 scrollEnd.Scale(m_pinchZoomViewport.minPageScaleFactor() / scaleBegin);
1293 scrollEnd -= anchorOffset; 1292 scrollEnd -= anchorOffset;
1294 scrollEnd.ClampToMax(BottomRight(gfx::RectF(scaledContentsSize)) - BottomRig ht(gfx::Rect(m_deviceViewportSize))); 1293 scrollEnd.ClampToMax(gfx::RectF(scaledContentsSize).BottomRight() - gfx::Rec t(m_deviceViewportSize).BottomRight());
1295 scrollEnd.ClampToMin(gfx::Vector2d()); 1294 scrollEnd.ClampToMin(gfx::Vector2d());
1296 scrollEnd.Scale(1 / pageScaleDeltaToSend); 1295 scrollEnd.Scale(1 / pageScaleDeltaToSend);
1297 scrollEnd.Scale(m_deviceScaleFactor); 1296 scrollEnd.Scale(m_deviceScaleFactor);
1298 1297
1299 makeScrollAndScaleSet(scrollInfo, gfx::ToRoundedVector2d(scrollEnd), m_pinch ZoomViewport.minPageScaleFactor()); 1298 makeScrollAndScaleSet(scrollInfo, gfx::ToRoundedVector2d(scrollEnd), m_pinch ZoomViewport.minPageScaleFactor());
1300 } 1299 }
1301 1300
1302 void LayerTreeHostImpl::makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx ::Vector2d scrollOffset, float pageScale) 1301 void LayerTreeHostImpl::makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx ::Vector2d scrollOffset, float pageScale)
1303 { 1302 {
1304 if (!m_rootScrollLayerImpl) 1303 if (!m_rootScrollLayerImpl)
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController(); 1487 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController();
1489 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); 1488 double monotonicTime = (time - base::TimeTicks()).InSecondsF();
1490 if (scrollbarController && scrollbarController->animate(monotonicTime)) 1489 if (scrollbarController && scrollbarController->animate(monotonicTime))
1491 m_client->setNeedsRedrawOnImplThread(); 1490 m_client->setNeedsRedrawOnImplThread();
1492 1491
1493 for (size_t i = 0; i < layer->children().size(); ++i) 1492 for (size_t i = 0; i < layer->children().size(); ++i)
1494 animateScrollbarsRecursive(layer->children()[i], time); 1493 animateScrollbarsRecursive(layer->children()[i], time);
1495 } 1494 }
1496 1495
1497 } // namespace cc 1496 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_impl.cc ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | ui/gfx/rect_base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698