Double Buffering gone mad
-
I tried myself on double buffering and came across a pretty funny bug. I painted one of the standard windows background images on screen, scaled down to 10% of the original size and as often as it would fit into the client area of the form. Without double buffering it was perfectly fine, I could watch as the small images filled the client area one by one. http://i35.tinypic.com/20r4q53.jpg[^] However, with double buffering, first painting the image to the Bitmap that was in memory and after everything was done, painting it on screen, I got a pretty weird result. http://i35.tinypic.com/344xe3b.jpg[^]
-
I tried myself on double buffering and came across a pretty funny bug. I painted one of the standard windows background images on screen, scaled down to 10% of the original size and as often as it would fit into the client area of the form. Without double buffering it was perfectly fine, I could watch as the small images filled the client area one by one. http://i35.tinypic.com/20r4q53.jpg[^] However, with double buffering, first painting the image to the Bitmap that was in memory and after everything was done, painting it on screen, I got a pretty weird result. http://i35.tinypic.com/344xe3b.jpg[^]
-
Was wondering that myself and how did he fix it?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
There's no subtlety in that at all. Without knowing the details of how the OP was doing the tiling into the bitmap, and just looking at the result, I'd guess that the code was not correctly accounting for the destination bitmap's ystep (ie: step in bytes from one pixel of one row to the same pixel in an adjacent row).
-
The results look like he painted mixed up source and target buffer, somehow - the already painted scaled-down-by-10 images are overlaid on the next ones.
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist -
I tried myself on double buffering and came across a pretty funny bug. I painted one of the standard windows background images on screen, scaled down to 10% of the original size and as often as it would fit into the client area of the form. Without double buffering it was perfectly fine, I could watch as the small images filled the client area one by one. http://i35.tinypic.com/20r4q53.jpg[^] However, with double buffering, first painting the image to the Bitmap that was in memory and after everything was done, painting it on screen, I got a pretty weird result. http://i35.tinypic.com/344xe3b.jpg[^]
That's not weird, it's a work of art!
Chuck Norris has the greatest Poker-Face of all time. He won the 1983 World Series of Poker, despite holding only a Joker, a Get out of Jail Free Monopoloy card, a 2 of clubs, 7 of spades and a green #4 card from the game UNO.
In the movie "The Matrix", Chuck Norris is the Matrix. If you pay close attention in the green "falling code" scenes, you can make out the faint texture of his beard.
Chuck Norris actually owns IBM. It was an extremely hostile takeover.
-