diff --git a/dlls/winex11.drv/Makefile.in b/dlls/winex11.drv/Makefile.in index 16948be1a24..2bc49f5f677 100644 --- a/dlls/winex11.drv/Makefile.in +++ b/dlls/winex11.drv/Makefile.in @@ -6,7 +6,6 @@ EXTRALIBS = @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ C_SRCS = \ bitblt.c \ - bitmap.c \ brush.c \ clipboard.c \ desktop.c \ diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 2db9e70e373..d7e1e07e705 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -599,7 +599,6 @@ static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, cons int exposures = 0; INT width = visRectDst->right - visRectDst->left; INT height = visRectDst->bottom - visRectDst->top; - BOOL memdc = (GetObjectType( physDev->dev.hdc ) == OBJ_MEMDC); wine_tsx11_lock(); @@ -613,25 +612,17 @@ static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, cons } else { - register INT x, y; + INT x, y; XImage *image; - if (memdc) - image = XGetImage( gdi_display, physDev->drawable, - physDev->dc_rect.left + visRectDst->left, - physDev->dc_rect.top + visRectDst->top, - width, height, AllPlanes, ZPixmap ); - else - { - /* Make sure we don't get a BadMatch error */ - XCopyArea( gdi_display, physDev->drawable, pixmap, gc, - physDev->dc_rect.left + visRectDst->left, - physDev->dc_rect.top + visRectDst->top, - width, height, 0, 0); - exposures++; - image = XGetImage( gdi_display, pixmap, 0, 0, width, height, - AllPlanes, ZPixmap ); - } + /* Make sure we don't get a BadMatch error */ + XCopyArea( gdi_display, physDev->drawable, pixmap, gc, + physDev->dc_rect.left + visRectDst->left, + physDev->dc_rect.top + visRectDst->top, + width, height, 0, 0); + exposures++; + image = XGetImage( gdi_display, pixmap, 0, 0, width, height, + AllPlanes, ZPixmap ); if (image) { for (y = 0; y < height; y++) diff --git a/dlls/winex11.drv/bitmap.c b/dlls/winex11.drv/bitmap.c deleted file mode 100644 index eb423a2444b..00000000000 --- a/dlls/winex11.drv/bitmap.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * X11DRV bitmap objects - * - * Copyright 1993 Alexandre Julliard - * 1999 Noel Borthwick - * - * 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 "config.h" - -#include -#include -#include "windef.h" -#include "wingdi.h" -#include "wine/debug.h" -#include "x11drv.h" - -WINE_DEFAULT_DEBUG_CHANNEL(x11drv); - - /* GCs used for B&W and color bitmap operations */ -static GC bitmap_gc[32]; -X_PHYSBITMAP BITMAP_stock_phys_bitmap = { 0 }; /* phys bitmap for the default stock bitmap */ - -static XContext bitmap_context; /* X context to associate a phys bitmap to a handle */ - -static GC get_bitmap_gc(int depth) -{ - if(depth < 1 || depth > 32) - return 0; - - return bitmap_gc[depth-1]; -} - -/*********************************************************************** - * X11DRV_BITMAP_Init - */ -void X11DRV_BITMAP_Init(void) -{ - int depth_count, index, i; - int *depth_list; - Pixmap tmpPixmap; - - wine_tsx11_lock(); - bitmap_context = XUniqueContext(); - BITMAP_stock_phys_bitmap.depth = 1; - BITMAP_stock_phys_bitmap.pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 1 ); - bitmap_gc[0] = XCreateGC( gdi_display, BITMAP_stock_phys_bitmap.pixmap, 0, NULL ); - XSetGraphicsExposures( gdi_display, bitmap_gc[0], False ); - XSetSubwindowMode( gdi_display, bitmap_gc[0], IncludeInferiors ); - - /* Create a GC for all available depths. GCs at depths other than 1-bit/screen_depth are for use - * in combination with XRender which allows us to create dibsections at more depths. - */ - depth_list = XListDepths(gdi_display, DefaultScreen(gdi_display), &depth_count); - for (i = 0; i < depth_count; i++) - { - index = depth_list[i] - 1; - if (bitmap_gc[index]) continue; - if ((tmpPixmap = XCreatePixmap( gdi_display, root_window, 1, 1, depth_list[i]))) - { - if ((bitmap_gc[index] = XCreateGC( gdi_display, tmpPixmap, 0, NULL ))) - { - XSetGraphicsExposures( gdi_display, bitmap_gc[index], False ); - XSetSubwindowMode( gdi_display, bitmap_gc[index], IncludeInferiors ); - } - XFreePixmap( gdi_display, tmpPixmap ); - } - } - XFree( depth_list ); - - wine_tsx11_unlock(); -} - -/*********************************************************************** - * SelectBitmap (X11DRV.@) - */ -HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap ) -{ - X11DRV_PDEVICE *physDev = get_x11drv_dev( dev ); - X_PHYSBITMAP *physBitmap; - BITMAP bitmap; - - if (!GetObjectW( hbitmap, sizeof(bitmap), &bitmap )) return 0; - - if (hbitmap == BITMAP_stock_phys_bitmap.hbitmap) physBitmap = &BITMAP_stock_phys_bitmap; - else if (!(physBitmap = X11DRV_get_phys_bitmap( hbitmap ))) return 0; - - physDev->bitmap = physBitmap; - physDev->drawable = physBitmap->pixmap; - physDev->color_shifts = physBitmap->trueColor ? &physBitmap->color_shifts : NULL; - SetRect( &physDev->drawable_rect, 0, 0, bitmap.bmWidth, bitmap.bmHeight ); - physDev->dc_rect = physDev->drawable_rect; - - /* Change GC depth if needed */ - - if (physDev->depth != physBitmap->depth) - { - physDev->depth = physBitmap->depth; - wine_tsx11_lock(); - XFreeGC( gdi_display, physDev->gc ); - physDev->gc = XCreateGC( gdi_display, physDev->drawable, 0, NULL ); - XSetGraphicsExposures( gdi_display, physDev->gc, False ); - XSetSubwindowMode( gdi_display, physDev->gc, IncludeInferiors ); - XFlush( gdi_display ); - wine_tsx11_unlock(); - } - - return hbitmap; -} - - -/*********************************************************************** - * X11DRV_create_phys_bitmap - */ -X_PHYSBITMAP *X11DRV_create_phys_bitmap( HBITMAP hbitmap, const BITMAP *bitmap, int depth ) -{ - X_PHYSBITMAP *physBitmap; - - if (bitmap->bmWidth > 65535 || bitmap->bmHeight > 65535 || bitmap->bmPlanes != 1 || - (bitmap->bmBitsPixel != 1 && bitmap->bmBitsPixel != screen_bpp)) - { - WARN( "Trying to create invalid pixmap %dx%d planes %d bpp %d\n", - bitmap->bmWidth, bitmap->bmHeight, bitmap->bmPlanes, bitmap->bmBitsPixel ); - return NULL; - } - - if (!(physBitmap = X11DRV_init_phys_bitmap( hbitmap ))) return NULL; - - physBitmap->depth = depth; - - wine_tsx11_lock(); - physBitmap->pixmap = XCreatePixmap( gdi_display, root_window, - bitmap->bmWidth, bitmap->bmHeight, physBitmap->depth ); - if (physBitmap->pixmap) - { - GC gc = get_bitmap_gc( depth ); - XSetFunction( gdi_display, gc, GXclear ); - XFillRectangle( gdi_display, physBitmap->pixmap, gc, 0, 0, bitmap->bmWidth, bitmap->bmHeight ); - XSetFunction( gdi_display, gc, GXcopy ); - } - wine_tsx11_unlock(); - if (!physBitmap->pixmap) - { - WARN("Can't create Pixmap\n"); - HeapFree( GetProcessHeap(), 0, physBitmap ); - return NULL; - } - TRACE( "(%p) %dx%d %d bpp -> %lx\n", - hbitmap, bitmap->bmWidth, bitmap->bmHeight, bitmap->bmBitsPixel, physBitmap->pixmap ); - return physBitmap; -} - - -/*********************************************************************** - * X11DRV_get_phys_bitmap - * - * Retrieve the X physical bitmap info. - */ -X_PHYSBITMAP *X11DRV_get_phys_bitmap( HBITMAP hbitmap ) -{ - X_PHYSBITMAP *ret; - - wine_tsx11_lock(); - if (XFindContext( gdi_display, (XID)hbitmap, bitmap_context, (char **)&ret )) ret = NULL; - wine_tsx11_unlock(); - return ret; -} - - -/*********************************************************************** - * X11DRV_init_phys_bitmap - * - * Initialize the X physical bitmap info. - */ -X_PHYSBITMAP *X11DRV_init_phys_bitmap( HBITMAP hbitmap ) -{ - X_PHYSBITMAP *ret; - - if ((ret = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret) )) != NULL) - { - ret->hbitmap = hbitmap; - wine_tsx11_lock(); - XSaveContext( gdi_display, (XID)hbitmap, bitmap_context, (char *)ret ); - wine_tsx11_unlock(); - } - return ret; -} - - -/*********************************************************************** - * X11DRV_get_pixmap - * - * Retrieve the pixmap associated to a bitmap. - */ -Pixmap X11DRV_get_pixmap( HBITMAP hbitmap ) -{ - X_PHYSBITMAP *physBitmap = X11DRV_get_phys_bitmap( hbitmap ); - - if (!physBitmap) return 0; - return physBitmap->pixmap; -} diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index f548792fa9e..1225256c80d 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -42,6 +42,7 @@ static int vert_size; /* vert. size of screen in millimeters */ static int palette_size; static int device_init_done; +static Pixmap stock_bitmap_pixmap; /* phys bitmap for the default stock bitmap */ static const WCHAR dpi_key_name[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'}; static const WCHAR dpi_value_name[] = {'L','o','g','P','i','x','e','l','s','\0'}; @@ -91,7 +92,9 @@ static void device_init(void) palette_size = X11DRV_PALETTE_Init(); - X11DRV_BITMAP_Init(); + wine_tsx11_lock(); + stock_bitmap_pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 1 ); + wine_tsx11_unlock(); /* Initialize device caps */ log_pixels_x = log_pixels_y = get_dpi(); @@ -157,14 +160,10 @@ static BOOL X11DRV_CreateDC( PHYSDEV *pdev, LPCWSTR driver, LPCWSTR device, static BOOL X11DRV_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev ) { const struct gdi_dc_funcs *glx_funcs = get_glx_driver(); - X11DRV_PDEVICE *physDev = create_x11_physdev( BITMAP_stock_phys_bitmap.pixmap ); + X11DRV_PDEVICE *physDev = create_x11_physdev( stock_bitmap_pixmap ); if (!physDev) return FALSE; - if (!BITMAP_stock_phys_bitmap.hbitmap) - BITMAP_stock_phys_bitmap.hbitmap = GetCurrentObject( (*pdev)->hdc, OBJ_BITMAP ); - - physDev->bitmap = &BITMAP_stock_phys_bitmap; physDev->depth = 1; SetRect( &physDev->drawable_rect, 0, 0, 1, 1 ); physDev->dc_rect = physDev->drawable_rect; @@ -594,7 +593,7 @@ static const struct gdi_dc_funcs x11drv_funcs = NULL, /* pSaveDC */ NULL, /* pScaleViewportExt */ NULL, /* pScaleWindowExt */ - X11DRV_SelectBitmap, /* pSelectBitmap */ + NULL, /* pSelectBitmap */ X11DRV_SelectBrush, /* pSelectBrush */ NULL, /* pSelectClipPath */ NULL, /* pSelectFont */ diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 697b8d49f17..c84226bfa54 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1586,7 +1586,7 @@ static BOOL internal_SetPixelFormat( struct glx_physdev *physdev, } /* physDev->current_pf will be set by the DCE update */ } - else if(physdev->x11dev->bitmap) { + else if (GetObjectType( physdev->dev.hdc ) == OBJ_MEMDC) { if(!(value&GLX_PIXMAP_BIT)) { WARN("Pixel format %d is not compatible for bitmap rendering\n", iPixelFormat); return FALSE; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 0d9746afb45..1adecd84919 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -60,7 +60,6 @@ typedef int Status; #include "wine/gdi_driver.h" #include "wine/list.h" -#define MAX_PIXELFORMATS 8 #define MAX_DASHLEN 16 #define WINE_XDND_VERSION 4 @@ -103,17 +102,6 @@ typedef struct ChannelShift logicalRed, logicalGreen, logicalBlue; } ColorShifts; - /* X physical bitmap */ -typedef struct -{ - HBITMAP hbitmap; - Pixmap pixmap; - int depth; /* depth of the X pixmap */ - int format; /* color format (used by XRender) */ - ColorShifts color_shifts; /* color shifts of the X pixmap */ - BOOL trueColor; -} X_PHYSBITMAP; - enum dc_gl_type { DC_GL_NONE, /* no GL support (pixel format not set yet) */ @@ -136,7 +124,6 @@ typedef struct HRGN region; /* Device region (visible region & clip region) */ X_PHYSPEN pen; X_PHYSBRUSH brush; - X_PHYSBITMAP *bitmap; /* currently selected bitmap for memory DCs */ int depth; /* bit depth of the DC */ ColorShifts *color_shifts; /* color shifts of the DC */ int exposures; /* count of graphics exposures operations */ @@ -162,8 +149,6 @@ static inline void add_bounds_rect( RECT *bounds, const RECT *rect ) bounds->bottom = max( bounds->bottom, rect->bottom ); } -extern X_PHYSBITMAP BITMAP_stock_phys_bitmap DECLSPEC_HIDDEN; /* phys bitmap for the default stock bitmap */ - /* Wine driver X11 functions */ extern BOOL X11DRV_Arc( PHYSDEV dev, INT left, INT top, INT right, @@ -197,7 +182,6 @@ extern UINT X11DRV_RealizePalette( PHYSDEV dev, HPALETTE hpal, BOOL primary ) DE extern BOOL X11DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom) DECLSPEC_HIDDEN; extern BOOL X11DRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height ) DECLSPEC_HIDDEN; -extern HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap ) DECLSPEC_HIDDEN; extern HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN; extern HPEN X11DRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN; extern COLORREF X11DRV_SetDCBrushColor( PHYSDEV dev, COLORREF crColor ) DECLSPEC_HIDDEN; @@ -212,13 +196,8 @@ extern BOOL X11DRV_UnrealizePalette( HPALETTE hpal ) DECLSPEC_HIDDEN; /* X11 driver internal functions */ extern void X11DRV_Xcursor_Init(void) DECLSPEC_HIDDEN; -extern void X11DRV_BITMAP_Init(void) DECLSPEC_HIDDEN; extern void X11DRV_XInput2_Init(void) DECLSPEC_HIDDEN; -extern X_PHYSBITMAP *X11DRV_get_phys_bitmap( HBITMAP hbitmap ) DECLSPEC_HIDDEN; -extern X_PHYSBITMAP *X11DRV_init_phys_bitmap( HBITMAP hbitmap ) DECLSPEC_HIDDEN; -extern X_PHYSBITMAP *X11DRV_create_phys_bitmap( HBITMAP hbitmap, const BITMAP *bitmap, int depth ) DECLSPEC_HIDDEN; -extern Pixmap X11DRV_get_pixmap( HBITMAP hbitmap ) DECLSPEC_HIDDEN; extern DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image, const struct gdi_image_bits *src_bits, struct gdi_image_bits *dst_bits, struct bitblt_coords *coords, const int *mapping, unsigned int zeropad_mask ) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 68a2b4de04c..5108dfdf2e5 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -1223,26 +1223,6 @@ static INT xrenderdrv_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID return dev->funcs->pExtEscape( dev, escape, in_count, in_data, out_count, out_data ); } -/*********************************************************************** - * xrenderdrv_SelectBitmap - */ -static HBITMAP xrenderdrv_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap ) -{ - HBITMAP ret; - struct xrender_physdev *physdev = get_xrender_dev( dev ); - - dev = GET_NEXT_PHYSDEV( dev, pSelectBitmap ); - ret = dev->funcs->pSelectBitmap( dev, hbitmap ); - if (ret) - { - free_xrender_picture( physdev ); - if (hbitmap == BITMAP_stock_phys_bitmap.hbitmap) physdev->format = WXR_FORMAT_MONO; - else physdev->format = X11DRV_get_phys_bitmap(hbitmap)->format; - physdev->pict_format = pict_formats[physdev->format]; - } - return ret; -} - /*********************************************************************** * xrenderdrv_SetDeviceClipping */ @@ -2575,7 +2555,7 @@ static const struct gdi_dc_funcs xrender_funcs = NULL, /* pSaveDC */ NULL, /* pScaleViewportExt */ NULL, /* pScaleWindowExt */ - xrenderdrv_SelectBitmap, /* pSelectBitmap */ + NULL, /* pSelectBitmap */ xrenderdrv_SelectBrush, /* pSelectBrush */ NULL, /* pSelectClipPath */ xrenderdrv_SelectFont, /* pSelectFont */ diff --git a/dlls/winex11.drv/xvidmode.c b/dlls/winex11.drv/xvidmode.c index e108dee9edf..e279b70cd6c 100644 --- a/dlls/winex11.drv/xvidmode.c +++ b/dlls/winex11.drv/xvidmode.c @@ -424,11 +424,6 @@ static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp) */ BOOL X11DRV_GetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp) { - if (GetObjectType( dev->hdc ) == OBJ_MEMDC) - { - SetLastError( ERROR_INVALID_PARAMETER ); - return FALSE; - } #ifdef SONAME_LIBXXF86VM return X11DRV_XF86VM_GetGammaRamp(ramp); #else @@ -445,11 +440,6 @@ BOOL X11DRV_GetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp) */ BOOL X11DRV_SetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp) { - if (GetObjectType( dev->hdc ) == OBJ_MEMDC) - { - SetLastError( ERROR_INVALID_PARAMETER ); - return FALSE; - } #ifdef SONAME_LIBXXF86VM return X11DRV_XF86VM_SetGammaRamp(ramp); #else