Added drawing rounded rectangles to the graphics benchmark.

This test is executed together with standard rectangles benchmark and both benchmarks are enabled with '--rectangles' option.
This commit is contained in:
Artur Wieczorek 2016-06-05 21:58:18 +02:00
parent 81d9208424
commit 82a0e285d8

View File

@ -369,6 +369,7 @@ private:
BenchmarkLines(msg, dc);
BenchmarkRawBitmaps(msg, dc);
BenchmarkRectangles(msg, dc);
BenchmarkRoundedRectangles(msg, dc);
BenchmarkCircles(msg, dc);
BenchmarkEllipses(msg, dc);
}
@ -437,6 +438,36 @@ private:
opts.numIters, t, (1000. * t)/opts.numIters);
}
void BenchmarkRoundedRectangles(const wxString& msg, wxDC& dc)
{
if ( !opts.testRectangles )
return;
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
dc.SetBrush( *wxCYAN_BRUSH );
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
wxStopWatch sw;
for ( int n = 0; n < opts.numIters; n++ )
{
int x = rand() % opts.width,
y = rand() % opts.height;
dc.DrawRoundedRectangle(x, y, 48, 32, 8);
}
const long t = sw.Time();
wxPrintf("%ld rounded rects done in %ldms = %gus/rect\n",
opts.numIters, t, (1000. * t)/opts.numIters);
}
void BenchmarkCircles(const wxString& msg, wxDC& dc)
{
if ( !opts.testCircles )