Cache draw output
-
I got a own draw controller. And I takes this controller 0.5sec to redraw because it does a lot of stuff and this is okay. But I wonder if I can speed up some thing. If I move an application over my program, a lot of redraws are done. And since every redraw take 0.5sec it flicker a little too much. So I wonder if there are anyway to cache the last draw result and use that if nothing in my program has changed. Since I'm using a MemDC in my program I think I should be able to cache a copy of it and use it. But how do I do that. /Mathias
-
I got a own draw controller. And I takes this controller 0.5sec to redraw because it does a lot of stuff and this is okay. But I wonder if I can speed up some thing. If I move an application over my program, a lot of redraws are done. And since every redraw take 0.5sec it flicker a little too much. So I wonder if there are anyway to cache the last draw result and use that if nothing in my program has changed. Since I'm using a MemDC in my program I think I should be able to cache a copy of it and use it. But how do I do that. /Mathias
If the draw functions are taking too long you can create a boolean that keeps track of if anything has been actually changed in your CMemDC. This is somewhat tedious as you must set it to true for every change made, but then include it in OnDraw(CDC* pDC). You must also use a more sophisticated version of CMemDC from the destructor into a function like CMemDC::Rredraw(), include CMemDC in your CView as a member (do not destroy it, with every OnDraw or OnPaint). You must also update it in OnSize() J. ----------------------------
-
I got a own draw controller. And I takes this controller 0.5sec to redraw because it does a lot of stuff and this is okay. But I wonder if I can speed up some thing. If I move an application over my program, a lot of redraws are done. And since every redraw take 0.5sec it flicker a little too much. So I wonder if there are anyway to cache the last draw result and use that if nothing in my program has changed. Since I'm using a MemDC in my program I think I should be able to cache a copy of it and use it. But how do I do that. /Mathias