Hi all,

I just saw in a relay trace that we have a really ugly "feature":
Call gdi32.441: 
SetDIBits(0000f51e,0000f536,00000000,000000b0,403b5df8,403b599c,00000000) ret=10025877 
fs=008f
trace:gdi:GDI_GetObjPtr (f51e): enter 1
trace:gdi:GDI_GetObjPtr (f536): enter 2
err:bitmap:X11DRV_DIB_BuildColorMap #1
trace:gdi:GDI_GetObjPtr (ffef): enter 3
trace:gdi:GDI_ReleaseObj (ffef): leave 3
err:bitmap:X11DRV_DIB_BuildColorMap #1
trace:gdi:GDI_GetObjPtr (ffef): enter 3
trace:gdi:GDI_ReleaseObj (ffef): leave 3
err:bitmap:X11DRV_DIB_BuildColorMap #1
trace:gdi:GDI_GetObjPtr (ffef): enter 3
trace:gdi:GDI_ReleaseObj (ffef): leave 3
err:bitmap:X11DRV_DIB_BuildColorMap #1
trace:gdi:GDI_GetObjPtr (ffef): enter 3
trace:gdi:GDI_ReleaseObj (ffef): leave 3
err:bitmap:X11DRV_DIB_BuildColorMap #1
trace:gdi:GDI_GetObjPtr (ffef): enter 3
trace:gdi:GDI_ReleaseObj (ffef): leave 3
.
.
.

(and so on until all colors are done)

This is kind of awful IMO.

GDI_GetObjPtr isn't that easy.
This is lots of CPU cycles wasted in these loops here:
                for (i = 0; i < colors; i++, rgb++)
                    colorMapping[i] = X11DRV_PALETTE_ToPhysical( dc, RGB(rgb->rgbRed,
                                                                rgb->rgbGreen,
                                                                rgb->rgbBlue));

(X11DRV_DIB_BuildColorMap(); colors often goes up to 256)

Why does X11DRV_PALETTE_ToPhysical() take a DC as parameter ?
It only uses dc->w.hPalette and dc->w.bitsPerPixel anyway.
So why not call it with a "locked" palPtr anyway ?
That way you'd avoid these tons of GetObjPtr, ReleaseObj...

Comments ?

Should I change it ?

Andreas Mohr

Reply via email to