-
- self.redBmp = self.MakeBitmap(188, 143, 234)
- self.greenBmp = self.MakeBitmap(35, 142, 35)
- self.blueBmp = self.MakeBitmap(50, 153, 204)
+
+ if TIMEIT:
+ import timeit
+ timeit.s = self # Put self in timeit's global namespace as
+ # 's' so it can be found in the code
+ # snippets being tested.
+ if not USE_NUMPY:
+ t = timeit.Timer("bmp = s.MakeBitmap(10, 20, 30)")
+ else:
+ t = timeit.Timer("bmp = s.MakeBitmap2(10, 20, 30)")
+ log.write("Timing...\n")
+ num = 100
+ tm = t.timeit(num)
+ log.write("%d passes in %f seconds == %f seconds per pass " %
+ (num, tm, tm/num))
+
+ if not USE_NUMPY:
+ log.write("using raw access\n")
+ self.redBmp = self.MakeBitmap(178, 34, 34)
+ self.greenBmp = self.MakeBitmap( 35, 142, 35)
+ self.blueBmp = self.MakeBitmap( 0, 0, 139)
+ else:
+ log.write("using %s\n" % numtype)
+ self.redBmp = self.MakeBitmap2(178, 34, 34)
+ self.greenBmp = self.MakeBitmap2( 35, 142, 35)
+ self.blueBmp = self.MakeBitmap2( 0, 0, 139)
+
+
+ def OnPaint(self, evt):
+ dc = wx.PaintDC(self)
+ dc.DrawBitmap(self.redBmp, 50, 50, True)
+ dc.DrawBitmap(self.greenBmp, 110, 110, True)
+ dc.DrawBitmap(self.blueBmp, 170, 50, True)
+