Index: ui/gfx/transform_util.cc |
diff --git a/ui/gfx/transform_util.cc b/ui/gfx/transform_util.cc |
index 655ce57f2bb2b799cbf7da1b69164d97e5a42dd0..37d3e538196e6bdff10d5fb5ccd61679bf57980e 100644 |
--- a/ui/gfx/transform_util.cc |
+++ b/ui/gfx/transform_util.cc |
@@ -282,6 +282,15 @@ Transform GetScaleTransform(const Point& anchor, float scale) { |
return transform; |
} |
+Transform GetRectTransform(const gfx::Rect& from, const gfx::Rect& to) { |
+ Transform transform; |
+ transform.Translate(to.x(), to.y()); |
+ transform.Scale(static_cast<double>(to.width()) / from.width(), |
Matt Giuca
2014/11/04 01:05:17
Going to have infinities if from.width() or from.h
calamity
2014/11/04 01:40:29
Done.
|
+ static_cast<double>(to.height()) / from.height()); |
+ transform.Translate(-from.x(), -from.y()); |
+ return transform; |
+} |
+ |
DecomposedTransform::DecomposedTransform() { |
translate[0] = translate[1] = translate[2] = 0.0; |
scale[0] = scale[1] = scale[2] = 1.0; |