Bug 1595038 - Add a planeNormal variable so that it's clear that the same plane is used for the entire inner loop. r=kip

Differential Revision: https://phabricator.services.mozilla.com/D68702

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2020-04-02 02:42:17 +00:00
Родитель d4709d16f3
Коммит c1f3167506
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -861,7 +861,8 @@ class Matrix4x4Typed {
// current clipped polygon. We double buffer that set of points, alternating
// between points[0] and points[1].
for (int plane = 0; plane < 4; plane++) {
planeNormals[plane].Normalize();
auto planeNormal = planeNormals[plane];
planeNormal.Normalize();
Point4DTyped<UnknownUnits, F>* srcPoint = dstPointStart;
Point4DTyped<UnknownUnits, F>* srcPointEnd = dstPoint;
@ -877,10 +878,10 @@ class Matrix4x4Typed {
// We may create duplicated points in the polygon. We keep those around
// until all clipping is done and then filter out duplicates at the end.
Point4DTyped<UnknownUnits, F>* prevPoint = srcPointEnd - 1;
F prevDot = planeNormals[plane].DotProduct(*prevPoint);
F prevDot = planeNormal.DotProduct(*prevPoint);
while (srcPoint < srcPointEnd &&
((dstPoint - dstPointStart) < kTransformAndClipRectMaxVerts)) {
F nextDot = planeNormals[plane].DotProduct(*srcPoint);
F nextDot = planeNormal.DotProduct(*srcPoint);
if ((nextDot >= 0.0) != (prevDot >= 0.0)) {
// An intersection with the clipping plane has been detected.