2 * DIB driver bitmap objects
4 * Copyright 2009 Massimo Del Fedele
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
22 #include "wine/port.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(dibdrv
);
29 /****************************************************************************
30 * SelectBitmap (WINEDIB.DRV.@)
32 HBITMAP
DIBDRV_SelectBitmap( DIBDRVPHYSDEV
*physDev
, HBITMAP hbitmap
)
34 DIBSECTION dibSection
;
37 TRACE("physDev:%p, hbitmap:%p\n", physDev
, hbitmap
);
39 /* try to get the DIBSECTION data from the bitmap */
40 if(GetObjectW(hbitmap
, sizeof(DIBSECTION
), &dibSection
) == sizeof(BITMAP
))
42 /* not a DIB section, sets it on physDev and use X11 behaviour */
43 physDev
->hasDIB
= FALSE
;
44 res
= _DIBDRV_GetDisplayDriver()->pSelectBitmap(physDev
->X11PhysDev
, hbitmap
);
46 physDev
->hbitmap
= hbitmap
;
50 /* it's a DIB section, sets it on physDev and use DIB Engine behaviour */
51 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
52 physDev
->hasDIB
= TRUE
;
53 res
= _DIBDRV_GetDisplayDriver()->pSelectBitmap(physDev
->X11PhysDev
, hbitmap
);
55 physDev
->hbitmap
= hbitmap
;
61 /****************************************************************************
64 BOOL
DIBDRV_CreateBitmap( DIBDRVPHYSDEV
*physDev
, HBITMAP hbitmap
, LPVOID bmBits
)
66 DIBSECTION dibSection
;
69 TRACE("physDev:%p, hbitmap:%p, bmBits:%p\n", physDev
, hbitmap
, bmBits
);
71 /* try to get the DIBSECTION data from the bitmap */
72 if(GetObjectW(hbitmap
, sizeof(DIBSECTION
), &dibSection
) == sizeof(BITMAP
))
74 /* not a DIB section, use X11 behaviour */
75 res
= _DIBDRV_GetDisplayDriver()->pCreateBitmap(physDev
->X11PhysDev
, hbitmap
, bmBits
);
79 /* it's a DIB section, use DIB Engine behaviour */
80 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
81 res
= _DIBDRV_GetDisplayDriver()->pCreateBitmap(physDev
->X11PhysDev
, hbitmap
, bmBits
);
86 /***********************************************************************
89 BOOL
DIBDRV_DeleteBitmap( HBITMAP hbitmap
)
91 DIBSECTION dibSection
;
94 TRACE("hbitmap:%p\n", hbitmap
);
96 /* try to get the DIBSECTION data from the bitmap */
97 if(GetObjectW(hbitmap
, sizeof(DIBSECTION
), &dibSection
) == sizeof(BITMAP
))
99 /* not a DIB section, use X11 behaviour */
100 res
= _DIBDRV_GetDisplayDriver()->pDeleteBitmap(hbitmap
);
104 /* it's a DIB section, use DIB Engine behaviour */
105 ONCE(FIXME("TEMPORARY - fallback to X11 driver\n"));
106 res
= _DIBDRV_GetDisplayDriver()->pDeleteBitmap(hbitmap
);
111 /***********************************************************************
112 * DIBDRV_GetBitmapBits
114 LONG
DIBDRV_GetBitmapBits( HBITMAP hbitmap
, void *buffer
, LONG count
)
118 TRACE("hbitmap:%p, buffer:%p, count:%d\n", hbitmap
, buffer
, count
);
120 /* GetBitmapBits is only valid for DDBs, so use X11 driver */
121 res
= _DIBDRV_GetDisplayDriver()->pGetBitmapBits(hbitmap
, buffer
, count
);
126 /******************************************************************************
127 * DIBDRV_SetBitmapBits
129 LONG
DIBDRV_SetBitmapBits( HBITMAP hbitmap
, const void *bits
, LONG count
)
133 TRACE("hbitmap:%p, bits:%p, count:%d\n", hbitmap
, bits
, count
);
135 /* SetBitmapBits is only valid for DDBs, so use X11 driver */
136 res
= _DIBDRV_GetDisplayDriver()->pSetBitmapBits(hbitmap
, bits
, count
);