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"
|
|
|
|
|
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);
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-12-12 16:11:17 +01:00
|
|
|
static void init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD *bit_fields,
|
2011-12-12 15:58:05 +01:00
|
|
|
const RGBQUAD *color_table, void *bits, enum dib_info_flags flags)
|
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;
|
2011-11-29 15:12:00 +01:00
|
|
|
dib->compression = bi->biCompression;
|
2011-08-19 17:26:17 +02:00
|
|
|
dib->stride = get_dib_stride( dib->width, dib->bit_count );
|
|
|
|
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
|
|
|
}
|
2011-12-12 11:44:11 +01:00
|
|
|
else if (flags & default_color_table)
|
|
|
|
{
|
2011-12-12 15:58:05 +01:00
|
|
|
dib->color_table = get_default_color_table( dib->bit_count );
|
2011-12-12 11:44:11 +01:00
|
|
|
dib->color_table_size = dib->color_table ? (1 << dib->bit_count) : 0;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2011-12-12 16:11:17 +01:00
|
|
|
void init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits, enum dib_info_flags flags)
|
2011-07-18 16:27:43 +02:00
|
|
|
{
|
2011-12-12 16:11:17 +01:00
|
|
|
init_dib_info( dib, &info->bmiHeader, (const DWORD *)info->bmiColors, info->bmiColors, bits, flags );
|
2011-07-18 16:27:43 +02:00
|
|
|
}
|
|
|
|
|
2011-08-29 15:26:50 +02:00
|
|
|
BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_flags flags)
|
|
|
|
{
|
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-01-10 16:09:54 +01:00
|
|
|
if (!bmp->dib.dsBm.bmBits)
|
2011-10-31 20:06:37 +01:00
|
|
|
{
|
2012-01-10 16:09:54 +01:00
|
|
|
int width_bytes = get_dib_stride( bmp->dib.dsBm.bmWidth, bmp->dib.dsBm.bmBitsPixel );
|
|
|
|
bmp->dib.dsBm.bmBits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
bmp->dib.dsBm.bmHeight * width_bytes );
|
|
|
|
if (!bmp->dib.dsBm.bmBits) return FALSE;
|
2011-10-31 20:06:37 +01:00
|
|
|
}
|
2012-01-10 16:09:54 +01:00
|
|
|
init_dib_info_from_bitmapinfo( dib, &info, bmp->dib.dsBm.bmBits, flags );
|
2011-08-29 15:55:35 +02:00
|
|
|
}
|
2012-01-10 16:04:17 +01:00
|
|
|
else init_dib_info( dib, &bmp->dib.dsBmih, bmp->dib.dsBitfields,
|
|
|
|
bmp->color_table, bmp->dib.dsBm.bmBits, flags );
|
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-05-27 15:17:20 +02:00
|
|
|
dib->color_table = NULL;
|
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,
|
2011-10-12 17:57:02 +02:00
|
|
|
const BITMAPINFO *dst_info, void *dst_bits, BOOL add_alpha )
|
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
|
|
|
|
2011-12-12 16:11:17 +01:00
|
|
|
init_dib_info_from_bitmapinfo( &src_dib, src_info, src_bits, default_color_table );
|
|
|
|
init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits, default_color_table );
|
2011-05-12 13:05:37 +02:00
|
|
|
|
2011-08-23 12:49:53 +02:00
|
|
|
__TRY
|
|
|
|
{
|
2011-10-13 00:15:29 +02:00
|
|
|
dst_dib.funcs->convert_to( &dst_dib, &src_dib, &src->visrect );
|
|
|
|
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
|
|
|
/* We shared the color tables, so there's no need to free the dib_infos here */
|
|
|
|
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-10-12 17:57:02 +02:00
|
|
|
|
|
|
|
if (add_alpha && dst_dib.funcs == &funcs_8888 && src_dib.funcs != &funcs_8888)
|
|
|
|
{
|
|
|
|
DWORD *pixel = dst_dib.bits.ptr;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
for (y = src->visrect.top; y < src->visrect.bottom; y++, pixel += dst_dib.stride / 4)
|
|
|
|
for (x = src->visrect.left; x < src->visrect.right; x++)
|
|
|
|
pixel[x] |= 0xff000000;
|
|
|
|
}
|
|
|
|
|
2011-07-18 16:27:43 +02:00
|
|
|
return ERROR_SUCCESS;
|
2011-05-12 13:05:37 +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 );
|
|
|
|
|
|
|
|
rect.left = 0;
|
|
|
|
rect.top = 0;
|
|
|
|
rect.right = dib->width;
|
|
|
|
rect.bottom = dib->height;
|
|
|
|
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;
|
|
|
|
|
|
|
|
for (i = 0; i < region->numRects; i++)
|
|
|
|
{
|
|
|
|
if (region->rects[i].top >= rect.bottom) break;
|
|
|
|
if (!intersect_rect( out, &rect, ®ion->rects[i] )) continue;
|
|
|
|
out++;
|
|
|
|
if (out == &clip_rects->buffer[sizeof(clip_rects->buffer) / sizeof(RECT)])
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
|
|
|
add_bounds_rect( dev->bounds, &rc );
|
2012-04-11 14:49:30 +02:00
|
|
|
}
|
|
|
|
|
2011-09-07 23:47:31 +02:00
|
|
|
/**********************************************************************
|
|
|
|
* dibdrv_CreateDC
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_CreateDC( PHYSDEV *dev, LPCWSTR driver, LPCWSTR device,
|
|
|
|
LPCWSTR output, const DEVMODEW *data )
|
|
|
|
{
|
|
|
|
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
|
|
|
|
*/
|
2011-07-13 14:56:12 +02:00
|
|
|
static BOOL 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 );
|
2011-09-07 23:47:31 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, pdev );
|
|
|
|
return TRUE;
|
2011-05-12 12:27:35 +02:00
|
|
|
}
|
|
|
|
|
2011-11-07 22:14:50 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_CopyBitmap
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_CopyBitmap( HBITMAP src, HBITMAP dst )
|
|
|
|
{
|
|
|
|
return nulldrv_CopyBitmap( src, dst );
|
|
|
|
}
|
|
|
|
|
2011-10-31 20:21:15 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_DeleteBitmap
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_DeleteBitmap( HBITMAP bitmap )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-04-01 16:27:48 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_SelectBitmap
|
|
|
|
*/
|
2011-07-13 14:56:12 +02:00
|
|
|
static HBITMAP 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;
|
|
|
|
|
2011-12-12 16:11:17 +01:00
|
|
|
if(!init_dib_info_from_bitmapobj(&dib, bmp, default_color_table))
|
|
|
|
{
|
|
|
|
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
|
|
|
|
*/
|
2011-12-06 13:15:35 +01:00
|
|
|
static void 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
|
|
|
|
*/
|
|
|
|
static UINT dibdrv_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2012-01-03 12:36:39 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_ChoosePixelFormat
|
|
|
|
*/
|
|
|
|
static INT dibdrv_ChoosePixelFormat( PHYSDEV dev, const PIXELFORMATDESCRIPTOR *pfd )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_DescribePixelFormat
|
|
|
|
*/
|
|
|
|
static INT dibdrv_DescribePixelFormat( PHYSDEV dev, INT fmt, UINT size, PIXELFORMATDESCRIPTOR *pfd )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-01-06 17:53:42 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_ExtEscape
|
|
|
|
*/
|
|
|
|
static INT dibdrv_ExtEscape( PHYSDEV dev, INT escape, INT in_size, const void *in_data,
|
|
|
|
INT out_size, void *out_data )
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-01-06 17:45:16 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_GetDeviceGammaRamp
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_GetDeviceGammaRamp( PHYSDEV dev, void *ramp )
|
|
|
|
{
|
|
|
|
SetLastError( ERROR_INVALID_PARAMETER );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-01-03 12:36:39 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_GetPixelFormat
|
|
|
|
*/
|
|
|
|
static INT dibdrv_GetPixelFormat( PHYSDEV dev )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-01-06 17:45:16 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_SetDeviceGammaRamp
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_SetDeviceGammaRamp( PHYSDEV dev, void *ramp )
|
|
|
|
{
|
|
|
|
SetLastError( ERROR_INVALID_PARAMETER );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-01-03 12:36:39 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_SetPixelFormat
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_SetPixelFormat( PHYSDEV dev, INT fmt, const PIXELFORMATDESCRIPTOR *pfd )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_SwapBuffers
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_SwapBuffers( PHYSDEV dev )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglCopyContext
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_wglCopyContext( HGLRC src, HGLRC dst, UINT mask )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglCreateContext
|
|
|
|
*/
|
|
|
|
static HGLRC dibdrv_wglCreateContext( PHYSDEV dev )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglCreateContextAttribsARB
|
|
|
|
*/
|
|
|
|
static HGLRC dibdrv_wglCreateContextAttribsARB( PHYSDEV dev, HGLRC ctx, const int *attribs )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglDeleteContext
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_wglDeleteContext( HGLRC ctx )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglGetPbufferDCARB
|
|
|
|
*/
|
|
|
|
static HDC dibdrv_wglGetPbufferDCARB( PHYSDEV dev, void *buffer )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglGetProcAddress
|
|
|
|
*/
|
|
|
|
static PROC dibdrv_wglGetProcAddress( LPCSTR name )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglMakeContextCurrentARB
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_wglMakeContextCurrentARB( PHYSDEV draw_dev, PHYSDEV read_dev, HGLRC ctx )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglMakeCurrent
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_wglMakeCurrent( PHYSDEV dev, HGLRC ctx )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglSetPixelFormatWINE
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_wglSetPixelFormatWINE( PHYSDEV dev, INT fmt, const PIXELFORMATDESCRIPTOR *pfd )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglShareLists
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_wglShareLists( HGLRC ctx1, HGLRC ctx2 )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglUseFontBitmapsA
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_wglUseFontBitmapsA( PHYSDEV dev, DWORD first, DWORD count, DWORD base )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dibdrv_wglUseFontBitmapsW
|
|
|
|
*/
|
|
|
|
static BOOL dibdrv_wglUseFontBitmapsW( PHYSDEV dev, DWORD first, DWORD count, DWORD base )
|
|
|
|
{
|
|
|
|
FIXME( "Not supported on DIB section\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-11-14 13:49:02 +01:00
|
|
|
|
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-03 12:36:39 +01:00
|
|
|
dibdrv_ChoosePixelFormat, /* pChoosePixelFormat */
|
2012-01-06 17:20:37 +01:00
|
|
|
dibdrv_Chord, /* pChord */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pCloseFigure */
|
2011-11-07 22:14:50 +01:00
|
|
|
dibdrv_CopyBitmap, /* pCopyBitmap */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pCreateBitmap */
|
2011-09-07 15:36:58 +02:00
|
|
|
NULL, /* pCreateCompatibleDC */
|
2011-09-07 23:47:31 +02:00
|
|
|
dibdrv_CreateDC, /* pCreateDC */
|
2011-10-31 20:21:15 +01:00
|
|
|
dibdrv_DeleteBitmap, /* pDeleteBitmap */
|
2011-04-01 16:27:48 +02:00
|
|
|
dibdrv_DeleteDC, /* pDeleteDC */
|
|
|
|
NULL, /* pDeleteObject */
|
2012-01-03 12:36:39 +01:00
|
|
|
dibdrv_DescribePixelFormat, /* pDescribePixelFormat */
|
2011-04-01 16:27:48 +02:00
|
|
|
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-01-06 17:53:42 +01:00
|
|
|
dibdrv_ExtEscape, /* 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 */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pFillPath */
|
|
|
|
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 */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGdiRealizationInfo */
|
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 */
|
|
|
|
NULL, /* pGetDeviceCaps */
|
2012-01-06 17:45:16 +01:00
|
|
|
dibdrv_GetDeviceGammaRamp, /* pGetDeviceGammaRamp */
|
2011-10-19 21:51:39 +02:00
|
|
|
NULL, /* pGetFontData */
|
|
|
|
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 */
|
2012-01-03 12:36:39 +01:00
|
|
|
dibdrv_GetPixelFormat, /* pGetPixelFormat */
|
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 */
|
|
|
|
NULL, /* pSelectFont */
|
|
|
|
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-01-06 17:45:16 +01:00
|
|
|
dibdrv_SetDeviceGammaRamp, /* 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 */
|
2012-01-03 12:36:39 +01:00
|
|
|
dibdrv_SetPixelFormat, /* pSetPixelFormat */
|
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 */
|
|
|
|
NULL, /* pStrokeAndFillPath */
|
|
|
|
NULL, /* pStrokePath */
|
2012-01-03 12:36:39 +01:00
|
|
|
dibdrv_SwapBuffers, /* pSwapBuffers */
|
2011-04-01 16:27:48 +02:00
|
|
|
NULL, /* pUnrealizePalette */
|
|
|
|
NULL, /* pWidenPath */
|
2012-01-03 12:36:39 +01:00
|
|
|
dibdrv_wglCopyContext, /* pwglCopyContext */
|
|
|
|
dibdrv_wglCreateContext, /* pwglCreateContext */
|
|
|
|
dibdrv_wglCreateContextAttribsARB, /* pwglCreateContextAttribsARB */
|
|
|
|
dibdrv_wglDeleteContext, /* pwglDeleteContext */
|
|
|
|
dibdrv_wglGetPbufferDCARB, /* pwglGetPbufferDCARB */
|
|
|
|
dibdrv_wglGetProcAddress, /* pwglGetProcAddress */
|
|
|
|
dibdrv_wglMakeContextCurrentARB, /* pwglMakeContextCurrentARB */
|
|
|
|
dibdrv_wglMakeCurrent, /* pwglMakeCurrent */
|
|
|
|
dibdrv_wglSetPixelFormatWINE, /* pwglSetPixelFormatWINE */
|
|
|
|
dibdrv_wglShareLists, /* pwglShareLists */
|
|
|
|
dibdrv_wglUseFontBitmapsA, /* pwglUseFontBitmapsA */
|
|
|
|
dibdrv_wglUseFontBitmapsW, /* pwglUseFontBitmapsW */
|
2011-04-01 16:27:48 +02:00
|
|
|
};
|