Advertisement

"Torn" images with BitBlt

Started by October 03, 2000 01:27 PM
11 comments, last by Orpheum 24 years, 3 months ago
Here''s a noggin scratcher... I''ve had this annoying as hell bug for awhile now and its time to squash it! When I execute the program, it should blt the test tile to the screen so that I can see that my new implementation of the bitmap class works. The screwy thing is that sometimes, the tile doesnt show up and you have to move that portion of the window off screen and back again to see it. Doing this will usually only show part of the tile and it appears to be torn. Once in a great while the image will appear normally after execution, but this is definetly the exception. There are a lot of temporary implementations in my engine, just for functionality''s sake... like the bitmap is being loaded in the rendering function so I can test the loading and blting all in one place (fewer chances of something getting f***ed along the way). This is the only thing I can think of that might be causing the tearing of the images (or them not appearing at all). Could the rendering function taking too long (it is called from WM_PAINT) cause the image screwiness? I haven''t had time to build the framework for my caching algorithm so I cant test that yet.
There is no spoon.
well for one it would help if you were a little more specific, such as are you using Direct X, or something else?

If Direct X...during the routine did you unlock the suface while drawing to it? or did you screw up the color palettes? is it 256 color, 16 bit ???

I would like to help...need more info.

Also, with code optimization, what is taking place while this is happening? if direct x ...are you using secondary sufaces to help with rendering?.......

feed me more info

a_insomniac

If my compiler was voice activated with the voice of my mother-in-law....there would be no errors!

----------

Advertisement
Sorry for not being specific enough... I tried to type that out before a meeting... I am using the regular old Win32 GDI. In my render function (remember just a test) I open the file, load it into memory, convert the DIB to a DDB, and then Blt.

Oh yea, this happens with both 8 and 24 bit bmps.

Edited by - Orpheum on October 3, 2000 7:31:27 PM
There is no spoon.
Are you invalidating the entire area of the control?

InvalidateRect(hWnd, NULL, false);


Steve 'Sly' Williams
Tools Developer
Krome Studios
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers
Not explicitly, I thought that whenever WM_PAINT was called that it automatically did that for you. I have a few test bed projects that do not do this... I have no idea what could be causing it.

I was thinking the render function taking too long would do it...

Edited by - Orpheum on October 4, 2000 11:27:36 PM

I just wanted to point out that calling InvalidateRect does not work. Somebody has to have some ideas... I've noticed that if I move the window as little as possible ~1 pixel, the test tile will appear, but if I move it about ~1 more pixel, it will vanish again! Wtf is going on??

Edited by - Orpheum on October 5, 2000 3:48:30 PM
There is no spoon.
Keeping the dream alive!
There is no spoon.
Advertisement
I've been playing around with InvalidateRect (its the only thing I have to go on) today and have a big problem with it! SOMETIMES when I close the window, the rest of the screen gets all f***ed up. The start bar will be blank until you cause each part of it to be redrawn (pressing ctrl-esc will bring the start button back, clicking where a window is minimized will bring its box on the task bar back, mousing over the quicklaunch icons will bring them back). The best way to fix the screen problem is to hit ctrl+alt+del to bring up task manager, then esc to have the whole screen redrawn. The further I get into my engine, the more I hate Win32! Has anyone had similar experiences that may be able to help me?

Where would you recomend PLACING the call to InvalidateRect??

I'm using W2k BTW.



Edited by - Orpheum on October 5, 2000 4:38:45 PM
There is no spoon.
That doesn''t sound right. Are you sure that the InvalidateRect call is being done on a valid window? I''d check to make sure that you aren''t calling it after you''ve closed the window.

----------------------------------------
"Before criticizing someone, walk a mile in their shoes.
Then, when you do criticize them, you will be a mile away and have their shoes." -- Deep Thoughts
Well like I said... I was wondering where a good place to put that call would be. I''ve tried at the beginning of WM_PAINT and my render function (which is called during WM_PAINT), and I''ve tried the end of WM_PAINT and my render function. The behavior is the same everywhere.
There is no spoon.
Hey this problem still exists!! What is wrong with this post???? Not enough info/too vague?? Tell me what you need... I''m so stuck (this is a FUNKY problem) that I totally need help on this one.
There is no spoon.

This topic is closed to new replies.

Advertisement