Hi! I checked this and it is all wrong,,,,, I reverted part of revision 19267:
Replacing the code with the original wine code that behaves like "Windows code" but should be called inside EngCreateBitmap if (pvBits) Width = DIB_GetDIBWidthBytes( lWidth, iFormat); .
As it should be:
INT FASTCALL DIB_GetDIBWidthBytes (INT width, INT depth) { // return ((width * depth + 31) & ~31) >> 3; int words;
switch(depth) { case 1: words = (width + 31) / 32; break; case 4: words = (width + 7) / 8; break; case 8: words = (width + 3) / 4; break; case 15: case 16: words = (width + 1) / 2; break; case 24: words = (width * 3 + 3)/4; break;
default: DPRINT1("(%d): Unsupported depth\n", depth ); /* fall through */ case 32: words = width; } return 4 * words; }
OMG!
eng/surface.c:149: NewBitmap = EngCreateBitmap(Size, DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(Format)), Format, 0, NULL);
Are you all aware that DIB_GetDIBWidthBytes is called again in IntCreateBitmap? Follow the flow.
No wonder bitmaps is fubared!
Please someone fix this! James
On Sat, May 31, 2008 at 1:41 PM, James Tabor jimtabor.rosdev@gmail.com wrote:
Hi! I checked this and it is all wrong,,,,, I reverted part of revision 19267:
Replacing the code with the original wine code that behaves like "Windows code" but should be called inside EngCreateBitmap if (pvBits) Width = DIB_GetDIBWidthBytes( lWidth, iFormat); .
As it should be:
INT FASTCALL DIB_GetDIBWidthBytes (INT width, INT depth) { // return ((width * depth + 31) & ~31) >> 3; int words;
switch(depth) { case 1: words = (width + 31) / 32; break; case 4: words = (width + 7) / 8; break; case 8: words = (width + 3) / 4; break; case 15: case 16: words = (width + 1) / 2; break; case 24: words = (width * 3 + 3)/4; break;
default: DPRINT1("(%d): Unsupported depth\n", depth );/* fall through */ case 32: words = width; } return 4 * words; }
And even more, James, there are live real cases during reactos start up process that DIB_GetDIBWidthBytes is called with negative width.
WBR, Aleksey Bragin.
On Jun 1, 2008, at 1:31 AM, James Tabor wrote:
OMG!
eng/surface.c:149: NewBitmap = EngCreateBitmap(Size, DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(Format)), Format, 0, NULL);
Are you all aware that DIB_GetDIBWidthBytes is called again in IntCreateBitmap? Follow the flow.
No wonder bitmaps is fubared!
Please someone fix this! James
On Sat, May 31, 2008 at 1:41 PM, James Tabor jimtabor.rosdev@gmail.com wrote:
Hi! I checked this and it is all wrong,,,,, I reverted part of revision 19267:
Replacing the code with the original wine code that behaves like "Windows code" but should be called inside EngCreateBitmap if (pvBits) Width = DIB_GetDIBWidthBytes( lWidth, iFormat); .
As it should be:
INT FASTCALL DIB_GetDIBWidthBytes (INT width, INT depth) { // return ((width * depth + 31) & ~31) >> 3; int words;
switch(depth) { case 1: words = (width + 31) / 32; break; case 4: words = (width + 7) / 8; break; case 8: words = (width + 3) / 4; break; case 15: case 16: words = (width + 1) / 2; break; case 24: words = (width * 3 + 3)/4; break;
default: DPRINT1("(%d): Unsupported depth\n", depth );/* fall through */ case 32: words = width; } return 4 * words; }
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev