summaryrefslogtreecommitdiffstats
path: root/gfx
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-09-04 12:00:36 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-09-04 12:00:36 +0200
commit69ac6335874875b3dd14a391e5ddcd73ad60f23d (patch)
treea6654003e6361258db269c9851543970a3608c9c /gfx
parent7b986188c1c3331a80fe0fb4062a060050b85e2a (diff)
downloadUXP-69ac6335874875b3dd14a391e5ddcd73ad60f23d.tar
UXP-69ac6335874875b3dd14a391e5ddcd73ad60f23d.tar.gz
UXP-69ac6335874875b3dd14a391e5ddcd73ad60f23d.tar.lz
UXP-69ac6335874875b3dd14a391e5ddcd73ad60f23d.tar.xz
UXP-69ac6335874875b3dd14a391e5ddcd73ad60f23d.zip
Revert "Correctly return zero vertices if clipping plane 0 or 2 clip away the"
This reverts commit 09a8b2f19689b679b1268a3004ec5e3f37b9732a.
Diffstat (limited to 'gfx')
-rw-r--r--gfx/2d/Matrix.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/gfx/2d/Matrix.h b/gfx/2d/Matrix.h
index 84c9a5280..22a01ca10 100644
--- a/gfx/2d/Matrix.h
+++ b/gfx/2d/Matrix.h
@@ -734,8 +734,7 @@ public:
// Initialize a double-buffered array of points in homogenous space with
// the input rectangle, aRect.
Point4DTyped<UnknownUnits, F> points[2][kTransformAndClipRectMaxVerts];
- Point4DTyped<UnknownUnits, F>* dstPointStart = points[0];
- Point4DTyped<UnknownUnits, F>* dstPoint = dstPointStart;
+ Point4DTyped<UnknownUnits, F>* dstPoint = points[0];
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.x, aRect.y, 0, 1));
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.XMost(), aRect.y, 0, 1));
@@ -755,11 +754,11 @@ public:
// points[1].
for (int plane=0; plane < 4; plane++) {
planeNormals[plane].Normalize();
- Point4DTyped<UnknownUnits, F>* srcPoint = dstPointStart;
+ Point4DTyped<UnknownUnits, F>* srcPoint = points[plane & 1];
Point4DTyped<UnknownUnits, F>* srcPointEnd = dstPoint;
- dstPointStart = points[~plane & 1];
- dstPoint = dstPointStart;
+ dstPoint = points[~plane & 1];
+ Point4DTyped<UnknownUnits, F>* dstPointStart = dstPoint;
Point4DTyped<UnknownUnits, F>* prevPoint = srcPointEnd - 1;
F prevDot = planeNormals[plane].DotProduct(*prevPoint);
@@ -788,10 +787,10 @@ public:
}
}
- Point4DTyped<UnknownUnits, F>* srcPoint = dstPointStart;
- Point4DTyped<UnknownUnits, F>* srcPointEnd = dstPoint;
- size_t vertCount = 0;
- while (srcPoint < srcPointEnd) {
+ size_t dstPointCount = 0;
+ size_t srcPointCount = dstPoint - points[0];
+ for (Point4DTyped<UnknownUnits, F>* srcPoint = points[0]; srcPoint < points[0] + srcPointCount; srcPoint++) {
+
PointTyped<TargetUnits, F> p;
if (srcPoint->w == 0.0) {
// If a point lies on the intersection of the clipping planes at
@@ -801,13 +800,12 @@ public:
p = srcPoint->As2DPoint();
}
// Emit only unique points
- if (vertCount == 0 || p != aVerts[vertCount - 1]) {
- aVerts[vertCount++] = p;
+ if (dstPointCount == 0 || p != aVerts[dstPointCount - 1]) {
+ aVerts[dstPointCount++] = p;
}
- srcPoint++;
}
- return vertCount;
+ return dstPointCount;
}
static const int kTransformAndClipRectMaxVerts = 32;