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..4bb51c7c052f59e5949c61449d01050484e93291 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,27 @@ 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 (int corner = 0; corner < 8; ++corner) { |
| + FloatPoint3D point(box.x(), box.y(), box.z()); |
| + point += FloatPoint3D(corner & 1? box.width() : 0, |
|
Ian Vollick
2014/06/16 15:23:38
Same comment about this little snippet.
awoloszyn
2014/06/17 14:26:01
Done.
|
| + corner & 2? box.height() : 0, |
| + corner & 4? box.depth() : 0); |
| + point = mapPoint(point); |
| + if (firstPoint) { |
| + bounds.setOrigin(point); |
| + firstPoint = false; |
| + } else { |
| + bounds.expandTo(point); |
| + } |
| + } |
| + box = bounds; |
| +} |
| + |
| + |
| FloatPoint TransformationMatrix::mapPoint(const FloatPoint& p) const |
| { |
| if (isIdentityOrTranslation()) |