Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Cache draw output

Cache draw output

Scheduled Pinned Locked Moved C / C++ / MFC
performancequestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mathias S
    wrote on last edited by
    #1

    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

    J 2 Replies Last reply
    0
    • M Mathias S

      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

      J Offline
      J Offline
      JWood
      wrote on last edited by
      #2

      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. ----------------------------

      1 Reply Last reply
      0
      • M Mathias S

        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

        J Offline
        J Offline
        JWood
        wrote on last edited by
        #3

        Buffer DC J. ----------------------------

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups