I think it’s nuts too, but in both cases there is no clipping (other than that in the component client area). Not sure exactly what other stuff could slow it down. Additionally, when I use the default Oversampling_4times setting in JUCE, AGG is still up to 5 times faster (but then I tried 100 segments) with much better anti-alias quality.
Anyway, here’s the code I used so you can check if there’s something else I might have done wrong:
Agg2D agg(g, getWidth(), getHeight());
for (int i = 0; i < 20; ++i)
double x1 = rnd.nextDouble() * getWidth()/2;
double x2 = x1 + getWidth()/2;
double y = rnd.nextDouble() * getHeight();
if (i == 0)
int64 juceStart = Time::getHighResolutionTicks();
int64 juceTime = Time::getHighResolutionTicks() - juceStart;
int64 aggStart = Time::getHighResolutionTicks();
int64 aggTime = Time::getHighResolutionTicks() - aggStart;
Logger::outputDebugPrintf(JUCE_T(“Juce: %lf s, AGG: %lf s”), Time::highResolutionTicksToSeconds(juceTime), Time::highResolutionTicksToSeconds(aggTime));[/code]
Note that the path adding part is not timed, I figured it would be negligible. Also, I’ve patched Agg2D to take a Graphics object (and in it I create an Image, attach it to a AGG rendering buffer, then on destruction I draw the Image into the Graphics object).