Okay, how is this for a weird problem?
I have a program that uses StretchBlt to paint an image from one Picture Box into another, smaller one. The user can check whether to squeeze the larger image to fit the smaller area, or to crop the image.
Example "Squeeze" code:
StretchBlt Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture2.hdc, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, SRCCOPY
Example "Cropped" code:
StretchBlt Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture2.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, SRCCOPY
Well, it's not weird yet, is it? Until I run the program (either compiled or in the IDE). Then the crazy stuff happens...
(Times in milliseconds are averages gathered using the GetTickCount API)
Okay, let's say my program is the only program that I have open. Here are the times it takes to draw the image:
Now, let's open Internet explorer.
Let's navigate to a site that has an embedded Flash movie on the page.
All I can say is: ???
Seriously, what is going on? Am I going crazy, or does this just not make any sense? Using the .PaintPicture method of the Picture Box, the same thing happens.
Is there an alternative to the StretchBlt API that is reliably fast? It's really, really annoying how inconsistant it is...
Edit: I should mention that the program is quickly and repeatedly StretchBlt'ing different images to the Picture Box, which is why the speed matters.