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

Side by Side Diff: cc/layer_tree_host_impl.cc

Issue 11186039: Move CC switches to cc/switches.h. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Switch ui/compositor back to using compositorSupport() Created 8 years, 2 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
« no previous file with comments | « cc/layer_tree_host.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 "config.h" 5 #include "config.h"
6 6
7 #include "CCLayerTreeHostImpl.h" 7 #include "CCLayerTreeHostImpl.h"
8 8
9 #include "CCAppendQuadsData.h" 9 #include "CCAppendQuadsData.h"
10 #include "CCDamageTracker.h" 10 #include "CCDamageTracker.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 return overflow; 140 return overflow;
141 } 141 }
142 142
143 WebTransformationMatrix CCPinchZoomViewport::implTransform() const 143 WebTransformationMatrix CCPinchZoomViewport::implTransform() const
144 { 144 {
145 WebTransformationMatrix transform; 145 WebTransformationMatrix transform;
146 transform.scale(m_pageScaleDelta); 146 transform.scale(m_pageScaleDelta);
147 147
148 // If the pinch state is applied in the impl, then push it to the 148 // If the pinch state is applied in the impl, then push it to the
149 // impl transform, otherwise the scale is handled by WebCore. 149 // impl transform, otherwise the scale is handled by WebCore.
150 if (CCSettings::pageScalePinchZoomEnabled()) { 150 if (Settings::pageScalePinchZoomEnabled()) {
151 transform.scale(m_pageScaleFactor); 151 transform.scale(m_pageScaleFactor);
152 transform.translate(-m_pinchViewportScrollDelta.x(), 152 transform.translate(-m_pinchViewportScrollDelta.x(),
153 -m_pinchViewportScrollDelta.y()); 153 -m_pinchViewportScrollDelta.y());
154 } 154 }
155 155
156 return transform; 156 return transform;
157 } 157 }
158 158
159 class CCLayerTreeHostImplTimeSourceAdapter : public CCTimeSourceClient { 159 class CCLayerTreeHostImplTimeSourceAdapter : public CCTimeSourceClient {
160 public: 160 public:
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 433
434 targetRenderPass->appendQuadsForLayer(*it, &occlusionTracker, ap pendQuadsData); 434 targetRenderPass->appendQuadsForLayer(*it, &occlusionTracker, ap pendQuadsData);
435 } 435 }
436 } 436 }
437 437
438 if (appendQuadsData.hadOcclusionFromOutsideTargetSurface) 438 if (appendQuadsData.hadOcclusionFromOutsideTargetSurface)
439 targetRenderPass->setHasOcclusionFromOutsideTargetSurface(true); 439 targetRenderPass->setHasOcclusionFromOutsideTargetSurface(true);
440 440
441 if (appendQuadsData.hadMissingTiles) { 441 if (appendQuadsData.hadMissingTiles) {
442 bool layerHasAnimatingTransform = it->screenSpaceTransformIsAnimatin g() || it->drawTransformIsAnimating(); 442 bool layerHasAnimatingTransform = it->screenSpaceTransformIsAnimatin g() || it->drawTransformIsAnimating();
443 if (layerHasAnimatingTransform || CCSettings::jankInsteadOfCheckerbo ard()) 443 if (layerHasAnimatingTransform || Settings::jankInsteadOfCheckerboar d())
444 drawFrame = false; 444 drawFrame = false;
445 } 445 }
446 446
447 occlusionTracker.leaveLayer(it); 447 occlusionTracker.leaveLayer(it);
448 } 448 }
449 449
450 #ifndef NDEBUG 450 #ifndef NDEBUG
451 for (size_t i = 0; i < frame.renderPasses.size(); ++i) { 451 for (size_t i = 0; i < frame.renderPasses.size(); ++i) {
452 for (size_t j = 0; j < frame.renderPasses[i]->quadList().size(); ++j) 452 for (size_t j = 0; j < frame.renderPasses[i]->quadList().size(); ++j)
453 DCHECK(frame.renderPasses[i]->quadList()[j]->sharedQuadStateId() >= 0); 453 DCHECK(frame.renderPasses[i]->quadList()[j]->sharedQuadStateId() >= 0);
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 } 927 }
928 928
929 void CCLayerTreeHostImpl::setPageScaleFactorAndLimits(float pageScaleFactor, flo at minPageScaleFactor, float maxPageScaleFactor) 929 void CCLayerTreeHostImpl::setPageScaleFactorAndLimits(float pageScaleFactor, flo at minPageScaleFactor, float maxPageScaleFactor)
930 { 930 {
931 if (!pageScaleFactor) 931 if (!pageScaleFactor)
932 return; 932 return;
933 933
934 float pageScaleChange = pageScaleFactor / m_pinchZoomViewport.pageScaleFacto r(); 934 float pageScaleChange = pageScaleFactor / m_pinchZoomViewport.pageScaleFacto r();
935 m_pinchZoomViewport.setPageScaleFactorAndLimits(pageScaleFactor, minPageScal eFactor, maxPageScaleFactor); 935 m_pinchZoomViewport.setPageScaleFactorAndLimits(pageScaleFactor, minPageScal eFactor, maxPageScaleFactor);
936 936
937 if (!CCSettings::pageScalePinchZoomEnabled()) { 937 if (!Settings::pageScalePinchZoomEnabled()) {
938 if (pageScaleChange != 1) 938 if (pageScaleChange != 1)
939 adjustScrollsForPageScaleChange(m_rootScrollLayerImpl, pageScaleChan ge); 939 adjustScrollsForPageScaleChange(m_rootScrollLayerImpl, pageScaleChan ge);
940 } 940 }
941 941
942 // Clamp delta to limits and refresh display matrix. 942 // Clamp delta to limits and refresh display matrix.
943 setPageScaleDelta(m_pinchZoomViewport.pageScaleDelta() / m_pinchZoomViewport .sentPageScaleDelta()); 943 setPageScaleDelta(m_pinchZoomViewport.pageScaleDelta() / m_pinchZoomViewport .sentPageScaleDelta());
944 m_pinchZoomViewport.setSentPageScaleDelta(1); 944 m_pinchZoomViewport.setSentPageScaleDelta(1);
945 } 945 }
946 946
947 void CCLayerTreeHostImpl::setPageScaleDelta(float delta) 947 void CCLayerTreeHostImpl::setPageScaleDelta(float delta)
(...skipping 11 matching lines...) Expand all
959 FloatSize viewBounds = m_deviceViewportSize; 959 FloatSize viewBounds = m_deviceViewportSize;
960 if (CCLayerImpl* clipLayer = m_rootScrollLayerImpl->parent()) { 960 if (CCLayerImpl* clipLayer = m_rootScrollLayerImpl->parent()) {
961 // Compensate for non-overlay scrollbars. 961 // Compensate for non-overlay scrollbars.
962 if (clipLayer->masksToBounds()) { 962 if (clipLayer->masksToBounds()) {
963 viewBounds = clipLayer->bounds(); 963 viewBounds = clipLayer->bounds();
964 viewBounds.scale(m_deviceScaleFactor); 964 viewBounds.scale(m_deviceScaleFactor);
965 } 965 }
966 } 966 }
967 967
968 IntSize contentBounds = contentSize(); 968 IntSize contentBounds = contentSize();
969 if (CCSettings::pageScalePinchZoomEnabled()) { 969 if (Settings::pageScalePinchZoomEnabled()) {
970 // Pinch with pageScale scrolls entirely in layout space. contentSize 970 // Pinch with pageScale scrolls entirely in layout space. contentSize
971 // returns the bounds including the page scale factor, so calculate the 971 // returns the bounds including the page scale factor, so calculate the
972 // pre page-scale layout size here. 972 // pre page-scale layout size here.
973 float pageScaleFactor = m_pinchZoomViewport.pageScaleFactor(); 973 float pageScaleFactor = m_pinchZoomViewport.pageScaleFactor();
974 contentBounds.setWidth(contentBounds.width() / pageScaleFactor); 974 contentBounds.setWidth(contentBounds.width() / pageScaleFactor);
975 contentBounds.setHeight(contentBounds.height() / pageScaleFactor); 975 contentBounds.setHeight(contentBounds.height() / pageScaleFactor);
976 } else { 976 } else {
977 viewBounds.scale(1 / m_pinchZoomViewport.pageScaleDelta()); 977 viewBounds.scale(1 / m_pinchZoomViewport.pageScaleDelta());
978 } 978 }
979 979
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 float pageScaleDelta = m_pinchZoomViewport.pageScaleDelta(); 1195 float pageScaleDelta = m_pinchZoomViewport.pageScaleDelta();
1196 FloatPoint previousScaleAnchor(m_previousPinchAnchor.x() / pageScaleDelta, 1196 FloatPoint previousScaleAnchor(m_previousPinchAnchor.x() / pageScaleDelta,
1197 m_previousPinchAnchor.y() / pageScaleDelta); 1197 m_previousPinchAnchor.y() / pageScaleDelta);
1198 setPageScaleDelta(pageScaleDelta * magnifyDelta); 1198 setPageScaleDelta(pageScaleDelta * magnifyDelta);
1199 pageScaleDelta = m_pinchZoomViewport.pageScaleDelta(); 1199 pageScaleDelta = m_pinchZoomViewport.pageScaleDelta();
1200 FloatPoint newScaleAnchor(anchor.x() / pageScaleDelta, anchor.y() / pageScal eDelta); 1200 FloatPoint newScaleAnchor(anchor.x() / pageScaleDelta, anchor.y() / pageScal eDelta);
1201 FloatSize move = previousScaleAnchor - newScaleAnchor; 1201 FloatSize move = previousScaleAnchor - newScaleAnchor;
1202 1202
1203 m_previousPinchAnchor = anchor; 1203 m_previousPinchAnchor = anchor;
1204 1204
1205 if (CCSettings::pageScalePinchZoomEnabled()) { 1205 if (Settings::pageScalePinchZoomEnabled()) {
1206 // Compute the application of the delta with respect to the current page zoom of the page. 1206 // Compute the application of the delta with respect to the current page zoom of the page.
1207 move.scale(1 / (m_pinchZoomViewport.pageScaleFactor() * m_deviceScaleFac tor)); 1207 move.scale(1 / (m_pinchZoomViewport.pageScaleFactor() * m_deviceScaleFac tor));
1208 } 1208 }
1209 1209
1210 FloatSize scrollOverflow = CCSettings::pageScalePinchZoomEnabled() ? m_pinch ZoomViewport.applyScroll(move) : move; 1210 FloatSize scrollOverflow = Settings::pageScalePinchZoomEnabled() ? m_pinchZo omViewport.applyScroll(move) : move;
1211 m_rootScrollLayerImpl->scrollBy(roundedIntSize(scrollOverflow)); 1211 m_rootScrollLayerImpl->scrollBy(roundedIntSize(scrollOverflow));
1212 1212
1213 if (m_rootScrollLayerImpl->scrollbarAnimationController()) 1213 if (m_rootScrollLayerImpl->scrollbarAnimationController())
1214 m_rootScrollLayerImpl->scrollbarAnimationController()->didPinchGestureUp date(); 1214 m_rootScrollLayerImpl->scrollbarAnimationController()->didPinchGestureUp date();
1215 1215
1216 m_client->setNeedsCommitOnImplThread(); 1216 m_client->setNeedsCommitOnImplThread();
1217 m_client->setNeedsRedrawOnImplThread(); 1217 m_client->setNeedsRedrawOnImplThread();
1218 } 1218 }
1219 1219
1220 void CCLayerTreeHostImpl::pinchGestureEnd() 1220 void CCLayerTreeHostImpl::pinchGestureEnd()
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 1301
1302 scoped_ptr<CCScrollAndScaleSet> CCLayerTreeHostImpl::processScrollDeltas() 1302 scoped_ptr<CCScrollAndScaleSet> CCLayerTreeHostImpl::processScrollDeltas()
1303 { 1303 {
1304 scoped_ptr<CCScrollAndScaleSet> scrollInfo(new CCScrollAndScaleSet()); 1304 scoped_ptr<CCScrollAndScaleSet> scrollInfo(new CCScrollAndScaleSet());
1305 1305
1306 if (m_pinchGestureActive || m_pageScaleAnimation) { 1306 if (m_pinchGestureActive || m_pageScaleAnimation) {
1307 scrollInfo->pageScaleDelta = 1; 1307 scrollInfo->pageScaleDelta = 1;
1308 m_pinchZoomViewport.setSentPageScaleDelta(1); 1308 m_pinchZoomViewport.setSentPageScaleDelta(1);
1309 // FIXME(aelias): Make these painting optimizations compatible with 1309 // FIXME(aelias): Make these painting optimizations compatible with
1310 // compositor-side scaling. 1310 // compositor-side scaling.
1311 if (!CCSettings::pageScalePinchZoomEnabled()) { 1311 if (!Settings::pageScalePinchZoomEnabled()) {
1312 if (m_pinchGestureActive) 1312 if (m_pinchGestureActive)
1313 computePinchZoomDeltas(scrollInfo.get()); 1313 computePinchZoomDeltas(scrollInfo.get());
1314 else if (m_pageScaleAnimation.get()) 1314 else if (m_pageScaleAnimation.get())
1315 computeDoubleTapZoomDeltas(scrollInfo.get()); 1315 computeDoubleTapZoomDeltas(scrollInfo.get());
1316 } 1316 }
1317 return scrollInfo.Pass(); 1317 return scrollInfo.Pass();
1318 } 1318 }
1319 1319
1320 collectScrollDeltas(scrollInfo.get(), m_rootLayerImpl.get()); 1320 collectScrollDeltas(scrollInfo.get(), m_rootLayerImpl.get());
1321 scrollInfo->pageScaleDelta = m_pinchZoomViewport.pageScaleDelta(); 1321 scrollInfo->pageScaleDelta = m_pinchZoomViewport.pageScaleDelta();
(...skipping 30 matching lines...) Expand all
1352 m_client->setNeedsRedrawOnImplThread(); 1352 m_client->setNeedsRedrawOnImplThread();
1353 1353
1354 if (m_pageScaleAnimation->isAnimationCompleteAtTime(monotonicTime)) { 1354 if (m_pageScaleAnimation->isAnimationCompleteAtTime(monotonicTime)) {
1355 m_pageScaleAnimation.reset(); 1355 m_pageScaleAnimation.reset();
1356 m_client->setNeedsCommitOnImplThread(); 1356 m_client->setNeedsCommitOnImplThread();
1357 } 1357 }
1358 } 1358 }
1359 1359
1360 void CCLayerTreeHostImpl::animateLayers(double monotonicTime, double wallClockTi me) 1360 void CCLayerTreeHostImpl::animateLayers(double monotonicTime, double wallClockTi me)
1361 { 1361 {
1362 if (!CCSettings::acceleratedAnimationEnabled() || !m_needsAnimateLayers || ! m_rootLayerImpl) 1362 if (!Settings::acceleratedAnimationEnabled() || !m_needsAnimateLayers || !m_ rootLayerImpl)
1363 return; 1363 return;
1364 1364
1365 TRACE_EVENT0("cc", "CCLayerTreeHostImpl::animateLayers"); 1365 TRACE_EVENT0("cc", "CCLayerTreeHostImpl::animateLayers");
1366 1366
1367 scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEv entsVector)); 1367 scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(new CCAnimationEv entsVector));
1368 1368
1369 bool didAnimate = false; 1369 bool didAnimate = false;
1370 animateLayersRecursive(m_rootLayerImpl.get(), monotonicTime, wallClockTime, events.get(), didAnimate, m_needsAnimateLayers); 1370 animateLayersRecursive(m_rootLayerImpl.get(), monotonicTime, wallClockTime, events.get(), didAnimate, m_needsAnimateLayers);
1371 1371
1372 if (!events->empty()) 1372 if (!events->empty())
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 1454
1455 CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimat ionController(); 1455 CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimat ionController();
1456 if (scrollbarController && scrollbarController->animate(monotonicTime)) 1456 if (scrollbarController && scrollbarController->animate(monotonicTime))
1457 m_client->setNeedsRedrawOnImplThread(); 1457 m_client->setNeedsRedrawOnImplThread();
1458 1458
1459 for (size_t i = 0; i < layer->children().size(); ++i) 1459 for (size_t i = 0; i < layer->children().size(); ++i)
1460 animateScrollbarsRecursive(layer->children()[i], monotonicTime); 1460 animateScrollbarsRecursive(layer->children()[i], monotonicTime);
1461 } 1461 }
1462 1462
1463 } // namespace cc 1463 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host.cc ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698