diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c index 5029128cd6f..87632186c42 100644 --- a/dlls/gdi32/bitblt.c +++ b/dlls/gdi32/bitblt.c @@ -256,13 +256,13 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, if (!(dc_src = get_dc_ptr( src_dev->hdc ))) return FALSE; src_dev = GET_DC_PHYSDEV( dc_src, pGetImage ); - err = src_dev->funcs->pGetImage( src_dev, 0, src_info, &bits, src ); + err = src_dev->funcs->pGetImage( src_dev, src_info, &bits, src ); release_dc_ptr( dc_src ); if (err) return FALSE; dst_dev = GET_DC_PHYSDEV( dc_dst, pPutImage ); copy_bitmapinfo( dst_info, src_info ); - err = dst_dev->funcs->pPutImage( dst_dev, 0, 0, dst_info, &bits, src, dst, rop ); + err = dst_dev->funcs->pPutImage( dst_dev, 0, dst_info, &bits, src, dst, rop ); if (err == ERROR_BAD_FORMAT) { DWORD dst_colors = dst_info->bmiHeader.biClrUsed; @@ -286,7 +286,7 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, { /* get rid of the fake destination table */ dst_info->bmiHeader.biClrUsed = dst_colors; - err = dst_dev->funcs->pPutImage( dst_dev, 0, 0, dst_info, &bits, src, dst, rop ); + err = dst_dev->funcs->pPutImage( dst_dev, 0, dst_info, &bits, src, dst, rop ); } } @@ -295,7 +295,7 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, { copy_bitmapinfo( src_info, dst_info ); err = stretch_bits( src_info, src, dst_info, dst, &bits, GetStretchBltMode( dst_dev->hdc )); - if (!err) err = dst_dev->funcs->pPutImage( dst_dev, 0, 0, dst_info, &bits, src, dst, rop ); + if (!err) err = dst_dev->funcs->pPutImage( dst_dev, 0, dst_info, &bits, src, dst, rop ); } if (bits.free) bits.free( &bits ); @@ -316,7 +316,7 @@ BOOL nulldrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, if (!(dc_src = get_dc_ptr( src_dev->hdc ))) return FALSE; src_dev = GET_DC_PHYSDEV( dc_src, pGetImage ); - err = src_dev->funcs->pGetImage( src_dev, 0, src_info, &bits, src ); + err = src_dev->funcs->pGetImage( src_dev, src_info, &bits, src ); release_dc_ptr( dc_src ); if (err) goto done; @@ -368,12 +368,12 @@ DWORD nulldrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_ dev = GET_DC_PHYSDEV( dc, pGetImage ); orig_dst = *dst; - err = dev->funcs->pGetImage( dev, 0, dst_info, &dst_bits, dst ); + err = dev->funcs->pGetImage( dev, dst_info, &dst_bits, dst ); if (err) return err; dev = GET_DC_PHYSDEV( dc, pPutImage ); err = blend_bits( info, bits, src, dst_info, &dst_bits, dst, blend ); - if (!err) err = dev->funcs->pPutImage( dev, 0, 0, dst_info, &dst_bits, dst, &orig_dst, SRCCOPY ); + if (!err) err = dev->funcs->pPutImage( dev, 0, dst_info, &dst_bits, dst, &orig_dst, SRCCOPY ); if (dst_bits.free) dst_bits.free( &dst_bits ); return err; @@ -441,7 +441,7 @@ BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, info->bmiHeader.biHeight = dst.visrect.bottom - dst.visrect.top; info->bmiHeader.biSizeImage = 0; dev = GET_DC_PHYSDEV( dc, pPutImage ); - err = dev->funcs->pPutImage( dev, 0, 0, info, NULL, NULL, NULL, 0 ); + err = dev->funcs->pPutImage( dev, 0, info, NULL, NULL, NULL, 0 ); if (err && err != ERROR_BAD_FORMAT) goto done; info->bmiHeader.biSizeImage = get_dib_image_size( info ); @@ -464,7 +464,7 @@ BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, rgn = CreateRectRgn( 0, 0, 0, 0 ); gradient_bitmapinfo( info, bits.ptr, vert_array, nvert, grad_array, ngrad, mode, pts, rgn ); OffsetRgn( rgn, dst.visrect.left, dst.visrect.top ); - ret = !dev->funcs->pPutImage( dev, 0, rgn, info, &bits, &src, &dst, SRCCOPY ); + ret = !dev->funcs->pPutImage( dev, rgn, info, &bits, &src, &dst, SRCCOPY ); if (bits.free) bits.free( &bits ); DeleteObject( rgn ); @@ -495,7 +495,7 @@ COLORREF nulldrv_GetPixel( PHYSDEV dev, INT x, INT y ) if (!clip_visrect( dc, &src.visrect, &src.visrect )) return CLR_INVALID; dev = GET_DC_PHYSDEV( dc, pGetImage ); - if (dev->funcs->pGetImage( dev, 0, info, &bits, &src )) return CLR_INVALID; + if (dev->funcs->pGetImage( dev, info, &bits, &src )) return CLR_INVALID; ret = get_pixel_bitmapinfo( info, bits.ptr, &src ); if (bits.free) bits.free( &bits ); diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index 8f044de0d7c..286c404e452 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -554,7 +554,7 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he dev = GET_DC_PHYSDEV( dc, pPutImage ); copy_bitmapinfo( dst_info, src_info ); - err = dev->funcs->pPutImage( dev, 0, clip, dst_info, &src_bits, &src, &dst, rop ); + err = dev->funcs->pPutImage( dev, clip, dst_info, &src_bits, &src, &dst, rop ); if (err == ERROR_BAD_FORMAT) { /* 1-bpp destination without a color table requires a fake 1-entry table @@ -573,7 +573,7 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he { /* get rid of the fake 1-bpp table */ if (dst_info->bmiHeader.biClrUsed == 1) dst_info->bmiHeader.biClrUsed = 0; - err = dev->funcs->pPutImage( dev, 0, clip, dst_info, &src_bits, &src, &dst, rop ); + err = dev->funcs->pPutImage( dev, clip, dst_info, &src_bits, &src, &dst, rop ); } } @@ -581,7 +581,7 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he { copy_bitmapinfo( src_info, dst_info ); err = stretch_bits( src_info, &src, dst_info, &dst, &src_bits, GetStretchBltMode( dev->hdc ) ); - if (!err) err = dev->funcs->pPutImage( dev, 0, NULL, dst_info, &src_bits, &src, &dst, rop ); + if (!err) err = dev->funcs->pPutImage( dev, NULL, dst_info, &src_bits, &src, &dst, rop ); } if (err) ret = 0; else if (rop == SRCCOPY) ret = height; @@ -850,11 +850,11 @@ INT nulldrv_SetDIBitsToDevice( PHYSDEV dev, INT x_dst, INT y_dst, DWORD cx, DWOR dev = GET_DC_PHYSDEV( dc, pPutImage ); copy_bitmapinfo( dst_info, src_info ); - err = dev->funcs->pPutImage( dev, 0, clip, dst_info, &src_bits, &src, &dst, SRCCOPY ); + err = dev->funcs->pPutImage( dev, clip, dst_info, &src_bits, &src, &dst, SRCCOPY ); if (err == ERROR_BAD_FORMAT) { err = convert_bits( src_info, &src, dst_info, &src_bits, FALSE ); - if (!err) err = dev->funcs->pPutImage( dev, 0, clip, dst_info, &src_bits, &src, &dst, SRCCOPY ); + if (!err) err = dev->funcs->pPutImage( dev, clip, dst_info, &src_bits, &src, &dst, SRCCOPY ); } if (err) lines = 0; diff --git a/dlls/gdi32/dibdrv/bitblt.c b/dlls/gdi32/dibdrv/bitblt.c index 6d5e51a5bdf..724b7047eb7 100644 --- a/dlls/gdi32/dibdrv/bitblt.c +++ b/dlls/gdi32/dibdrv/bitblt.c @@ -850,22 +850,12 @@ DWORD get_image_from_bitmap( BITMAPOBJ *bmp, BITMAPINFO *info, /*********************************************************************** * dibdrv_GetImage */ -DWORD dibdrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, - struct gdi_image_bits *bits, struct bitblt_coords *src ) +DWORD dibdrv_GetImage( PHYSDEV dev, BITMAPINFO *info, struct gdi_image_bits *bits, + struct bitblt_coords *src ) { dibdrv_physdev *pdev = get_dibdrv_pdev(dev); - TRACE( "%p %p %p\n", dev, hbitmap, info ); - - if (hbitmap) - { - DWORD ret; - BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ); - if (!bmp) return ERROR_INVALID_HANDLE; - ret = get_image_from_bitmap( bmp, info, bits, src ); - GDI_ReleaseObj( hbitmap ); - return ret; - } + TRACE( "%p %p\n", dev, info ); return get_image_dib_info( &pdev->dib, info, bits, src ); } @@ -956,7 +946,7 @@ static inline BOOL rop_uses_pat(DWORD rop) /*********************************************************************** * dibdrv_PutImage */ -DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info, +DWORD dibdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, const struct gdi_image_bits *bits, struct bitblt_coords *src, struct bitblt_coords *dst, DWORD rop ) { @@ -966,17 +956,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info HRGN tmp_rgn = 0; dibdrv_physdev *pdev = get_dibdrv_pdev( dev ); - TRACE( "%p %p %p\n", dev, hbitmap, info ); - - if (hbitmap) - { - DWORD ret; - BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ); - if (!bmp) return ERROR_INVALID_HANDLE; - ret = put_image_into_bitmap( bmp, clip, info, bits, src, dst ); - GDI_ReleaseObj( hbitmap ); - return ret; - } + TRACE( "%p %p\n", dev, info ); if (!matching_color_info( &pdev->dib, info )) goto update_format; if (!bits) return ERROR_SUCCESS; diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index 017bb69da24..cb948003f2b 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -118,8 +118,8 @@ extern BOOL dibdrv_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT b extern BOOL dibdrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT type ) DECLSPEC_HIDDEN; extern BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect, LPCWSTR str, UINT count, const INT *dx ) DECLSPEC_HIDDEN; -extern DWORD dibdrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, - struct gdi_image_bits *bits, struct bitblt_coords *src ) DECLSPEC_HIDDEN; +extern DWORD dibdrv_GetImage( PHYSDEV dev, BITMAPINFO *info, struct gdi_image_bits *bits, + struct bitblt_coords *src ) DECLSPEC_HIDDEN; extern COLORREF dibdrv_GetNearestColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern COLORREF dibdrv_GetPixel( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL dibdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, @@ -134,7 +134,7 @@ extern BOOL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* DWORD polylines ) DECLSPEC_HIDDEN; extern BOOL dibdrv_Polygon( PHYSDEV dev, const POINT *pt, INT count ) DECLSPEC_HIDDEN; extern BOOL dibdrv_Polyline( PHYSDEV dev, const POINT* pt, INT count ) DECLSPEC_HIDDEN; -extern DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info, +extern DWORD dibdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, const struct gdi_image_bits *bits, struct bitblt_coords *src, struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN; extern BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 8fc94b0f189..4b7118ef5f4 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -385,8 +385,8 @@ static BOOL nulldrv_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename ) return FALSE; } -static DWORD nulldrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, - struct gdi_image_bits *bits, struct bitblt_coords *src ) +static DWORD nulldrv_GetImage( PHYSDEV dev, BITMAPINFO *info, struct gdi_image_bits *bits, + struct bitblt_coords *src ) { return ERROR_NOT_SUPPORTED; } @@ -502,7 +502,7 @@ static BOOL nulldrv_Polyline( PHYSDEV dev, const POINT *points, INT count ) return PolyPolyline( dev->hdc, points, counts, 1 ); } -static DWORD nulldrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info, +static DWORD nulldrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, const struct gdi_image_bits *bits, struct bitblt_coords *src, struct bitblt_coords *dst, DWORD rop ) { diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index d9c16a48670..0c20ea5f27b 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -1896,7 +1896,7 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect info->bmiHeader.biSize = sizeof(info->bmiHeader); info->bmiHeader.biWidth = src.width; info->bmiHeader.biHeight = -src.height; - err = dst_dev->funcs->pPutImage( dst_dev, 0, 0, info, NULL, NULL, NULL, 0 ); + err = dst_dev->funcs->pPutImage( dst_dev, 0, info, NULL, NULL, NULL, 0 ); if (!err || err == ERROR_BAD_FORMAT) { /* make the source rectangle relative to the source bits */ @@ -1915,7 +1915,7 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect else { PHYSDEV src_dev = GET_DC_PHYSDEV( dc, pGetImage ); - err = src_dev->funcs->pGetImage( src_dev, 0, info, &bits, &src ); + err = src_dev->funcs->pGetImage( src_dev, info, &bits, &src ); if (!err && !bits.is_copy) { void *ptr = HeapAlloc( GetProcessHeap(), 0, get_dib_image_size( info )); @@ -1938,7 +1938,7 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect y += src.visrect.top - dst.visrect.top; render_aa_text_bitmapinfo( dev->hdc, info, &bits, &src, x, y, flags, aa_flags, str, count, dx ); - err = dst_dev->funcs->pPutImage( dst_dev, 0, 0, info, &bits, &src, &dst, SRCCOPY ); + err = dst_dev->funcs->pPutImage( dst_dev, 0, info, &bits, &src, &dst, SRCCOPY ); if (bits.free) bits.free( &bits ); return !err; } diff --git a/dlls/wineps.drv/bitmap.c b/dlls/wineps.drv/bitmap.c index ef6e482d585..e7fcba36870 100644 --- a/dlls/wineps.drv/bitmap.c +++ b/dlls/wineps.drv/bitmap.c @@ -167,7 +167,7 @@ static void PSDRV_WriteImageBits( PHYSDEV dev, const BITMAPINFO *info, INT xDst, /*********************************************************************** * PSDRV_PutImage */ -DWORD PSDRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info, +DWORD PSDRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, const struct gdi_image_bits *bits, struct bitblt_coords *src, struct bitblt_coords *dst, DWORD rop ) { @@ -176,8 +176,6 @@ DWORD PSDRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info, unsigned char *src_ptr, *dst_ptr; struct gdi_image_bits dst_bits; - if (hbitmap) return ERROR_NOT_SUPPORTED; - if (info->bmiHeader.biPlanes != 1) goto update_format; if (info->bmiHeader.biCompression != BI_RGB) goto update_format; if (info->bmiHeader.biBitCount == 16 || info->bmiHeader.biBitCount == 32) goto update_format; diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h index 38e8306d8d0..309cfee96cd 100644 --- a/dlls/wineps.drv/psdrv.h +++ b/dlls/wineps.drv/psdrv.h @@ -437,7 +437,7 @@ extern BOOL PSDRV_PolyBezier( PHYSDEV dev, const POINT *pts, DWORD count ) DECLS extern BOOL PSDRV_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD count ) DECLSPEC_HIDDEN; extern BOOL PSDRV_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* counts, UINT polygons ) DECLSPEC_HIDDEN; extern BOOL PSDRV_PolyPolyline( PHYSDEV dev, const POINT* pts, const DWORD* counts, DWORD polylines ) DECLSPEC_HIDDEN; -extern DWORD PSDRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info, +extern DWORD PSDRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, const struct gdi_image_bits *bits, struct bitblt_coords *src, struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN; extern BOOL PSDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 6dec77f1444..887384efef8 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1199,12 +1199,11 @@ DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image, /*********************************************************************** * X11DRV_PutImage */ -DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info, +DWORD X11DRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, const struct gdi_image_bits *bits, struct bitblt_coords *src, struct bitblt_coords *dst, DWORD rop ) { - X11DRV_PDEVICE *physdev; - X_PHYSBITMAP *bitmap; + X11DRV_PDEVICE *physdev = get_x11drv_dev( dev ); DWORD ret; XImage *image; XVisualInfo vis; @@ -1213,26 +1212,12 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info const BYTE *opcode = BITBLT_Opcodes[(rop >> 16) & 0xff]; const int *mapping = NULL; - if (hbitmap) + vis.depth = physdev->depth; + if (physdev->color_shifts) { - if (!(bitmap = X11DRV_get_phys_bitmap( hbitmap ))) return ERROR_INVALID_HANDLE; - physdev = NULL; - vis.depth = bitmap->depth; - vis.red_mask = bitmap->color_shifts.logicalRed.max << bitmap->color_shifts.logicalRed.shift; - vis.green_mask = bitmap->color_shifts.logicalGreen.max << bitmap->color_shifts.logicalGreen.shift; - vis.blue_mask = bitmap->color_shifts.logicalBlue.max << bitmap->color_shifts.logicalBlue.shift; - } - else - { - physdev = get_x11drv_dev( dev ); - bitmap = NULL; - vis.depth = physdev->depth; - if (physdev->color_shifts) - { - vis.red_mask = physdev->color_shifts->logicalRed.max << physdev->color_shifts->logicalRed.shift; - vis.green_mask = physdev->color_shifts->logicalGreen.max << physdev->color_shifts->logicalGreen.shift; - vis.blue_mask = physdev->color_shifts->logicalBlue.max << physdev->color_shifts->logicalBlue.shift; - } + vis.red_mask = physdev->color_shifts->logicalRed.max << physdev->color_shifts->logicalRed.shift; + vis.green_mask = physdev->color_shifts->logicalGreen.max << physdev->color_shifts->logicalGreen.shift; + vis.blue_mask = physdev->color_shifts->logicalBlue.max << physdev->color_shifts->logicalBlue.shift; } format = pixmap_formats[vis.depth]; @@ -1251,7 +1236,7 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info if (image->bits_per_pixel == 4 || image->bits_per_pixel == 8) { - if (bitmap || (!opcode[1] && OP_SRCDST(opcode[0]) == OP_ARGS(SRC,DST))) + if (!opcode[1] && OP_SRCDST(opcode[0]) == OP_ARGS(SRC,DST)) mapping = X11DRV_PALETTE_PaletteToXPixel; } @@ -1259,67 +1244,45 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info if (!ret) { + BOOL restore_region = add_extra_clipping_region( physdev, clip ); int width = dst->visrect.right - dst->visrect.left; int height = dst->visrect.bottom - dst->visrect.top; image->data = dst_bits.ptr; - if (bitmap) + /* optimization for single-op ROPs */ + if (!opcode[1] && OP_SRCDST(opcode[0]) == OP_ARGS(SRC,DST)) { - RGNDATA *clip_data = NULL; - GC gc; - - if (clip) clip_data = X11DRV_GetRegionData( clip, 0 ); - wine_tsx11_lock(); - gc = XCreateGC( gdi_display, bitmap->pixmap, 0, NULL ); - XSetGraphicsExposures( gdi_display, gc, False ); - if (clip_data) XSetClipRectangles( gdi_display, gc, 0, 0, (XRectangle *)clip_data->Buffer, - clip_data->rdh.nCount, YXBanded ); - XPutImage( gdi_display, bitmap->pixmap, gc, image, src->visrect.left, 0, - dst->visrect.left, dst->visrect.top, width, height ); - XFreeGC( gdi_display, gc ); + XSetFunction( gdi_display, physdev->gc, OP_ROP(*opcode) ); + XPutImage( gdi_display, physdev->drawable, physdev->gc, image, src->visrect.left, 0, + physdev->dc_rect.left + dst->visrect.left, + physdev->dc_rect.top + dst->visrect.top, width, height ); wine_tsx11_unlock(); - HeapFree( GetProcessHeap(), 0, clip_data ); } else { - BOOL restore_region = add_extra_clipping_region( physdev, clip ); + Pixmap src_pixmap; + GC gc; - /* optimization for single-op ROPs */ - if (!opcode[1] && OP_SRCDST(opcode[0]) == OP_ARGS(SRC,DST)) - { - wine_tsx11_lock(); - XSetFunction( gdi_display, physdev->gc, OP_ROP(*opcode) ); - XPutImage( gdi_display, physdev->drawable, physdev->gc, image, src->visrect.left, 0, - physdev->dc_rect.left + dst->visrect.left, - physdev->dc_rect.top + dst->visrect.top, width, height ); - wine_tsx11_unlock(); - } - else - { - Pixmap src_pixmap; - GC gc; + wine_tsx11_lock(); + gc = XCreateGC( gdi_display, physdev->drawable, 0, NULL ); + XSetSubwindowMode( gdi_display, gc, IncludeInferiors ); + XSetGraphicsExposures( gdi_display, gc, False ); + src_pixmap = XCreatePixmap( gdi_display, root_window, width, height, vis.depth ); + XPutImage( gdi_display, src_pixmap, gc, image, src->visrect.left, 0, 0, 0, width, height ); + wine_tsx11_unlock(); - wine_tsx11_lock(); - gc = XCreateGC( gdi_display, physdev->drawable, 0, NULL ); - XSetSubwindowMode( gdi_display, gc, IncludeInferiors ); - XSetGraphicsExposures( gdi_display, gc, False ); - src_pixmap = XCreatePixmap( gdi_display, root_window, width, height, vis.depth ); - XPutImage( gdi_display, src_pixmap, gc, image, src->visrect.left, 0, 0, 0, width, height ); - wine_tsx11_unlock(); + execute_rop( physdev, src_pixmap, gc, &dst->visrect, rop ); - execute_rop( physdev, src_pixmap, gc, &dst->visrect, rop ); - - wine_tsx11_lock(); - XFreePixmap( gdi_display, src_pixmap ); - XFreeGC( gdi_display, gc ); - wine_tsx11_unlock(); - } - - if (restore_region) restore_clipping_region( physdev ); - add_device_bounds( physdev, &dst->visrect ); + wine_tsx11_lock(); + XFreePixmap( gdi_display, src_pixmap ); + XFreeGC( gdi_display, gc ); + wine_tsx11_unlock(); } + + if (restore_region) restore_clipping_region( physdev ); + add_device_bounds( physdev, &dst->visrect ); image->data = NULL; } @@ -1340,11 +1303,10 @@ update_format: /*********************************************************************** * X11DRV_GetImage */ -DWORD X11DRV_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, +DWORD X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info, struct gdi_image_bits *bits, struct bitblt_coords *src ) { - X11DRV_PDEVICE *physdev; - X_PHYSBITMAP *bitmap; + X11DRV_PDEVICE *physdev = get_x11drv_dev( dev ); DWORD ret = ERROR_SUCCESS; XImage *image; XVisualInfo vis; @@ -1353,26 +1315,12 @@ DWORD X11DRV_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, const XPixmapFormatValues *format; const int *mapping = NULL; - if (hbitmap) + vis.depth = physdev->depth; + if (physdev->color_shifts) { - if (!(bitmap = X11DRV_get_phys_bitmap( hbitmap ))) return ERROR_INVALID_HANDLE; - physdev = NULL; - vis.depth = bitmap->depth; - vis.red_mask = bitmap->color_shifts.logicalRed.max << bitmap->color_shifts.logicalRed.shift; - vis.green_mask = bitmap->color_shifts.logicalGreen.max << bitmap->color_shifts.logicalGreen.shift; - vis.blue_mask = bitmap->color_shifts.logicalBlue.max << bitmap->color_shifts.logicalBlue.shift; - } - else - { - physdev = get_x11drv_dev( dev ); - bitmap = NULL; - vis.depth = physdev->depth; - if (physdev->color_shifts) - { - vis.red_mask = physdev->color_shifts->logicalRed.max << physdev->color_shifts->logicalRed.shift; - vis.green_mask = physdev->color_shifts->logicalGreen.max << physdev->color_shifts->logicalGreen.shift; - vis.blue_mask = physdev->color_shifts->logicalBlue.max << physdev->color_shifts->logicalBlue.shift; - } + vis.red_mask = physdev->color_shifts->logicalRed.max << physdev->color_shifts->logicalRed.shift; + vis.green_mask = physdev->color_shifts->logicalGreen.max << physdev->color_shifts->logicalGreen.shift; + vis.blue_mask = physdev->color_shifts->logicalBlue.max << physdev->color_shifts->logicalBlue.shift; } format = pixmap_formats[vis.depth]; @@ -1410,45 +1358,22 @@ DWORD X11DRV_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, src->y -= y; OffsetRect( &src->visrect, -x, -y ); - if (bitmap) + X11DRV_expect_error( gdi_display, XGetImage_handler, NULL ); + image = XGetImage( gdi_display, physdev->drawable, + physdev->dc_rect.left + x, physdev->dc_rect.top + y, + width, height, AllPlanes, ZPixmap ); + if (X11DRV_check_error()) { - BITMAP bm; - GetObjectW( hbitmap, sizeof(bm), &bm ); - width = min( width, bm.bmWidth - x ); - height = min( height, bm.bmHeight - y ); - wine_tsx11_lock(); - image = XGetImage( gdi_display, bitmap->pixmap, x, y, width, height, AllPlanes, ZPixmap ); - wine_tsx11_unlock(); - } - else if (GetObjectType( dev->hdc ) == OBJ_MEMDC) - { - width = min( width, physdev->dc_rect.right - physdev->dc_rect.left - x ); - height = min( height, physdev->dc_rect.bottom - physdev->dc_rect.top - y ); - wine_tsx11_lock(); - image = XGetImage( gdi_display, physdev->drawable, - physdev->dc_rect.left + x, physdev->dc_rect.top + y, - width, height, AllPlanes, ZPixmap ); - wine_tsx11_unlock(); - } - else - { - X11DRV_expect_error( gdi_display, XGetImage_handler, NULL ); - image = XGetImage( gdi_display, physdev->drawable, - physdev->dc_rect.left + x, physdev->dc_rect.top + y, - width, height, AllPlanes, ZPixmap ); - if (X11DRV_check_error()) - { - /* use a temporary pixmap to avoid the BadMatch error */ - Pixmap pixmap; + /* use a temporary pixmap to avoid the BadMatch error */ + Pixmap pixmap; - wine_tsx11_lock(); - pixmap = XCreatePixmap( gdi_display, root_window, width, height, vis.depth ); - XCopyArea( gdi_display, physdev->drawable, pixmap, get_bitmap_gc(vis.depth), - physdev->dc_rect.left + x, physdev->dc_rect.top + y, width, height, 0, 0 ); - image = XGetImage( gdi_display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap ); - XFreePixmap( gdi_display, pixmap ); - wine_tsx11_unlock(); - } + wine_tsx11_lock(); + pixmap = XCreatePixmap( gdi_display, root_window, width, height, vis.depth ); + XCopyArea( gdi_display, physdev->drawable, pixmap, get_bitmap_gc(vis.depth), + physdev->dc_rect.left + x, physdev->dc_rect.top + y, width, height, 0, 0 ); + image = XGetImage( gdi_display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap ); + XFreePixmap( gdi_display, pixmap ); + wine_tsx11_unlock(); } if (!image) return ERROR_OUTOFMEMORY; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 720f672b6f6..53a6d42a390 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -180,7 +180,7 @@ extern INT X11DRV_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW proc, LPARAM lparam extern BOOL X11DRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType ) DECLSPEC_HIDDEN; extern BOOL X11DRV_GetDeviceGammaRamp( PHYSDEV dev, LPVOID ramp ) DECLSPEC_HIDDEN; extern BOOL X11DRV_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename ) DECLSPEC_HIDDEN; -extern DWORD X11DRV_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, +extern DWORD X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info, struct gdi_image_bits *bits, struct bitblt_coords *src ) DECLSPEC_HIDDEN; extern COLORREF X11DRV_GetNearestColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern UINT X11DRV_GetSystemPaletteEntries( PHYSDEV dev, UINT start, UINT count, LPPALETTEENTRY entries ) DECLSPEC_HIDDEN; @@ -194,7 +194,7 @@ extern BOOL X11DRV_Pie( PHYSDEV dev, INT left, INT top, INT right, extern BOOL X11DRV_Polygon( PHYSDEV dev, const POINT* pt, INT count ) DECLSPEC_HIDDEN; extern BOOL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polygons) DECLSPEC_HIDDEN; extern BOOL X11DRV_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWORD polylines) DECLSPEC_HIDDEN; -extern DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info, +extern DWORD X11DRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, const struct gdi_image_bits *bits, struct bitblt_coords *src, struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN; extern UINT X11DRV_RealizeDefaultPalette( PHYSDEV dev ) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 1f8558fd3f1..5837148340e 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -1316,17 +1316,6 @@ static HBITMAP xrenderdrv_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap ) return ret; } -/*********************************************************************** - * xrenderdrv_GetImage - */ -static DWORD xrenderdrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, - struct gdi_image_bits *bits, struct bitblt_coords *src ) -{ - if (hbitmap) return X11DRV_GetImage( dev, hbitmap, info, bits, src ); - dev = GET_NEXT_PHYSDEV( dev, pGetImage ); - return dev->funcs->pGetImage( dev, hbitmap, info, bits, src ); -} - /*********************************************************************** * xrenderdrv_SetDeviceClipping */ @@ -2183,12 +2172,11 @@ x11drv_fallback: /*********************************************************************** * xrenderdrv_PutImage */ -static DWORD xrenderdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info, +static DWORD xrenderdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, const struct gdi_image_bits *bits, struct bitblt_coords *src, struct bitblt_coords *dst, DWORD rop ) { - struct xrender_physdev *physdev; - X_PHYSBITMAP *bitmap; + struct xrender_physdev *physdev = get_xrender_dev( dev ); DWORD ret; Pixmap tmp_pixmap; GC gc; @@ -2198,19 +2186,7 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMA Picture src_pict, mask_pict = 0; BOOL use_repeat; - if (hbitmap) - { - if (!(bitmap = X11DRV_get_phys_bitmap( hbitmap ))) return ERROR_INVALID_HANDLE; - physdev = NULL; - dst_format = bitmap->format; - } - else - { - physdev = get_xrender_dev( dev ); - bitmap = NULL; - dst_format = physdev->format; - } - + dst_format = physdev->format; src_format = get_xrender_format_from_bitmapinfo( info ); if (!(pict_format = pict_formats[src_format])) goto update_format; @@ -2231,53 +2207,41 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMA { struct bitblt_coords tmp; - if (bitmap) + if (rop != SRCCOPY) { - HRGN rgn = CreateRectRgnIndirect( &dst->visrect ); - if (clip) CombineRgn( rgn, rgn, clip, RGN_AND ); + BOOL restore_region = add_extra_clipping_region( physdev->x11dev, clip ); - xrender_put_image( src_pixmap, src_pict, mask_pict, rgn, - pict_formats[dst_format], NULL, bitmap->pixmap, src, dst, use_repeat ); - DeleteObject( rgn ); + /* make coordinates relative to tmp pixmap */ + tmp = *dst; + tmp.x -= tmp.visrect.left; + tmp.y -= tmp.visrect.top; + OffsetRect( &tmp.visrect, -tmp.visrect.left, -tmp.visrect.top ); + + wine_tsx11_lock(); + gc = XCreateGC( gdi_display, physdev->x11dev->drawable, 0, NULL ); + XSetSubwindowMode( gdi_display, gc, IncludeInferiors ); + XSetGraphicsExposures( gdi_display, gc, False ); + tmp_pixmap = XCreatePixmap( gdi_display, root_window, + tmp.visrect.right - tmp.visrect.left, + tmp.visrect.bottom - tmp.visrect.top, + physdev->pict_format->depth ); + wine_tsx11_unlock(); + + xrender_put_image( src_pixmap, src_pict, mask_pict, NULL, physdev->pict_format, + NULL, tmp_pixmap, src, &tmp, use_repeat ); + execute_rop( physdev->x11dev, tmp_pixmap, gc, &dst->visrect, rop ); + + wine_tsx11_lock(); + XFreePixmap( gdi_display, tmp_pixmap ); + XFreeGC( gdi_display, gc ); + wine_tsx11_unlock(); + + if (restore_region) restore_clipping_region( physdev->x11dev ); } - else - { - if (rop != SRCCOPY) - { - BOOL restore_region = add_extra_clipping_region( physdev->x11dev, clip ); + else xrender_put_image( src_pixmap, src_pict, mask_pict, clip, + physdev->pict_format, physdev, 0, src, dst, use_repeat ); - /* make coordinates relative to tmp pixmap */ - tmp = *dst; - tmp.x -= tmp.visrect.left; - tmp.y -= tmp.visrect.top; - OffsetRect( &tmp.visrect, -tmp.visrect.left, -tmp.visrect.top ); - - wine_tsx11_lock(); - gc = XCreateGC( gdi_display, physdev->x11dev->drawable, 0, NULL ); - XSetSubwindowMode( gdi_display, gc, IncludeInferiors ); - XSetGraphicsExposures( gdi_display, gc, False ); - tmp_pixmap = XCreatePixmap( gdi_display, root_window, - tmp.visrect.right - tmp.visrect.left, - tmp.visrect.bottom - tmp.visrect.top, - physdev->pict_format->depth ); - wine_tsx11_unlock(); - - xrender_put_image( src_pixmap, src_pict, mask_pict, NULL, physdev->pict_format, - NULL, tmp_pixmap, src, &tmp, use_repeat ); - execute_rop( physdev->x11dev, tmp_pixmap, gc, &dst->visrect, rop ); - - wine_tsx11_lock(); - XFreePixmap( gdi_display, tmp_pixmap ); - XFreeGC( gdi_display, gc ); - wine_tsx11_unlock(); - - if (restore_region) restore_clipping_region( physdev->x11dev ); - } - else xrender_put_image( src_pixmap, src_pict, mask_pict, clip, - physdev->pict_format, physdev, 0, src, dst, use_repeat ); - - add_device_bounds( physdev->x11dev, &dst->visrect ); - } + add_device_bounds( physdev->x11dev, &dst->visrect ); wine_tsx11_lock(); pXRenderFreePicture( gdi_display, src_pict ); @@ -2292,9 +2256,8 @@ update_format: return ERROR_BAD_FORMAT; x11drv_fallback: - if (hbitmap) return X11DRV_PutImage( dev, hbitmap, clip, info, bits, src, dst, rop ); dev = GET_NEXT_PHYSDEV( dev, pPutImage ); - return dev->funcs->pPutImage( dev, hbitmap, clip, info, bits, src, dst, rop ); + return dev->funcs->pPutImage( dev, clip, info, bits, src, dst, rop ); } @@ -2665,7 +2628,7 @@ static const struct gdi_dc_funcs xrender_funcs = NULL, /* pGetGlyphIndices */ NULL, /* pGetGlyphOutline */ NULL, /* pGetICMProfile */ - xrenderdrv_GetImage, /* pGetImage */ + NULL, /* pGetImage */ NULL, /* pGetKerningPairs */ NULL, /* pGetNearestColor */ NULL, /* pGetOutlineTextMetrics */ diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 3943c2e1abc..34ad521f0e6 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -110,7 +110,7 @@ struct gdi_dc_funcs DWORD (*pGetGlyphIndices)(PHYSDEV,LPCWSTR,INT,LPWORD,DWORD); DWORD (*pGetGlyphOutline)(PHYSDEV,UINT,UINT,LPGLYPHMETRICS,DWORD,LPVOID,const MAT2*); BOOL (*pGetICMProfile)(PHYSDEV,LPDWORD,LPWSTR); - DWORD (*pGetImage)(PHYSDEV,HBITMAP,BITMAPINFO*,struct gdi_image_bits*,struct bitblt_coords*); + DWORD (*pGetImage)(PHYSDEV,BITMAPINFO*,struct gdi_image_bits*,struct bitblt_coords*); DWORD (*pGetKerningPairs)(PHYSDEV,DWORD,LPKERNINGPAIR); COLORREF (*pGetNearestColor)(PHYSDEV,COLORREF); UINT (*pGetOutlineTextMetrics)(PHYSDEV,UINT,LPOUTLINETEXTMETRICW); @@ -142,7 +142,7 @@ struct gdi_dc_funcs BOOL (*pPolygon)(PHYSDEV,const POINT*,INT); BOOL (*pPolyline)(PHYSDEV,const POINT*,INT); BOOL (*pPolylineTo)(PHYSDEV,const POINT*,INT); - DWORD (*pPutImage)(PHYSDEV,HBITMAP,HRGN,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,DWORD); + DWORD (*pPutImage)(PHYSDEV,HRGN,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,DWORD); UINT (*pRealizeDefaultPalette)(PHYSDEV); UINT (*pRealizePalette)(PHYSDEV,HPALETTE,BOOL); BOOL (*pRectangle)(PHYSDEV,INT,INT,INT,INT); @@ -211,7 +211,7 @@ struct gdi_dc_funcs }; /* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 29 +#define WINE_GDI_DRIVER_VERSION 30 #define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */