|
How much time does it take to do the other 4 lines?
|
|
|
|
|
It seems 1-3 ms, based on tickcount() result
|
|
|
|
|
Do you handled CDC::SetStretchBltMode[^] ? Depend on this settings, you will have rendering speed or render quality ...
|
|
|
|
|
Thanks, I will read descriptions of this function
|
|
|
|
|
Hey why not using DirectX ,it uses Double buffering algorithm
|
|
|
|
|
Thanks,image without dirctx components inside
|
|
|
|
|
If it's indeed the blit sucking that much time, prime suspect would be format conversion.
Check out GetObject() for BITMAP, to see what the format of src and dest are. I'm willing to bet 3 lines of C++ that they are different.
modified 2-Feb-15 18:09pm.
|
|
|
|
|
Hi, I have a question, situation like:
void funcA()
{
CDC MemDC;
CDC *pDC ;
pDC = GetDC();
memDC.CreateCompatibleDC(pDC);
funcB(memDC);
}
void funcB(CDC *pDC)
{
HDC hdc;
HDC hdcMem;
hdc = pDC->m_hDC;
hdcMem = CreateCompatibleDC(hdc);
...
BitBlt(hdc,0,0,100,100,hdcMem,0,0,SRCCOPY);
}
I think this BitBlt() will copy hdcMem to MemDC(in FuncA), right? just want to confirm it.
|
|
|
|
|
What exactly are you trying to achieve?
|
|
|
|
|
I want funcB draw picture on it's own temporary DC, then paste on funcA's memory DC, and FuncA paste the whole funcA's DC to screen.
Like:
B -> A
c -> A
...
x -> A
and A -> screen.
And I had another question, I have a big bitmap, represent the screen, many parts of the bitmap need to update independently and frequently.
is it a good idea using one memory DC to hold
all part's temporary DC, then post the whole memory DC to screen? that is, the double buffering technique.
|
|
|
|
|
1. Sounds OK. What happens when you try it?
2. Yes, keeping a MemDC with all the information and then updating that, before blitting to screen is probably the best way.
|
|
|
|
|
Thanks, have not try it.
Just thinking if the way is reasonable.
|
|
|
|
|
Trying things is the best way to learn.
|
|
|
|
|
Hi,I wonder how a bitblt function of a CDC object, which src is a HDC object?
like:
MemDC.BitBlt(Icon.pos_x, Icon.pos_y, bm.w, bm.h,HdcObject,0,0,SRCCOPY);
|
|
|
|
|
Quote: which src is a HDC object?
What? That doesn't make sense. Try rephrasing or expand on what you're trying to ask.
|
|
|
|
|
I mean HdcObject in the code.
I just want to copy a HDC object to CDC object, use CDC object's BitBlt() function.
|
|
|
|
|
HDC is a handle not an object....
You can use CDC::FromHandle() to get a temporary object for immediate use. Alternatively, you can CDC::Attach() to keep a more permanent CDC object around. You should make sure you release a device context (DC) when you're done using it (FromHandle sort of automatically handles this situation by going out of scope).
If you have CWnds, you can also get a pointer to an existing CDC with CWnd::GetDC().
There is a lot of info on drawing in GDI online, I suggest you read up on it.
|
|
|
|
|
Hello, I get this error when I try to create a new project wi h Visual Studio 2010 (XP), Win32, MFC or Forms (only VB works)
"Object reference not set to an instance of an object"
I found nothing with Google for this case (just creating a new project) and tried to uninstall/install, repair, n times, impossible to fix
Thanks in advance for any idea, I'm desperate, unable to create even an empty Win32 project !
|
|
|
|
|
Looks like a Visual Studio problem, but impossible to guess what.
|
|
|
|
|
But it appeared just recently, it had worked for years before
|
|
|
|
|
I can only assume that something has been corrupted somewhere. But as I said before, it's impossible to guess what. Your only chance is to collect all the information that you can, and report it to Microsoft.
|
|
|
|
|
How can I get the CListCtrl scrollbar rectangle ? Whether the scrollbar is visible or not, I tested in following way:
if(GetStyle() & WS_VSCROLL)
{
}
but, in order to change the scrollbar background by DrawThemeBackground[^], I need the scrollbar rectangle ... how can I retrieve the scrollbar rectangle ?
|
|
|
|
|
|
Thank you Jochen ... the rectangle is retrieve it ...
I have to dig in, because it seems that something is wrong in my code, because though rectangle is correct now, the color of scrollbar is not drawn ...
void CGridCtrlExt::OnDraw(CDC* pDC)
{
HTHEME hTheme = OpenThemeData(m_hWnd, L"WINDOW");
if(NULL != hTheme)
{
if(WS_VSCROLL & GetStyle())
{
SCROLLBARINFO si;
si.cbSize = sizeof(SCROLLBARINFO);
GetScrollBarInfo(OBJID_VSCROLL, &si);
CRect rect(si.rcScrollBar);
pDC->FillSolidRect(&rect, RGB(255, 255, 0));
DrawThemeBackground(hTheme, pDC->GetSafeHdc(), WP_VERTSCROLL, VSS_NORMAL, &rect, NULL);
}
CloseThemeData(hTheme);
}
}
|
|
|
|
|
This may be because the scroll bar is redrawn by the system.
You may use a custom drawn scroll bar or handle WM_CTLCOLOR when you only need to change the background.
Searching the web may give you some solutions. The article http://www.drdobbs.com/windows/developing-a-custom-windows-scrollbar-in/184416659[^] is rather old but contains a good introduction and shows how to implement a custom drawn scroll bar.
|
|
|
|