Moved the 16-bit pointer to the DIB bits out of the driver-specific
structure and into the main bitmap structure. Removed CreateDIBSection16 from the driver interface.
This commit is contained in:
parent
ef06b4a694
commit
6bbc745dde
|
@ -6,10 +6,6 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef X_DISPLAY_MISSING
|
||||
#include "x11drv.h"
|
||||
#endif /* !defined(X_DISPLAY_MISSING) */
|
||||
|
||||
#include "wine/winuser16.h"
|
||||
#include "bitmap.h"
|
||||
#include "debugtools.h"
|
||||
|
@ -89,19 +85,15 @@ HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi,
|
|||
*/
|
||||
SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi)
|
||||
{
|
||||
BITMAPOBJ* bmp = (BITMAPOBJ *) GDI_GetObjPtr( hWinGBitmap, BITMAP_MAGIC );
|
||||
BITMAPOBJ* bmp = (BITMAPOBJ *) GDI_GetObjPtr( hWinGBitmap, BITMAP_MAGIC );
|
||||
SEGPTR res = 0;
|
||||
|
||||
TRACE("(%d,%p)\n", hWinGBitmap, bmpi);
|
||||
if (!bmp) return (SEGPTR)NULL;
|
||||
if (!bmp) return 0;
|
||||
|
||||
if (bmpi)
|
||||
FIXME(": Todo - implement setting BITMAPINFO\n");
|
||||
if (bmpi) FIXME(": Todo - implement setting BITMAPINFO\n");
|
||||
|
||||
#ifndef X_DISPLAY_MISSING
|
||||
res = MAKESEGPTR(((X11DRV_DIBSECTION *) bmp->dib)->selector, 0);
|
||||
#endif /* !defined(X_DISPLAY_MISSING) */
|
||||
|
||||
res = bmp->segptr_bits;
|
||||
GDI_ReleaseObj( hWinGBitmap );
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -184,19 +184,6 @@ HBITMAP TTYDRV_BITMAP_CreateDIBSection(
|
|||
return (HBITMAP) NULL;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* TTYDRV_BITMAP_CreateDIBSection16
|
||||
*/
|
||||
HBITMAP16 TTYDRV_DIB_CreateDIBSection16(
|
||||
DC *dc, BITMAPINFO *bmi, UINT16 usage,
|
||||
SEGPTR *bits, HANDLE section, DWORD offset)
|
||||
{
|
||||
FIXME("(%p, %p, %u, %p, 0x%04x, %ld): stub\n",
|
||||
dc, bmi, usage, bits, section, offset);
|
||||
|
||||
return (HBITMAP16) NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* TTYDRV_BITMAP_DeleteDIBSection
|
||||
*/
|
||||
|
|
|
@ -33,7 +33,6 @@ static const DC_FUNCTIONS TTYDRV_DC_Driver =
|
|||
TTYDRV_DC_CreateBitmap, /* pCreateBitmap */
|
||||
TTYDRV_DC_CreateDC, /* pCreateDC */
|
||||
NULL, /* pCreateDIBSection */
|
||||
NULL, /* pCreateDIBSection16 */
|
||||
TTYDRV_DC_DeleteDC, /* pDeleteDC */
|
||||
TTYDRV_DC_DeleteObject, /* pDeleteObject */
|
||||
NULL, /* pDescribePixelFormat */
|
||||
|
|
|
@ -45,8 +45,6 @@ extern void TTYDRV_GDI_Finalize(void);
|
|||
/* TTY GDI bitmap driver */
|
||||
|
||||
extern HBITMAP TTYDRV_BITMAP_CreateDIBSection(struct tagDC *dc, BITMAPINFO *bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset);
|
||||
extern HBITMAP16 TTYDRV_BITMAP_CreateDIBSection16(struct tagDC *dc, BITMAPINFO *bmi, UINT16 usage, SEGPTR *bits, HANDLE section, DWORD offset);
|
||||
|
||||
extern INT TTYDRV_BITMAP_SetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap);
|
||||
extern INT TTYDRV_BITMAP_GetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan, UINT lines, LPVOID bits, BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap);
|
||||
extern void TTYDRV_BITMAP_DeleteDIBSection(struct tagBITMAPOBJ *bmp);
|
||||
|
|
|
@ -45,7 +45,6 @@ static const DC_FUNCTIONS PSDRV_Funcs =
|
|||
NULL, /* pCreateBitmap */
|
||||
PSDRV_CreateDC, /* pCreateDC */
|
||||
NULL, /* pCreateDIBSection */
|
||||
NULL, /* pCreateDIBSection16 */
|
||||
PSDRV_DeleteDC, /* pDeleteDC */
|
||||
NULL, /* pDeleteObject */
|
||||
NULL, /* pDescribePixelFormat */
|
||||
|
|
|
@ -32,7 +32,6 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
|
|||
NULL, /* pCreateBitmap */
|
||||
NULL, /* no implementation */ /* pCreateDC */
|
||||
NULL, /* pCreateDIBSection */
|
||||
NULL, /* pCreateDIBSection16 */
|
||||
NULL, /* no implementation */ /* pDeleteDC */
|
||||
NULL, /* pDeleteObject */
|
||||
NULL, /* pDescribePixelFormat */
|
||||
|
|
|
@ -32,7 +32,6 @@ static const DC_FUNCTIONS MFDRV_Funcs =
|
|||
NULL, /* pCreateBitmap */
|
||||
NULL, /* no implementation */ /* pCreateDC */
|
||||
NULL, /* pCreateDIBSection */
|
||||
NULL, /* pCreateDIBSection16 */
|
||||
NULL, /* no implementation */ /* pDeleteDC */
|
||||
NULL, /* pDeleteObject */
|
||||
NULL, /* pDescribePixelFormat */
|
||||
|
|
|
@ -58,7 +58,6 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
|
|||
NULL, /* pCreateBitmap */
|
||||
WIN16DRV_CreateDC, /* pCreateDC */
|
||||
NULL, /* pCreateDIBSection */
|
||||
NULL, /* pCreateDIBSection16 */
|
||||
NULL, /* pDeleteDC */
|
||||
NULL, /* pDeleteObject */
|
||||
NULL, /* pDescribePixelFormat */
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
#include "x11drv.h"
|
||||
#include "debugtools.h"
|
||||
#include "gdi.h"
|
||||
#include "color.h"
|
||||
#include "selectors.h"
|
||||
#include "palette.h"
|
||||
#include "global.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(bitmap);
|
||||
|
@ -3732,46 +3731,6 @@ void X11DRV_UnlockDIBSection(DC *dc, BOOL commit)
|
|||
X11DRV_UnlockDIBSection2( dc->hBitmap, commit );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* X11DRV_DIB_CreateDIBSection16
|
||||
*/
|
||||
HBITMAP16 X11DRV_DIB_CreateDIBSection16(
|
||||
DC *dc, BITMAPINFO *bmi, UINT16 usage,
|
||||
SEGPTR *bits, HANDLE section,
|
||||
DWORD offset, DWORD ovr_pitch)
|
||||
{
|
||||
HBITMAP res = X11DRV_DIB_CreateDIBSection(dc, bmi, usage, NULL,
|
||||
section, offset, ovr_pitch);
|
||||
if ( res )
|
||||
{
|
||||
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr(res, BITMAP_MAGIC);
|
||||
if ( bmp && bmp->dib )
|
||||
{
|
||||
DIBSECTION *dib = bmp->dib;
|
||||
INT height = dib->dsBm.bmHeight >= 0 ?
|
||||
dib->dsBm.bmHeight : -dib->dsBm.bmHeight;
|
||||
/* same as above - only use biSizeImage as the correct size if it a
|
||||
compressed image and it's currently non-zero. In other cases, use
|
||||
width * height as the value. */
|
||||
INT size = dib->dsBmih.biSizeImage && dib->dsBmih.biCompression != BI_RGB
|
||||
? dib->dsBmih.biSizeImage
|
||||
: dib->dsBm.bmWidthBytes * height;
|
||||
if ( dib->dsBm.bmBits )
|
||||
{
|
||||
((X11DRV_DIBSECTION *) bmp->dib)->selector =
|
||||
SELECTOR_AllocBlock( dib->dsBm.bmBits, size, WINE_LDT_FLAGS_DATA );
|
||||
}
|
||||
TRACE("ptr = %p, size =%d, selector = %04x, segptr = %ld\n",
|
||||
dib->dsBm.bmBits, size, ((X11DRV_DIBSECTION *) bmp->dib)->selector,
|
||||
MAKESEGPTR(((X11DRV_DIBSECTION *) bmp->dib)->selector, 0));
|
||||
if ( bits )
|
||||
*bits = MAKESEGPTR( ((X11DRV_DIBSECTION *) bmp->dib)->selector, 0 );
|
||||
}
|
||||
if (bmp) GDI_ReleaseObj( res );
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBXXSHM
|
||||
/***********************************************************************
|
||||
|
@ -3945,8 +3904,6 @@ HBITMAP X11DRV_DIB_CreateDIBSection(
|
|||
dib->dibSection.dsOffset = offset;
|
||||
|
||||
dib->status = DIB_Status_None;
|
||||
dib->selector = 0;
|
||||
|
||||
dib->nColorMap = nColorMap;
|
||||
dib->colorMap = colorMap;
|
||||
}
|
||||
|
@ -4055,7 +4012,6 @@ void X11DRV_DIB_DeleteDIBSection(BITMAPOBJ *bmp)
|
|||
if (dib->colorMap)
|
||||
HeapFree(GetProcessHeap(), 0, dib->colorMap);
|
||||
|
||||
if (dib->selector) SELECTOR_FreeBlock( dib->selector );
|
||||
DeleteCriticalSection(&(dib->lock));
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "bitmap.h"
|
||||
#include "color.h"
|
||||
#include "palette.h"
|
||||
#include "debugtools.h"
|
||||
#include "winnt.h"
|
||||
#include "x11drv.h"
|
||||
|
@ -42,7 +42,6 @@ const DC_FUNCTIONS X11DRV_DC_Funcs =
|
|||
X11DRV_CreateBitmap, /* pCreateBitmap */
|
||||
X11DRV_CreateDC, /* pCreateDC */
|
||||
X11DRV_DIB_CreateDIBSection, /* pCreateDIBSection */
|
||||
X11DRV_DIB_CreateDIBSection16, /* pCreateDIBSection16 */
|
||||
X11DRV_DeleteDC, /* pDeleteDC */
|
||||
X11DRV_DeleteObject, /* pDeleteObject */
|
||||
X11DRV_DescribePixelFormat, /* pDescribePixelFormat */
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef struct tagBITMAPOBJ
|
|||
void *physBitmap; /* ptr to device specific data */
|
||||
/* For device-independent bitmaps: */
|
||||
DIBSECTION *dib;
|
||||
SEGPTR segptr_bits; /* segptr to DIB bits */
|
||||
} BITMAPOBJ;
|
||||
|
||||
typedef struct tagBITMAP_DRIVER
|
||||
|
|
|
@ -175,8 +175,6 @@ typedef struct tagDC_FUNCS
|
|||
BOOL (*pCreateDC)(DC*,LPCSTR,LPCSTR,LPCSTR,const DEVMODEA*);
|
||||
HBITMAP (*pCreateDIBSection)(DC *,BITMAPINFO *,UINT,LPVOID *,HANDLE,
|
||||
DWORD,DWORD);
|
||||
HBITMAP16 (*pCreateDIBSection16)(DC *,BITMAPINFO *,UINT16,SEGPTR *,HANDLE,
|
||||
DWORD,DWORD);
|
||||
BOOL (*pDeleteDC)(DC*);
|
||||
BOOL (*pDeleteObject)(HGDIOBJ);
|
||||
INT (*pDescribePixelFormat)(DC *,INT,UINT,PIXELFORMATDESCRIPTOR *);
|
||||
|
|
|
@ -214,9 +214,6 @@ typedef struct
|
|||
/* Cached XImage */
|
||||
XImage *image;
|
||||
|
||||
/* Selector for 16-bit access to bits */
|
||||
WORD selector;
|
||||
|
||||
#ifdef HAVE_LIBXXSHM
|
||||
/* Shared memory segment info */
|
||||
XShmSegmentInfo shminfo;
|
||||
|
@ -243,8 +240,6 @@ extern void X11DRV_UnlockDIBSection2(HBITMAP bmp,BOOL);
|
|||
|
||||
extern HBITMAP X11DRV_DIB_CreateDIBSection(struct tagDC *dc, BITMAPINFO *bmi, UINT usage,
|
||||
LPVOID *bits, HANDLE section, DWORD offset, DWORD ovr_pitch);
|
||||
extern HBITMAP16 X11DRV_DIB_CreateDIBSection16(struct tagDC *dc, BITMAPINFO *bmi, UINT16 usage,
|
||||
SEGPTR *bits, HANDLE section, DWORD offset, DWORD ovr_pitch);
|
||||
|
||||
extern struct tagBITMAP_DRIVER X11DRV_BITMAP_Driver;
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@ HBITMAP WINAPI CreateBitmap( INT width, INT height, UINT planes,
|
|||
bmp->funcs = NULL;
|
||||
bmp->physBitmap = NULL;
|
||||
bmp->dib = NULL;
|
||||
bmp->segptr_bits = 0;
|
||||
|
||||
if (bits) /* Set bitmap bits */
|
||||
SetBitmapBits( hbitmap, height * bmp->bitmap.bmWidthBytes,
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "winbase.h"
|
||||
#include "bitmap.h"
|
||||
#include "callback.h"
|
||||
#include "selectors.h"
|
||||
#include "gdi.h"
|
||||
#include "debugtools.h"
|
||||
#include "palette.h"
|
||||
|
@ -853,29 +854,29 @@ HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header,
|
|||
* CreateDIBSection (GDI.489)
|
||||
*/
|
||||
HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, BITMAPINFO *bmi, UINT16 usage,
|
||||
SEGPTR *bits, HANDLE section,
|
||||
DWORD offset)
|
||||
SEGPTR *bits16, HANDLE section, DWORD offset)
|
||||
{
|
||||
HBITMAP16 hbitmap = 0;
|
||||
DC *dc;
|
||||
BOOL bDesktopDC = FALSE;
|
||||
LPVOID bits32;
|
||||
HBITMAP hbitmap;
|
||||
|
||||
/* If the reference hdc is null, take the desktop dc */
|
||||
if (hdc == 0)
|
||||
hbitmap = CreateDIBSection( hdc, bmi, usage, &bits32, section, offset );
|
||||
if (hbitmap)
|
||||
{
|
||||
hdc = CreateCompatibleDC(0);
|
||||
bDesktopDC = TRUE;
|
||||
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr(hbitmap, BITMAP_MAGIC);
|
||||
if (bmp && bmp->dib && bits32)
|
||||
{
|
||||
BITMAPINFOHEADER *bi = &bmi->bmiHeader;
|
||||
INT height = bi->biHeight >= 0 ? bi->biHeight : -bi->biHeight;
|
||||
INT width_bytes = DIB_GetDIBWidthBytes(bi->biWidth, bi->biBitCount);
|
||||
INT size = (bi->biSizeImage && bi->biCompression != BI_RGB) ?
|
||||
bi->biSizeImage : width_bytes * height;
|
||||
|
||||
WORD sel = SELECTOR_AllocBlock( bits32, size, WINE_LDT_FLAGS_DATA );
|
||||
bmp->segptr_bits = MAKESEGPTR( sel, 0 );
|
||||
if (bits16) *bits16 = bmp->segptr_bits;
|
||||
}
|
||||
if (bmp) GDI_ReleaseObj( hbitmap );
|
||||
}
|
||||
|
||||
if ((dc = DC_GetDCPtr( hdc )))
|
||||
{
|
||||
hbitmap = dc->funcs->pCreateDIBSection16(dc, bmi, usage, bits, section, offset, 0);
|
||||
GDI_ReleaseObj(hdc);
|
||||
}
|
||||
|
||||
if (bDesktopDC)
|
||||
DeleteDC(hdc);
|
||||
|
||||
return hbitmap;
|
||||
}
|
||||
|
||||
|
@ -945,6 +946,7 @@ void DIB_DeleteDIBSection( BITMAPOBJ *bmp )
|
|||
|
||||
HeapFree(GetProcessHeap(), 0, dib);
|
||||
bmp->dib = NULL;
|
||||
if (bmp->segptr_bits) SELECTOR_FreeBlock( SELECTOROF(bmp->segptr_bits) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue