surface.DrawPoly is Acting Up

I’m trying to draw a complicated shape and the shape seems to break in two specific places.

The white background of each shape is the actual size of the panel I am drawing on and is visible for debug purposes.
The blue is the polygon.

The issue is with the rectangles that are supposed to jut out or in (the ones on the sides).
For some reason, the final point of each rectangle is ignored, making a sloped line instead of a horizontal one.

Here is the relative code:
for i=1, #(self:GetInputs() or {}) do
table.insert(self.tbl, {x=w,y=(i20)}) --20 is the spacing between each indent.
table.insert(self.tbl, {x=w-20,y=(i
table.insert(self.tbl, {x=w-20,y=(i20)+10})
table.insert(self.tbl, {x=w,y=(i
table.insert(self.tbl, {x=w,y=(i*20)+15})
Where self:GetInputs() returns a table size of one for print and a size of two for ents.FindInSphere. This code draws the indents on the right hand side.
The rest of the polygon is drawn above or below this snippet.

Essentially, drawpoly seems to be ignoring this line (line 5 above):
table.insert(self.tbl, {x=w,y=(i*20)+10})

What gives? Is there something about drawpoly that restricts it from working like this?

There is a triangular indent that is supposed to draw on top of print, but that doesn’t appear either.

Thank you for any help.

[editline]2:00AM PST[/editline]
I switched to using rectangles to make primitive shapes, but this problem is still bugging me.