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

Side by Side Diff: cc/layer_tree_host.cc

Issue 11644008: Migrate from MathUtil::inverse() to gfx::Transform::GetInverse() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved uninvertible matrix identity-initialization into gfx::Transform Created 7 years, 11 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.h" 5 #include "cc/layer_tree_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 gfx::PointF LayerTreeHost::adjustEventPointForPinchZoom(const gfx::PointF& zoome dViewportPoint) 787 gfx::PointF LayerTreeHost::adjustEventPointForPinchZoom(const gfx::PointF& zoome dViewportPoint)
788 const 788 const
789 { 789 {
790 if (m_implTransform.IsIdentity()) 790 if (m_implTransform.IsIdentity())
791 return zoomedViewportPoint; 791 return zoomedViewportPoint;
792 792
793 DCHECK(m_implTransform.IsInvertible()); 793 DCHECK(m_implTransform.IsInvertible());
794 794
795 // Scale to screen space before applying implTransform inverse. 795 // Scale to screen space before applying implTransform inverse.
796 gfx::PointF zoomedScreenspacePoint = gfx::ScalePoint(zoomedViewportPoint, de viceScaleFactor()); 796 gfx::PointF zoomedScreenspacePoint = gfx::ScalePoint(zoomedViewportPoint, de viceScaleFactor());
797 gfx::Transform inverseImplTransform = MathUtil::inverse(m_implTransform); 797
798 gfx::Transform inverseImplTransform(gfx::Transform::kSkipInitialization);
799 if (!m_implTransform.GetInverse(&inverseImplTransform)) {
800 // TODO(shawnsingh): Either we need to handle uninvertible transforms
801 // here, or DCHECK that the transform is invertible.
danakj 2013/01/04 21:56:07 Thanks, I like how this makes current potential bu
802 }
798 803
799 bool wasClipped = false; 804 bool wasClipped = false;
800 gfx::PointF unzoomedScreenspacePoint = MathUtil::projectPoint(inverseImplTra nsform, zoomedScreenspacePoint, wasClipped); 805 gfx::PointF unzoomedScreenspacePoint = MathUtil::projectPoint(inverseImplTra nsform, zoomedScreenspacePoint, wasClipped);
801 DCHECK(!wasClipped); 806 DCHECK(!wasClipped);
802 807
803 // Convert back to logical pixels for hit testing. 808 // Convert back to logical pixels for hit testing.
804 gfx::PointF unzoomedViewportPoint = gfx::ScalePoint(unzoomedScreenspacePoint , 1 / deviceScaleFactor()); 809 gfx::PointF unzoomedViewportPoint = gfx::ScalePoint(unzoomedScreenspacePoint , 1 / deviceScaleFactor());
805 810
806 return unzoomedViewportPoint; 811 return unzoomedViewportPoint;
807 } 812 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 else 897 else
893 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); 898 layer->notifyAnimationFinished(wallClockTime.ToDoubleT());
894 } 899 }
895 } 900 }
896 901
897 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 902 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
898 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 903 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
899 } 904 }
900 905
901 } // namespace cc 906 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_impl.cc ('k') | cc/layer_tree_host_common.cc » ('j') | cc/layer_tree_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698