Thread: Need a faster BitBlt() !

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708

    Need a faster BitBlt() !

    Is their a faster Win32 function?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    No, but why not use some directx?

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Well, I've learned that DirectX is a 55 meg download and a 15 meg resident which - as MS so nonchalantly mentions: "CANNOT BE UNINSTALLED". C'mon guys, I wanted a lib to link to, not another friggin marriage of OS and software (ie: the IE 'Active Desktop'- also uninstallable!)
    What I REALLY want is an ASM routine which does the same vid mem to vid mem transfers at those speed (or better ). Well I'll search around a bit till I break down


    [edit] ...hmm..just food for thought, apparently someone has figured out how to uninstall it! --> X
    ...no, this doesn't mean I want it, either![/edit]
    Last edited by Sebastiani; 07-29-2002 at 01:32 AM.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    A seperate Graphics lib like DX will provide a far better method of painting the screen than GDI...but if you want to stick with GDI, then there are still things you can do to improve speed...BitBlt is probably the fasteset of all those Blt funcs...I'm no graphics guru but there are loads of little possibilities to get a better draw....

    Post a quick example of what you have done so far, and lets see if we can change a few things to jump the speed a little....

    BTW....there's no quick and easy way to access vid memory.......There are hacks (which would be buggy and probably platform dependant), but I wouldnt bother!....

  5. #5
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    ie:

    Blit the eraser to the screen.
    Move the object's coordinates in a specified direction.
    Blit the screen to the eraser DC.
    Blit the object to screen DC via SRCAND.
    Invalidate the object's rectanglular region.

    Every operation has been optimized by Blitting/Invalidating the objects rectangle solely, with exception to the moving op whereby a small portion of the previous area must be invalidated to reflect the new change. In the past, this worked fine for slower motions, but at 10 ops/sec or more the flicker becomes intolerable. Incidentally, I don't completely blame BitBlt(). I have a feeling InvalidateRect() may be the true culprit, but I ain't exactly sure.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  6. #6
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I'm going to say, judging by the post on the other board, that you aren't double buffering. Here is a demo that I used back in the day that helped me learn how to do this. If this doesn't solve your problems you are going to have to go with directx. You could also go opengl, I think that is only a 10meg d/l.

  7. #7
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Oh yeah, one other thing. If you are using InvalidateRect() you should pass FALSE in for the third parameter. This way you don't delete the square then draw, you just draw over what is already there.

  8. #8
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Are you using GetUpdateRect() in your paint function to minimise the area drawn? (before the call to BeginPaint() validates the region)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  9. #9
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708

    Lightbulb

    No!

    But I will very shortly

    I'll let you know how it turns out...thx for the tip man.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Faster bitwise operator
    By Yarin in forum C++ Programming
    Replies: 18
    Last Post: 04-29-2009, 01:56 PM
  2. Faster way of printing to the screen
    By cacophonix in forum C Programming
    Replies: 16
    Last Post: 02-04-2009, 01:18 PM
  3. does const make functions faster?
    By MathFan in forum C++ Programming
    Replies: 7
    Last Post: 04-25-2005, 09:03 AM
  4. bitblt
    By canine in forum Windows Programming
    Replies: 3
    Last Post: 07-10-2002, 12:17 AM
  5. Floating point faster than fixed-point
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 11-08-2001, 11:34 PM