Commit Graph

20 Commits

Author SHA1 Message Date
Seebs c6e7a83467 Reduce copying in fillPolygon
A slice of points means copying every point into the slice, then
copying every point's data from the slice to TrianglesData. An
array of indicies lets the compiler make better choices.
2017-06-09 10:37:47 -05:00
Seebs b6533006e7 smaller imdraw optimizations
For polyline, don't compute each normal twice; when we're going through a line,
the "next" normal for segment N is always the "previous" normal for segment
N+1, and we can compute fewer of them.
2017-06-09 10:37:47 -05:00
Seebs 9d1fc5bd1f use point pool
For internal operations (anything using getAndClearPoints), there's a
pretty good chance that the operation will repeatedly invoke something
like fillPolygon(), meaning that it needs to push "a few" points
and then invoke something that uses those points.

So, we add a slice for containing spare slices of points, and on the
way out of each such function, shove the current imd.points (as used
inside that function) onto a stack, and set imd.points to [0:0] of
the thing it was called with.

Performance goes from 11-13fps to 17-18fps on my test case.
2017-06-09 10:37:47 -05:00
faiface fcfeb200b6 replace complex128 Vec with a struct 2017-05-21 19:25:06 +02:00
faiface 022f25895a change IMDraw properties to fields 2017-05-18 23:50:45 +02:00
faiface b333cd2e0b IMDraw: change default point color to (1, 1, 1, 1) (was (0, 0, 0, 0)) 2017-05-06 22:57:55 +02:00
faiface 663727731c remove commented code 2017-04-21 16:43:56 +02:00
faiface ac61175aea fix drawing non-closed lines in IMDraw 2017-04-21 01:17:29 +02:00
faiface fc2a7a8afc simplify code in IMDraw 2017-04-16 00:59:07 +02:00
faiface 9d48c4a828 add IMDraw.Rectangle 2017-04-16 00:01:43 +02:00
faiface f0303c27af immediate-like-mode -> immediate-mode-like 2017-04-13 17:44:28 +02:00
faiface 7939b1fdb7 add imdraw package doc comment 2017-04-13 17:41:38 +02:00
faiface b2819732fc clarify IMDraw.Draw doc 2017-04-12 16:03:36 +02:00
faiface 3e65588e00 adopt RGB and Alpha 2017-04-10 17:25:56 +02:00
faiface f4916a4272 replace NRGBA to RGBA because Porter-Duff (!!!) 2017-04-09 22:00:26 +02:00
faiface 379b4df667 adopt new ToNRGBA function 2017-03-23 23:07:49 +01:00
faiface fb8424cd32 add support for one point lines in imdraw 2017-03-23 19:38:53 +01:00
faiface 4619398b9e fix 0 vector len + fix imdraw polyline 2017-03-23 19:15:06 +01:00
faiface 0585b0af8c improve imdraw doc 2017-03-22 18:53:25 +01:00
faiface 5e698c63f0 move IMDraw to separate package 2017-03-21 11:33:11 +01:00