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

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: Fixing android build 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..4403d3e7ec91180ff8865f15023b1a11d25ce89b 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,28 @@ 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(), j * box.height(), k * box.depth());
+ 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())
« no previous file with comments | « Source/platform/transforms/TransformationMatrix.h ('k') | Source/platform/transforms/TranslateTransformOperation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698