Fixes to allow running with 64-bit wxGTK

- use correct printf format specifiers
- don't perform operations requiring a window until the window has been created


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70764 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett 2012-03-01 07:09:43 +00:00
parent 0309327e97
commit f8497215c1

View File

@ -15,6 +15,7 @@
#include "wx/dcmemory.h"
#include "wx/dcgraph.h"
#include "wx/stopwatch.h"
#include "wx/crt.h"
struct GraphicsBenchmarkOptions
{
@ -42,14 +43,20 @@ public:
GraphicsBenchmarkFrame()
: wxFrame(NULL, wxID_ANY, "wxWidgets Graphics Benchmark")
{
Connect(wxEVT_CREATE,
wxWindowCreateEventHandler(GraphicsBenchmarkFrame::OnCreate));
Connect(wxEVT_PAINT,
wxPaintEventHandler(GraphicsBenchmarkFrame::OnPaint));
m_bitmap.Create(64, 64, 32);
m_bitmap.Create(64, 64, 32);
Show();
SetClientSize(opts.width, opts.height);
}
private:
void OnCreate(wxWindowCreateEvent&)
{
wxClientDC dc(this);
BenchmarkLines("dc client", dc);
BenchmarkRectangles("dc client", dc);
@ -72,7 +79,6 @@ public:
BenchmarkBitmaps("gcdc memory", gcdc2);
}
protected:
void OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxPaintDC dc(this);
@ -114,7 +120,7 @@ protected:
const long t = sw.Time();
wxPrintf("%d lines done in %lums = %gus/line\n",
wxPrintf("%ld lines done in %ldms = %gus/line\n",
opts.numLines, t, (1000. * t)/opts.numLines);
}
@ -141,7 +147,7 @@ protected:
const long t = sw.Time();
wxPrintf("%d rects done in %lums = %gus/rect\n",
wxPrintf("%ld rects done in %ldms = %gus/rect\n",
opts.numLines, t, (1000. * t)/opts.numLines);
}
@ -165,7 +171,7 @@ protected:
const long t = sw.Time();
wxPrintf("%d bitmaps done in %lums = %gus/bitmap\n",
wxPrintf("%ld bitmaps done in %ldms = %gus/bitmap\n",
opts.numLines, t, (1000. * t)/opts.numLines);
}