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

Unified Diff: Source/platform/transforms/TransformationMatrix.cpp

Issue 328333003: Adding Blink-side 3d Box and Bounds calculations to TransformOperations (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
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())

Powered by Google App Engine
This is Rietveld 408576698