DPlot Forum Index DPlot
http://www.dplot.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bitmap not displaying fast enough

 
Post new topic   Reply to topic    DPlot Forum Index -> C, C++, C#
View previous topic :: View next topic  
Author Message
Sadbrute



Joined: 26 Apr 2011
Posts: 14

PostPosted: Wed May 11, 2011 3:53 pm    Post subject: Bitmap not displaying fast enough Reply with quote

I have an SSTab and i switch between tabs, they each have a picturebox controller (CStatic derived class). I will display the OnPaint Code of the picture box controller:

Code:

 if(hbmp_!=0)
      {
         CRect r;
         CBitmap* m_bitmap=CBitmap::FromHandle(hbmp_);
         
          CDC dc,*pDC=0;
         
         
          pDC = this->GetDC();
         dc.CreateCompatibleDC(pDC);
         
         if(m_bitmap!=0 && dc.m_hDC!=NULL)
         {
             // Select the bitmap into the in-memory DC
            CBitmap* pOldBitmap = dc.SelectObject(m_bitmap);
            pDC->BitBlt(rect_->left,rect_->top,cx_,cy_,&dc, 0, 0, SRCCOPY);
            pDC->SelectObject(pOldBitmap);
            //::DeleteObject(dc);
            m_bitmap->Detach();
            m_bitmap->DeleteObject();
         }
         //dc.ReleaseOutputDC();
         ::ReleaseDC(this->m_hWnd,dc);

         ::DeleteObject(dc);
         ::DeleteObject(pDC);
      }
      else
      {
         CWnd::OnPaint();
      }

But, when i carefully check ,the bottlneck seems to come from here:

Code:

hbmp_ = (HBITMAP)dPlot_GetBitmapEx(DocNum, cxBitmap_, cyBitmap_, &dpm_);



any ideas?


P.S. The slow down comes when i switch a lot ,it might be a memory leak but i'm not creating anything else except what DPLOT gives me ,the HBITMAP.
Back to top
View user's profile Send private message
Sadbrute



Joined: 26 Apr 2011
Posts: 14

PostPosted: Wed May 11, 2011 4:28 pm    Post subject: Reply with quote

I seem to leak somewhere,just by switching tabs and drawing the same graph, but i do release the bitmap handles and the Docnum everytime i draw...
Back to top
View user's profile Send private message
Sadbrute



Joined: 26 Apr 2011
Posts: 14

PostPosted: Wed May 11, 2011 5:23 pm    Post subject: Reply with quote

I seem to have fixed the speed problem, but after 20 clicks Dplot does not seem to deliver the Bitmap fast enough and makes The onPaint crash. I know it's Dplot because its window kind of "opens up" (well it stays grey) and then the entire screen turns grey....
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Thu May 12, 2011 12:31 pm    Post subject: Reply with quote

You're welcome to send me your application, preferably with source.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sadbrute



Joined: 26 Apr 2011
Posts: 14

PostPosted: Thu May 19, 2011 4:26 pm    Post subject: Reply with quote

Thx i solved it!
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Thu May 19, 2011 4:34 pm    Post subject: Reply with quote

If there was a problem you can share here, it might help others. In any case, glad this worked out.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sadbrute



Joined: 26 Apr 2011
Posts: 14

PostPosted: Fri May 20, 2011 9:39 am    Post subject: Reply with quote

It was leaking memory and it caused to "corrupt" my picture boxes.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> C, C++, C# All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group