Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. BitBlt() function performance question

BitBlt() function performance question

Scheduled Pinned Locked Moved C / C++ / MFC
performancequestion
16 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    econy
    wrote on last edited by
    #1

    Hi, in a windows CE platform, I tested BitBlt() function, I found it will take about 400 millisecdons to do:

    MemBoard.CreateCompatibleDC(&dc);
    bmpDashBoard.LoadBitmap( IDB_SCREEN_IMP );
    pOldBmp = (CBitmap*)Memboard.SelectObject(&bmpBoard);
    ...
    MemDC.CreateCompatibleDC(dc);
    ..
    MemDC.BitBlt(0,0, 800,600,&Memboard, 0, 0, SRCCOPY);

    is there anyway to speed up BitBlt() function?

    C A enhzflepE _ N 6 Replies Last reply
    0
    • E econy

      Hi, in a windows CE platform, I tested BitBlt() function, I found it will take about 400 millisecdons to do:

      MemBoard.CreateCompatibleDC(&dc);
      bmpDashBoard.LoadBitmap( IDB_SCREEN_IMP );
      pOldBmp = (CBitmap*)Memboard.SelectObject(&bmpBoard);
      ...
      MemDC.CreateCompatibleDC(dc);
      ..
      MemDC.BitBlt(0,0, 800,600,&Memboard, 0, 0, SRCCOPY);

      is there anyway to speed up BitBlt() function?

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      are you saying it takes 400ms to do all of that, or just the BitBlt? because you can do the LoadBitmap ahead of time and just keep the CBitmap around for when you need it.

      image processing toolkits | batch image processing

      E 1 Reply Last reply
      0
      • C Chris Losinger

        are you saying it takes 400ms to do all of that, or just the BitBlt? because you can do the LoadBitmap ahead of time and just keep the CBitmap around for when you need it.

        image processing toolkits | batch image processing

        E Offline
        E Offline
        econy
        wrote on last edited by
        #3

        I can't get precise time, but, with old BitBlt(), not a 800*600 bitmap, I set tick count array in program, tkCount[15]-tkCount[14] = tkCount[14] - tkCount[13] ... = tkCount[1] - tkCount[0] = 170 ms around. Then I use new BitBlt() to load 800*600 bitmap, it gives 400ms around. So I should say it added 230 ms. Old BitBlt() just transport about 1/5 or 1/6 part of 800*600 bitmap. I expected to use a 800*600(the screen area) memory DC to hold all parts changes, then BitBlt() to screen. Now that 800*600 tooks so much time, I don't think a double buffer technique is helpful.

        C 1 Reply Last reply
        0
        • E econy

          Hi, in a windows CE platform, I tested BitBlt() function, I found it will take about 400 millisecdons to do:

          MemBoard.CreateCompatibleDC(&dc);
          bmpDashBoard.LoadBitmap( IDB_SCREEN_IMP );
          pOldBmp = (CBitmap*)Memboard.SelectObject(&bmpBoard);
          ...
          MemDC.CreateCompatibleDC(dc);
          ..
          MemDC.BitBlt(0,0, 800,600,&Memboard, 0, 0, SRCCOPY);

          is there anyway to speed up BitBlt() function?

          A Offline
          A Offline
          Albert Holguin
          wrote on last edited by
          #4

          I doubt it's the BitBlt slowing you down that much. You probably shouldn't be loading a bitmap every single time, load it once and keep it in memory for better results.

          E 1 Reply Last reply
          0
          • E econy

            Hi, in a windows CE platform, I tested BitBlt() function, I found it will take about 400 millisecdons to do:

            MemBoard.CreateCompatibleDC(&dc);
            bmpDashBoard.LoadBitmap( IDB_SCREEN_IMP );
            pOldBmp = (CBitmap*)Memboard.SelectObject(&bmpBoard);
            ...
            MemDC.CreateCompatibleDC(dc);
            ..
            MemDC.BitBlt(0,0, 800,600,&Memboard, 0, 0, SRCCOPY);

            is there anyway to speed up BitBlt() function?

            enhzflepE Offline
            enhzflepE Offline
            enhzflep
            wrote on last edited by
            #5

            How much time does it take to do the other 4 lines?

            E 1 Reply Last reply
            0
            • E econy

              Hi, in a windows CE platform, I tested BitBlt() function, I found it will take about 400 millisecdons to do:

              MemBoard.CreateCompatibleDC(&dc);
              bmpDashBoard.LoadBitmap( IDB_SCREEN_IMP );
              pOldBmp = (CBitmap*)Memboard.SelectObject(&bmpBoard);
              ...
              MemDC.CreateCompatibleDC(dc);
              ..
              MemDC.BitBlt(0,0, 800,600,&Memboard, 0, 0, SRCCOPY);

              is there anyway to speed up BitBlt() function?

              _ Offline
              _ Offline
              _Flaviu
              wrote on last edited by
              #6

              Do you handled CDC::SetStretchBltMode[^] ? Depend on this settings, you will have rendering speed or render quality ...

              E 1 Reply Last reply
              0
              • _ _Flaviu

                Do you handled CDC::SetStretchBltMode[^] ? Depend on this settings, you will have rendering speed or render quality ...

                E Offline
                E Offline
                econy
                wrote on last edited by
                #7

                Thanks, I will read descriptions of this function

                1 Reply Last reply
                0
                • A Albert Holguin

                  I doubt it's the BitBlt slowing you down that much. You probably shouldn't be loading a bitmap every single time, load it once and keep it in memory for better results.

                  E Offline
                  E Offline
                  econy
                  wrote on last edited by
                  #8

                  Yes, I know redraw picture is a time-costing work. But, the application need to update picture with the real-time data.

                  A 1 Reply Last reply
                  0
                  • enhzflepE enhzflep

                    How much time does it take to do the other 4 lines?

                    E Offline
                    E Offline
                    econy
                    wrote on last edited by
                    #9

                    It seems 1-3 ms, based on tickcount() result

                    1 Reply Last reply
                    0
                    • E econy

                      Yes, I know redraw picture is a time-costing work. But, the application need to update picture with the real-time data.

                      A Offline
                      A Offline
                      Albert Holguin
                      wrote on last edited by
                      #10

                      I do real-time drawing... bitblt() is your friend, you're probably doing something else that's slow.

                      E 1 Reply Last reply
                      0
                      • A Albert Holguin

                        I do real-time drawing... bitblt() is your friend, you're probably doing something else that's slow.

                        E Offline
                        E Offline
                        econy
                        wrote on last edited by
                        #11

                        The background picture is 800*600, 24 color depth, so it is about 1.44 MB. Did you think the picture size would affect the BitBlt() speed?

                        A 1 Reply Last reply
                        0
                        • E econy

                          The background picture is 800*600, 24 color depth, so it is about 1.44 MB. Did you think the picture size would affect the BitBlt() speed?

                          A Offline
                          A Offline
                          Albert Holguin
                          wrote on last edited by
                          #12

                          I'm sure it would... but not to the extent that your numbers reflect. You're doing something else wrong (or... more precisely, you're doing something else that's slowing the process down).

                          1 Reply Last reply
                          0
                          • E econy

                            Hi, in a windows CE platform, I tested BitBlt() function, I found it will take about 400 millisecdons to do:

                            MemBoard.CreateCompatibleDC(&dc);
                            bmpDashBoard.LoadBitmap( IDB_SCREEN_IMP );
                            pOldBmp = (CBitmap*)Memboard.SelectObject(&bmpBoard);
                            ...
                            MemDC.CreateCompatibleDC(dc);
                            ..
                            MemDC.BitBlt(0,0, 800,600,&Memboard, 0, 0, SRCCOPY);

                            is there anyway to speed up BitBlt() function?

                            N Offline
                            N Offline
                            Nitin K Kawale
                            wrote on last edited by
                            #13

                            Hey why not using DirectX ,it uses Double buffering algorithm

                            E 1 Reply Last reply
                            0
                            • E econy

                              I can't get precise time, but, with old BitBlt(), not a 800*600 bitmap, I set tick count array in program, tkCount[15]-tkCount[14] = tkCount[14] - tkCount[13] ... = tkCount[1] - tkCount[0] = 170 ms around. Then I use new BitBlt() to load 800*600 bitmap, it gives 400ms around. So I should say it added 230 ms. Old BitBlt() just transport about 1/5 or 1/6 part of 800*600 bitmap. I expected to use a 800*600(the screen area) memory DC to hold all parts changes, then BitBlt() to screen. Now that 800*600 tooks so much time, I don't think a double buffer technique is helpful.

                              C Offline
                              C Offline
                              Chris Losinger
                              wrote on last edited by
                              #14

                              what do you mean "old" and "new" BitBlt ?

                              image processing toolkits | batch image processing

                              1 Reply Last reply
                              0
                              • N Nitin K Kawale

                                Hey why not using DirectX ,it uses Double buffering algorithm

                                E Offline
                                E Offline
                                econy
                                wrote on last edited by
                                #15

                                Thanks,image without dirctx components inside

                                1 Reply Last reply
                                0
                                • E econy

                                  Hi, in a windows CE platform, I tested BitBlt() function, I found it will take about 400 millisecdons to do:

                                  MemBoard.CreateCompatibleDC(&dc);
                                  bmpDashBoard.LoadBitmap( IDB_SCREEN_IMP );
                                  pOldBmp = (CBitmap*)Memboard.SelectObject(&bmpBoard);
                                  ...
                                  MemDC.CreateCompatibleDC(dc);
                                  ..
                                  MemDC.BitBlt(0,0, 800,600,&Memboard, 0, 0, SRCCOPY);

                                  is there anyway to speed up BitBlt() function?

                                  M Offline
                                  M Offline
                                  Mike Nordell
                                  wrote on last edited by
                                  #16

                                  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. :-)

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups