Hello everybody,
I'm currently racking my brains about strange behaviour when vertically resizing the window.

Here are two images showing the situation:

^ Before resizing.


^ After (slowly) resizing.

This only happens with a bottom-up DIB (bmiHeader.biHeight > 0). If I change biHeight to negative (top-down DIB) it doesn't happen.

Is this some StretchDIBits weirdness? I've looked closely at the BitmapMemory and the Width and Height parameters in various places and didn't see anything suspicious.

Anyone have any ideas?
Thanks

EDIT:I think I kind of know why it happens. When I resize the window a little bit then the bitmap gets resized in the same way essentially, right? But if I only extend the window a little bit the rendereing code only renders what is supposed to be the bottom of the next gradient.

Essentially the displaying and the rendering order are flipped? If I rewrite the renderer to render bottom up then this would work I think.

Although I assumed the StretchDIBits call to update the whole window? It doesn't seem to do that in this case.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
internal void
Win32UpdateWindow(HDC DeviceContext, RECT *WindowRect, int X, int Y, int Width, int Height)
{
	int WindowWidth = WindowRect->right - WindowRect->left;
	int WindowHeight = WindowRect->bottom - WindowRect->top;
	
	StretchDIBits(DeviceContext, 
				  /*
				  X, Y, Width, Height, 
				  X, Y, Width, Height,
				  */
				  0, 0, BitmapWidth, BitmapHeight,
				  0, 0, WindowWidth, WindowHeight,
				  BitmapMemory,
				  &BitmapInfo,
				  DIB_RGB_COLORS, SRCCOPY);
}


EDIT 2: On Day 005 this is indirectly adressed. It has to do with the WindowClass.style, CS_HREDRAW and CS_VREDRAW. Basically it did not redraw the whole window on resize because the style field was not set.