2011-04-01 16:27:48 +02:00
|
|
|
/*
|
|
|
|
* DIB driver initialization and DC functions.
|
|
|
|
*
|
|
|
|
* Copyright 2011 Huw Davies
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
#include "gdi_private.h"
|
|
|
|
#include "dibdrv.h"
|
|
|
|
|
2020-11-05 10:41:12 +01:00
|
|
|
#include "wine/wgl.h"
|
|
|
|
#include "wine/wgl_driver.h"
|
2011-08-23 12:49:53 +02:00
|
|
|
#include "wine/exception.h"
|
2011-04-01 16:27:48 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dib);
|
|
|
|
|
2020-11-05 10:41:12 +01:00
|
|
|
extern BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT fmt, const PIXELFORMATDESCRIPTOR *pfd );
|
|
|
|
|
|
|
|
static const struct osmesa_funcs *osmesa_funcs;
|
|
|
|
|
2011-07-25 15:30:33 +02:00
|
|
|
static const DWORD bit_fields_888[3] = {0xff0000, 0x00ff00, 0x0000ff};
|
|
|
|
static const DWORD bit_fields_555[3] = {0x7c00, 0x03e0, 0x001f};
|
|
|
|
|
2011-04-05 14:26:08 +02:00
|
|
|
static void calc_shift_and_len(DWORD mask, int *shift, int *len)
|
|
|
|
{
|
|
|
|
int s, l;
|
|
|
|
|
2011-04-12 13:49:08 +02:00
|
|
|
if(!mask)
|
|
|
|
{
|
|
|
|
*shift = *len = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-04-05 14:26:08 +02:00
|
|
|
s = 0;
|
|
|
|
while ((mask & 1) == 0)
|
|
|
|
{
|
|
|
|
mask >>= 1;
|
|
|
|
s++;
|
|
|
|
}
|
|
|
|
l = 0;
|
|
|
|
while ((mask & 1) == 1)
|
|
|
|
{
|
|
|
|
mask >>= 1;
|
|
|
|
l++;
|
|
|
|
}
|
|
|
|
*shift = s;
|
|
|
|
*len = l;
|
|
|
|
}
|
|
|
|
|
2011-04-05 14:23:20 +02:00
|
|
|
static void init_bit_fields(dib_info *dib, const DWORD *bit_fields)
|
|
|
|
{
|
|
|
|
dib->red_mask = bit_fields[0];
|
|
|
|
dib->green_mask = bit_fields[1];
|
|
|
|
dib->blue_mask = bit_fields[2];
|
2011-04-05 14:26:08 +02:00
|
|
|
calc_shift_and_len(dib->red_mask, &dib->red_shift, &dib->red_len);
|
|
|
|
calc_shift_and_len(dib->green_mask, &dib->green_shift, &dib->green_len);
|
|
|
|
calc_shift_and_len(dib->blue_mask, &dib->blue_shift, &dib->blue_len);
|
2011-04-05 14:23:20 +02:00
|
|
|
}
|
|
|
|
|
2016-04-13 12:18:51 +02:00
|
|
|
static void init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, int stride,
|
|
|
|
const DWORD *bit_fields, const RGBQUAD *color_table, void *bits)
|
2011-04-01 16:27:48 +02:00
|
|
|
{
|
2011-08-19 17:26:17 +02:00
|
|
|
dib->bit_count = bi->biBitCount;
|
|
|
|
dib->width = bi->biWidth;
|
|
|
|
dib->height = bi->biHeight;
|
2012-04-27 14:44:53 +02:00
|
|
|
dib->rect.left = 0;
|
|
|
|
dib->rect.top = 0;
|
|
|
|
dib->rect.right = bi->biWidth;
|
|
|
|
dib->rect.bottom = abs( bi->biHeight );
|
2011-11-29 15:12:00 +01:00
|
|
|
dib->compression = bi->biCompression;
|
2016-04-13 12:18:51 +02:00
|
|
|
dib->stride = stride;
|
2011-08-19 17:26:17 +02:00
|
|
|
dib->bits.ptr = bits;
|
|
|
|
dib->bits.is_copy = FALSE;
|
|
|
|
dib->bits.free = NULL;
|
|
|
|
dib->bits.param = NULL;
|
2011-04-01 16:27:48 +02:00
|
|
|
|
|
|
|
if(dib->height < 0) /* top-down */
|
|
|
|
{
|
|
|
|
dib->height = -dib->height;
|
|
|
|
}
|
|
|
|
else /* bottom-up */
|
|
|
|
{
|
|
|
|
/* bits always points to the top-left corner and the stride is -ve */
|
2011-08-19 17:26:17 +02:00
|
|
|
dib->bits.ptr = (BYTE*)dib->bits.ptr + (dib->height - 1) * dib->stride;
|
2011-04-01 16:27:48 +02:00
|
|
|
dib->stride = -dib->stride;
|
|
|
|
}
|
|
|
|
|
2011-04-05 14:23:20 +02:00
|
|
|
dib->funcs = &funcs_null;
|
|
|
|
|
2011-04-01 16:27:48 +02:00
|
|
|
switch(dib->bit_count)
|
|
|
|
{
|
2011-04-05 14:23:20 +02:00
|
|
|
case 32:
|
2011-04-12 13:49:08 +02:00
|
|
|
if(bi->biCompression == BI_RGB)
|
2011-05-11 16:13:40 +02:00
|
|
|
bit_fields = bit_fields_888;
|
|
|
|
|
|
|
|
init_bit_fields(dib, bit_fields);
|
|
|
|
|
|
|
|
if(dib->red_mask == 0xff0000 && dib->green_mask == 0x00ff00 && dib->blue_mask == 0x0000ff)
|
2011-04-07 14:47:18 +02:00
|
|
|
dib->funcs = &funcs_8888;
|
|
|
|
else
|
2011-05-11 16:13:40 +02:00
|
|
|
dib->funcs = &funcs_32;
|
2011-04-07 14:47:18 +02:00
|
|
|
break;
|
2011-04-05 14:23:20 +02:00
|
|
|
|
2011-06-01 10:41:39 +02:00
|
|
|
case 24:
|
|
|
|
dib->funcs = &funcs_24;
|
|
|
|
break;
|
|
|
|
|
2011-05-27 14:10:29 +02:00
|
|
|
case 16:
|
|
|
|
if(bi->biCompression == BI_RGB)
|
|
|
|
bit_fields = bit_fields_555;
|
|
|
|
|
|
|
|
init_bit_fields(dib, bit_fields);
|
|
|
|
|
|
|
|
if(dib->red_mask == 0x7c00 && dib->green_mask == 0x03e0 && dib->blue_mask == 0x001f)
|
|
|
|
dib->funcs = &funcs_555;
|
|
|
|
else
|
|
|
|
dib->funcs = &funcs_16;
|
|
|
|
break;
|
|
|
|
|
2011-05-27 15:26:02 +02:00
|
|
|
case 8:
|
|
|
|
dib->funcs = &funcs_8;
|
|
|
|
break;
|
|
|
|
|
2011-05-31 11:02:03 +02:00
|
|
|
case 4:
|
|
|
|
dib->funcs = &funcs_4;
|
|
|
|
break;
|
|
|
|
|
2011-06-15 14:43:49 +02:00
|
|
|
case 1:
|
|
|
|
dib->funcs = &funcs_1;
|
|
|
|
break;
|
2011-04-01 16:27:48 +02:00
|
|
|
}
|
|
|
|
|
2011-12-10 12:48:33 +01:00
|
|
|
if (color_table && bi->biClrUsed)
|
2011-05-27 15:17:20 +02:00
|
|
|
{
|
2011-12-12 15:58:05 +01:00
|
|
|
dib->color_table = color_table;
|
2011-12-10 12:48:33 +01:00
|
|
|
dib->color_table_size = bi->biClrUsed;
|
2011-05-27 15:17:20 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dib->color_table = NULL;
|
|
|
|
dib->color_table_size = 0;
|
|
|
|
}
|
2011-04-01 16:27:48 +02:00
|
|
|
}
|
|
|
|
|
2012-05-23 11:56:38 +02:00
|
|
|
void init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits)
|
2011-07-18 16:27:43 +02:00
|
|
|
{
|
2017-02-13 15:08:04 +01:00
|
|
|
int width_bytes = get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount );
|
|
|
|
if (info->bmiHeader.biSizeImage)
|
|
|
|
width_bytes = info->bmiHeader.biSizeImage / abs( info->bmiHeader.biHeight );
|
|
|
|
init_dib_info( dib, &info->bmiHeader, width_bytes,
|
2016-04-13 12:18:51 +02:00
|
|
|
(const DWORD *)info->bmiColors, info->bmiColors, bits );
|
2011-07-18 16:27:43 +02:00
|
|
|
}
|
|
|
|
|
2012-05-23 11:56:38 +02:00
|
|
|
BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp)
|
2011-08-29 15:26:50 +02:00
|
|
|
{
|
2012-01-10 16:04:17 +01:00
|
|
|
if (!is_bitmapobj_dib( bmp ))
|
2011-08-29 15:55:35 +02:00
|
|
|
{
|
2011-12-12 11:44:11 +01:00
|
|
|
BITMAPINFO info;
|
2011-08-29 15:55:35 +02:00
|
|
|
|
2011-12-12 11:44:11 +01:00
|
|
|
get_ddb_bitmapinfo( bmp, &info );
|
2012-05-23 11:56:38 +02:00
|
|
|
init_dib_info_from_bitmapinfo( dib, &info, bmp->dib.dsBm.bmBits );
|
2011-08-29 15:55:35 +02:00
|
|
|
}
|
2016-04-13 12:18:51 +02:00
|
|
|
else init_dib_info( dib, &bmp->dib.dsBmih, bmp->dib.dsBm.bmWidthBytes,
|
|
|
|
bmp->dib.dsBitfields, bmp->color_table, bmp->dib.dsBm.bmBits );
|
2011-12-12 16:11:17 +01:00
|
|
|
return TRUE;
|
2011-08-29 15:26:50 +02:00
|
|
|
}
|
|
|
|
|
2011-05-12 12:27:35 +02:00
|
|
|
static void clear_dib_info(dib_info *dib)
|
|
|
|
{
|
2011-08-19 17:26:17 +02:00
|
|
|
dib->bits.ptr = NULL;
|
|
|
|
dib->bits.free = NULL;
|
|
|
|
dib->bits.param = NULL;
|
2011-05-12 12:27:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* free_dib_info
|
|
|
|
*
|
|
|
|
* Free the resources associated with a dib and optionally the bits
|
|
|
|
*/
|
2011-07-12 17:12:04 +02:00
|
|
|
void free_dib_info(dib_info *dib)
|
2011-05-12 12:27:35 +02:00
|
|
|
{
|
2011-08-19 17:26:17 +02:00
|
|
|
if (dib->bits.free) dib->bits.free( &dib->bits );
|
|
|
|
clear_dib_info( dib );
|
2011-05-12 12:27:35 +02:00
|
|
|
}
|
|
|
|
|
2011-05-12 13:05:37 +02:00
|
|
|
void copy_dib_color_info(dib_info *dst, const dib_info *src)
|
|
|
|
{
|
|
|
|
dst->bit_count = src->bit_count;
|
|
|
|
dst->red_mask = src->red_mask;
|
|
|
|
dst->green_mask = src->green_mask;
|
|
|
|
dst->blue_mask = src->blue_mask;
|
|
|
|
dst->red_len = src->red_len;
|
|
|
|
dst->green_len = src->green_len;
|
|
|
|
dst->blue_len = src->blue_len;
|
|
|
|
dst->red_shift = src->red_shift;
|
|
|
|
dst->green_shift = src->green_shift;
|
|
|
|
dst->blue_shift = src->blue_shift;
|
|
|
|
dst->funcs = src->funcs;
|
2011-05-27 15:17:20 +02:00
|
|
|
dst->color_table_size = src->color_table_size;
|
2011-12-12 15:58:05 +01:00
|
|
|
dst->color_table = src->color_table;
|
2011-05-12 13:05:37 +02:00
|
|
|
}
|
|
|
|
|
2011-08-03 20:26:44 +02:00
|
|
|
DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitblt_coords *src,
|
2012-10-10 17:19:42 +02:00
|
|
|
const BITMAPINFO *dst_info, void *dst_bits )
|
2011-05-12 13:05:37 +02:00
|
|
|
{
|
2011-07-18 16:27:43 +02:00
|
|
|
dib_info src_dib, dst_dib;
|
|
|
|
DWORD ret;
|
2011-05-12 13:05:37 +02:00
|
|
|
|
2012-05-23 11:56:38 +02:00
|
|
|
init_dib_info_from_bitmapinfo( &src_dib, src_info, src_bits );
|
|
|
|
init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits );
|
2011-05-12 13:05:37 +02:00
|
|
|
|
2011-08-23 12:49:53 +02:00
|
|
|
__TRY
|
|
|
|
{
|
2012-05-22 10:57:01 +02:00
|
|
|
dst_dib.funcs->convert_to( &dst_dib, &src_dib, &src->visrect, FALSE );
|
2011-10-13 00:15:29 +02:00
|
|
|
ret = TRUE;
|
2011-08-23 12:49:53 +02:00
|
|
|
}
|
|
|
|
__EXCEPT_PAGE_FAULT
|
|
|
|
{
|
|
|
|
WARN( "invalid bits pointer %p\n", src_bits );
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
__ENDTRY
|
2011-05-12 13:05:37 +02:00
|
|
|
|
2011-07-18 16:27:43 +02:00
|
|
|
if(!ret) return ERROR_BAD_FORMAT;
|
2011-08-03 20:26:44 +02:00
|
|
|
|
|
|
|
/* update coordinates, the destination rectangle is always stored at 0,0 */
|
|
|
|
src->x -= src->visrect.left;
|
|
|
|
src->y -= src->visrect.top;
|
|
|
|
offset_rect( &src->visrect, -src->visrect.left, -src->visrect.top );
|
2011-07-18 16:27:43 +02:00
|
|
|
return ERROR_SUCCESS;
|
2011-05-12 13:05:37 +02:00
|
|
|
}
|
|
|
|
|
2018-04-04 15:20:57 +02:00
|
|
|
int get_dib_rect( const dib_info *dib, RECT *rc )
|
|
|
|
{
|
|
|
|
rc->left = max( 0, -dib->rect.left );
|
|
|
|
rc->top = max( 0, -dib->rect.top );
|
|
|
|
rc->right = min( dib->rect.right, dib->width ) - dib->rect.left;
|
|
|
|
rc->bottom = min( dib->rect.bottom, dib->height ) - dib->rect.top;
|
|
|
|
return !is_rect_empty( rc );
|
|
|
|
}
|
|
|
|
|
2012-07-30 13:59:04 +02:00
|
|
|
int clip_rect_to_dib( const dib_info *dib, RECT *rc )
|
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
|
2018-04-04 15:20:57 +02:00
|
|
|
return get_dib_rect( dib, &rect ) && intersect_rect( rc, &rect, rc );
|
2012-07-30 13:59:04 +02:00
|
|
|
}
|
|
|
|
|
2011-12-27 14:31:11 +01:00
|
|
|
int get_clipped_rects( const dib_info *dib, const RECT *rc, HRGN clip, struct clipped_rects *clip_rects )
|
|
|
|
{
|
|
|
|
const WINEREGION *region;
|
|
|
|
RECT rect, *out = clip_rects->buffer;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
init_clipped_rects( clip_rects );
|
|
|
|
|
2018-04-04 15:20:57 +02:00
|
|
|
if (!get_dib_rect( dib, &rect )) return 0;
|
2011-12-27 14:31:11 +01:00
|
|
|
if (rc && !intersect_rect( &rect, &rect, rc )) return 0;
|
|
|
|
|
|
|
|
if (!clip)
|
|
|
|
{
|
|
|
|
*out = rect;
|
|
|
|
clip_rects->count = 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(region = get_wine_region( clip ))) return 0;
|
|
|
|
|
2016-07-06 12:09:12 +02:00
|
|
|
for (i = region_find_pt( region, rect.left, rect.top, NULL ); i < region->numRects; i++)
|
2011-12-27 14:31:11 +01:00
|
|
|
{
|
|
|
|
if (region->rects[i].top >= rect.bottom) break;
|
|
|
|
if (!intersect_rect( out, &rect, ®ion->rects[i] )) continue;
|
|
|
|
out++;
|
2018-10-05 21:35:35 +02:00
|
|
|
if (out == &clip_rects->buffer[ARRAY_SIZE( clip_rects->buffer )])
|
2011-12-27 14:31:11 +01:00
|
|
|
{
|
|
|
|
clip_rects->rects = HeapAlloc( GetProcessHeap(), 0, region->numRects * sizeof(RECT) );
|
|
|
|
if (!clip_rects->rects) return 0;
|
|
|
|
memcpy( clip_rects->rects, clip_rects->buffer, (out - clip_rects->buffer) * sizeof(RECT) );
|
|
|
|
out = clip_rects->rects + (out - clip_rects->buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
release_wine_region( clip );
|
|
|
|
clip_rects->count = out - clip_rects->rects;
|
|
|
|
return clip_rects->count;
|
|
|
|
}
|
|
|
|
|
2012-04-25 13:15:24 +02:00
|
|
|
void add_clipped_bounds( dibdrv_physdev *dev, const RECT *rect, HRGN clip )
|
2012-04-11 14:49:30 +02:00
|
|
|
{
|
|
|
|
const WINEREGION *region;
|
|
|
|
RECT rc;
|
|
|
|
|
2012-04-25 13:15:24 +02:00
|
|
|
if (!dev->bounds) return;
|
2012-04-11 14:49:30 +02:00
|
|
|
if (clip)
|
|
|
|
{
|
|
|
|
if (!(region = get_wine_region( clip ))) return;
|
2012-04-25 13:15:24 +02:00
|
|
|
if (!rect) rc = region->extents;
|
|
|
|
else intersect_rect( &rc, rect, ®ion->extents );
|
2012-04-11 14:49:30 +02:00
|
|
|
release_wine_region( clip );
|
|
|
|
}
|
2012-04-25 13:15:24 +02:00
|
|
|
else rc = *rect;
|
|
|
|
|
2012-04-27 14:44:53 +02:00
|
|
|
if (is_rect_empty( &rc )) return;
|
|
|
|
offset_rect( &rc, dev->dib.rect.left, dev->dib.rect.top );
|
2012-04-25 13:15:24 +02:00
|
|
|
add_bounds_rect( dev->bounds, &rc );
|
2012-04-11 14:49:30 +02:00
|
|
|
}
|
|
|
|
|
2011-09-07 23:47:31 +02:00
|
|
|
/**********************************************************************
|
|
|
|
* dibdrv_CreateDC
|
|
|
|
*/
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL dibdrv_CreateDC( PHYSDEV *dev, LPCWSTR driver, LPCWSTR device,
|
|
|
|
LPCWSTR output, const DEVMODEW *data )
|
2011-09-07 23:47:31 +02:00
|
|
|
{
|
|
|
|
dibdrv_physdev *pdev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pdev) );
|
|
|
|
|
|
|
|
if (!pdev) return FALSE;
|
|
|
|
clear_dib_info(&pdev->dib);
|
2011-12-30 10:17:37 +01:00
|
|
|
clear_dib_info(&pdev->brush.dib);
|
2011-12-30 10:38:18 +01:00
|
|
|
clear_dib_info(&pdev->pen_brush.dib);
|
2011-09-07 23:47:31 +02:00
|
|
|
push_dc_driver( dev, &pdev->dev, &dib_driver );
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-05-12 12:27:35 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_DeleteDC
|
|
|
|
*/
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL dibdrv_DeleteDC( PHYSDEV dev )
|
2011-05-12 12:27:35 +02:00
|
|
|
{
|
|
|
|
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
|
|
|
TRACE("(%p)\n", dev);
|
2011-12-30 10:17:37 +01:00
|
|
|
free_pattern_brush( &pdev->brush );
|
2011-12-30 10:38:18 +01:00
|
|
|
free_pattern_brush( &pdev->pen_brush );
|
2012-11-27 23:19:29 +01:00
|
|
|
release_cached_font( pdev->font );
|
2011-09-07 23:47:31 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, pdev );
|
|
|
|
return TRUE;
|
2011-05-12 12:27:35 +02:00
|
|
|
}
|
|
|
|
|
2011-04-01 16:27:48 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_SelectBitmap
|
|
|
|
*/
|
2019-07-06 20:45:50 +02:00
|
|
|
static HBITMAP CDECL dibdrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
|
2011-04-01 16:27:48 +02:00
|
|
|
{
|
|
|
|
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
|
|
|
BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP );
|
2011-12-12 16:11:17 +01:00
|
|
|
dib_info dib;
|
|
|
|
|
2011-04-01 16:27:48 +02:00
|
|
|
TRACE("(%p, %p)\n", dev, bitmap);
|
|
|
|
|
|
|
|
if (!bmp) return 0;
|
|
|
|
|
2012-05-23 11:56:38 +02:00
|
|
|
if (!init_dib_info_from_bitmapobj(&dib, bmp))
|
2011-12-12 16:11:17 +01:00
|
|
|
{
|
|
|
|
GDI_ReleaseObj( bitmap );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
pdev->dib = dib;
|
2011-04-01 16:27:48 +02:00
|
|
|
GDI_ReleaseObj( bitmap );
|
|
|
|
|
2012-01-09 12:14:20 +01:00
|
|
|
return bitmap;
|
2011-04-01 16:27:48 +02:00
|
|
|
}
|
|
|
|
|
2011-04-13 15:57:44 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_SetDeviceClipping
|
|
|
|
*/
|
2019-07-06 20:45:50 +02:00
|
|
|
static void CDECL dibdrv_SetDeviceClipping( PHYSDEV dev, HRGN rgn )
|
2011-04-13 15:57:44 +02:00
|
|
|
{
|
|
|
|
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
2011-12-06 13:15:35 +01:00
|
|
|
TRACE("(%p, %p)\n", dev, rgn);
|
2011-04-13 15:57:44 +02:00
|
|
|
|
2011-12-27 15:48:05 +01:00
|
|
|
pdev->clip = rgn;
|
2011-04-13 15:57:44 +02:00
|
|
|
}
|
|
|
|
|
2012-04-25 12:26:44 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_SetBoundsRect
|
|
|
|
*/
|
2019-07-06 20:45:50 +02:00
|
|
|
static UINT CDECL dibdrv_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
|
2012-04-25 12:26:44 +02:00
|
|
|
{
|
|
|
|
dibdrv_physdev *pdev = get_dibdrv_pdev( dev );
|
|
|
|
|
2012-04-25 13:15:24 +02:00
|
|
|
if (flags & DCB_DISABLE) pdev->bounds = NULL;
|
|
|
|
else if (flags & DCB_ENABLE) pdev->bounds = rect;
|
|
|
|
return DCB_RESET; /* we don't have device-specific bounds */
|
2012-04-25 12:26:44 +02:00
|
|
|
}
|
|
|
|
|
2020-11-05 10:41:12 +01:00
|
|
|
struct wgl_context;
|
|
|
|
|
|
|
|
static const struct
|
|
|
|
{
|
|
|
|
BYTE color_bits;
|
|
|
|
BYTE red_bits, red_shift;
|
|
|
|
BYTE green_bits, green_shift;
|
|
|
|
BYTE blue_bits, blue_shift;
|
|
|
|
BYTE alpha_bits, alpha_shift;
|
|
|
|
BYTE accum_bits;
|
|
|
|
BYTE depth_bits;
|
|
|
|
BYTE stencil_bits;
|
|
|
|
} pixel_formats[] =
|
|
|
|
{
|
|
|
|
{ 32, 8, 16, 8, 8, 8, 0, 8, 24, 16, 32, 8 },
|
|
|
|
{ 32, 8, 16, 8, 8, 8, 0, 8, 24, 16, 16, 8 },
|
|
|
|
{ 32, 8, 0, 8, 8, 8, 16, 8, 24, 16, 32, 8 },
|
|
|
|
{ 32, 8, 0, 8, 8, 8, 16, 8, 24, 16, 16, 8 },
|
|
|
|
{ 32, 8, 8, 8, 16, 8, 24, 8, 0, 16, 32, 8 },
|
|
|
|
{ 32, 8, 8, 8, 16, 8, 24, 8, 0, 16, 16, 8 },
|
|
|
|
{ 24, 8, 0, 8, 8, 8, 16, 0, 0, 16, 32, 8 },
|
|
|
|
{ 24, 8, 0, 8, 8, 8, 16, 0, 0, 16, 16, 8 },
|
|
|
|
{ 24, 8, 16, 8, 8, 8, 0, 0, 0, 16, 32, 8 },
|
|
|
|
{ 24, 8, 16, 8, 8, 8, 0, 0, 0, 16, 16, 8 },
|
|
|
|
{ 16, 5, 0, 6, 5, 5, 11, 0, 0, 16, 32, 8 },
|
|
|
|
{ 16, 5, 0, 6, 5, 5, 11, 0, 0, 16, 16, 8 },
|
|
|
|
};
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* dibdrv_wglDescribePixelFormat
|
|
|
|
*/
|
|
|
|
static int WINAPI dibdrv_wglDescribePixelFormat( HDC hdc, int fmt, UINT size, PIXELFORMATDESCRIPTOR *descr )
|
|
|
|
{
|
|
|
|
int ret = ARRAY_SIZE( pixel_formats );
|
|
|
|
|
|
|
|
if (!descr) return ret;
|
|
|
|
if (fmt <= 0 || fmt > ret) return 0;
|
|
|
|
if (size < sizeof(*descr)) return 0;
|
|
|
|
|
|
|
|
memset( descr, 0, sizeof(*descr) );
|
|
|
|
descr->nSize = sizeof(*descr);
|
|
|
|
descr->nVersion = 1;
|
|
|
|
descr->dwFlags = PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_BITMAP | PFD_GENERIC_FORMAT;
|
|
|
|
descr->iPixelType = PFD_TYPE_RGBA;
|
|
|
|
descr->cColorBits = pixel_formats[fmt - 1].color_bits;
|
|
|
|
descr->cRedBits = pixel_formats[fmt - 1].red_bits;
|
|
|
|
descr->cRedShift = pixel_formats[fmt - 1].red_shift;
|
|
|
|
descr->cGreenBits = pixel_formats[fmt - 1].green_bits;
|
|
|
|
descr->cGreenShift = pixel_formats[fmt - 1].green_shift;
|
|
|
|
descr->cBlueBits = pixel_formats[fmt - 1].blue_bits;
|
|
|
|
descr->cBlueShift = pixel_formats[fmt - 1].blue_shift;
|
|
|
|
descr->cAlphaBits = pixel_formats[fmt - 1].alpha_bits;
|
|
|
|
descr->cAlphaShift = pixel_formats[fmt - 1].alpha_shift;
|
|
|
|
descr->cAccumBits = pixel_formats[fmt - 1].accum_bits;
|
|
|
|
descr->cAccumRedBits = pixel_formats[fmt - 1].accum_bits / 4;
|
|
|
|
descr->cAccumGreenBits = pixel_formats[fmt - 1].accum_bits / 4;
|
|
|
|
descr->cAccumBlueBits = pixel_formats[fmt - 1].accum_bits / 4;
|
|
|
|
descr->cAccumAlphaBits = pixel_formats[fmt - 1].accum_bits / 4;
|
|
|
|
descr->cDepthBits = pixel_formats[fmt - 1].depth_bits;
|
|
|
|
descr->cStencilBits = pixel_formats[fmt - 1].stencil_bits;
|
|
|
|
descr->cAuxBuffers = 0;
|
|
|
|
descr->iLayerType = PFD_MAIN_PLANE;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglCopyContext
|
|
|
|
*/
|
|
|
|
static BOOL WINAPI dibdrv_wglCopyContext( struct wgl_context *src, struct wgl_context *dst, UINT mask )
|
|
|
|
{
|
|
|
|
FIXME( "not supported yet\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglCreateContext
|
|
|
|
*/
|
|
|
|
static struct wgl_context * WINAPI dibdrv_wglCreateContext( HDC hdc )
|
|
|
|
{
|
|
|
|
PIXELFORMATDESCRIPTOR descr;
|
|
|
|
int format = GetPixelFormat( hdc );
|
|
|
|
|
|
|
|
if (!format) format = 1;
|
|
|
|
if (!DescribePixelFormat( hdc, format, sizeof(descr), &descr )) return NULL;
|
|
|
|
|
|
|
|
if (!osmesa_funcs) return NULL;
|
|
|
|
return osmesa_funcs->create_context( hdc, &descr );
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglDeleteContext
|
|
|
|
*/
|
|
|
|
static BOOL WINAPI dibdrv_wglDeleteContext( struct wgl_context *context )
|
|
|
|
{
|
|
|
|
if (!osmesa_funcs) return FALSE;
|
|
|
|
return osmesa_funcs->delete_context( context );
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglGetPixelFormat
|
|
|
|
*/
|
|
|
|
static int WINAPI dibdrv_wglGetPixelFormat( HDC hdc )
|
|
|
|
{
|
|
|
|
DC *dc = get_dc_ptr( hdc );
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (dc)
|
|
|
|
{
|
|
|
|
ret = dc->pixel_format;
|
|
|
|
release_dc_ptr( dc );
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglGetProcAddress
|
|
|
|
*/
|
|
|
|
static PROC WINAPI dibdrv_wglGetProcAddress( const char *proc )
|
|
|
|
{
|
|
|
|
if (!strncmp( proc, "wgl", 3 )) return NULL;
|
|
|
|
if (!osmesa_funcs) return NULL;
|
|
|
|
return osmesa_funcs->get_proc_address( proc );
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglMakeCurrent
|
|
|
|
*/
|
|
|
|
static BOOL WINAPI dibdrv_wglMakeCurrent( HDC hdc, struct wgl_context *context )
|
|
|
|
{
|
|
|
|
HBITMAP bitmap;
|
|
|
|
BITMAPOBJ *bmp;
|
|
|
|
dib_info dib;
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
|
|
|
|
if (!osmesa_funcs) return FALSE;
|
|
|
|
if (!context) return osmesa_funcs->make_current( NULL, NULL, 0, 0, 0, 0 );
|
|
|
|
|
|
|
|
bitmap = GetCurrentObject( hdc, OBJ_BITMAP );
|
|
|
|
bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP );
|
|
|
|
if (!bmp) return FALSE;
|
|
|
|
|
|
|
|
if (init_dib_info_from_bitmapobj( &dib, bmp ))
|
|
|
|
{
|
|
|
|
char *bits;
|
|
|
|
int width = dib.rect.right - dib.rect.left;
|
|
|
|
int height = dib.rect.bottom - dib.rect.top;
|
|
|
|
|
|
|
|
if (dib.stride < 0)
|
|
|
|
bits = (char *)dib.bits.ptr + (dib.rect.bottom - 1) * dib.stride;
|
|
|
|
else
|
|
|
|
bits = (char *)dib.bits.ptr + dib.rect.top * dib.stride;
|
|
|
|
bits += dib.rect.left * dib.bit_count / 8;
|
|
|
|
|
|
|
|
TRACE( "context %p bits %p size %ux%u\n", context, bits, width, height );
|
|
|
|
|
|
|
|
ret = osmesa_funcs->make_current( context, bits, width, height, dib.bit_count, dib.stride );
|
|
|
|
}
|
|
|
|
GDI_ReleaseObj( bitmap );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* dibdrv_wglSetPixelFormat
|
|
|
|
*/
|
|
|
|
static BOOL WINAPI dibdrv_wglSetPixelFormat( HDC hdc, int fmt, const PIXELFORMATDESCRIPTOR *descr )
|
|
|
|
{
|
|
|
|
if (fmt <= 0 || fmt > ARRAY_SIZE( pixel_formats )) return FALSE;
|
|
|
|
return GdiSetPixelFormat( hdc, fmt, descr );
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglShareLists
|
|
|
|
*/
|
|
|
|
static BOOL WINAPI dibdrv_wglShareLists( struct wgl_context *org, struct wgl_context *dest )
|
|
|
|
{
|
|
|
|
FIXME( "not supported yet\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglSwapBuffers
|
|
|
|
*/
|
|
|
|
static BOOL WINAPI dibdrv_wglSwapBuffers( HDC hdc )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct opengl_funcs opengl_funcs =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dibdrv_wglCopyContext, /* p_wglCopyContext */
|
|
|
|
dibdrv_wglCreateContext, /* p_wglCreateContext */
|
|
|
|
dibdrv_wglDeleteContext, /* p_wglDeleteContext */
|
|
|
|
dibdrv_wglDescribePixelFormat, /* p_wglDescribePixelFormat */
|
|
|
|
dibdrv_wglGetPixelFormat, /* p_wglGetPixelFormat */
|
|
|
|
dibdrv_wglGetProcAddress, /* p_wglGetProcAddress */
|
|
|
|
dibdrv_wglMakeCurrent, /* p_wglMakeCurrent */
|
|
|
|
dibdrv_wglSetPixelFormat, /* p_wglSetPixelFormat */
|
|
|
|
dibdrv_wglShareLists, /* p_wglShareLists */
|
|
|
|
dibdrv_wglSwapBuffers, /* p_wglSwapBuffers */
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* dibdrv_wine_get_wgl_driver
|
|
|
|
*/
|
|
|
|
static struct opengl_funcs * CDECL dibdrv_wine_get_wgl_driver( PHYSDEV dev, UINT version )
|
|
|
|
{
|
|
|
|
if (version != WINE_WGL_DRIVER_VERSION)
|
|
|
|
{
|
|
|
|
ERR( "version mismatch, opengl32 wants %u but dibdrv has %u\n", version, WINE_WGL_DRIVER_VERSION );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (!osmesa_funcs && __wine_init_unix_lib( gdi32_module, DLL_PROCESS_ATTACH, NULL, &osmesa_funcs ))
|
|
|
|
{
|
|
|
|
static int warned;
|
|
|
|
if (!warned++) ERR( "OSMesa not available, no OpenGL bitmap support\n" );
|
|
|
|
return (void *)-1;
|
|
|
|
}
|
|
|
|
osmesa_funcs->get_gl_funcs( &opengl_funcs );
|
|
|
|
return &opengl_funcs;
|
|
|
|
}
|
|
|
|
|
2011-10-17 20:39:54 +02:00
|
|
|
const struct gdi_dc_funcs dib_driver =
|
2011-04-01 16:27:48 +02:00
|
|
|
{
|
|
|
|
NULL, /* pAbortDoc */
|
|
|
|
NULL, /* pAbortPath */
|
2011-10-11 15:23:04 +02:00
|
|
|
dibdrv_AlphaBlend, /* pAlphaBlend */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pAngleArc */
|
2012-01-06 17:20:37 +01:00
|
|
|
dibdrv_Arc, /* pArc */
|
|
|
|
dibdrv_ArcTo, /* pArcTo */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pBeginPath */
|
2011-10-14 12:30:28 +02:00
|
|
|
dibdrv_BlendImage, /* pBlendImage */
|
2012-01-06 17:20:37 +01:00
|
|
|
dibdrv_Chord, /* pChord */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pCloseFigure */
|
2011-09-07 15:36:58 +02:00
|
|
|
NULL, /* pCreateCompatibleDC */
|
2011-09-07 23:47:31 +02:00
|
|
|
dibdrv_CreateDC, /* pCreateDC */
|
2011-04-01 16:27:48 +02:00
|
|
|
dibdrv_DeleteDC, /* pDeleteDC */
|
|
|
|
NULL, /* pDeleteObject */
|
|
|
|
NULL, /* pDeviceCapabilities */
|
2012-01-06 12:55:15 +01:00
|
|
|
dibdrv_Ellipse, /* pEllipse */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pEndDoc */
|
|
|
|
NULL, /* pEndPage */
|
|
|
|
NULL, /* pEndPath */
|
2011-10-19 15:37:10 +02:00
|
|
|
NULL, /* pEnumFonts */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pEnumICMProfiles */
|
|
|
|
NULL, /* pExcludeClipRect */
|
|
|
|
NULL, /* pExtDeviceMode */
|
2012-05-09 17:07:15 +02:00
|
|
|
NULL, /* pExtEscape */
|
2012-01-06 17:23:00 +01:00
|
|
|
dibdrv_ExtFloodFill, /* pExtFloodFill */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pExtSelectClipRgn */
|
2011-11-14 13:49:04 +01:00
|
|
|
dibdrv_ExtTextOut, /* pExtTextOut */
|
2016-06-16 07:06:48 +02:00
|
|
|
dibdrv_FillPath, /* pFillPath */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pFillRgn */
|
|
|
|
NULL, /* pFlattenPath */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pFontIsLinked */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pFrameRgn */
|
|
|
|
NULL, /* pGdiComment */
|
2012-04-25 13:15:24 +02:00
|
|
|
NULL, /* pGetBoundsRect */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetCharABCWidths */
|
|
|
|
NULL, /* pGetCharABCWidthsI */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pGetCharWidth */
|
2019-04-09 11:32:59 +02:00
|
|
|
NULL, /* pGetCharWidthInfo */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pGetDeviceCaps */
|
2012-05-31 13:44:32 +02:00
|
|
|
NULL, /* pGetDeviceGammaRamp */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetFontData */
|
2015-08-29 18:54:17 +02:00
|
|
|
NULL, /* pGetFontRealizationInfo */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetFontUnicodeRanges */
|
|
|
|
NULL, /* pGetGlyphIndices */
|
|
|
|
NULL, /* pGetGlyphOutline */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pGetICMProfile */
|
2011-07-25 15:30:33 +02:00
|
|
|
dibdrv_GetImage, /* pGetImage */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetKerningPairs */
|
2011-12-12 20:20:06 +01:00
|
|
|
dibdrv_GetNearestColor, /* pGetNearestColor */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetOutlineTextMetrics */
|
2011-10-19 13:41:58 +02:00
|
|
|
dibdrv_GetPixel, /* pGetPixel */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pGetSystemPaletteEntries */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetTextCharsetInfo */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pGetTextExtentExPoint */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetTextExtentExPointI */
|
|
|
|
NULL, /* pGetTextFace */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pGetTextMetrics */
|
2011-11-28 13:21:52 +01:00
|
|
|
dibdrv_GradientFill, /* pGradientFill */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pIntersectClipRect */
|
|
|
|
NULL, /* pInvertRgn */
|
2011-04-07 14:49:33 +02:00
|
|
|
dibdrv_LineTo, /* pLineTo */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pModifyWorldTransform */
|
|
|
|
NULL, /* pMoveTo */
|
|
|
|
NULL, /* pOffsetClipRgn */
|
|
|
|
NULL, /* pOffsetViewportOrg */
|
|
|
|
NULL, /* pOffsetWindowOrg */
|
2011-05-16 12:29:04 +02:00
|
|
|
dibdrv_PaintRgn, /* pPaintRgn */
|
2011-04-11 11:07:12 +02:00
|
|
|
dibdrv_PatBlt, /* pPatBlt */
|
2012-01-06 17:20:37 +01:00
|
|
|
dibdrv_Pie, /* pPie */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pPolyBezier */
|
|
|
|
NULL, /* pPolyBezierTo */
|
|
|
|
NULL, /* pPolyDraw */
|
2011-12-29 09:57:58 +01:00
|
|
|
dibdrv_PolyPolygon, /* pPolyPolygon */
|
2011-08-19 17:26:19 +02:00
|
|
|
dibdrv_PolyPolyline, /* pPolyPolyline */
|
2011-12-29 09:57:58 +01:00
|
|
|
dibdrv_Polygon, /* pPolygon */
|
2011-08-19 17:26:19 +02:00
|
|
|
dibdrv_Polyline, /* pPolyline */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pPolylineTo */
|
2011-08-02 15:11:10 +02:00
|
|
|
dibdrv_PutImage, /* pPutImage */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pRealizeDefaultPalette */
|
|
|
|
NULL, /* pRealizePalette */
|
2011-05-13 14:28:15 +02:00
|
|
|
dibdrv_Rectangle, /* pRectangle */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pResetDC */
|
|
|
|
NULL, /* pRestoreDC */
|
2012-01-06 12:55:15 +01:00
|
|
|
dibdrv_RoundRect, /* pRoundRect */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pSaveDC */
|
|
|
|
NULL, /* pScaleViewportExt */
|
|
|
|
NULL, /* pScaleWindowExt */
|
|
|
|
dibdrv_SelectBitmap, /* pSelectBitmap */
|
2011-04-11 11:00:28 +02:00
|
|
|
dibdrv_SelectBrush, /* pSelectBrush */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pSelectClipPath */
|
2012-10-31 16:07:51 +01:00
|
|
|
dibdrv_SelectFont, /* pSelectFont */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pSelectPalette */
|
2011-04-07 14:46:33 +02:00
|
|
|
dibdrv_SelectPen, /* pSelectPen */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pSetArcDirection */
|
2011-12-22 16:32:37 +01:00
|
|
|
NULL, /* pSetBkColor */
|
2011-12-22 16:18:13 +01:00
|
|
|
NULL, /* pSetBkMode */
|
2012-04-25 12:26:44 +02:00
|
|
|
dibdrv_SetBoundsRect, /* pSetBoundsRect */
|
2011-04-11 11:00:28 +02:00
|
|
|
dibdrv_SetDCBrushColor, /* pSetDCBrushColor */
|
2011-04-07 14:47:59 +02:00
|
|
|
dibdrv_SetDCPenColor, /* pSetDCPenColor */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pSetDIBitsToDevice */
|
2011-04-13 15:57:44 +02:00
|
|
|
dibdrv_SetDeviceClipping, /* pSetDeviceClipping */
|
2012-05-31 13:44:32 +02:00
|
|
|
NULL, /* pSetDeviceGammaRamp */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pSetLayout */
|
|
|
|
NULL, /* pSetMapMode */
|
|
|
|
NULL, /* pSetMapperFlags */
|
2011-10-19 13:41:55 +02:00
|
|
|
dibdrv_SetPixel, /* pSetPixel */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pSetPolyFillMode */
|
2011-12-27 16:40:48 +01:00
|
|
|
NULL, /* pSetROP2 */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pSetRelAbs */
|
|
|
|
NULL, /* pSetStretchBltMode */
|
|
|
|
NULL, /* pSetTextAlign */
|
|
|
|
NULL, /* pSetTextCharacterExtra */
|
2011-12-22 16:32:37 +01:00
|
|
|
NULL, /* pSetTextColor */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pSetTextJustification */
|
|
|
|
NULL, /* pSetViewportExt */
|
|
|
|
NULL, /* pSetViewportOrg */
|
|
|
|
NULL, /* pSetWindowExt */
|
|
|
|
NULL, /* pSetWindowOrg */
|
|
|
|
NULL, /* pSetWorldTransform */
|
|
|
|
NULL, /* pStartDoc */
|
|
|
|
NULL, /* pStartPage */
|
2011-09-27 17:13:39 +02:00
|
|
|
dibdrv_StretchBlt, /* pStretchBlt */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pStretchDIBits */
|
2016-06-16 07:06:48 +02:00
|
|
|
dibdrv_StrokeAndFillPath, /* pStrokeAndFillPath */
|
|
|
|
dibdrv_StrokePath, /* pStrokePath */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pUnrealizePalette */
|
|
|
|
NULL, /* pWidenPath */
|
2019-10-22 10:38:56 +02:00
|
|
|
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
|
|
|
|
NULL, /* pD3DKMTSetVidPnSourceOwner */
|
2012-07-26 20:47:31 +02:00
|
|
|
dibdrv_wine_get_wgl_driver, /* wine_get_wgl_driver */
|
2018-02-26 19:42:15 +01:00
|
|
|
NULL, /* wine_get_vulkan_driver */
|
2012-05-08 12:16:05 +02:00
|
|
|
GDI_PRIORITY_DIB_DRV /* priority */
|
2011-04-01 16:27:48 +02:00
|
|
|
};
|
2012-09-06 12:23:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* Driver for window surfaces.
|
|
|
|
*
|
|
|
|
* It uses the DIB engine but needs extra locking since multiple DCs
|
|
|
|
* can paint to the same window.
|
|
|
|
*/
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
#define FLUSH_PERIOD 50 /* time in ms since drawing started for forcing a surface flush */
|
|
|
|
|
2012-09-06 12:23:10 +02:00
|
|
|
struct windrv_physdev
|
|
|
|
{
|
|
|
|
struct gdi_physdev dev;
|
|
|
|
struct dibdrv_physdev *dibdrv;
|
|
|
|
struct window_surface *surface;
|
2015-11-27 10:46:43 +01:00
|
|
|
DWORD start_ticks;
|
2012-09-06 12:23:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct gdi_dc_funcs window_driver;
|
|
|
|
|
|
|
|
static inline struct windrv_physdev *get_windrv_physdev( PHYSDEV dev )
|
|
|
|
{
|
|
|
|
return (struct windrv_physdev *)dev;
|
|
|
|
}
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
static inline void lock_surface( struct windrv_physdev *dev )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
GDI_CheckNotLock();
|
2015-11-27 10:46:43 +01:00
|
|
|
dev->surface->funcs->lock( dev->surface );
|
|
|
|
if (is_rect_empty( dev->dibdrv->bounds )) dev->start_ticks = GetTickCount();
|
2012-09-06 12:23:10 +02:00
|
|
|
}
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
static inline void unlock_surface( struct windrv_physdev *dev )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
2015-11-27 10:46:43 +01:00
|
|
|
dev->surface->funcs->unlock( dev->surface );
|
|
|
|
if (GetTickCount() - dev->start_ticks > FLUSH_PERIOD) dev->surface->funcs->flush( dev->surface );
|
2012-09-06 12:23:10 +02:00
|
|
|
}
|
|
|
|
|
2020-09-22 10:26:25 +02:00
|
|
|
static void CDECL unlock_bits_surface( struct gdi_image_bits *bits )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
2015-11-27 10:46:43 +01:00
|
|
|
struct window_surface *surface = bits->param;
|
|
|
|
surface->funcs->unlock( surface );
|
2012-09-06 12:23:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void dibdrv_set_window_surface( DC *dc, struct window_surface *surface )
|
|
|
|
{
|
|
|
|
char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
|
|
|
|
BITMAPINFO *info = (BITMAPINFO *)buffer;
|
|
|
|
void *bits;
|
|
|
|
PHYSDEV windev;
|
|
|
|
struct windrv_physdev *physdev;
|
|
|
|
struct dibdrv_physdev *dibdrv;
|
|
|
|
|
|
|
|
TRACE( "%p %p\n", dc->hSelf, surface );
|
|
|
|
|
|
|
|
windev = pop_dc_driver( dc, &window_driver );
|
|
|
|
|
|
|
|
if (surface)
|
|
|
|
{
|
|
|
|
if (windev) push_dc_driver( &dc->physDev, windev, windev->funcs );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!window_driver.pCreateDC( &dc->physDev, NULL, NULL, NULL, NULL )) return;
|
|
|
|
windev = find_dc_driver( dc, &window_driver );
|
|
|
|
}
|
|
|
|
|
|
|
|
physdev = get_windrv_physdev( windev );
|
|
|
|
window_surface_add_ref( surface );
|
|
|
|
if (physdev->surface) window_surface_release( physdev->surface );
|
|
|
|
physdev->surface = surface;
|
|
|
|
|
|
|
|
dibdrv = physdev->dibdrv;
|
|
|
|
bits = surface->funcs->get_info( surface, info );
|
|
|
|
init_dib_info_from_bitmapinfo( &dibdrv->dib, info, bits );
|
|
|
|
dibdrv->dib.rect = dc->vis_rect;
|
2018-07-11 15:20:56 +02:00
|
|
|
offset_rect( &dibdrv->dib.rect, -dc->device_rect.left, -dc->device_rect.top );
|
2012-09-06 12:23:10 +02:00
|
|
|
dibdrv->bounds = surface->funcs->get_bounds( surface );
|
|
|
|
DC_InitDC( dc );
|
|
|
|
}
|
|
|
|
else if (windev)
|
|
|
|
{
|
|
|
|
dib_driver.pDeleteDC( pop_dc_driver( dc, &dib_driver ));
|
|
|
|
windev->funcs->pDeleteDC( windev );
|
|
|
|
DC_InitDC( dc );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
|
|
|
|
PHYSDEV src_dev, struct bitblt_coords *src, BLENDFUNCTION func )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dst_dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dst_dev = GET_NEXT_PHYSDEV( dst_dev, pAlphaBlend );
|
|
|
|
ret = dst_dev->funcs->pAlphaBlend( dst_dev, dst, src_dev, src, func );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT xstart, INT ystart, INT xend, INT yend )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pArc );
|
|
|
|
ret = dev->funcs->pArc( dev, left, top, right, bottom, xstart, ystart, xend, yend );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT xstart, INT ystart, INT xend, INT yend )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pArc );
|
|
|
|
ret = dev->funcs->pArcTo( dev, left, top, right, bottom, xstart, ystart, xend, yend );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static DWORD CDECL windrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_bits *bits,
|
|
|
|
struct bitblt_coords *src, struct bitblt_coords *dst, BLENDFUNCTION blend )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
DWORD ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pBlendImage );
|
|
|
|
ret = dev->funcs->pBlendImage( dev, info, bits, src, dst, blend );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT xstart, INT ystart, INT xend, INT yend )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pChord );
|
|
|
|
ret = dev->funcs->pChord( dev, left, top, right, bottom, xstart, ystart, xend, yend );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_CreateDC( PHYSDEV *dev, LPCWSTR driver, LPCWSTR device,
|
|
|
|
LPCWSTR output, const DEVMODEW *devmode )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physdev) );
|
|
|
|
|
|
|
|
if (!physdev) return FALSE;
|
|
|
|
|
|
|
|
if (!dib_driver.pCreateDC( dev, NULL, NULL, NULL, NULL ))
|
|
|
|
{
|
|
|
|
HeapFree( GetProcessHeap(), 0, physdev );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
physdev->dibdrv = get_dibdrv_pdev( *dev );
|
|
|
|
push_dc_driver( dev, &physdev->dev, &window_driver );
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_DeleteDC( PHYSDEV dev )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
|
|
|
|
window_surface_release( physdev->surface );
|
|
|
|
HeapFree( GetProcessHeap(), 0, physdev );
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pEllipse );
|
|
|
|
ret = dev->funcs->pEllipse( dev, left, top, right, bottom );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT type )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pExtFloodFill );
|
|
|
|
ret = dev->funcs->pExtFloodFill( dev, x, y, color, type );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect,
|
|
|
|
LPCWSTR str, UINT count, const INT *dx )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pExtTextOut );
|
|
|
|
ret = dev->funcs->pExtTextOut( dev, x, y, flags, rect, str, count, dx );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static DWORD CDECL windrv_GetImage( PHYSDEV dev, BITMAPINFO *info,
|
|
|
|
struct gdi_image_bits *bits, struct bitblt_coords *src )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
DWORD ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pGetImage );
|
|
|
|
ret = dev->funcs->pGetImage( dev, info, bits, src );
|
2012-10-10 17:08:05 +02:00
|
|
|
|
|
|
|
/* don't return alpha if original surface doesn't support it */
|
|
|
|
if (info->bmiHeader.biBitCount == 32 &&
|
|
|
|
info->bmiHeader.biCompression == BI_RGB &&
|
|
|
|
physdev->dibdrv->dib.compression == BI_BITFIELDS)
|
|
|
|
{
|
|
|
|
DWORD *colors = (DWORD *)info->bmiColors;
|
|
|
|
colors[0] = 0xff0000;
|
|
|
|
colors[1] = 0x00ff00;
|
|
|
|
colors[2] = 0x0000ff;
|
|
|
|
info->bmiHeader.biCompression = BI_BITFIELDS;
|
|
|
|
}
|
|
|
|
|
2012-09-06 12:23:10 +02:00
|
|
|
if (!bits->is_copy)
|
|
|
|
{
|
|
|
|
/* use the freeing callback to unlock the surface */
|
|
|
|
assert( !bits->free );
|
|
|
|
bits->free = unlock_bits_surface;
|
|
|
|
bits->param = physdev->surface;
|
|
|
|
}
|
2015-11-27 10:46:43 +01:00
|
|
|
else unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static COLORREF CDECL windrv_GetPixel( PHYSDEV dev, INT x, INT y )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
COLORREF ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pGetPixel );
|
|
|
|
ret = dev->funcs->pGetPixel( dev, x, y );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
|
|
|
|
void * grad_array, ULONG ngrad, ULONG mode )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pGradientFill );
|
|
|
|
ret = dev->funcs->pGradientFill( dev, vert_array, nvert, grad_array, ngrad, mode );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_LineTo( PHYSDEV dev, INT x, INT y )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pLineTo );
|
|
|
|
ret = dev->funcs->pLineTo( dev, x, y );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_PaintRgn( PHYSDEV dev, HRGN rgn )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pPaintRgn );
|
|
|
|
ret = dev->funcs->pPaintRgn( dev, rgn );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pPatBlt );
|
|
|
|
ret = dev->funcs->pPatBlt( dev, dst, rop );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT xstart, INT ystart, INT xend, INT yend )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pPie );
|
|
|
|
ret = dev->funcs->pPie( dev, left, top, right, bottom, xstart, ystart, xend, yend );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_PolyPolygon( PHYSDEV dev, const POINT *points, const INT *counts, UINT polygons )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pPolyPolygon );
|
|
|
|
ret = dev->funcs->pPolyPolygon( dev, points, counts, polygons );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_PolyPolyline( PHYSDEV dev, const POINT *points, const DWORD *counts, DWORD lines )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pPolyPolyline );
|
|
|
|
ret = dev->funcs->pPolyPolyline( dev, points, counts, lines );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_Polygon( PHYSDEV dev, const POINT *points, INT count )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pPolygon );
|
|
|
|
ret = dev->funcs->pPolygon( dev, points, count );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_Polyline( PHYSDEV dev, const POINT *points, INT count )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pPolyline );
|
|
|
|
ret = dev->funcs->pPolyline( dev, points, count );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static DWORD CDECL windrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
|
|
|
|
const struct gdi_image_bits *bits, struct bitblt_coords *src,
|
|
|
|
struct bitblt_coords *dst, DWORD rop )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
DWORD ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pPutImage );
|
|
|
|
ret = dev->funcs->pPutImage( dev, clip, info, bits, src, dst, rop );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pRectangle );
|
|
|
|
ret = dev->funcs->pRectangle( dev, left, top, right, bottom );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT ell_width, INT ell_height )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pRoundRect );
|
|
|
|
ret = dev->funcs->pRoundRect( dev, left, top, right, bottom, ell_width, ell_height );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static UINT CDECL windrv_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
/* do nothing, we use the dibdrv bounds tracking for our own purpose */
|
|
|
|
return DCB_RESET;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static INT CDECL windrv_SetDIBitsToDevice( PHYSDEV dev, INT x_dst, INT y_dst, DWORD cx, DWORD cy,
|
|
|
|
INT x_src, INT y_src, UINT startscan, UINT lines,
|
|
|
|
const void *bits, BITMAPINFO *src_info, UINT coloruse )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
INT ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pSetDIBitsToDevice );
|
|
|
|
ret = dev->funcs->pSetDIBitsToDevice( dev, x_dst, y_dst, cx, cy,
|
|
|
|
x_src, y_src, startscan, lines, bits, src_info, coloruse );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static void CDECL windrv_SetDeviceClipping( PHYSDEV dev, HRGN rgn )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pSetDeviceClipping );
|
|
|
|
dev->funcs->pSetDeviceClipping( dev, rgn );
|
|
|
|
/* also forward to the graphics driver for the OpenGL case */
|
|
|
|
if (dev->funcs == &dib_driver)
|
|
|
|
{
|
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pSetDeviceClipping );
|
|
|
|
dev->funcs->pSetDeviceClipping( dev, rgn );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static COLORREF CDECL windrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
COLORREF ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pSetPixel );
|
|
|
|
ret = dev->funcs->pSetPixel( dev, x, y, color );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL windrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
|
|
|
|
PHYSDEV src_dev, struct bitblt_coords *src, DWORD rop )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dst_dev );
|
|
|
|
BOOL ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dst_dev = GET_NEXT_PHYSDEV( dst_dev, pStretchBlt );
|
|
|
|
ret = dst_dev->funcs->pStretchBlt( dst_dev, dst, src_dev, src, rop );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static INT CDECL windrv_StretchDIBits( PHYSDEV dev, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
|
|
|
|
INT x_src, INT y_src, INT width_src, INT height_src, const void *bits,
|
|
|
|
BITMAPINFO *src_info, UINT coloruse, DWORD rop )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
struct windrv_physdev *physdev = get_windrv_physdev( dev );
|
|
|
|
INT ret;
|
|
|
|
|
2015-11-27 10:46:43 +01:00
|
|
|
lock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
dev = GET_NEXT_PHYSDEV( dev, pStretchDIBits );
|
|
|
|
ret = dev->funcs->pStretchDIBits( dev, x_dst, y_dst, width_dst, height_dst,
|
|
|
|
x_src, y_src, width_src, height_src, bits, src_info, coloruse, rop );
|
2015-11-27 10:46:43 +01:00
|
|
|
unlock_surface( physdev );
|
2012-09-06 12:23:10 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static struct opengl_funcs * CDECL windrv_wine_get_wgl_driver( PHYSDEV dev, UINT version )
|
2012-09-06 12:23:10 +02:00
|
|
|
{
|
|
|
|
dev = GET_NEXT_PHYSDEV( dev, wine_get_wgl_driver );
|
|
|
|
if (dev->funcs == &dib_driver) dev = GET_NEXT_PHYSDEV( dev, wine_get_wgl_driver );
|
|
|
|
return dev->funcs->wine_get_wgl_driver( dev, version );
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct gdi_dc_funcs window_driver =
|
|
|
|
{
|
|
|
|
NULL, /* pAbortDoc */
|
|
|
|
NULL, /* pAbortPath */
|
|
|
|
windrv_AlphaBlend, /* pAlphaBlend */
|
|
|
|
NULL, /* pAngleArc */
|
|
|
|
windrv_Arc, /* pArc */
|
|
|
|
windrv_ArcTo, /* pArcTo */
|
|
|
|
NULL, /* pBeginPath */
|
|
|
|
windrv_BlendImage, /* pBlendImage */
|
|
|
|
windrv_Chord, /* pChord */
|
|
|
|
NULL, /* pCloseFigure */
|
|
|
|
NULL, /* pCreateCompatibleDC */
|
|
|
|
windrv_CreateDC, /* pCreateDC */
|
|
|
|
windrv_DeleteDC, /* pDeleteDC */
|
|
|
|
NULL, /* pDeleteObject */
|
|
|
|
NULL, /* pDeviceCapabilities */
|
|
|
|
windrv_Ellipse, /* pEllipse */
|
|
|
|
NULL, /* pEndDoc */
|
|
|
|
NULL, /* pEndPage */
|
|
|
|
NULL, /* pEndPath */
|
|
|
|
NULL, /* pEnumFonts */
|
|
|
|
NULL, /* pEnumICMProfiles */
|
|
|
|
NULL, /* pExcludeClipRect */
|
|
|
|
NULL, /* pExtDeviceMode */
|
|
|
|
NULL, /* pExtEscape */
|
|
|
|
windrv_ExtFloodFill, /* pExtFloodFill */
|
|
|
|
NULL, /* pExtSelectClipRgn */
|
|
|
|
windrv_ExtTextOut, /* pExtTextOut */
|
|
|
|
NULL, /* pFillPath */
|
|
|
|
NULL, /* pFillRgn */
|
|
|
|
NULL, /* pFlattenPath */
|
|
|
|
NULL, /* pFontIsLinked */
|
|
|
|
NULL, /* pFrameRgn */
|
|
|
|
NULL, /* pGdiComment */
|
|
|
|
NULL, /* pGetBoundsRect */
|
|
|
|
NULL, /* pGetCharABCWidths */
|
|
|
|
NULL, /* pGetCharABCWidthsI */
|
|
|
|
NULL, /* pGetCharWidth */
|
2019-04-09 11:32:59 +02:00
|
|
|
NULL, /* pGetCharWidthInfo */
|
2012-09-06 12:23:10 +02:00
|
|
|
NULL, /* pGetDeviceCaps */
|
|
|
|
NULL, /* pGetDeviceGammaRamp */
|
|
|
|
NULL, /* pGetFontData */
|
2015-08-29 18:54:17 +02:00
|
|
|
NULL, /* pGetFontRealizationInfo */
|
2012-09-06 12:23:10 +02:00
|
|
|
NULL, /* pGetFontUnicodeRanges */
|
|
|
|
NULL, /* pGetGlyphIndices */
|
|
|
|
NULL, /* pGetGlyphOutline */
|
|
|
|
NULL, /* pGetICMProfile */
|
|
|
|
windrv_GetImage, /* pGetImage */
|
|
|
|
NULL, /* pGetKerningPairs */
|
|
|
|
NULL, /* pGetNearestColor */
|
|
|
|
NULL, /* pGetOutlineTextMetrics */
|
|
|
|
windrv_GetPixel, /* pGetPixel */
|
|
|
|
NULL, /* pGetSystemPaletteEntries */
|
|
|
|
NULL, /* pGetTextCharsetInfo */
|
|
|
|
NULL, /* pGetTextExtentExPoint */
|
|
|
|
NULL, /* pGetTextExtentExPointI */
|
|
|
|
NULL, /* pGetTextFace */
|
|
|
|
NULL, /* pGetTextMetrics */
|
|
|
|
windrv_GradientFill, /* pGradientFill */
|
|
|
|
NULL, /* pIntersectClipRect */
|
|
|
|
NULL, /* pInvertRgn */
|
|
|
|
windrv_LineTo, /* pLineTo */
|
|
|
|
NULL, /* pModifyWorldTransform */
|
|
|
|
NULL, /* pMoveTo */
|
|
|
|
NULL, /* pOffsetClipRgn */
|
|
|
|
NULL, /* pOffsetViewportOrg */
|
|
|
|
NULL, /* pOffsetWindowOrg */
|
|
|
|
windrv_PaintRgn, /* pPaintRgn */
|
|
|
|
windrv_PatBlt, /* pPatBlt */
|
|
|
|
windrv_Pie, /* pPie */
|
|
|
|
NULL, /* pPolyBezier */
|
|
|
|
NULL, /* pPolyBezierTo */
|
|
|
|
NULL, /* pPolyDraw */
|
|
|
|
windrv_PolyPolygon, /* pPolyPolygon */
|
|
|
|
windrv_PolyPolyline, /* pPolyPolyline */
|
|
|
|
windrv_Polygon, /* pPolygon */
|
|
|
|
windrv_Polyline, /* pPolyline */
|
|
|
|
NULL, /* pPolylineTo */
|
|
|
|
windrv_PutImage, /* pPutImage */
|
|
|
|
NULL, /* pRealizeDefaultPalette */
|
|
|
|
NULL, /* pRealizePalette */
|
|
|
|
windrv_Rectangle, /* pRectangle */
|
|
|
|
NULL, /* pResetDC */
|
|
|
|
NULL, /* pRestoreDC */
|
|
|
|
windrv_RoundRect, /* pRoundRect */
|
|
|
|
NULL, /* pSaveDC */
|
|
|
|
NULL, /* pScaleViewportExt */
|
|
|
|
NULL, /* pScaleWindowExt */
|
|
|
|
NULL, /* pSelectBitmap */
|
|
|
|
NULL, /* pSelectBrush */
|
|
|
|
NULL, /* pSelectClipPath */
|
|
|
|
NULL, /* pSelectFont */
|
|
|
|
NULL, /* pSelectPalette */
|
|
|
|
NULL, /* pSelectPen */
|
|
|
|
NULL, /* pSetArcDirection */
|
|
|
|
NULL, /* pSetBkColor */
|
|
|
|
NULL, /* pSetBkMode */
|
|
|
|
windrv_SetBoundsRect, /* pSetBoundsRect */
|
|
|
|
NULL, /* pSetDCBrushColor */
|
|
|
|
NULL, /* pSetDCPenColor */
|
|
|
|
windrv_SetDIBitsToDevice, /* pSetDIBitsToDevice */
|
|
|
|
windrv_SetDeviceClipping, /* pSetDeviceClipping */
|
|
|
|
NULL, /* pSetDeviceGammaRamp */
|
|
|
|
NULL, /* pSetLayout */
|
|
|
|
NULL, /* pSetMapMode */
|
|
|
|
NULL, /* pSetMapperFlags */
|
|
|
|
windrv_SetPixel, /* pSetPixel */
|
|
|
|
NULL, /* pSetPolyFillMode */
|
|
|
|
NULL, /* pSetROP2 */
|
|
|
|
NULL, /* pSetRelAbs */
|
|
|
|
NULL, /* pSetStretchBltMode */
|
|
|
|
NULL, /* pSetTextAlign */
|
|
|
|
NULL, /* pSetTextCharacterExtra */
|
|
|
|
NULL, /* pSetTextColor */
|
|
|
|
NULL, /* pSetTextJustification */
|
|
|
|
NULL, /* pSetViewportExt */
|
|
|
|
NULL, /* pSetViewportOrg */
|
|
|
|
NULL, /* pSetWindowExt */
|
|
|
|
NULL, /* pSetWindowOrg */
|
|
|
|
NULL, /* pSetWorldTransform */
|
|
|
|
NULL, /* pStartDoc */
|
|
|
|
NULL, /* pStartPage */
|
|
|
|
windrv_StretchBlt, /* pStretchBlt */
|
|
|
|
windrv_StretchDIBits, /* pStretchDIBits */
|
|
|
|
NULL, /* pStrokeAndFillPath */
|
|
|
|
NULL, /* pStrokePath */
|
|
|
|
NULL, /* pUnrealizePalette */
|
|
|
|
NULL, /* pWidenPath */
|
2019-10-22 10:38:56 +02:00
|
|
|
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
|
|
|
|
NULL, /* pD3DKMTSetVidPnSourceOwner */
|
2012-09-06 12:23:10 +02:00
|
|
|
windrv_wine_get_wgl_driver, /* wine_get_wgl_driver */
|
2018-02-26 19:42:15 +01:00
|
|
|
NULL, /* wine_get_vulkan_driver */
|
2012-09-06 12:23:10 +02:00
|
|
|
GDI_PRIORITY_DIB_DRV + 10 /* priority */
|
|
|
|
};
|