Allow selecting the kinds of DC to test in the graphics benchmark too.
Still run all the tests by default but allow specifying --dc or --gc as well as --paint, --client or --memory to test just the specified kinds of DCs. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73470 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,6 +32,13 @@ struct GraphicsBenchmarkOptions
|
|||||||
testBitmaps =
|
testBitmaps =
|
||||||
testLines =
|
testLines =
|
||||||
testRectangles = false;
|
testRectangles = false;
|
||||||
|
|
||||||
|
usePaint =
|
||||||
|
useClient =
|
||||||
|
useMemory = false;
|
||||||
|
|
||||||
|
useDC =
|
||||||
|
useGC = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
long mapMode,
|
long mapMode,
|
||||||
@@ -43,6 +50,13 @@ struct GraphicsBenchmarkOptions
|
|||||||
bool testBitmaps,
|
bool testBitmaps,
|
||||||
testLines,
|
testLines,
|
||||||
testRectangles;
|
testRectangles;
|
||||||
|
|
||||||
|
bool usePaint,
|
||||||
|
useClient,
|
||||||
|
useMemory;
|
||||||
|
|
||||||
|
bool useDC,
|
||||||
|
useGC;
|
||||||
} opts;
|
} opts;
|
||||||
|
|
||||||
class GraphicsBenchmarkFrame : public wxFrame
|
class GraphicsBenchmarkFrame : public wxFrame
|
||||||
@@ -63,18 +77,21 @@ public:
|
|||||||
private:
|
private:
|
||||||
void OnPaint(wxPaintEvent& WXUNUSED(event))
|
void OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
if ( opts.usePaint )
|
||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
wxGCDC gcdc(dc);
|
wxGCDC gcdc(dc);
|
||||||
BenchmarkDCAndGC("paint", dc, gcdc);
|
BenchmarkDCAndGC("paint", dc, gcdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( opts.useClient )
|
||||||
{
|
{
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
wxGCDC gcdc(dc);
|
wxGCDC gcdc(dc);
|
||||||
BenchmarkDCAndGC("client", dc, gcdc);
|
BenchmarkDCAndGC("client", dc, gcdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( opts.useMemory )
|
||||||
{
|
{
|
||||||
wxBitmap bmp(opts.width, opts.height);
|
wxBitmap bmp(opts.width, opts.height);
|
||||||
wxMemoryDC dc(bmp);
|
wxMemoryDC dc(bmp);
|
||||||
@@ -87,7 +104,9 @@ private:
|
|||||||
|
|
||||||
void BenchmarkDCAndGC(const char* dckind, wxDC& dc, wxGCDC& gcdc)
|
void BenchmarkDCAndGC(const char* dckind, wxDC& dc, wxGCDC& gcdc)
|
||||||
{
|
{
|
||||||
|
if ( opts.useDC )
|
||||||
BenchmarkAll(wxString::Format("%6s DC", dckind), dc);
|
BenchmarkAll(wxString::Format("%6s DC", dckind), dc);
|
||||||
|
if ( opts.useGC )
|
||||||
BenchmarkAll(wxString::Format("%6s GC", dckind), gcdc);
|
BenchmarkAll(wxString::Format("%6s GC", dckind), gcdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,6 +223,11 @@ public:
|
|||||||
{ wxCMD_LINE_SWITCH, "", "bitmaps" },
|
{ wxCMD_LINE_SWITCH, "", "bitmaps" },
|
||||||
{ wxCMD_LINE_SWITCH, "", "lines" },
|
{ wxCMD_LINE_SWITCH, "", "lines" },
|
||||||
{ wxCMD_LINE_SWITCH, "", "rectangles" },
|
{ wxCMD_LINE_SWITCH, "", "rectangles" },
|
||||||
|
{ wxCMD_LINE_SWITCH, "", "paint" },
|
||||||
|
{ wxCMD_LINE_SWITCH, "", "client" },
|
||||||
|
{ wxCMD_LINE_SWITCH, "", "memory" },
|
||||||
|
{ wxCMD_LINE_SWITCH, "", "dc" },
|
||||||
|
{ wxCMD_LINE_SWITCH, "", "gc" },
|
||||||
{ wxCMD_LINE_OPTION, "m", "map-mode", "", wxCMD_LINE_VAL_NUMBER },
|
{ wxCMD_LINE_OPTION, "m", "map-mode", "", wxCMD_LINE_VAL_NUMBER },
|
||||||
{ wxCMD_LINE_OPTION, "p", "pen-width", "", wxCMD_LINE_VAL_NUMBER },
|
{ wxCMD_LINE_OPTION, "p", "pen-width", "", wxCMD_LINE_VAL_NUMBER },
|
||||||
{ wxCMD_LINE_OPTION, "w", "width", "", wxCMD_LINE_VAL_NUMBER },
|
{ wxCMD_LINE_OPTION, "w", "width", "", wxCMD_LINE_VAL_NUMBER },
|
||||||
@@ -240,6 +264,24 @@ public:
|
|||||||
opts.testRectangles = true;
|
opts.testRectangles = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts.usePaint = parser.Found("paint");
|
||||||
|
opts.useClient = parser.Found("client");
|
||||||
|
opts.useMemory = parser.Found("memory");
|
||||||
|
if ( !(opts.usePaint || opts.useClient || opts.useMemory) )
|
||||||
|
{
|
||||||
|
opts.usePaint =
|
||||||
|
opts.useClient =
|
||||||
|
opts.useMemory = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
opts.useDC = parser.Found("dc");
|
||||||
|
opts.useGC = parser.Found("gc");
|
||||||
|
if ( !(opts.useDC || opts.useGC) )
|
||||||
|
{
|
||||||
|
opts.useDC =
|
||||||
|
opts.useGC = true;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user