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

Side by Side Diff: cc/layer_tree_host_impl.cc

Issue 11550035: Implement pinch-zoom scaling for main-frame scrollbars and pinch-zoom overlay scrollbars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix impl-side painting issues. Created 7 years, 9 months 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"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 437 }
438 } 438 }
439 439
440 bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame) 440 bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
441 { 441 {
442 DCHECK(frame.renderPasses.empty()); 442 DCHECK(frame.renderPasses.empty());
443 443
444 if (!canDraw() || !rootLayer()) 444 if (!canDraw() || !rootLayer())
445 return false; 445 return false;
446 446
447 // Set the opacity of the pinch zoom scrollbars. This is done here
448 // so that it comes after the commit and we can directly set the
449 // opacity on the impl scrollbar layers.
450 activeTree()->SetPinchZoomScrollbarsVisibility();
jamesr 2013/02/26 20:48:46 Why is this different for the pinch zoom scrollbar
wjmaclean 2013/03/01 15:30:32 Because I had thought in the initial CL we would d
451
447 trackDamageForAllSurfaces(rootLayer(), *frame.renderSurfaceLayerList); 452 trackDamageForAllSurfaces(rootLayer(), *frame.renderSurfaceLayerList);
448 453
449 TRACE_EVENT1("cc", "LayerTreeHostImpl::calculateRenderPasses", "renderSurfac eLayerList.size()", static_cast<long long unsigned>(frame.renderSurfaceLayerList ->size())); 454 TRACE_EVENT1("cc", "LayerTreeHostImpl::calculateRenderPasses", "renderSurfac eLayerList.size()", static_cast<long long unsigned>(frame.renderSurfaceLayerList ->size()));
450 455
451 // Create the render passes in dependency order. 456 // Create the render passes in dependency order.
452 for (int surfaceIndex = frame.renderSurfaceLayerList->size() - 1; surfaceInd ex >= 0 ; --surfaceIndex) { 457 for (int surfaceIndex = frame.renderSurfaceLayerList->size() - 1; surfaceInd ex >= 0 ; --surfaceIndex) {
453 LayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceI ndex]; 458 LayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceI ndex];
454 renderSurfaceLayer->renderSurface()->appendRenderPasses(frame); 459 renderSurfaceLayer->renderSurface()->appendRenderPasses(frame);
455 } 460 }
456 461
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 // Allow further movement only on an axis perpendicular to the direction in which the layer 1351 // Allow further movement only on an axis perpendicular to the direction in which the layer
1347 // moved. 1352 // moved.
1348 gfx::Vector2dF perpendicularAxis(-appliedDelta.y(), appliedDelta.x()); 1353 gfx::Vector2dF perpendicularAxis(-appliedDelta.y(), appliedDelta.x());
1349 pendingDelta = MathUtil::projectVector(pendingDelta, perpendicularAxis); 1354 pendingDelta = MathUtil::projectVector(pendingDelta, perpendicularAxis);
1350 1355
1351 if (gfx::ToFlooredVector2d(pendingDelta).IsZero()) 1356 if (gfx::ToFlooredVector2d(pendingDelta).IsZero())
1352 break; 1357 break;
1353 } 1358 }
1354 1359
1355 if (didScroll) { 1360 if (didScroll) {
1361 activeTree()->UpdatePinchZoomScrollbarsIfNeeded();
1356 m_client->setNeedsCommitOnImplThread(); 1362 m_client->setNeedsCommitOnImplThread();
1357 m_client->setNeedsRedrawOnImplThread(); 1363 m_client->setNeedsRedrawOnImplThread();
1358 m_client->renewTreePriority(); 1364 m_client->renewTreePriority();
1359 } 1365 }
1360 return didScroll; 1366 return didScroll;
1361 } 1367 }
1362 1368
1363 void LayerTreeHostImpl::clearCurrentlyScrollingLayer() 1369 void LayerTreeHostImpl::clearCurrentlyScrollingLayer()
1364 { 1370 {
1365 m_activeTree->ClearCurrentlyScrollingLayer(); 1371 m_activeTree->ClearCurrentlyScrollingLayer();
1366 m_didLockScrollingLayer = false; 1372 m_didLockScrollingLayer = false;
1367 } 1373 }
1368 1374
1369 void LayerTreeHostImpl::scrollEnd() 1375 void LayerTreeHostImpl::scrollEnd()
1370 { 1376 {
1371 if (m_topControlsManager) 1377 if (m_topControlsManager)
1372 m_topControlsManager->ScrollEnd(); 1378 m_topControlsManager->ScrollEnd();
1373 clearCurrentlyScrollingLayer(); 1379 clearCurrentlyScrollingLayer();
1380 if (activeTree()->HasPinchZoomScrollbars())
1381 m_client->setNeedsRedrawOnImplThread();
1374 } 1382 }
1375 1383
1376 void LayerTreeHostImpl::pinchGestureBegin() 1384 void LayerTreeHostImpl::pinchGestureBegin()
1377 { 1385 {
1378 m_pinchGestureActive = true; 1386 m_pinchGestureActive = true;
1379 m_previousPinchAnchor = gfx::Point(); 1387 m_previousPinchAnchor = gfx::Point();
1380 m_client->renewTreePriority(); 1388 m_client->renewTreePriority();
1381 } 1389 }
1382 1390
1383 void LayerTreeHostImpl::pinchGestureUpdate(float magnifyDelta, gfx::Point anchor ) 1391 void LayerTreeHostImpl::pinchGestureUpdate(float magnifyDelta, gfx::Point anchor )
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats ()); 1728 m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats ());
1721 } 1729 }
1722 1730
1723 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime, int commitNumber) 1731 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime, int commitNumber)
1724 { 1732 {
1725 DCHECK(m_debugState.continuousPainting); 1733 DCHECK(m_debugState.continuousPainting);
1726 m_paintTimeCounter->SavePaintTime(totalPaintTime, commitNumber); 1734 m_paintTimeCounter->SavePaintTime(totalPaintTime, commitNumber);
1727 } 1735 }
1728 1736
1729 } // namespace cc 1737 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698