2 * DIB driver initialization and DC functions.
4 * Copyright 2011 Huw Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "gdi_private.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(dib
);
30 static const DWORD bit_fields_888
[3] = {0xff0000, 0x00ff00, 0x0000ff};
31 static const DWORD bit_fields_555
[3] = {0x7c00, 0x03e0, 0x001f};
33 static void calc_shift_and_len(DWORD mask
, int *shift
, int *len
)
44 while ((mask
& 1) == 0)
50 while ((mask
& 1) == 1)
59 static void init_bit_fields(dib_info
*dib
, const DWORD
*bit_fields
)
61 dib
->red_mask
= bit_fields
[0];
62 dib
->green_mask
= bit_fields
[1];
63 dib
->blue_mask
= bit_fields
[2];
64 calc_shift_and_len(dib
->red_mask
, &dib
->red_shift
, &dib
->red_len
);
65 calc_shift_and_len(dib
->green_mask
, &dib
->green_shift
, &dib
->green_len
);
66 calc_shift_and_len(dib
->blue_mask
, &dib
->blue_shift
, &dib
->blue_len
);
69 static BOOL
init_dib_info(dib_info
*dib
, const BITMAPINFOHEADER
*bi
, const DWORD
*bit_fields
,
70 RGBQUAD
*color_table
, int color_table_size
, void *bits
, enum dib_info_flags flags
)
72 dib
->bit_count
= bi
->biBitCount
;
73 dib
->width
= bi
->biWidth
;
74 dib
->height
= bi
->biHeight
;
75 dib
->stride
= get_dib_stride( dib
->width
, dib
->bit_count
);
77 dib
->bits
.is_copy
= FALSE
;
78 dib
->bits
.free
= NULL
;
79 dib
->bits
.param
= NULL
;
82 if(dib
->height
< 0) /* top-down */
84 dib
->height
= -dib
->height
;
88 /* bits always points to the top-left corner and the stride is -ve */
89 dib
->bits
.ptr
= (BYTE
*)dib
->bits
.ptr
+ (dib
->height
- 1) * dib
->stride
;
90 dib
->stride
= -dib
->stride
;
93 dib
->funcs
= &funcs_null
;
95 switch(dib
->bit_count
)
98 if(bi
->biCompression
== BI_RGB
)
99 bit_fields
= bit_fields_888
;
101 init_bit_fields(dib
, bit_fields
);
103 if(dib
->red_mask
== 0xff0000 && dib
->green_mask
== 0x00ff00 && dib
->blue_mask
== 0x0000ff)
104 dib
->funcs
= &funcs_8888
;
106 dib
->funcs
= &funcs_32
;
110 dib
->funcs
= &funcs_24
;
114 if(bi
->biCompression
== BI_RGB
)
115 bit_fields
= bit_fields_555
;
117 init_bit_fields(dib
, bit_fields
);
119 if(dib
->red_mask
== 0x7c00 && dib
->green_mask
== 0x03e0 && dib
->blue_mask
== 0x001f)
120 dib
->funcs
= &funcs_555
;
122 dib
->funcs
= &funcs_16
;
126 dib
->funcs
= &funcs_8
;
130 dib
->funcs
= &funcs_4
;
134 dib
->funcs
= &funcs_1
;
138 TRACE("bpp %d not supported, will forward to graphics driver.\n", dib
->bit_count
);
144 if (flags
& private_color_table
)
146 dib
->color_table
= HeapAlloc(GetProcessHeap(), 0, color_table_size
* sizeof(dib
->color_table
[0]));
147 if(!dib
->color_table
) return FALSE
;
148 memcpy(dib
->color_table
, color_table
, color_table_size
* sizeof(color_table
[0]));
151 dib
->color_table
= color_table
;
152 dib
->color_table_size
= color_table_size
;
156 dib
->color_table
= NULL
;
157 dib
->color_table_size
= 0;
163 BOOL
init_dib_info_from_packed(dib_info
*dib
, const BITMAPINFOHEADER
*bi
, WORD usage
, HPALETTE palette
)
166 RGBQUAD
*color_table
= NULL
, pal_table
[256];
167 BYTE
*ptr
= (BYTE
*)bi
+ bi
->biSize
;
168 int num_colors
= get_dib_num_of_colors( (const BITMAPINFO
*)bi
);
170 if(bi
->biCompression
== BI_BITFIELDS
)
172 masks
= (DWORD
*)ptr
;
173 ptr
+= 3 * sizeof(DWORD
);
178 if(usage
== DIB_PAL_COLORS
)
180 PALETTEENTRY entries
[256];
181 const WORD
*index
= (const WORD
*) ptr
;
182 UINT i
, count
= GetPaletteEntries( palette
, 0, num_colors
, entries
);
183 for (i
= 0; i
< num_colors
; i
++, index
++)
185 PALETTEENTRY
*entry
= &entries
[*index
% count
];
186 pal_table
[i
].rgbRed
= entry
->peRed
;
187 pal_table
[i
].rgbGreen
= entry
->peGreen
;
188 pal_table
[i
].rgbBlue
= entry
->peBlue
;
189 pal_table
[i
].rgbReserved
= 0;
191 color_table
= pal_table
;
192 ptr
+= num_colors
* sizeof(WORD
);
196 color_table
= (RGBQUAD
*)ptr
;
197 ptr
+= num_colors
* sizeof(*color_table
);
201 return init_dib_info(dib
, bi
, masks
, color_table
, num_colors
, ptr
, private_color_table
);
204 BOOL
init_dib_info_from_bitmapinfo(dib_info
*dib
, const BITMAPINFO
*info
, void *bits
, enum dib_info_flags flags
)
206 unsigned int colors
= get_dib_num_of_colors( info
);
207 void *colorptr
= (char *)&info
->bmiHeader
+ info
->bmiHeader
.biSize
;
208 const DWORD
*bitfields
= (info
->bmiHeader
.biCompression
== BI_BITFIELDS
) ? (DWORD
*)colorptr
: NULL
;
210 return init_dib_info( dib
, &info
->bmiHeader
, bitfields
, colors
? colorptr
: NULL
, colors
, bits
, flags
);
213 static void clear_dib_info(dib_info
*dib
)
215 dib
->color_table
= NULL
;
216 dib
->bits
.ptr
= NULL
;
217 dib
->bits
.free
= NULL
;
218 dib
->bits
.param
= NULL
;
221 /**********************************************************************
224 * Free the resources associated with a dib and optionally the bits
226 void free_dib_info(dib_info
*dib
)
228 if (dib
->flags
& private_color_table
)
229 HeapFree(GetProcessHeap(), 0, dib
->color_table
);
231 if (dib
->bits
.free
) dib
->bits
.free( &dib
->bits
);
232 clear_dib_info( dib
);
235 void copy_dib_color_info(dib_info
*dst
, const dib_info
*src
)
237 dst
->bit_count
= src
->bit_count
;
238 dst
->red_mask
= src
->red_mask
;
239 dst
->green_mask
= src
->green_mask
;
240 dst
->blue_mask
= src
->blue_mask
;
241 dst
->red_len
= src
->red_len
;
242 dst
->green_len
= src
->green_len
;
243 dst
->blue_len
= src
->blue_len
;
244 dst
->red_shift
= src
->red_shift
;
245 dst
->green_shift
= src
->green_shift
;
246 dst
->blue_shift
= src
->blue_shift
;
247 dst
->funcs
= src
->funcs
;
248 dst
->color_table_size
= src
->color_table_size
;
249 dst
->color_table
= NULL
;
250 dst
->flags
= src
->flags
;
251 if(dst
->color_table_size
)
253 int size
= dst
->color_table_size
* sizeof(dst
->color_table
[0]);
254 if (dst
->flags
& private_color_table
)
256 dst
->color_table
= HeapAlloc(GetProcessHeap(), 0, size
);
257 memcpy(dst
->color_table
, src
->color_table
, size
);
260 dst
->color_table
= src
->color_table
;
264 DWORD
convert_bitmapinfo( const BITMAPINFO
*src_info
, void *src_bits
, struct bitblt_coords
*src
,
265 const BITMAPINFO
*dst_info
, void *dst_bits
)
267 dib_info src_dib
, dst_dib
;
270 if ( !init_dib_info_from_bitmapinfo( &src_dib
, src_info
, src_bits
, 0 ) )
271 return ERROR_BAD_FORMAT
;
272 if ( !init_dib_info_from_bitmapinfo( &dst_dib
, dst_info
, dst_bits
, 0 ) )
273 return ERROR_BAD_FORMAT
;
275 ret
= dst_dib
.funcs
->convert_to( &dst_dib
, &src_dib
, &src
->visrect
);
277 /* We shared the color tables, so there's no need to free the dib_infos here */
278 if(!ret
) return ERROR_BAD_FORMAT
;
280 /* update coordinates, the destination rectangle is always stored at 0,0 */
281 src
->x
-= src
->visrect
.left
;
282 src
->y
-= src
->visrect
.top
;
283 offset_rect( &src
->visrect
, -src
->visrect
.left
, -src
->visrect
.top
);
284 return ERROR_SUCCESS
;
287 static void update_fg_colors( dibdrv_physdev
*pdev
)
289 pdev
->pen_color
= get_fg_color( pdev
, pdev
->pen_colorref
);
290 pdev
->brush_color
= get_fg_color( pdev
, pdev
->brush_colorref
);
293 static void update_masks( dibdrv_physdev
*pdev
, INT rop
)
295 calc_and_xor_masks( rop
, pdev
->pen_color
, &pdev
->pen_and
, &pdev
->pen_xor
);
296 update_brush_rop( pdev
, rop
);
297 if( GetBkMode( pdev
->dev
.hdc
) == OPAQUE
)
298 calc_and_xor_masks( rop
, pdev
->bkgnd_color
, &pdev
->bkgnd_and
, &pdev
->bkgnd_xor
);
301 /***********************************************************************
302 * add_extra_clipping_region
304 * Temporarily add a region to the current clipping region.
305 * The returned region must be restored with restore_clipping_region.
307 static HRGN
add_extra_clipping_region( dibdrv_physdev
*pdev
, HRGN rgn
)
311 if (!(clip
= CreateRectRgn( 0, 0, 0, 0 ))) return 0;
312 CombineRgn( clip
, pdev
->clip
, rgn
, RGN_AND
);
318 /***********************************************************************
319 * restore_clipping_region
321 static void restore_clipping_region( dibdrv_physdev
*pdev
, HRGN rgn
)
324 DeleteObject( pdev
->clip
);
328 /***********************************************************************
331 static BOOL
dibdrv_DeleteDC( PHYSDEV dev
)
333 dibdrv_physdev
*pdev
= get_dibdrv_pdev(dev
);
334 TRACE("(%p)\n", dev
);
335 DeleteObject(pdev
->clip
);
336 free_pattern_brush(pdev
);
337 free_dib_info(&pdev
->dib
);
341 static void set_color_info( const dib_info
*dib
, BITMAPINFO
*info
)
343 DWORD
*masks
= (DWORD
*)info
->bmiColors
;
345 info
->bmiHeader
.biCompression
= BI_RGB
;
346 info
->bmiHeader
.biClrUsed
= 0;
348 switch (info
->bmiHeader
.biBitCount
)
353 if (dib
->color_table
)
355 info
->bmiHeader
.biClrUsed
= min( dib
->color_table_size
, 1 << dib
->bit_count
);
356 memcpy( info
->bmiColors
, dib
->color_table
,
357 info
->bmiHeader
.biClrUsed
* sizeof(RGBQUAD
) );
361 masks
[0] = dib
->red_mask
;
362 masks
[1] = dib
->green_mask
;
363 masks
[2] = dib
->blue_mask
;
364 info
->bmiHeader
.biCompression
= BI_BITFIELDS
;
367 if (dib
->funcs
!= &funcs_8888
)
369 masks
[0] = dib
->red_mask
;
370 masks
[1] = dib
->green_mask
;
371 masks
[2] = dib
->blue_mask
;
372 info
->bmiHeader
.biCompression
= BI_BITFIELDS
;
378 /***********************************************************************
381 static DWORD
dibdrv_GetImage( PHYSDEV dev
, HBITMAP hbitmap
, BITMAPINFO
*info
,
382 struct gdi_image_bits
*bits
, struct bitblt_coords
*src
)
384 DWORD ret
= ERROR_SUCCESS
;
385 dib_info
*dib
, stand_alone
;
387 TRACE( "%p %p %p\n", dev
, hbitmap
, info
);
389 info
->bmiHeader
.biSize
= sizeof(info
->bmiHeader
);
390 info
->bmiHeader
.biPlanes
= 1;
391 info
->bmiHeader
.biCompression
= BI_RGB
;
392 info
->bmiHeader
.biXPelsPerMeter
= 0;
393 info
->bmiHeader
.biYPelsPerMeter
= 0;
394 info
->bmiHeader
.biClrUsed
= 0;
395 info
->bmiHeader
.biClrImportant
= 0;
399 BITMAPOBJ
*bmp
= GDI_GetObjPtr( hbitmap
, OBJ_BITMAP
);
401 if (!bmp
) return ERROR_INVALID_HANDLE
;
404 if (!init_dib_info( &stand_alone
, &bmp
->dib
->dsBmih
, bmp
->dib
->dsBitfields
,
405 bmp
->color_table
, bmp
->nb_colors
, bmp
->dib
->dsBm
.bmBits
, 0 ))
407 ret
= ERROR_BAD_FORMAT
;
414 dibdrv_physdev
*pdev
= get_dibdrv_pdev(dev
);
418 info
->bmiHeader
.biWidth
= dib
->width
;
419 info
->bmiHeader
.biHeight
= dib
->stride
> 0 ? -dib
->height
: dib
->height
;
420 info
->bmiHeader
.biBitCount
= dib
->bit_count
;
421 info
->bmiHeader
.biSizeImage
= dib
->height
* abs( dib
->stride
);
423 set_color_info( dib
, info
);
427 bits
->ptr
= dib
->bits
.ptr
;
429 bits
->ptr
= (char *)bits
->ptr
+ (dib
->height
- 1) * dib
->stride
;
430 bits
->is_copy
= FALSE
;
435 if (hbitmap
) GDI_ReleaseObj( hbitmap
);
439 static BOOL
matching_color_info( const dib_info
*dib
, const BITMAPINFO
*info
)
441 switch (info
->bmiHeader
.biBitCount
)
447 RGBQUAD
*color_table
= (RGBQUAD
*)((char *)info
+ info
->bmiHeader
.biSize
);
448 if (dib
->color_table_size
!= get_dib_num_of_colors( info
)) return FALSE
;
449 return !memcmp( color_table
, dib
->color_table
, dib
->color_table_size
* sizeof(RGBQUAD
) );
454 DWORD
*masks
= (DWORD
*)info
->bmiColors
;
455 if (info
->bmiHeader
.biCompression
== BI_RGB
) return dib
->funcs
== &funcs_555
;
456 if (info
->bmiHeader
.biCompression
== BI_BITFIELDS
)
457 return masks
[0] == dib
->red_mask
&& masks
[1] == dib
->green_mask
&& masks
[2] == dib
->blue_mask
;
466 DWORD
*masks
= (DWORD
*)info
->bmiColors
;
467 if (info
->bmiHeader
.biCompression
== BI_RGB
) return dib
->funcs
== &funcs_8888
;
468 if (info
->bmiHeader
.biCompression
== BI_BITFIELDS
)
469 return masks
[0] == dib
->red_mask
&& masks
[1] == dib
->green_mask
&& masks
[2] == dib
->blue_mask
;
478 static inline BOOL
rop_uses_pat(DWORD rop
)
480 return ((rop
>> 4) & 0x0f0000) != (rop
& 0x0f0000);
484 /***********************************************************************
487 static DWORD
dibdrv_PutImage( PHYSDEV dev
, HBITMAP hbitmap
, HRGN clip
, BITMAPINFO
*info
,
488 const struct gdi_image_bits
*bits
, struct bitblt_coords
*src
,
489 struct bitblt_coords
*dst
, DWORD rop
)
491 dib_info
*dib
, stand_alone
;
495 HRGN saved_clip
= NULL
;
496 dibdrv_physdev
*pdev
= NULL
;
497 const WINEREGION
*clip_data
;
500 TRACE( "%p %p %p\n", dev
, hbitmap
, info
);
502 if (!hbitmap
&& rop_uses_pat( rop
))
504 PHYSDEV next
= GET_NEXT_PHYSDEV( dev
, pPutImage
);
505 FIXME( "rop %08x unsupported, forwarding to graphics driver\n", rop
);
506 return next
->funcs
->pPutImage( next
, 0, clip
, info
, bits
, src
, dst
, rop
);
511 BITMAPOBJ
*bmp
= GDI_GetObjPtr( hbitmap
, OBJ_BITMAP
);
513 if (!bmp
) return ERROR_INVALID_HANDLE
;
516 if (!init_dib_info( &stand_alone
, &bmp
->dib
->dsBmih
, bmp
->dib
->dsBitfields
,
517 bmp
->color_table
, bmp
->nb_colors
, bmp
->dib
->dsBm
.bmBits
, 0 ))
519 ret
= ERROR_BAD_FORMAT
;
527 pdev
= get_dibdrv_pdev( dev
);
531 if (info
->bmiHeader
.biPlanes
!= 1) goto update_format
;
532 if (info
->bmiHeader
.biBitCount
!= dib
->bit_count
) goto update_format
;
533 if (!matching_color_info( dib
, info
)) goto update_format
;
539 if ((src
->width
!= dst
->width
) || (src
->height
!= dst
->height
))
541 ret
= ERROR_TRANSFORM_NOT_SUPPORTED
;
545 init_dib_info_from_bitmapinfo( &src_dib
, info
, bits
->ptr
, 0 );
546 src_dib
.bits
.is_copy
= bits
->is_copy
;
548 origin
.x
= src
->visrect
.left
;
549 origin
.y
= src
->visrect
.top
;
553 if (clip
) saved_clip
= add_extra_clipping_region( pdev
, clip
);
557 rop2
= ((rop
>> 16) & 0xf) + 1;
559 if (clip
== NULL
) dib
->funcs
->copy_rect( dib
, &dst
->visrect
, &src_dib
, &origin
, rop2
);
562 clip_data
= get_wine_region( clip
);
563 for (i
= 0; i
< clip_data
->numRects
; i
++)
567 if (intersect_rect( &clipped_rect
, &dst
->visrect
, clip_data
->rects
+ i
))
569 origin
.x
= src
->visrect
.left
+ clipped_rect
.left
- dst
->visrect
.left
;
570 origin
.y
= src
->visrect
.top
+ clipped_rect
.top
- dst
->visrect
.top
;
571 dib
->funcs
->copy_rect( dib
, &clipped_rect
, &src_dib
, &origin
, rop2
);
574 release_wine_region( clip
);
578 if (saved_clip
) restore_clipping_region( pdev
, saved_clip
);
583 info
->bmiHeader
.biPlanes
= 1;
584 info
->bmiHeader
.biBitCount
= dib
->bit_count
;
585 set_color_info( dib
, info
);
586 ret
= ERROR_BAD_FORMAT
;
589 if (hbitmap
) GDI_ReleaseObj( hbitmap
);
594 /***********************************************************************
595 * dibdrv_SelectBitmap
597 static HBITMAP
dibdrv_SelectBitmap( PHYSDEV dev
, HBITMAP bitmap
)
599 PHYSDEV next
= GET_NEXT_PHYSDEV( dev
, pSelectBitmap
);
600 dibdrv_physdev
*pdev
= get_dibdrv_pdev(dev
);
601 BITMAPOBJ
*bmp
= GDI_GetObjPtr( bitmap
, OBJ_BITMAP
);
602 TRACE("(%p, %p)\n", dev
, bitmap
);
607 pdev
->clip
= CreateRectRgn(0, 0, 0, 0);
610 clear_dib_info(&pdev
->dib
);
611 clear_dib_info(&pdev
->brush_dib
);
612 pdev
->brush_and_bits
= pdev
->brush_xor_bits
= NULL
;
614 if(!init_dib_info(&pdev
->dib
, &bmp
->dib
->dsBmih
, bmp
->dib
->dsBitfields
,
615 bmp
->color_table
, bmp
->nb_colors
, bmp
->dib
->dsBm
.bmBits
, private_color_table
))
616 pdev
->defer
|= DEFER_FORMAT
;
618 GDI_ReleaseObj( bitmap
);
620 return next
->funcs
->pSelectBitmap( next
, bitmap
);
623 /***********************************************************************
626 static COLORREF
dibdrv_SetBkColor( PHYSDEV dev
, COLORREF color
)
628 PHYSDEV next
= GET_NEXT_PHYSDEV( dev
, pSetBkColor
);
629 dibdrv_physdev
*pdev
= get_dibdrv_pdev(dev
);
631 pdev
->bkgnd_color
= pdev
->dib
.funcs
->colorref_to_pixel( &pdev
->dib
, color
);
633 if( GetBkMode(dev
->hdc
) == OPAQUE
)
634 calc_and_xor_masks( GetROP2(dev
->hdc
), pdev
->bkgnd_color
, &pdev
->bkgnd_and
, &pdev
->bkgnd_xor
);
637 pdev
->bkgnd_and
= ~0u;
641 update_fg_colors( pdev
); /* Only needed in the 1 bpp case */
643 return next
->funcs
->pSetBkColor( next
, color
);
646 /***********************************************************************
649 static INT
dibdrv_SetBkMode( PHYSDEV dev
, INT mode
)
651 PHYSDEV next
= GET_NEXT_PHYSDEV( dev
, pSetBkMode
);
652 dibdrv_physdev
*pdev
= get_dibdrv_pdev(dev
);
655 calc_and_xor_masks( GetROP2(dev
->hdc
), pdev
->bkgnd_color
, &pdev
->bkgnd_and
, &pdev
->bkgnd_xor
);
658 pdev
->bkgnd_and
= ~0u;
662 return next
->funcs
->pSetBkMode( next
, mode
);
665 /***********************************************************************
666 * dibdrv_SetDeviceClipping
668 static void dibdrv_SetDeviceClipping( PHYSDEV dev
, HRGN vis_rgn
, HRGN clip_rgn
)
670 PHYSDEV next
= GET_NEXT_PHYSDEV( dev
, pSetDeviceClipping
);
671 dibdrv_physdev
*pdev
= get_dibdrv_pdev(dev
);
672 TRACE("(%p, %p, %p)\n", dev
, vis_rgn
, clip_rgn
);
674 CombineRgn( pdev
->clip
, vis_rgn
, clip_rgn
, clip_rgn
? RGN_AND
: RGN_COPY
);
675 return next
->funcs
->pSetDeviceClipping( next
, vis_rgn
, clip_rgn
);
678 /***********************************************************************
679 * dibdrv_SetDIBColorTable
681 static UINT
dibdrv_SetDIBColorTable( PHYSDEV dev
, UINT pos
, UINT count
, const RGBQUAD
*colors
)
683 PHYSDEV next
= GET_NEXT_PHYSDEV( dev
, pSetDIBColorTable
);
684 dibdrv_physdev
*pdev
= get_dibdrv_pdev(dev
);
685 TRACE("(%p, %d, %d, %p)\n", dev
, pos
, count
, colors
);
687 if( pdev
->dib
.color_table
&& pos
< pdev
->dib
.color_table_size
)
689 if( pos
+ count
> pdev
->dib
.color_table_size
) count
= pdev
->dib
.color_table_size
- pos
;
690 memcpy( pdev
->dib
.color_table
+ pos
, colors
, count
* sizeof(RGBQUAD
) );
692 pdev
->bkgnd_color
= pdev
->dib
.funcs
->colorref_to_pixel( &pdev
->dib
, GetBkColor( dev
->hdc
) );
693 update_fg_colors( pdev
);
695 update_masks( pdev
, GetROP2( dev
->hdc
) );
697 return next
->funcs
->pSetDIBColorTable( next
, pos
, count
, colors
);
700 /***********************************************************************
703 static INT
dibdrv_SetROP2( PHYSDEV dev
, INT rop
)
705 PHYSDEV next
= GET_NEXT_PHYSDEV( dev
, pSetROP2
);
706 dibdrv_physdev
*pdev
= get_dibdrv_pdev(dev
);
708 update_masks( pdev
, rop
);
710 return next
->funcs
->pSetROP2( next
, rop
);
713 const DC_FUNCTIONS dib_driver
=
715 NULL
, /* pAbortDoc */
716 NULL
, /* pAbortPath */
717 NULL
, /* pAlphaBlend */
718 NULL
, /* pAngleArc */
721 NULL
, /* pBeginPath */
722 NULL
, /* pChoosePixelFormat */
724 NULL
, /* pCloseFigure */
725 NULL
, /* pCreateBitmap */
726 NULL
, /* pCreateDC */
727 NULL
, /* pCreateDIBSection */
728 NULL
, /* pDeleteBitmap */
729 dibdrv_DeleteDC
, /* pDeleteDC */
730 NULL
, /* pDeleteObject */
731 NULL
, /* pDescribePixelFormat */
732 NULL
, /* pDeviceCapabilities */
737 NULL
, /* pEnumDeviceFonts */
738 NULL
, /* pEnumICMProfiles */
739 NULL
, /* pExcludeClipRect */
740 NULL
, /* pExtDeviceMode */
741 NULL
, /* pExtEscape */
742 NULL
, /* pExtFloodFill */
743 NULL
, /* pExtSelectClipRgn */
744 NULL
, /* pExtTextOut */
745 NULL
, /* pFillPath */
747 NULL
, /* pFlattenPath */
748 NULL
, /* pFrameRgn */
749 NULL
, /* pGdiComment */
750 NULL
, /* pGetCharWidth */
751 NULL
, /* pGetDeviceCaps */
752 NULL
, /* pGetDeviceGammaRamp */
753 NULL
, /* pGetICMProfile */
754 dibdrv_GetImage
, /* pGetImage */
755 NULL
, /* pGetNearestColor */
756 NULL
, /* pGetPixel */
757 NULL
, /* pGetPixelFormat */
758 NULL
, /* pGetSystemPaletteEntries */
759 NULL
, /* pGetTextExtentExPoint */
760 NULL
, /* pGetTextMetrics */
761 NULL
, /* pIntersectClipRect */
762 NULL
, /* pInvertRgn */
763 dibdrv_LineTo
, /* pLineTo */
764 NULL
, /* pModifyWorldTransform */
766 NULL
, /* pOffsetClipRgn */
767 NULL
, /* pOffsetViewportOrg */
768 NULL
, /* pOffsetWindowOrg */
769 dibdrv_PaintRgn
, /* pPaintRgn */
770 dibdrv_PatBlt
, /* pPatBlt */
772 NULL
, /* pPolyBezier */
773 NULL
, /* pPolyBezierTo */
774 NULL
, /* pPolyDraw */
775 NULL
, /* pPolyPolygon */
776 NULL
, /* pPolyPolyline */
778 NULL
, /* pPolyline */
779 NULL
, /* pPolylineTo */
780 dibdrv_PutImage
, /* pPutImage */
781 NULL
, /* pRealizeDefaultPalette */
782 NULL
, /* pRealizePalette */
783 dibdrv_Rectangle
, /* pRectangle */
785 NULL
, /* pRestoreDC */
786 NULL
, /* pRoundRect */
788 NULL
, /* pScaleViewportExt */
789 NULL
, /* pScaleWindowExt */
790 dibdrv_SelectBitmap
, /* pSelectBitmap */
791 dibdrv_SelectBrush
, /* pSelectBrush */
792 NULL
, /* pSelectClipPath */
793 NULL
, /* pSelectFont */
794 NULL
, /* pSelectPalette */
795 dibdrv_SelectPen
, /* pSelectPen */
796 NULL
, /* pSetArcDirection */
797 dibdrv_SetBkColor
, /* pSetBkColor */
798 dibdrv_SetBkMode
, /* pSetBkMode */
799 dibdrv_SetDCBrushColor
, /* pSetDCBrushColor */
800 dibdrv_SetDCPenColor
, /* pSetDCPenColor */
801 dibdrv_SetDIBColorTable
, /* pSetDIBColorTable */
802 NULL
, /* pSetDIBitsToDevice */
803 dibdrv_SetDeviceClipping
, /* pSetDeviceClipping */
804 NULL
, /* pSetDeviceGammaRamp */
805 NULL
, /* pSetLayout */
806 NULL
, /* pSetMapMode */
807 NULL
, /* pSetMapperFlags */
808 NULL
, /* pSetPixel */
809 NULL
, /* pSetPixelFormat */
810 NULL
, /* pSetPolyFillMode */
811 dibdrv_SetROP2
, /* pSetROP2 */
812 NULL
, /* pSetRelAbs */
813 NULL
, /* pSetStretchBltMode */
814 NULL
, /* pSetTextAlign */
815 NULL
, /* pSetTextCharacterExtra */
816 NULL
, /* pSetTextColor */
817 NULL
, /* pSetTextJustification */
818 NULL
, /* pSetViewportExt */
819 NULL
, /* pSetViewportOrg */
820 NULL
, /* pSetWindowExt */
821 NULL
, /* pSetWindowOrg */
822 NULL
, /* pSetWorldTransform */
823 NULL
, /* pStartDoc */
824 NULL
, /* pStartPage */
825 NULL
, /* pStretchBlt */
826 NULL
, /* pStretchDIBits */
827 NULL
, /* pStrokeAndFillPath */
828 NULL
, /* pStrokePath */
829 NULL
, /* pSwapBuffers */
830 NULL
, /* pUnrealizePalette */
831 NULL
, /* pWidenPath */
832 NULL
, /* pwglCopyContext */
833 NULL
, /* pwglCreateContext */
834 NULL
, /* pwglCreateContextAttribsARB */
835 NULL
, /* pwglDeleteContext */
836 NULL
, /* pwglGetPbufferDCARB */
837 NULL
, /* pwglGetProcAddress */
838 NULL
, /* pwglMakeContextCurrentARB */
839 NULL
, /* pwglMakeCurrent */
840 NULL
, /* pwglSetPixelFormatWINE */
841 NULL
, /* pwglShareLists */
842 NULL
, /* pwglUseFontBitmapsA */
843 NULL
/* pwglUseFontBitmapsW */