def OnPaint(self):
     if not self._win_paint_broken:
         try:
             win = self._win
             dc, ps = win.BeginPaint()
             try:
                 win_update_rect = ps[2]
                 if not empty_rect(win_update_rect):
                     #print "DrawableContainer.OnPaint: win_update_rect =", win_update_rect ###
                     scroll_offset = self._win_scroll_offset()
                     view_update_rect = offset_rect(win_update_rect, scroll_offset)
                     if self._double_buffer:
                         dx, dy = rect_topleft(view_update_rect)
                         width, height = rect_size(view_update_rect)
                         buffer = gdi.Bitmap(width, height)
                         canvas = Canvas._from_win_image(buffer)
                         canvas.translate(-dx, -dy)
                         self.draw(canvas, view_update_rect)
                         graphics = gdi.Graphics.from_dc(dc)
                         src_rect = (0, 0, width, height)
                         graphics.DrawImage_rr(buffer, win_update_rect, src_rect)
                     else:
                         self._win_prepare_dc(dc)
                         canvas = Canvas._from_win_dc(dc)
                         self.draw(canvas, view_update_rect)
             finally:
                 win.EndPaint(ps)
         except Exception:
             self._win_paint_broken = True
             raise
Beispiel #2
0
 def __init__(self, width, height, config=None, share_group=None, **kwds):
     print("GLPixmap:", width, height, kwds)  ###
     config = GLConfig._from_args(config, kwds)
     image = gdi.Bitmap(width, height)
     self._win_image = image
     graphics = gdi.Graphics.from_image(image)
     self._win_graphics = graphics
     hdc = graphics.GetHDC()
     self._win_hdc = hdc
     GLContext.__init__(self, share_group, config, hdc, 'pixmap')
     self._with_context(hdc, self._init_context)
     print("GLPixmap: done")  ###