View previous topic :: View next topic |
Author |
Message |
Sadbrute
Joined: 26 Apr 2011 Posts: 14
|
Posted: Wed May 11, 2011 3:53 pm Post subject: Bitmap not displaying fast enough |
|
|
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 |
|
|
Sadbrute
Joined: 26 Apr 2011 Posts: 14
|
Posted: Wed May 11, 2011 4:28 pm Post subject: |
|
|
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 |
|
|
Sadbrute
Joined: 26 Apr 2011 Posts: 14
|
Posted: Wed May 11, 2011 5:23 pm Post subject: |
|
|
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 |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
Posted: Thu May 12, 2011 12:31 pm Post subject: |
|
|
You're welcome to send me your application, preferably with source. _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
Sadbrute
Joined: 26 Apr 2011 Posts: 14
|
Posted: Thu May 19, 2011 4:26 pm Post subject: |
|
|
Thx i solved it! |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
Posted: Thu May 19, 2011 4:34 pm Post subject: |
|
|
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 |
|
|
Sadbrute
Joined: 26 Apr 2011 Posts: 14
|
Posted: Fri May 20, 2011 9:39 am Post subject: |
|
|
It was leaking memory and it caused to "corrupt" my picture boxes. |
|
Back to top |
|
|
|
|
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
|