From 6e6f4d35725a4600c41baf5c0e0ef690cff89eef Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 5 Feb 2013 20:47:07 +0000 Subject: [PATCH] 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 --- tests/benchmarks/graphics.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/graphics.cpp b/tests/benchmarks/graphics.cpp index a5f9a49705..457aa39ade 100644 --- a/tests/benchmarks/graphics.cpp +++ b/tests/benchmarks/graphics.cpp @@ -81,6 +81,18 @@ public: } 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)) { if ( opts.usePaint ) @@ -233,7 +245,7 @@ private: wxStopWatch sw; for ( int n = 0; n < opts.numIters; n++ ) { - image.Clear(n % 256); + UpdateRGB(image.GetData(), n); dc.DrawBitmap(image, 0, 0); } @@ -261,7 +273,7 @@ private: wxStopWatch sw; for ( int n = 0; n < opts.numIters; n++ ) { - const unsigned char c = n % 256; + unsigned char c = n % 256; { wxNativePixelData::Iterator p(data); for ( int y = 0; y < opts.height; ++y ) @@ -278,6 +290,7 @@ private: p = rowStart; p.OffsetY(data, 1); + c++; } } -- 2.47.2