Use a non-uniform bitmap for image tests in the graphics benchmark.

This makes it easier to estimate the speed of the display update visually.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-02-05 20:47:07 +00:00
parent ce0cdeb0b7
commit 6e6f4d3572

View File

@@ -81,6 +81,18 @@ public:
} }
private: private:
// Just change the image in some (quick) way to show that it's really being
// updated on screen.
void UpdateRGB(unsigned char* data, int n)
{
for ( int y = 0; y < opts.height; ++y )
{
memset(data, n % 256, 3*opts.width);
data += 3*opts.width;
n++;
}
}
void OnPaint(wxPaintEvent& WXUNUSED(event)) void OnPaint(wxPaintEvent& WXUNUSED(event))
{ {
if ( opts.usePaint ) if ( opts.usePaint )
@@ -233,7 +245,7 @@ private:
wxStopWatch sw; wxStopWatch sw;
for ( int n = 0; n < opts.numIters; n++ ) for ( int n = 0; n < opts.numIters; n++ )
{ {
image.Clear(n % 256); UpdateRGB(image.GetData(), n);
dc.DrawBitmap(image, 0, 0); dc.DrawBitmap(image, 0, 0);
} }
@@ -261,7 +273,7 @@ private:
wxStopWatch sw; wxStopWatch sw;
for ( int n = 0; n < opts.numIters; n++ ) for ( int n = 0; n < opts.numIters; n++ )
{ {
const unsigned char c = n % 256; unsigned char c = n % 256;
{ {
wxNativePixelData::Iterator p(data); wxNativePixelData::Iterator p(data);
for ( int y = 0; y < opts.height; ++y ) for ( int y = 0; y < opts.height; ++y )
@@ -278,6 +290,7 @@ private:
p = rowStart; p = rowStart;
p.OffsetY(data, 1); p.OffsetY(data, 1);
c++;
} }
} }