Alexandre Julliard julliard@winehq.org wrote:
- case BITSPIXEL: return 32;
Shouldn't BITSPIXEL be also fetched from dev->hdc like the values below?
- case NUMCOLORS:
bpp = GetDeviceCaps( dev->hdc, BITSPIXEL );
return (bpp > 8) ? -1 : (1 << bpp);
- case COLORRES:
/* The observed correspondence between BITSPIXEL and COLORRES is:
* BITSPIXEL: 8 -> COLORRES: 18
* BITSPIXEL: 16 -> COLORRES: 16
* BITSPIXEL: 24 -> COLORRES: 24
* BITSPIXEL: 32 -> COLORRES: 24 */
bpp = GetDeviceCaps( dev->hdc, BITSPIXEL );
return (bpp <= 8) ? 18 : min( 24, bpp );
Dmitry Timoshkov dmitry@baikal.ru writes:
Alexandre Julliard julliard@winehq.org wrote:
- case BITSPIXEL: return 32;
Shouldn't BITSPIXEL be also fetched from dev->hdc like the values below?
It would have to be fetched from other values, but I don't see how you would do that. You can't fetch BITSPIXEL itself, that would cause an infinite loop.
Alexandre Julliard julliard@winehq.org wrote:
- case BITSPIXEL: return 32;
Shouldn't BITSPIXEL be also fetched from dev->hdc like the values below?
It would have to be fetched from other values, but I don't see how you would do that. You can't fetch BITSPIXEL itself, that would cause an infinite loop.
Does that mean that null driver always uses hardcoded BITSPIXEL = 32, and therefore other values depending on it should be hardcoded too?
Dmitry Timoshkov dmitry@baikal.ru writes:
Alexandre Julliard julliard@winehq.org wrote:
- case BITSPIXEL: return 32;
Shouldn't BITSPIXEL be also fetched from dev->hdc like the values below?
It would have to be fetched from other values, but I don't see how you would do that. You can't fetch BITSPIXEL itself, that would cause an infinite loop.
Does that mean that null driver always uses hardcoded BITSPIXEL = 32, and therefore other values depending on it should be hardcoded too?
No, the goal is to provide useful fallbacks, so that other drivers only need to return the correct BITSPIXEL and don't have to duplicate the code for computing the other values. That's why the null driver calls GetDeviceCaps instead of nulldrv_GetDeviceCaps; this way it goes through the driver stack again.