gdi32: Add a flag to request a default color table from init_dib_info.
[wine] / dlls / gdi32 / dibdrv / dc.c
1 /*
2  * DIB driver initialization and DC functions.
3  *
4  * Copyright 2011 Huw Davies
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include <assert.h>
22
23 #include "gdi_private.h"
24 #include "dibdrv.h"
25
26 #include "wine/exception.h"
27 #include "wine/debug.h"
28
29 WINE_DEFAULT_DEBUG_CHANNEL(dib);
30
31 static const DWORD bit_fields_888[3] = {0xff0000, 0x00ff00, 0x0000ff};
32 static const DWORD bit_fields_555[3] = {0x7c00, 0x03e0, 0x001f};
33
34 static void calc_shift_and_len(DWORD mask, int *shift, int *len)
35 {
36     int s, l;
37
38     if(!mask)
39     {
40         *shift = *len = 0;
41         return;
42     }
43
44     s = 0;
45     while ((mask & 1) == 0)
46     {
47         mask >>= 1;
48         s++;
49     }
50     l = 0;
51     while ((mask & 1) == 1)
52     {
53         mask >>= 1;
54         l++;
55     }
56     *shift = s;
57     *len = l;
58 }
59
60 static void init_bit_fields(dib_info *dib, const DWORD *bit_fields)
61 {
62     dib->red_mask    = bit_fields[0];
63     dib->green_mask  = bit_fields[1];
64     dib->blue_mask   = bit_fields[2];
65     calc_shift_and_len(dib->red_mask,   &dib->red_shift,   &dib->red_len);
66     calc_shift_and_len(dib->green_mask, &dib->green_shift, &dib->green_len);
67     calc_shift_and_len(dib->blue_mask,  &dib->blue_shift,  &dib->blue_len);
68 }
69
70 static BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD *bit_fields,
71                           RGBQUAD *color_table, void *bits, enum dib_info_flags flags)
72 {
73     dib->bit_count    = bi->biBitCount;
74     dib->width        = bi->biWidth;
75     dib->height       = bi->biHeight;
76     dib->compression  = bi->biCompression;
77     dib->stride       = get_dib_stride( dib->width, dib->bit_count );
78     dib->bits.ptr     = bits;
79     dib->bits.is_copy = FALSE;
80     dib->bits.free    = NULL;
81     dib->bits.param   = NULL;
82     dib->flags        = flags;
83
84     if(dib->height < 0) /* top-down */
85     {
86         dib->height = -dib->height;
87     }
88     else /* bottom-up */
89     {
90         /* bits always points to the top-left corner and the stride is -ve */
91         dib->bits.ptr = (BYTE*)dib->bits.ptr + (dib->height - 1) * dib->stride;
92         dib->stride  = -dib->stride;
93     }
94
95     dib->funcs = &funcs_null;
96
97     switch(dib->bit_count)
98     {
99     case 32:
100         if(bi->biCompression == BI_RGB)
101             bit_fields = bit_fields_888;
102
103         init_bit_fields(dib, bit_fields);
104
105         if(dib->red_mask == 0xff0000 && dib->green_mask == 0x00ff00 && dib->blue_mask == 0x0000ff)
106             dib->funcs = &funcs_8888;
107         else
108             dib->funcs = &funcs_32;
109         break;
110
111     case 24:
112         dib->funcs = &funcs_24;
113         break;
114
115     case 16:
116         if(bi->biCompression == BI_RGB)
117             bit_fields = bit_fields_555;
118
119         init_bit_fields(dib, bit_fields);
120
121         if(dib->red_mask == 0x7c00 && dib->green_mask == 0x03e0 && dib->blue_mask == 0x001f)
122             dib->funcs = &funcs_555;
123         else
124             dib->funcs = &funcs_16;
125         break;
126
127     case 8:
128         dib->funcs = &funcs_8;
129         break;
130
131     case 4:
132         dib->funcs = &funcs_4;
133         break;
134
135     case 1:
136         dib->funcs = &funcs_1;
137         break;
138
139     default:
140         TRACE("bpp %d not supported, will forward to graphics driver.\n", dib->bit_count);
141         return FALSE;
142     }
143
144     if (color_table && bi->biClrUsed)
145     {
146         if (flags & private_color_table)
147         {
148             dib->color_table = HeapAlloc(GetProcessHeap(), 0, bi->biClrUsed * sizeof(dib->color_table[0]));
149             if(!dib->color_table) return FALSE;
150             memcpy(dib->color_table, color_table, bi->biClrUsed * sizeof(color_table[0]));
151         }
152         else
153             dib->color_table = color_table;
154         dib->color_table_size = bi->biClrUsed;
155     }
156     else if (flags & default_color_table)
157     {
158         dib->color_table = (RGBQUAD *)get_default_color_table( dib->bit_count );
159         dib->color_table_size = dib->color_table ? (1 << dib->bit_count) : 0;
160     }
161     else
162     {
163         dib->color_table = NULL;
164         dib->color_table_size = 0;
165     }
166
167     return TRUE;
168 }
169
170 BOOL init_dib_info_from_brush(dib_info *dib, const BITMAPINFO *bi, void *bits, UINT usage, HDC hdc)
171 {
172     if (bi->bmiHeader.biClrUsed && usage == DIB_PAL_COLORS)
173     {
174         char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
175         BITMAPINFO *info = (BITMAPINFO *)buffer;
176
177         copy_bitmapinfo( info, bi );
178         fill_color_table_from_pal_colors( info, hdc );
179         return init_dib_info_from_bitmapinfo( dib, info, bits, private_color_table );
180     }
181     return init_dib_info_from_bitmapinfo(dib, bi, bits, private_color_table );
182 }
183
184 BOOL init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits, enum dib_info_flags flags)
185 {
186     return init_dib_info( dib, &info->bmiHeader, (const DWORD *)info->bmiColors,
187                           (RGBQUAD *)info->bmiColors, bits, flags );
188 }
189
190 BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_flags flags)
191 {
192     if (!bmp->dib)
193     {
194         BITMAPINFO info;
195
196         get_ddb_bitmapinfo( bmp, &info );
197         if (!bmp->bitmap.bmBits)
198         {
199             int width_bytes = get_dib_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel );
200             bmp->bitmap.bmBits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
201                                             bmp->bitmap.bmHeight * width_bytes );
202             if (!bmp->bitmap.bmBits) return FALSE;
203         }
204         return init_dib_info_from_bitmapinfo( dib, &info, bmp->bitmap.bmBits, flags );
205     }
206     return init_dib_info( dib, &bmp->dib->dsBmih, bmp->dib->dsBitfields,
207                           bmp->color_table, bmp->dib->dsBm.bmBits, flags );
208 }
209
210 static void clear_dib_info(dib_info *dib)
211 {
212     dib->color_table = NULL;
213     dib->bits.ptr    = NULL;
214     dib->bits.free   = NULL;
215     dib->bits.param  = NULL;
216 }
217
218 /**********************************************************************
219  *      free_dib_info
220  *
221  * Free the resources associated with a dib and optionally the bits
222  */
223 void free_dib_info(dib_info *dib)
224 {
225     if (dib->flags & private_color_table)
226         HeapFree(GetProcessHeap(), 0, dib->color_table);
227
228     if (dib->bits.free) dib->bits.free( &dib->bits );
229     clear_dib_info( dib );
230 }
231
232 void copy_dib_color_info(dib_info *dst, const dib_info *src)
233 {
234     dst->bit_count        = src->bit_count;
235     dst->red_mask         = src->red_mask;
236     dst->green_mask       = src->green_mask;
237     dst->blue_mask        = src->blue_mask;
238     dst->red_len          = src->red_len;
239     dst->green_len        = src->green_len;
240     dst->blue_len         = src->blue_len;
241     dst->red_shift        = src->red_shift;
242     dst->green_shift      = src->green_shift;
243     dst->blue_shift       = src->blue_shift;
244     dst->funcs            = src->funcs;
245     dst->color_table_size = src->color_table_size;
246     dst->color_table      = NULL;
247     dst->flags            = src->flags;
248     if(dst->color_table_size)
249     {
250         int size = dst->color_table_size * sizeof(dst->color_table[0]);
251         if (dst->flags & private_color_table)
252         {
253             dst->color_table = HeapAlloc(GetProcessHeap(), 0, size);
254             memcpy(dst->color_table, src->color_table, size);
255         }
256         else
257             dst->color_table = src->color_table;
258     }
259 }
260
261 DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitblt_coords *src,
262                           const BITMAPINFO *dst_info, void *dst_bits, BOOL add_alpha )
263 {
264     dib_info src_dib, dst_dib;
265     DWORD ret;
266
267     if ( !init_dib_info_from_bitmapinfo( &src_dib, src_info, src_bits, default_color_table ) )
268         return ERROR_BAD_FORMAT;
269     if ( !init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits, default_color_table ) )
270         return ERROR_BAD_FORMAT;
271
272     __TRY
273     {
274         dst_dib.funcs->convert_to( &dst_dib, &src_dib, &src->visrect );
275         ret = TRUE;
276     }
277     __EXCEPT_PAGE_FAULT
278     {
279         WARN( "invalid bits pointer %p\n", src_bits );
280         ret = FALSE;
281     }
282     __ENDTRY
283
284     /* We shared the color tables, so there's no need to free the dib_infos here */
285     if(!ret) return ERROR_BAD_FORMAT;
286
287     /* update coordinates, the destination rectangle is always stored at 0,0 */
288     src->x -= src->visrect.left;
289     src->y -= src->visrect.top;
290     offset_rect( &src->visrect, -src->visrect.left, -src->visrect.top );
291
292     if (add_alpha && dst_dib.funcs == &funcs_8888 && src_dib.funcs != &funcs_8888)
293     {
294         DWORD *pixel = dst_dib.bits.ptr;
295         int x, y;
296
297         for (y = src->visrect.top; y < src->visrect.bottom; y++, pixel += dst_dib.stride / 4)
298             for (x = src->visrect.left; x < src->visrect.right; x++)
299                 pixel[x] |= 0xff000000;
300     }
301
302     return ERROR_SUCCESS;
303 }
304
305 static void update_fg_colors( dibdrv_physdev *pdev )
306 {
307     pdev->pen_color   = get_pixel_color( pdev, pdev->pen_colorref,   TRUE );
308     pdev->brush_color = get_pixel_color( pdev, pdev->brush_colorref, TRUE );
309     pdev->text_color  = get_pixel_color( pdev, GetTextColor( pdev->dev.hdc ), TRUE );
310 }
311
312 static void update_masks( dibdrv_physdev *pdev, INT rop )
313 {
314     calc_and_xor_masks( rop, pdev->pen_color, &pdev->pen_and, &pdev->pen_xor );
315     update_brush_rop( pdev, rop );
316     if( GetBkMode( pdev->dev.hdc ) == OPAQUE )
317         calc_and_xor_masks( rop, pdev->bkgnd_color, &pdev->bkgnd_and, &pdev->bkgnd_xor );
318 }
319
320  /***********************************************************************
321  *           add_extra_clipping_region
322  *
323  * Temporarily add a region to the current clipping region.
324  * The returned region must be restored with restore_clipping_region.
325  */
326 HRGN add_extra_clipping_region( dibdrv_physdev *pdev, HRGN rgn )
327 {
328     HRGN ret, clip;
329
330     if (!(clip = CreateRectRgn( 0, 0, 0, 0 ))) return 0;
331     CombineRgn( clip, pdev->clip, rgn, RGN_AND );
332     ret = pdev->clip;
333     pdev->clip = clip;
334     return ret;
335 }
336
337 /***********************************************************************
338  *           restore_clipping_region
339  */
340 void restore_clipping_region( dibdrv_physdev *pdev, HRGN rgn )
341 {
342     if (!rgn) return;
343     DeleteObject( pdev->clip );
344     pdev->clip = rgn;
345 }
346
347 /**********************************************************************
348  *           dibdrv_CreateDC
349  */
350 static BOOL dibdrv_CreateDC( PHYSDEV *dev, LPCWSTR driver, LPCWSTR device,
351                              LPCWSTR output, const DEVMODEW *data )
352 {
353     dibdrv_physdev *pdev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pdev) );
354
355     if (!pdev) return FALSE;
356     if (!(pdev->clip = CreateRectRgn(0, 0, 0, 0)))
357     {
358         HeapFree( GetProcessHeap(), 0, pdev );
359         return FALSE;
360     }
361     clear_dib_info(&pdev->dib);
362     clear_dib_info(&pdev->brush_dib);
363     push_dc_driver( dev, &pdev->dev, &dib_driver );
364     return TRUE;
365 }
366
367 /***********************************************************************
368  *           dibdrv_DeleteDC
369  */
370 static BOOL dibdrv_DeleteDC( PHYSDEV dev )
371 {
372     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
373     TRACE("(%p)\n", dev);
374     DeleteObject(pdev->clip);
375     free_pattern_brush(pdev);
376     free_dib_info(&pdev->dib);
377     HeapFree( GetProcessHeap(), 0, pdev );
378     return TRUE;
379 }
380
381 /***********************************************************************
382  *           dibdrv_CopyBitmap
383  */
384 static BOOL dibdrv_CopyBitmap( HBITMAP src, HBITMAP dst )
385 {
386     return nulldrv_CopyBitmap( src, dst );
387 }
388
389 /***********************************************************************
390  *           dibdrv_DeleteBitmap
391  */
392 static BOOL dibdrv_DeleteBitmap( HBITMAP bitmap )
393 {
394     return TRUE;
395 }
396
397 /***********************************************************************
398  *           dibdrv_SelectBitmap
399  */
400 static HBITMAP dibdrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
401 {
402     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectBitmap );
403     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
404     BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP );
405     TRACE("(%p, %p)\n", dev, bitmap);
406
407     if (!bmp) return 0;
408
409     free_dib_info(&pdev->dib);
410     pdev->defer = 0;
411     if(!init_dib_info_from_bitmapobj(&pdev->dib, bmp, default_color_table))
412         pdev->defer |= DEFER_FORMAT;
413
414     GDI_ReleaseObj( bitmap );
415
416     return next->funcs->pSelectBitmap( next, bitmap );
417 }
418
419 /***********************************************************************
420  *           dibdrv_SetBkColor
421  */
422 static COLORREF dibdrv_SetBkColor( PHYSDEV dev, COLORREF color )
423 {
424     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetBkColor );
425     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
426
427     pdev->bkgnd_color = get_pixel_color( pdev, color, FALSE );
428
429     if( GetBkMode(dev->hdc) == OPAQUE )
430         calc_and_xor_masks( GetROP2(dev->hdc), pdev->bkgnd_color, &pdev->bkgnd_and, &pdev->bkgnd_xor );
431     else
432     {
433         pdev->bkgnd_and = ~0u;
434         pdev->bkgnd_xor = 0;
435     }
436
437     update_fg_colors( pdev ); /* Only needed in the 1 bpp case */
438
439     return next->funcs->pSetBkColor( next, color );
440 }
441
442 /***********************************************************************
443  *           dibdrv_SetBkMode
444  */
445 static INT dibdrv_SetBkMode( PHYSDEV dev, INT mode )
446 {
447     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetBkMode );
448     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
449
450     if( mode == OPAQUE )
451         calc_and_xor_masks( GetROP2(dev->hdc), pdev->bkgnd_color, &pdev->bkgnd_and, &pdev->bkgnd_xor );
452     else
453     {
454         pdev->bkgnd_and = ~0u;
455         pdev->bkgnd_xor = 0;
456     }
457
458     return next->funcs->pSetBkMode( next, mode );
459 }
460
461 /***********************************************************************
462  *           dibdrv_SetDeviceClipping
463  */
464 static void dibdrv_SetDeviceClipping( PHYSDEV dev, HRGN rgn )
465 {
466     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetDeviceClipping );
467     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
468     TRACE("(%p, %p)\n", dev, rgn);
469
470     SetRectRgn( pdev->clip, 0, 0, pdev->dib.width, pdev->dib.height );
471     if (rgn) CombineRgn( pdev->clip, pdev->clip, rgn, RGN_AND );
472     return next->funcs->pSetDeviceClipping( next, rgn );
473 }
474
475 /***********************************************************************
476  *           dibdrv_SetDIBColorTable
477  */
478 static UINT dibdrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, const RGBQUAD *colors )
479 {
480     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetDIBColorTable );
481     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
482     TRACE("(%p, %d, %d, %p)\n", dev, pos, count, colors);
483
484     if (pdev->dib.color_table)
485     {
486         pdev->bkgnd_color = get_pixel_color( pdev, GetBkColor( dev->hdc ), FALSE );
487         update_fg_colors( pdev );
488
489         update_masks( pdev, GetROP2( dev->hdc ) );
490     }
491     return next->funcs->pSetDIBColorTable( next, pos, count, colors );
492 }
493
494 /***********************************************************************
495  *           dibdrv_SetROP2
496  */
497 static INT dibdrv_SetROP2( PHYSDEV dev, INT rop )
498 {
499     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetROP2 );
500     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
501
502     update_masks( pdev, rop );
503
504     return next->funcs->pSetROP2( next, rop );
505 }
506
507 /***********************************************************************
508  *           dibdrv_SetTextColor
509  */
510 static COLORREF dibdrv_SetTextColor( PHYSDEV dev, COLORREF color )
511 {
512     PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetTextColor );
513     dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
514
515     pdev->text_color = get_pixel_color( pdev, color, TRUE );
516     update_aa_ranges( pdev );
517
518     return next->funcs->pSetTextColor( next, color );
519 }
520
521 const struct gdi_dc_funcs dib_driver =
522 {
523     NULL,                               /* pAbortDoc */
524     NULL,                               /* pAbortPath */
525     dibdrv_AlphaBlend,                  /* pAlphaBlend */
526     NULL,                               /* pAngleArc */
527     NULL,                               /* pArc */
528     NULL,                               /* pArcTo */
529     NULL,                               /* pBeginPath */
530     dibdrv_BlendImage,                  /* pBlendImage */
531     NULL,                               /* pChoosePixelFormat */
532     NULL,                               /* pChord */
533     NULL,                               /* pCloseFigure */
534     dibdrv_CopyBitmap,                  /* pCopyBitmap */
535     NULL,                               /* pCreateBitmap */
536     NULL,                               /* pCreateCompatibleDC */
537     dibdrv_CreateDC,                    /* pCreateDC */
538     NULL,                               /* pCreateDIBSection */
539     dibdrv_DeleteBitmap,                /* pDeleteBitmap */
540     dibdrv_DeleteDC,                    /* pDeleteDC */
541     NULL,                               /* pDeleteObject */
542     NULL,                               /* pDescribePixelFormat */
543     NULL,                               /* pDeviceCapabilities */
544     NULL,                               /* pEllipse */
545     NULL,                               /* pEndDoc */
546     NULL,                               /* pEndPage */
547     NULL,                               /* pEndPath */
548     NULL,                               /* pEnumFonts */
549     NULL,                               /* pEnumICMProfiles */
550     NULL,                               /* pExcludeClipRect */
551     NULL,                               /* pExtDeviceMode */
552     NULL,                               /* pExtEscape */
553     NULL,                               /* pExtFloodFill */
554     NULL,                               /* pExtSelectClipRgn */
555     dibdrv_ExtTextOut,                  /* pExtTextOut */
556     NULL,                               /* pFillPath */
557     NULL,                               /* pFillRgn */
558     NULL,                               /* pFlattenPath */
559     NULL,                               /* pFontIsLinked */
560     NULL,                               /* pFrameRgn */
561     NULL,                               /* pGdiComment */
562     NULL,                               /* pGdiRealizationInfo */
563     NULL,                               /* pGetCharABCWidths */
564     NULL,                               /* pGetCharABCWidthsI */
565     NULL,                               /* pGetCharWidth */
566     NULL,                               /* pGetDeviceCaps */
567     NULL,                               /* pGetDeviceGammaRamp */
568     NULL,                               /* pGetFontData */
569     NULL,                               /* pGetFontUnicodeRanges */
570     NULL,                               /* pGetGlyphIndices */
571     NULL,                               /* pGetGlyphOutline */
572     NULL,                               /* pGetICMProfile */
573     dibdrv_GetImage,                    /* pGetImage */
574     NULL,                               /* pGetKerningPairs */
575     NULL,                               /* pGetNearestColor */
576     NULL,                               /* pGetOutlineTextMetrics */
577     dibdrv_GetPixel,                    /* pGetPixel */
578     NULL,                               /* pGetPixelFormat */
579     NULL,                               /* pGetSystemPaletteEntries */
580     NULL,                               /* pGetTextCharsetInfo */
581     NULL,                               /* pGetTextExtentExPoint */
582     NULL,                               /* pGetTextExtentExPointI */
583     NULL,                               /* pGetTextFace */
584     NULL,                               /* pGetTextMetrics */
585     dibdrv_GradientFill,                /* pGradientFill */
586     NULL,                               /* pIntersectClipRect */
587     NULL,                               /* pInvertRgn */
588     dibdrv_LineTo,                      /* pLineTo */
589     NULL,                               /* pModifyWorldTransform */
590     NULL,                               /* pMoveTo */
591     NULL,                               /* pOffsetClipRgn */
592     NULL,                               /* pOffsetViewportOrg */
593     NULL,                               /* pOffsetWindowOrg */
594     dibdrv_PaintRgn,                    /* pPaintRgn */
595     dibdrv_PatBlt,                      /* pPatBlt */
596     NULL,                               /* pPie */
597     NULL,                               /* pPolyBezier */
598     NULL,                               /* pPolyBezierTo */
599     NULL,                               /* pPolyDraw */
600     NULL,                               /* pPolyPolygon */
601     dibdrv_PolyPolyline,                /* pPolyPolyline */
602     NULL,                               /* pPolygon */
603     dibdrv_Polyline,                    /* pPolyline */
604     NULL,                               /* pPolylineTo */
605     dibdrv_PutImage,                    /* pPutImage */
606     NULL,                               /* pRealizeDefaultPalette */
607     NULL,                               /* pRealizePalette */
608     dibdrv_Rectangle,                   /* pRectangle */
609     NULL,                               /* pResetDC */
610     NULL,                               /* pRestoreDC */
611     NULL,                               /* pRoundRect */
612     NULL,                               /* pSaveDC */
613     NULL,                               /* pScaleViewportExt */
614     NULL,                               /* pScaleWindowExt */
615     dibdrv_SelectBitmap,                /* pSelectBitmap */
616     dibdrv_SelectBrush,                 /* pSelectBrush */
617     NULL,                               /* pSelectClipPath */
618     NULL,                               /* pSelectFont */
619     NULL,                               /* pSelectPalette */
620     dibdrv_SelectPen,                   /* pSelectPen */
621     NULL,                               /* pSetArcDirection */
622     dibdrv_SetBkColor,                  /* pSetBkColor */
623     dibdrv_SetBkMode,                   /* pSetBkMode */
624     dibdrv_SetDCBrushColor,             /* pSetDCBrushColor */
625     dibdrv_SetDCPenColor,               /* pSetDCPenColor */
626     dibdrv_SetDIBColorTable,            /* pSetDIBColorTable */
627     NULL,                               /* pSetDIBitsToDevice */
628     dibdrv_SetDeviceClipping,           /* pSetDeviceClipping */
629     NULL,                               /* pSetDeviceGammaRamp */
630     NULL,                               /* pSetLayout */
631     NULL,                               /* pSetMapMode */
632     NULL,                               /* pSetMapperFlags */
633     dibdrv_SetPixel,                    /* pSetPixel */
634     NULL,                               /* pSetPixelFormat */
635     NULL,                               /* pSetPolyFillMode */
636     dibdrv_SetROP2,                     /* pSetROP2 */
637     NULL,                               /* pSetRelAbs */
638     NULL,                               /* pSetStretchBltMode */
639     NULL,                               /* pSetTextAlign */
640     NULL,                               /* pSetTextCharacterExtra */
641     dibdrv_SetTextColor,                /* pSetTextColor */
642     NULL,                               /* pSetTextJustification */
643     NULL,                               /* pSetViewportExt */
644     NULL,                               /* pSetViewportOrg */
645     NULL,                               /* pSetWindowExt */
646     NULL,                               /* pSetWindowOrg */
647     NULL,                               /* pSetWorldTransform */
648     NULL,                               /* pStartDoc */
649     NULL,                               /* pStartPage */
650     dibdrv_StretchBlt,                  /* pStretchBlt */
651     NULL,                               /* pStretchDIBits */
652     NULL,                               /* pStrokeAndFillPath */
653     NULL,                               /* pStrokePath */
654     NULL,                               /* pSwapBuffers */
655     NULL,                               /* pUnrealizePalette */
656     NULL,                               /* pWidenPath */
657     NULL,                               /* pwglCopyContext */
658     NULL,                               /* pwglCreateContext */
659     NULL,                               /* pwglCreateContextAttribsARB */
660     NULL,                               /* pwglDeleteContext */
661     NULL,                               /* pwglGetPbufferDCARB */
662     NULL,                               /* pwglGetProcAddress */
663     NULL,                               /* pwglMakeContextCurrentARB */
664     NULL,                               /* pwglMakeCurrent */
665     NULL,                               /* pwglSetPixelFormatWINE */
666     NULL,                               /* pwglShareLists */
667     NULL,                               /* pwglUseFontBitmapsA */
668     NULL                                /* pwglUseFontBitmapsW */
669 };