From 51f64663bf600d5b1d2f8d2643f722c8a062df62 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 5 Feb 2013 20:46:53 +0000 Subject: [PATCH] Allow running only some graphics benchmarks to save time. Running all the benchmarks is relatively long, so allow running individual ones only. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73467 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/benchmarks/graphics.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/benchmarks/graphics.cpp b/tests/benchmarks/graphics.cpp index 4ebb8541c3..7d4184fa4a 100644 --- a/tests/benchmarks/graphics.cpp +++ b/tests/benchmarks/graphics.cpp @@ -28,6 +28,10 @@ struct GraphicsBenchmarkOptions height = 600; numLines = 10000; + + testBitmaps = + testLines = + testRectangles = false; } long mapMode, @@ -35,6 +39,10 @@ struct GraphicsBenchmarkOptions width, height, numLines; + + bool testBitmaps, + testLines, + testRectangles; } opts; class GraphicsBenchmarkFrame : public wxFrame @@ -97,6 +105,9 @@ private: void BenchmarkLines(const char *msg, wxDC& dc) { + if ( !opts.testLines ) + return; + if ( opts.mapMode != 0 ) dc.SetMapMode((wxMappingMode)opts.mapMode); if ( opts.penWidth != 0 ) @@ -127,6 +138,9 @@ private: void BenchmarkRectangles(const char *msg, wxDC& dc) { + if ( !opts.testRectangles ) + return; + if ( opts.mapMode != 0 ) dc.SetMapMode((wxMappingMode)opts.mapMode); if ( opts.penWidth != 0 ) @@ -153,6 +167,9 @@ private: void BenchmarkBitmaps(const char *msg, wxDC& dc) { + if ( !opts.testBitmaps ) + return; + if ( opts.mapMode != 0 ) dc.SetMapMode((wxMappingMode)opts.mapMode); if ( opts.penWidth != 0 ) @@ -186,6 +203,9 @@ public: { static const wxCmdLineEntryDesc desc[] = { + { wxCMD_LINE_SWITCH, "", "bitmaps" }, + { wxCMD_LINE_SWITCH, "", "lines" }, + { wxCMD_LINE_SWITCH, "", "rectangles" }, { wxCMD_LINE_OPTION, "m", "map-mode", "", wxCMD_LINE_VAL_NUMBER }, { wxCMD_LINE_OPTION, "p", "pen-width", "", wxCMD_LINE_VAL_NUMBER }, { wxCMD_LINE_OPTION, "w", "width", "", wxCMD_LINE_VAL_NUMBER }, @@ -211,6 +231,17 @@ public: if ( parser.Found("L", &opts.numLines) && opts.numLines < 1 ) return false; + opts.testBitmaps = parser.Found("bitmaps"); + opts.testLines = parser.Found("lines"); + opts.testRectangles = parser.Found("rectangles"); + if ( !(opts.testBitmaps || opts.testLines || opts.testRectangles) ) + { + // Do everything by default. + opts.testBitmaps = + opts.testLines = + opts.testRectangles = true; + } + return true; } -- 2.45.2