|
-
March 3rd, 2005, 10:06 AM
#1
help with stetchblt performance
Hey guys. I am reading in a cdg file (karaoke) for mp3+g playback. I have it all working, but I have one little problem. The cd+g is meant to be played at the size 300 x 216, but I want to go 2x, 3x, or fullscreen of that. Problem is that when I do a stretchblt instead of bitblt it gets really slow
is there some alternative I can use other than stretchblt that will size a 300 x 216 bitmap to double or triple the size without such a performance hit?
Here is some of my code: Is there some way I can make this faster?
Code:
int THEWIDTH = 600;desired width of bitmap
int THEHEIGHT = 438; desired height of bitmap
BYTE pixles[64800]; //300*216 this holds the image i want to put in the bitmap
CDC* pDC = pKaraokeWindow.m_KaraokeWnd.GetDC();
CDC memdcX;
memdcX.CreateCompatibleDC(pDC);
// Set up a palette
hBitmap = CreateDIBSection(NULL, lpbi, DIB_RGB_COLORS, NULL/*(LPVOID *)&pixels*/, NULL, 0 );
m_bitmap.DeleteObject();
m_bitmap.Attach(hBitmap);
m_bitmap.SetBitmapBits(300*216,&pixels);
memdcX.SelectPalette(&m_pPalette, FALSE);
CBitmap* pBitmap = memdcX.SelectObject(&m_bitmap);
//pDC->BitBlt(0,0,300,216 ,&memdcX,0,0,SRCCOPY);
pDC->StretchBlt(0,0,THEWIDTH, THEHEIGHT, &memdcX, 0,0, 300, 216, SRCCOPY);
memdcX.SelectObject(pBitmap);
ReleaseDC(pDC);
-
March 3rd, 2005, 10:44 AM
#2
Re: help with stetchblt performance
One possible solution is to stretchblt the original bitmap to the compatible DC first. Then bitblt the compatible DC.
Kuphryn
-
March 3rd, 2005, 10:52 AM
#3
Re: help with stetchblt performance
I thought that's what I was doing? Could you post sample code of what you mean?
Thanks,
Greg
-
March 3rd, 2005, 11:56 AM
#4
Re: help with stetchblt performance
The code bitblt to the DC that pDC points to. Is that the device context of the surface you want to draw?
Kuphryn
-
March 3rd, 2005, 12:02 PM
#5
Re: help with stetchblt performance
yes pDC is the device context I want to draw to.
-
March 3rd, 2005, 12:34 PM
#6
Re: help with stetchblt performance
K I changed the code here to stretchblt to the compatible dc and it does go faster, but the pDC is not the correct size!!
the pDC show up at 300x216 even though memdcX is 600x432?? why wouldn't the pDC be 600x432
Code:
int THEWIDTH = 600;
int THEHEIGHT = 432;
CDC* pDC = pKaraokeWindow.m_KaraokeWnd.GetDC();
CDC memdcX;
memdcX.CreateCompatibleDC(pDC);
// Set up a palette
hBitmap = CreateDIBSection(NULL, lpbi, DIB_RGB_COLORS, NULL/*(LPVOID *)&pixels*/, NULL, 0 );
m_bitmap.DeleteObject();
m_bitmap.Attach(hBitmap);
m_bitmap.SetBitmapBits(300*216,&pixels);
memdcX.SelectPalette(&m_pPalette, FALSE);
CBitmap* pBitmap = memdcX.SelectObject(&m_bitmap);
memdcX.StretchBlt(0,0,THEWIDTH, THEHEIGHT, &memdcX, 0,0, 300, 216, SRCCOPY);
pDC->BitBlt(0,0,THEWIDTH,THEHEIGHT ,&memdcX,0,0,SRCCOPY);
//pDC->StretchBlt(0,0,THEWIDTH, THEHEIGHT, &memdcX, 0,0, 300, 216, SRCCOPY);
memdcX.SelectObject(pBitmap);
ReleaseDC(pDC);
PeekAndPump();
Sleep(1);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|