1

Recently i have been investigating using Direct 2D (D2D) instead of GDI+ to draw cached bitmaps, i figured that since D2D was hardware accelerated i would get much lower drawing times (the API also seemed to be fairly friendly). My prototyping in fact indicates i should stick with GDI+ for now and it is in fact faster for this particular scenario.

In my prototype i have an MFC app which draws about 1000 icons to a canvas in the OnPaint function. The icons are not all different, there are probably less than 20 different types. From there i initialise both GDI+ and D2D from the GDI drawing context. First access of the bitmaps comes at a cost after that they are cached. I store them as a map of CachedBitmaps and ID2D1Bitmaps.

My feeling is that at this level (drawing bitmaps) the slowness is caused by interop'ing D2D with GDI (i believe this results in copying the results of the D2D rendering back to the GDI context). I dont know at what level GDI+ is hardware accelerated but i presume BitBlt is...

Can anyone shed any more light on my findings?

rupertmulrenan
  • 355
  • 1
  • 3
  • 13
  • You should explain what do you mean by "slowness" and by "inconsistent". – user7860670 Sep 04 '17 at 19:45
  • I have created a new question regarding the inconsistency because in retrospect its probably two separate issues: https://stackoverflow.com/questions/46116849/inconsistent-application-drawing-performance-locally-vs-remote-desktop – rupertmulrenan Sep 08 '17 at 12:43
  • The slowness i was referring to is Direct2D appears to be slower at doing the same job as GDI+ with regards to drawing bitmaps. – rupertmulrenan Sep 08 '17 at 12:45
  • Just "slowness" or "appears to be slower" are very obscure descriptions. You should post exact performance measurement results and rendering code. Maybe you are not drawing the same stuff, for example using cubic interpolation with d2d or something. But it is not really possible to tell without seeing the code. – user7860670 Sep 08 '17 at 19:29
  • Image(texture) loading and drawing is the almost same. In my experience, scaling is the real difference: https://stackoverflow.com/questions/26153633/windows-stretchblt-api-performance – 9dan Sep 26 '17 at 06:19

0 Answers0