PATCH: video mode changes

Dimitrie O. Paun dpaun at rogers.com
Sat Apr 12 01:24:32 CDT 2003


On April 12, 2003 12:16 am, Alex Pasadyn wrote:
> +        if (TRACE_ON(x11drv))
> +        {
> +            MESSAGE("\tDM_fields=");_dump_DM_fields(devmode->dmFields);MESSAGE("\n");
> +            MESSAGE("   bpp=%ld\n",devmode->dmBitsPerPel);
> +            MESSAGE("   width=%ld\n",devmode->dmPelsWidth);
> +            MESSAGE("   height=%ld\n",devmode->dmPelsHeight);
> +            MESSAGE("   freq=%ld\n",devmode->dmDisplayFrequency);
> +        }

Please don't use MESSAGE. Use TRACE instead, it will do the right thing.
This piece can be rewritten as:

         TRACE("\tDM_fields=");_dump_DM_fields(devmode->dmFields);TRACE("\n");
         TRACE("   bpp=%ld\n",devmode->dmBitsPerPel);
         TRACE("   width=%ld\n",devmode->dmPelsWidth);
         TRACE("   height=%ld\n",devmode->dmPelsHeight);
         TRACE("   freq=%ld\n",devmode->dmDisplayFrequency);

Also, it will be a lot nicer if you rewrite _dump_DM_dields to return a
string, so you can write:

         TRACE("\tDM_fields=%s\n", debug_DM_fields(devmode->dmFields));
         TRACE("   bpp=%ld\n",devmode->dmBitsPerPel);
         TRACE("   width=%ld\n",devmode->dmPelsWidth);
         TRACE("   height=%ld\n",devmode->dmPelsHeight);
         TRACE("   freq=%ld\n",devmode->dmDisplayFrequency);

The debug_DM_fields() function would than look like so:

static const char* debug_DM_fields(DWORD fields) 
{
	BOOL first = TRUE;
	char buf[128] = "", *p = buf;
#define DEBUG_FIELD(x) if ((fields) & DM_##x) { p += sprintf(p, "%s%s", first ? "" : " ,", #x); first = FALSE; }
        DEBUG_FIELD(BITSPERPEL);
	DEBUG_FIELD(PELSWIDTH);
	DEBUG_FIELD(PELSHEIGHT);
	DEBUG_FIELD(DISPLAYFLAGS);
        DEBUG_FIELD(DISPLAYFREQUENCY);
	DEBUG_FIELD(POSITION);
#undef DEBUG_FIELD
	return wine_dbg_sprintf("%s", buf);
}


-- 
Dimi.




More information about the wine-devel mailing list