The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: redskull on February 03, 2008, 08:03:43 PM

Title: GDI memory alignment
Post by: redskull on February 03, 2008, 08:03:43 PM
Does anyone have anything 'official' as it relates to GDI drawing functions needing data aligned on DWORD boundaries?  I often run into quirkly lock-up problems when using non-aligned data that seem to magically resolve themselves when the data is subsequently aligned.  For example, Polygon() takes a pointer to a set of data points; if the points are non-aligned, the program (sometimes) hangs in the function forever.  Can anyone else confirm or deny this behavior, or point me to a reference that does?

TIA
-alan
Title: Re: GDI memory alignment
Post by: MichaelW on February 04, 2008, 03:01:21 AM
I couldn't find any information on this problem, and on my system, using the default Windows 2000 drivers for a fairly ancient Matrox G200, the Polygon function has no problems with the array of vertices at any alignment. Perhaps the problem is with later versions of Windows and/or more recent drivers. The attachment is my crude test app.


[attachment deleted by admin]
Title: Re: GDI memory alignment
Post by: u on February 04, 2008, 03:44:13 AM
MichaelW's test runs perfectly on:
Win2k SP5(unofficial) with GF7600GT and okay drivers

redskull, maybe it's your drivers that ruin things for you? Or a part of some OS file is damaged (has happened to me)
Title: Re: GDI memory alignment
Post by: jj2007 on February 04, 2008, 09:08:56 AM
Michael's test works on XP SP2 with NVIDIA GeForce 6200 TurboCache
Title: Re: GDI memory alignment
Post by: redskull on February 05, 2008, 04:14:22 AM
I guess it must just be this particular video card; it's a crappy notebook card that's suspect to begin with (it doesn't change resolution, it just changes screen size), so i'm not inclined to get so upset about it.  I would have thought Windows would do some altering of the memory, at least a little bit, before the driver gets hold of it; I guess video cards have some sort of DMA-like thing?
In either case, thanks to everyone for helping out in testing it.

-alan