Chromium Code Reviews| Index: Source/platform/transforms/TransformationMatrix.cpp |
| diff --git a/Source/platform/transforms/TransformationMatrix.cpp b/Source/platform/transforms/TransformationMatrix.cpp |
| index ba4713bc4ee7020daab6c6d4f5a2c11e059dc7e7..5812ca48f0dc5b07c86dce9a1c2ebe94e4abf6f0 100644 |
| --- a/Source/platform/transforms/TransformationMatrix.cpp |
| +++ b/Source/platform/transforms/TransformationMatrix.cpp |
| @@ -28,6 +28,7 @@ |
| #include "config.h" |
| #include "platform/transforms/TransformationMatrix.h" |
| +#include "platform/geometry/FloatBox.h" |
| #include "platform/geometry/FloatQuad.h" |
| #include "platform/geometry/FloatRect.h" |
| #include "platform/geometry/IntRect.h" |
| @@ -646,6 +647,31 @@ LayoutRect TransformationMatrix::clampedBoundsOfProjectedQuad(const FloatQuad& q |
| return LayoutRect(LayoutUnit::clamp(left), LayoutUnit::clamp(top), LayoutUnit::clamp(right - left), LayoutUnit::clamp(bottom - top)); |
| } |
| +void TransformationMatrix::transformBox(FloatBox& box) const |
| +{ |
| + FloatBox bounds; |
| + bool firstPoint = true; |
| + for (size_t i = 0; i < 2; ++i) { |
| + for (size_t j = 0; j < 2; ++j) { |
| + for (size_t k = 0; k < 2; ++k) { |
| + FloatPoint3D point(box.x(), box.y(), box.z()); |
| + point += FloatPoint3D(i * box.width(), |
|
Ian Vollick
2014/06/17 15:54:56
nit: I think this would look prettier on one line
awoloszyn
2014/06/17 20:06:03
Done.
|
| + j * box.height(), |
| + k * box.depth()); |
| + point = mapPoint(point); |
| + if (firstPoint) { |
| + bounds.setOrigin(point); |
| + firstPoint = false; |
| + } else { |
| + bounds.expandTo(point); |
| + } |
| + } |
| + } |
| + } |
| + box = bounds; |
| +} |
|
Ian Vollick
2014/06/17 15:54:56
nit: extra ws.
awoloszyn
2014/06/17 20:06:03
Done.
|
| + |
| + |
| FloatPoint TransformationMatrix::mapPoint(const FloatPoint& p) const |
| { |
| if (isIdentityOrTranslation()) |