mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 19:10:09 +01:00
Remove all BeginDrawing/EndDrawing calls
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@74229 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -443,7 +443,6 @@ class PrintCalend:
|
||||
|
||||
def DoDrawing(self, DC):
|
||||
size = DC.GetSize()
|
||||
DC.BeginDrawing()
|
||||
|
||||
cal = wx.lib.calendar.PrtCalDraw(self)
|
||||
|
||||
@@ -496,8 +495,6 @@ class PrintCalend:
|
||||
|
||||
x = x + 4.0 # next column
|
||||
|
||||
DC.EndDrawing()
|
||||
|
||||
self.ymax = DC.MaxY()
|
||||
self.xmax = DC.MaxX()
|
||||
|
||||
|
||||
@@ -33,12 +33,10 @@ class DoodlePad(wx.Window):
|
||||
self.DrawSavedLines(dc)
|
||||
|
||||
def DrawSavedLines(self, dc):
|
||||
# dc.BeginDrawing()
|
||||
dc.SetPen(wx.Pen(wx.BLUE, 3))
|
||||
for line in self.lines:
|
||||
for coords in line:
|
||||
dc.DrawLine(*coords)
|
||||
# dc.EndDrawing()
|
||||
|
||||
def OnLeftDown(self, event):
|
||||
if self.mode == "Drag":
|
||||
@@ -64,14 +62,12 @@ class DoodlePad(wx.Window):
|
||||
def OnMotion(self, event):
|
||||
if self.HasCapture() and event.Dragging() and not self.mode == "Drag":
|
||||
dc = wx.ClientDC(self)
|
||||
# dc.BeginDrawing()
|
||||
dc.SetPen(wx.Pen(wx.BLUE, 3))
|
||||
evtPos = event.GetPosition()
|
||||
coords = (self.x, self.y) + (evtPos.x, evtPos.y)
|
||||
self.curLine.append(coords)
|
||||
dc.DrawLine(*coords)
|
||||
self.x, self.y = event.GetPosition()
|
||||
# dc.EndDrawing()
|
||||
|
||||
def StartDragOpperation(self):
|
||||
# pickle the lines list
|
||||
@@ -189,13 +185,11 @@ class DoodleViewer(wx.Window):
|
||||
self.DrawSavedLines(dc)
|
||||
|
||||
def DrawSavedLines(self, dc):
|
||||
# dc.BeginDrawing()
|
||||
dc.SetPen(wx.Pen(wx.RED, 3))
|
||||
|
||||
for line in self.lines:
|
||||
for coords in line:
|
||||
dc.DrawLine(*coords)
|
||||
# dc.EndDrawing()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -187,7 +187,6 @@ def Init(w, h, n):
|
||||
|
||||
|
||||
def TestPoints(dc,log):
|
||||
# dc.BeginDrawing()
|
||||
start = time.time()
|
||||
dc.SetPen(wx.Pen("BLACK", 4))
|
||||
|
||||
@@ -195,7 +194,6 @@ def TestPoints(dc,log):
|
||||
dc.DrawPointList(points, wx.Pen("RED", 2))
|
||||
dc.DrawPointList(points, pens)
|
||||
|
||||
# dc.EndDrawing()
|
||||
log.write("DrawTime: %s seconds with DrawPointList\n" % (time.time() - start))
|
||||
|
||||
|
||||
@@ -203,7 +201,6 @@ def TestArrayPoints(dc,log):
|
||||
try:
|
||||
import Numeric
|
||||
|
||||
# dc.BeginDrawing()
|
||||
start = time.time()
|
||||
dc.SetPen(wx.Pen("BLACK", 1))
|
||||
|
||||
@@ -212,7 +209,6 @@ def TestArrayPoints(dc,log):
|
||||
|
||||
#dc.DrawPointList(Apoints, wx.Pen("RED", 2))
|
||||
#dc.DrawPointList(Apoints, pens)
|
||||
# dc.EndDrawing()
|
||||
log.write("DrawTime: %s seconds with DrawPointList an Numpy Array\n" % (time.time() - start))
|
||||
except ImportError:
|
||||
log.write("Couldn't import Numeric")
|
||||
@@ -220,7 +216,6 @@ def TestArrayPoints(dc,log):
|
||||
|
||||
|
||||
def TestLines(dc,log):
|
||||
# dc.BeginDrawing()
|
||||
start = time.time()
|
||||
|
||||
dc.SetPen(wx.Pen("BLACK", 2))
|
||||
@@ -228,12 +223,10 @@ def TestLines(dc,log):
|
||||
dc.DrawLineList(lines, wx.Pen("RED", 2))
|
||||
dc.DrawLineList(lines, pens)
|
||||
|
||||
# dc.EndDrawing()
|
||||
log.write("DrawTime: %s seconds with DrawLineList\n" % (time.time() - start))
|
||||
|
||||
|
||||
def TestRectangles(dc,log):
|
||||
# dc.BeginDrawing()
|
||||
start = time.time()
|
||||
|
||||
dc.SetPen( wx.Pen("BLACK",1) )
|
||||
@@ -248,12 +241,10 @@ def TestRectangles(dc,log):
|
||||
## #dc.DrawRectangleList(rectangles,pens,brushes)
|
||||
## dc.DrawRectangleList(rectangles)
|
||||
|
||||
# dc.EndDrawing()
|
||||
log.write("DrawTime: %s seconds with DrawRectanglesList\n" % (time.time() - start))
|
||||
|
||||
|
||||
def TestEllipses(dc,log):
|
||||
# dc.BeginDrawing()
|
||||
start = time.time()
|
||||
|
||||
dc.SetPen( wx.Pen("BLACK",1) )
|
||||
@@ -266,7 +257,6 @@ def TestEllipses(dc,log):
|
||||
dc.DrawEllipseList(rectangles,None,brushes)
|
||||
dc.DrawEllipseList(rectangles,pens,brushes)
|
||||
|
||||
# dc.EndDrawing()
|
||||
log.write("DrawTime: %s seconds with DrawEllipsesList\n" % (time.time() - start))
|
||||
|
||||
|
||||
@@ -275,7 +265,6 @@ def TestRectanglesArray(dc,log):
|
||||
import Numeric
|
||||
Apoints = Numeric.array(rectangles)
|
||||
|
||||
# dc.BeginDrawing()
|
||||
start = time.time()
|
||||
dc.SetPen(wx.Pen("BLACK", 1))
|
||||
dc.DrawRectangleList(rectangles)
|
||||
@@ -287,7 +276,6 @@ def TestRectanglesArray(dc,log):
|
||||
## #dc.DrawRectangleList(rectangles,pens,brushes)
|
||||
## dc.DrawRectangleList(rectangles)
|
||||
|
||||
# dc.EndDrawing()
|
||||
log.write("DrawTime: %s seconds with DrawRectangleList and Numpy Array\n" % (time.time() - start))
|
||||
except ImportError:
|
||||
log.write("Couldn't import Numeric")
|
||||
@@ -295,7 +283,6 @@ def TestRectanglesArray(dc,log):
|
||||
|
||||
|
||||
def TestRectanglesLoop(dc,log):
|
||||
# dc.BeginDrawing()
|
||||
|
||||
start = time.time()
|
||||
dc.DrawRectangleList(rectangles,pens,brushes)
|
||||
@@ -308,12 +295,10 @@ def TestRectanglesLoop(dc,log):
|
||||
dc.SetBrush( brushes[i] )
|
||||
dc.DrawRectangle(rectangles[i][0],rectangles[i][1],rectangles[i][2],rectangles[i][3])
|
||||
|
||||
# dc.EndDrawing()
|
||||
log.write("DrawTime: %s seconds with Python loop\n" % (time.time() - start))
|
||||
|
||||
|
||||
def TestPolygons(dc,log):
|
||||
# dc.BeginDrawing()
|
||||
|
||||
start = time.time()
|
||||
dc.SetPen(wx.Pen("BLACK", 1))
|
||||
@@ -324,11 +309,9 @@ def TestPolygons(dc,log):
|
||||
dc.DrawPolygonList(polygons,None,brushes)
|
||||
log.write("DrawTime: %s seconds with DrawPolygonList\n" % (time.time() - start))
|
||||
|
||||
# dc.EndDrawing()
|
||||
|
||||
|
||||
def TestText(dc,log):
|
||||
# dc.BeginDrawing()
|
||||
|
||||
start = time.time()
|
||||
|
||||
@@ -340,7 +323,6 @@ def TestText(dc,log):
|
||||
|
||||
log.write("DrawTime: %s seconds with DrawTextList\n" % (time.time() - start))
|
||||
|
||||
# dc.EndDrawing()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -91,9 +91,6 @@ class JoyGauge(wx.Panel):
|
||||
# above.
|
||||
dc.SetClippingRegion(xorigin, yorigin, edgeSize, edgeSize)
|
||||
|
||||
# Optimize drawing a bit (for Win)
|
||||
# dc.BeginDrawing()
|
||||
|
||||
dc.SetBrush(wx.Brush(wx.Colour(251, 252, 237)))
|
||||
dc.DrawRectangle(xorigin, yorigin, edgeSize, edgeSize)
|
||||
|
||||
@@ -140,8 +137,6 @@ class JoyGauge(wx.Panel):
|
||||
dc.SetPen(wx.Pen(wx.RED, 2))
|
||||
dc.CrossHair(x, y)
|
||||
|
||||
# Turn off drawing optimization
|
||||
# dc.EndDrawing()
|
||||
|
||||
def Update(self):
|
||||
dc = wx.BufferedDC(wx.ClientDC(self), self.buffer)
|
||||
@@ -234,9 +229,6 @@ class POVGauge(wx.Panel):
|
||||
xcenter = xorigin + diameter / 2
|
||||
ycenter = yorigin + diameter / 2
|
||||
|
||||
# Optimize drawing a bit (for Win)
|
||||
# dc.BeginDrawing()
|
||||
|
||||
# our 'raster'.
|
||||
dc.SetBrush(wx.Brush(wx.WHITE))
|
||||
dc.DrawCircle(xcenter, ycenter, diameter/2)
|
||||
@@ -290,8 +282,6 @@ class POVGauge(wx.Panel):
|
||||
dc.SetBrush(wx.Brush(wx.BLUE))
|
||||
dc.DrawCircle(nx, ny, 8)
|
||||
|
||||
# Turn off drawing optimization
|
||||
# dc.EndDrawing()
|
||||
|
||||
def Update(self):
|
||||
dc = wx.BufferedDC(wx.ClientDC(self), self.buffer)
|
||||
@@ -445,9 +435,6 @@ class LED(wx.Panel):
|
||||
xorigin = center - (bw / 2)
|
||||
yorigin = center - (bh / 2)
|
||||
|
||||
# Optimize drawing a bit (for Win)
|
||||
# dc.BeginDrawing()
|
||||
|
||||
# our 'raster'.
|
||||
if self.state == 0:
|
||||
dc.SetBrush(wx.Brush(wx.RED))
|
||||
@@ -479,9 +466,6 @@ class LED(wx.Panel):
|
||||
dc.SetTextForeground(wx.WHITE)
|
||||
dc.DrawText(txt, tx, ty)
|
||||
|
||||
# Turn off drawing optimization
|
||||
# dc.EndDrawing()
|
||||
# dc.EndDrawing()
|
||||
|
||||
|
||||
def Update(self):
|
||||
|
||||
@@ -164,7 +164,6 @@ class MyCanvas(wx.ScrolledWindow):
|
||||
random.seed()
|
||||
self.objids = []
|
||||
self.boundsdict = {}
|
||||
dc.BeginDrawing()
|
||||
for i in range(SHAPE_COUNT):
|
||||
id = wx.NewId()
|
||||
dc.SetId(id)
|
||||
@@ -252,7 +251,7 @@ class MyCanvas(wx.ScrolledWindow):
|
||||
dc.DrawBitmap(self.bmp,x,y,True)
|
||||
dc.SetIdBounds(id,wx.Rect(x,y,w,h))
|
||||
self.objids.append(id)
|
||||
dc.EndDrawing()
|
||||
|
||||
|
||||
class ControlPanel(wx.Panel):
|
||||
def __init__(self, parent, id, pos=wx.DefaultPosition,
|
||||
|
||||
@@ -69,7 +69,6 @@ class MyCanvas(wx.ScrolledWindow):
|
||||
|
||||
|
||||
def DoDrawing(self, dc, printing=False):
|
||||
# dc.BeginDrawing()
|
||||
dc.SetPen(wx.Pen('RED'))
|
||||
dc.DrawRectangle(5, 5, 50, 50)
|
||||
|
||||
@@ -142,7 +141,7 @@ class MyCanvas(wx.ScrolledWindow):
|
||||
dc.GradientFillConcentric((20, 325, 50, 50),
|
||||
"red", "blue", (25,25))
|
||||
self.DrawSavedLines(dc)
|
||||
# dc.EndDrawing()
|
||||
|
||||
|
||||
def DrawSavedLines(self, dc):
|
||||
dc.SetPen(wx.Pen('MEDIUM FOREST GREEN', 4))
|
||||
|
||||
@@ -985,8 +985,7 @@ class Calendar( wx.Control ):
|
||||
self.DoDrawing(DC)
|
||||
|
||||
def DoDrawing(self, DC):
|
||||
#DC = wx.PaintDC(self)
|
||||
# DC.BeginDrawing()
|
||||
DC = wx.PaintDC(self)
|
||||
|
||||
try:
|
||||
cal = self.caldraw
|
||||
@@ -1031,7 +1030,6 @@ class Calendar( wx.Control ):
|
||||
if self.set_day != None:
|
||||
self.SetDay(self.set_day)
|
||||
|
||||
# DC.EndDrawing()
|
||||
|
||||
# draw the selection rectangle
|
||||
def DrawFocusIndicator(self, draw):
|
||||
@@ -1049,7 +1047,6 @@ class Calendar( wx.Control ):
|
||||
return
|
||||
|
||||
DC = wx.ClientDC(self)
|
||||
# DC.BeginDrawing()
|
||||
|
||||
brush = wx.Brush(MakeColor(bgcolor))
|
||||
DC.SetBrush(brush)
|
||||
@@ -1061,14 +1058,12 @@ class Calendar( wx.Control ):
|
||||
|
||||
self.caldraw.DrawDayText(DC,key)
|
||||
|
||||
# DC.EndDrawing()
|
||||
|
||||
def DrawRectOrg(self, key, fgcolor = 'BLACK', width = 0):
|
||||
if key == None:
|
||||
return
|
||||
|
||||
DC = wx.ClientDC(self)
|
||||
# DC.BeginDrawing()
|
||||
|
||||
brush = wx.Brush(wx.Colour(0, 0xFF, 0x80), wx.TRANSPARENT)
|
||||
DC.SetBrush(brush)
|
||||
@@ -1081,7 +1076,6 @@ class Calendar( wx.Control ):
|
||||
rect = self.rg[key]
|
||||
DC.DrawRectangle(rect)
|
||||
|
||||
# DC.EndDrawing()
|
||||
|
||||
# set the day selection
|
||||
|
||||
|
||||
@@ -125,9 +125,7 @@ class Canvas(wx.Window):
|
||||
def Blit(self, dc):
|
||||
"""Performs the blit of the buffer contents on-screen."""
|
||||
width, height = self.buffer.GetSize()
|
||||
dc.BeginDrawing()
|
||||
dc.Blit(0, 0, width, height, self.buffer, 0, 0)
|
||||
dc.EndDrawing()
|
||||
|
||||
def GetBoundingRect(self):
|
||||
"""Returns a tuple that contains the co-ordinates of the
|
||||
|
||||
@@ -364,9 +364,7 @@ def RenderToBitmap(str, background=None, enclose=1):
|
||||
dc.SetBackground(background)
|
||||
dc.Clear()
|
||||
renderer = DCRenderer(dc, y=dy)
|
||||
dc.BeginDrawing()
|
||||
RenderToRenderer(str, renderer, enclose)
|
||||
dc.EndDrawing()
|
||||
dc.SelectObject(wx.NullBitmap)
|
||||
if background is None:
|
||||
img = wx.ImageFromBitmap(bmp)
|
||||
|
||||
@@ -328,7 +328,6 @@ class RubberBand:
|
||||
Draw one box shape and possibly erase another.
|
||||
"""
|
||||
dc = wx.ClientDC(self.drawingSurface)
|
||||
dc.BeginDrawing()
|
||||
dc.SetPen(wx.Pen(wx.WHITE, 1, wx.DOT))
|
||||
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
||||
dc.SetLogicalFunction(wx.XOR)
|
||||
@@ -338,7 +337,6 @@ class RubberBand:
|
||||
|
||||
r = wx.Rect(*boxToDraw)
|
||||
dc.DrawRectangleRect(r)
|
||||
dc.EndDrawing()
|
||||
|
||||
def __dumpMouseEvent(self, event):
|
||||
print 'Moving: ',event.Moving()
|
||||
|
||||
@@ -603,7 +603,6 @@ class TreePainter(Painter):
|
||||
treesize = self.tree.GetSize()
|
||||
size = self.tree.transform.GetSize()
|
||||
size = (max(treesize.width, size[0]+50), max(treesize.height, size[1]+50))
|
||||
# dc.BeginDrawing()
|
||||
if doubleBuffered:
|
||||
mem_dc = wx.MemoryDC()
|
||||
if not self.GetBuffer():
|
||||
@@ -635,7 +634,6 @@ class TreePainter(Painter):
|
||||
#whole background, we have to paint in parts to undo selection coloring.
|
||||
pb = paintBackground
|
||||
self.paintWalk(node, dc, not pb)
|
||||
# dc.EndDrawing()
|
||||
|
||||
def GetDashPen(self):
|
||||
return self.dashpen
|
||||
|
||||
@@ -1165,7 +1165,6 @@ class PlotCanvas(wx.Panel):
|
||||
dc.SetTextForeground(self.GetForegroundColour())
|
||||
dc.SetTextBackground(self.GetBackgroundColour())
|
||||
|
||||
# dc.BeginDrawing()
|
||||
# dc.Clear()
|
||||
|
||||
# set font size for every thing but title and legend
|
||||
@@ -1264,7 +1263,6 @@ class PlotCanvas(wx.Panel):
|
||||
# print "entire graphics drawing took: %f second"%(_time.clock() - start)
|
||||
# remove the clipping region
|
||||
dc.DestroyClippingRegion()
|
||||
# dc.EndDrawing()
|
||||
|
||||
self._adjustScrollbars()
|
||||
|
||||
@@ -1528,9 +1526,7 @@ class PlotCanvas(wx.Panel):
|
||||
else:
|
||||
tmp_Buffer = self._Buffer.GetSubBitmap((0, 0, width, height))
|
||||
dcs = wx.MemoryDC(self._Buffer)
|
||||
# dcs.BeginDrawing()
|
||||
self._pointLabelFunc(dcs,mDataDict) #custom user pointLabel function
|
||||
# dcs.EndDrawing()
|
||||
|
||||
dc = wx.ClientDC( self.canvas )
|
||||
#this will erase if called twice
|
||||
@@ -1607,13 +1603,11 @@ class PlotCanvas(wx.Panel):
|
||||
ptx,pty,rectWidth,rectHeight= self._point2ClientCoord(corner1, corner2)
|
||||
# draw rectangle
|
||||
dc = wx.ClientDC( self.canvas )
|
||||
# dc.BeginDrawing()
|
||||
dc.SetPen(wx.Pen(wx.BLACK))
|
||||
dc.SetBrush(wx.Brush( wx.WHITE, wx.TRANSPARENT ) )
|
||||
dc.SetLogicalFunction(wx.INVERT)
|
||||
dc.DrawRectangle( ptx,pty, rectWidth,rectHeight)
|
||||
dc.SetLogicalFunction(wx.COPY)
|
||||
# dc.EndDrawing()
|
||||
|
||||
def _getFont(self,size):
|
||||
"""Take font size, adjusts if printing and returns wx.Font"""
|
||||
|
||||
@@ -655,9 +655,7 @@ class PrintTableDraw(wx.ScrolledWindow, PrintBase):
|
||||
size = DC.GetSize()
|
||||
self.DC = DC
|
||||
|
||||
# DC.BeginDrawing()
|
||||
self.DrawText()
|
||||
# DC.EndDrawing()
|
||||
|
||||
self.sizew = DC.MaxY()
|
||||
self.sizeh = DC.MaxX()
|
||||
@@ -942,7 +940,6 @@ class PrintTable(object):
|
||||
|
||||
def DoDrawing(self, DC):
|
||||
size = DC.GetSize()
|
||||
# DC.BeginDrawing()
|
||||
|
||||
table = PrintTableDraw(self, DC, size)
|
||||
table.data = self.data
|
||||
@@ -967,8 +964,6 @@ class PrintTable(object):
|
||||
table.OutCanvas()
|
||||
self.page_total = table.total_pages # total display pages
|
||||
|
||||
# DC.EndDrawing()
|
||||
|
||||
self.ymax = DC.MaxY()
|
||||
self.xmax = DC.MaxX()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user