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_impl.cc

Issue 11644008: Migrate from MathUtil::inverse() to gfx::Transform::GetInverse() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Partially addressed uninvertible cases Created 7 years, 12 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_impl.h" 5 #include "cc/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/animation_registrar.h" 10 #include "cc/animation_registrar.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return InputHandlerClient::ScrollOnMainThread; 256 return InputHandlerClient::ScrollOnMainThread;
257 } 257 }
258 258
259 if (!screenSpaceTransform().IsInvertible()) { 259 if (!screenSpaceTransform().IsInvertible()) {
260 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Ignored nonInvertibleTransform "); 260 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Ignored nonInvertibleTransform ");
261 return InputHandlerClient::ScrollIgnored; 261 return InputHandlerClient::ScrollIgnored;
262 } 262 }
263 263
264 if (!nonFastScrollableRegion().IsEmpty()) { 264 if (!nonFastScrollableRegion().IsEmpty()) {
265 bool clipped = false; 265 bool clipped = false;
266 gfx::PointF hitTestPointInContentSpace = MathUtil::projectPoint(MathUtil ::inverse(screenSpaceTransform()), screenSpacePoint, clipped); 266 // TODO: We shouldn't be applying a projection if screen space transform is uninvertible here.
267 // Perhaps we should be returning ScrollOnMainThread if GetInverse returns false?
268 gfx::Transform inverseScreenSpaceTransform(gfx::Transform::kSkipInitiali zation);
269 if (!screenSpaceTransform().GetInverse(&inverseScreenSpaceTransform))
270 inverseScreenSpaceTransform.MakeIdentity();
271
272 gfx::PointF hitTestPointInContentSpace = MathUtil::projectPoint(inverseS creenSpaceTransform, screenSpacePoint, clipped);
267 gfx::PointF hitTestPointInLayerSpace = gfx::ScalePoint(hitTestPointInCon tentSpace, 1 / contentsScaleX(), 1 / contentsScaleY()); 273 gfx::PointF hitTestPointInLayerSpace = gfx::ScalePoint(hitTestPointInCon tentSpace, 1 / contentsScaleX(), 1 / contentsScaleY());
268 if (!clipped && nonFastScrollableRegion().Contains(gfx::ToRoundedPoint(h itTestPointInLayerSpace))) { 274 if (!clipped && nonFastScrollableRegion().Contains(gfx::ToRoundedPoint(h itTestPointInLayerSpace))) {
269 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed nonFastScrollableRe gion"); 275 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed nonFastScrollableRe gion");
270 return InputHandlerClient::ScrollOnMainThread; 276 return InputHandlerClient::ScrollOnMainThread;
271 } 277 }
272 } 278 }
273 279
274 if (type == InputHandlerClient::Wheel && haveWheelEventHandlers()) { 280 if (type == InputHandlerClient::Wheel && haveWheelEventHandlers()) {
275 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed wheelEventHandlers"); 281 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed wheelEventHandlers");
276 return InputHandlerClient::ScrollOnMainThread; 282 return InputHandlerClient::ScrollOnMainThread;
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 822
817 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) 823 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer)
818 { 824 {
819 if (!m_scrollbarAnimationController) 825 if (!m_scrollbarAnimationController)
820 m_scrollbarAnimationController = ScrollbarAnimationController::create(th is); 826 m_scrollbarAnimationController = ScrollbarAnimationController::create(th is);
821 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); 827 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer);
822 m_scrollbarAnimationController->updateScrollOffset(this); 828 m_scrollbarAnimationController->updateScrollOffset(this);
823 } 829 }
824 830
825 } // namespace cc 831 } // namespace cc
OLDNEW
« cc/direct_renderer.cc ('K') | « cc/gl_renderer.cc ('k') | cc/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698