GDI objects out of control

Armel armelasselin at hotmail.com
Tue May 27 13:27:58 PDT 2008


  "Christopher Bruno" <cbruno.linux at gmail.com> a =E9crit dans le message de=
 news: mailman.14.1211917789.17800.wx-users at lists.wxwidgets.org...
  Thanks to wx-users ive isolated the problem - too many gdi-objects. XP on=
ly allows up to 10,000 GDI object for a process - not the question...how do=
 I lower the number of GDI Object allocated??? Im just using normal pens an=
d calls to wxDC functions.

Generally the idea is to use only bare data in your internal structures (su=
ch as wxColour in place wxPen/wxBrushes, wxImage in place of wxBitmap), and=
 then instantiate on the fly only the wxPen/wxBrush/wxBitmap that you need =
on the fly.
It generally lower the number of actually used objects per paint.
In addition, you may want to restrict the number of things you paint geogra=
phically, I mean that even if you can think of drawing as 'paint all my dat=
a at their place' with origin/view clipping doing the selection job for you=
, you can also decide to exclude by yourself the items which have no chance=
 to show (using wxRect intersection tests for example), it can greatly impr=
ove performance. For very large data set, geographically oriented data stru=
cture can select the objects to draw for you much more quickly then a full =
scan.

HIH
Armel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20080527/1ce=
a4b65/attachment.htm


More information about the wx-users mailing list