Thread: another BitBlt question..

  1. #1
    julie lexx... btq's Avatar
    Join Date
    Jun 2002
    Posts
    161

    another BitBlt question..

    he..yup, another one for ya'll!
    I'm getting really strange behaviour by BitBlt. I use lotsa BitBlt's
    in response to the WM_MOUSEMOVE message.
    It looks a little something like this:
    Code:
    BitBlt(tempDC,0,0,
    			kWindowWidth,
    			kWindowHeight,
    			hDCMono,
    			0,
    			0,
    			SRCCOPY);
    		SelectObject(hDCMono,hSelectedMonoBitmap);
    
    		BitBlt(tempDC,0,0,
    			kWindowWidth,
    			kWindowHeight(yDelta),
    			hDCMono,
    			0+ConvertToTimePoint(xDelta)+kWindowWidth,
    			0+ConvertToPoint(yDelta),
    			SRCAND);
    In the first BitBlt, tempDC is using a bitmap of 3 times the size as
    hDCMONO does, but that shoudn't matter since it's cut by the
    width and height params. In the next blt hDCMono uses a monochrome BitMap by the dimension
    (0,0,kWindowWidth,kWindowHeight), the same dimensions
    as the previous bitmap.
    Now the question is why the first of these calls take aproximatly
    60-70 ms to perform while the second only takes 10-20...?!

    I performed som experiments:
    I created(after many experiments) a bitmap by the dimension
    800*360(kWindowHeight is 500, and width 400) and selected it into tempDC before the first blt. Now it
    worked real smooth, everthing took about 20 ms. Then I changed
    the BitMap to be 800*370, and I was back to were I started with my 70 msec.
    ohhhhhh... why is it like this!!?

    I guess my real question is: what affects BitBlt's performance?

    any help is greatly apriciated
    take care
    /btq
    Last edited by btq; 10-10-2002 at 11:26 AM.

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    How many memory DC do you create?

    Kuphryn

  3. #3
    julie lexx... btq's Avatar
    Join Date
    Jun 2002
    Posts
    161
    I create two memoryDC's and I'm getting the main window...
    so I move between 3 DC's

    /btq

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    I believe the performance is better when you you create the memory DC and then use BitBlt() to draw it on the window. You could also use BitBlt() to draw the bitmap on the window once and then make modification to the window directly, but that affect the program's performance.

    Kuphryn

  5. #5
    julie lexx... btq's Avatar
    Join Date
    Jun 2002
    Posts
    161
    I believe the performance is better when you you create the memory DC and then use BitBlt() to draw it on the window.
    but this is exactly what I'm doing...

    /btq

  6. #6
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Okay. I am out of ideas.

    Kuphryn

  7. #7
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>what affects BitBlt's performance?<<

    1. Image bit depth - monochrome images will blit faster than 32 bit images.

    2. Image dimensions - smaller is faster (usually). Also dimensions in powers of 2 should do better than those that are not.

    3. The type of blitting operation performed will probably have an effect too; some testing of blits with the various flags may generate some detectable time differences.

    If you are interested in performance (ie speed), dump gdi and go for openGL or DirectX. GDI is really only intended/useful for GUI apps, although with the faster machines available today you can make some passable 2d stuff.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  2. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  3. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM
  4. Question about linked lists.
    By cheeisme123 in forum C++ Programming
    Replies: 6
    Last Post: 02-25-2003, 01:36 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM