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

Unified Diff: ui/gfx/transform.cc

Issue 1883623002: Correct normal computation for inverted polygons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « ui/gfx/transform.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/transform.cc
diff --git a/ui/gfx/transform.cc b/ui/gfx/transform.cc
index a0445e45d7491bee4679e1352188845e65878049..88f0942a974f8067df245e8a6c2b1fb7cd803391 100644
--- a/ui/gfx/transform.cc
+++ b/ui/gfx/transform.cc
@@ -407,6 +407,11 @@ void Transform::TransformPoint(Point3F* point) const {
TransformPointInternal(matrix_, point);
}
+void Transform::TransformVector(Vector3dF* vector) const {
+ DCHECK(vector);
+ TransformVectorInternal(matrix_, vector);
+}
+
bool Transform::TransformPointReverse(Point* point) const {
DCHECK(point);
@@ -520,6 +525,22 @@ void Transform::TransformPointInternal(const SkMatrix44& xform,
}
}
+void Transform::TransformVectorInternal(const SkMatrix44& xform,
+ Vector3dF* vector) const {
+ if (xform.isIdentity())
+ return;
+
+ SkMScalar p[4] = {SkFloatToMScalar(vector->x()),
+ SkFloatToMScalar(vector->y()),
+ SkFloatToMScalar(vector->z()), 0};
+
+ xform.mapMScalars(p);
+
+ vector->set_x(p[0]);
+ vector->set_y(p[1]);
+ vector->set_z(p[2]);
+}
+
void Transform::TransformPointInternal(const SkMatrix44& xform,
Point* point) const {
if (xform.isIdentity())
« no previous file with comments | « ui/gfx/transform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698