gdi32: Avoid a variable holding an ARRAY_SIZE.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
67a33fce6f
commit
02b7f00a11
|
@ -94,7 +94,6 @@ static const struct
|
||||||
{ OSMESA_RGB_565, 16, 5, 0, 6, 5, 5, 11, 0, 0, 16, 32, 8 },
|
{ OSMESA_RGB_565, 16, 5, 0, 6, 5, 5, 11, 0, 0, 16, 32, 8 },
|
||||||
{ OSMESA_RGB_565, 16, 5, 0, 6, 5, 5, 11, 0, 0, 16, 16, 8 },
|
{ OSMESA_RGB_565, 16, 5, 0, 6, 5, 5, 11, 0, 0, 16, 16, 8 },
|
||||||
};
|
};
|
||||||
static const int nb_formats = sizeof(pixel_formats) / sizeof(pixel_formats[0]);
|
|
||||||
|
|
||||||
static BOOL init_opengl(void)
|
static BOOL init_opengl(void)
|
||||||
{
|
{
|
||||||
|
@ -148,7 +147,7 @@ failed:
|
||||||
*/
|
*/
|
||||||
static int dibdrv_wglDescribePixelFormat( HDC hdc, int fmt, UINT size, PIXELFORMATDESCRIPTOR *descr )
|
static int dibdrv_wglDescribePixelFormat( HDC hdc, int fmt, UINT size, PIXELFORMATDESCRIPTOR *descr )
|
||||||
{
|
{
|
||||||
int ret = sizeof(pixel_formats) / sizeof(pixel_formats[0]);
|
int ret = ARRAY_SIZE( pixel_formats );
|
||||||
|
|
||||||
if (!descr) return ret;
|
if (!descr) return ret;
|
||||||
if (fmt <= 0 || fmt > ret) return 0;
|
if (fmt <= 0 || fmt > ret) return 0;
|
||||||
|
@ -198,7 +197,7 @@ static struct wgl_context *dibdrv_wglCreateContext( HDC hdc )
|
||||||
|
|
||||||
if (!(context = HeapAlloc( GetProcessHeap(), 0, sizeof( *context )))) return NULL;
|
if (!(context = HeapAlloc( GetProcessHeap(), 0, sizeof( *context )))) return NULL;
|
||||||
context->format = GetPixelFormat( hdc );
|
context->format = GetPixelFormat( hdc );
|
||||||
if (!context->format || context->format > nb_formats) context->format = 1;
|
if (!context->format || context->format > ARRAY_SIZE( pixel_formats )) context->format = 1;
|
||||||
|
|
||||||
if (!(context->context = pOSMesaCreateContextExt( pixel_formats[context->format - 1].mesa,
|
if (!(context->context = pOSMesaCreateContextExt( pixel_formats[context->format - 1].mesa,
|
||||||
pixel_formats[context->format - 1].depth_bits,
|
pixel_formats[context->format - 1].depth_bits,
|
||||||
|
@ -306,7 +305,7 @@ static BOOL dibdrv_wglMakeCurrent( HDC hdc, struct wgl_context *context )
|
||||||
*/
|
*/
|
||||||
static BOOL dibdrv_wglSetPixelFormat( HDC hdc, int fmt, const PIXELFORMATDESCRIPTOR *descr )
|
static BOOL dibdrv_wglSetPixelFormat( HDC hdc, int fmt, const PIXELFORMATDESCRIPTOR *descr )
|
||||||
{
|
{
|
||||||
if (fmt <= 0 || fmt > nb_formats) return FALSE;
|
if (fmt <= 0 || fmt > ARRAY_SIZE( pixel_formats )) return FALSE;
|
||||||
return GdiSetPixelFormat( hdc, fmt, descr );
|
return GdiSetPixelFormat( hdc, fmt, descr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue