winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
August 2011
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
770 discussions
Start a n
N
ew thread
Alexandre Julliard : gdi32: Use GetImage to retrieve the brush bits in metafiles.
by Alexandre Julliard
03 Aug '11
03 Aug '11
Module: wine Branch: master Commit: 91976a5b7461d7cae28f1c7622fb2eea3a2ef395 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=91976a5b7461d7cae28f1c762…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 3 13:01:29 2011 +0200 gdi32: Use GetImage to retrieve the brush bits in metafiles. --- dlls/gdi32/bitmap.c | 20 ++++++ dlls/gdi32/gdi_private.h | 1 + dlls/gdi32/mfdrv/objects.c | 141 ++++++++++++-------------------------------- 3 files changed, 59 insertions(+), 103 deletions(-) diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index cfe9fc1..3d7e1a2 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -414,6 +414,26 @@ HBITMAP WINAPI CreateBitmapIndirect( const BITMAP *bmp ) } +/* convenience wrapper for GetImage to retrieve the full contents of a bitmap */ +BOOL get_bitmap_image( HBITMAP hbitmap, BITMAPINFO *info, struct gdi_image_bits *bits ) +{ + struct bitblt_coords src; + BOOL ret = FALSE; + BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ); + + if (bmp) + { + src.visrect.left = src.x = 0; + src.visrect.top = src.y = 0; + src.visrect.right = src.width = bmp->bitmap.bmWidth; + src.visrect.bottom = src.height = bmp->bitmap.bmHeight; + ret = !bmp->funcs->pGetImage( NULL, hbitmap, info, bits, &src ); + GDI_ReleaseObj( hbitmap ); + } + return ret; +} + + /*********************************************************************** * GetBitmapBits [GDI32.@] * diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 4479316..f0fb825 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -309,6 +309,7 @@ extern BOOL BIDI_Reorder( HDC hDC, LPCWSTR lpString, INT uCount, DWORD dwFlags, LPWSTR lpOutString, INT uCountOut, UINT *lpOrder, WORD **lpGlyphs, INT* cGlyphs ) DECLSPEC_HIDDEN; /* bitmap.c */ +extern BOOL get_bitmap_image( HBITMAP hbitmap, BITMAPINFO *info, struct gdi_image_bits *bits ) DECLSPEC_HIDDEN; extern HBITMAP BITMAP_CopyBitmap( HBITMAP hbitmap ) DECLSPEC_HIDDEN; extern BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, PHYSDEV physdev ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/mfdrv/objects.c b/dlls/gdi32/mfdrv/objects.c index d9c9f95..674e7e1 100644 --- a/dlls/gdi32/mfdrv/objects.c +++ b/dlls/gdi32/mfdrv/objects.c @@ -142,69 +142,6 @@ HBITMAP MFDRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap ) return 0; } -/*********************************************************************** - * Internal helper for MFDRV_CreateBrushIndirect(): - * Change the padding of a bitmap from 16 (BMP) to 32 (DIB) bits. - */ -static inline void MFDRV_PadTo32(LPBYTE lpRows, int height, int width) -{ - int bytes16 = 2 * ((width + 15) / 16); - int bytes32 = 4 * ((width + 31) / 32); - LPBYTE lpSrc, lpDst; - int i; - - if (!height) - return; - - height = abs(height) - 1; - lpSrc = lpRows + height * bytes16; - lpDst = lpRows + height * bytes32; - - /* Note that we work backwards so we can re-pad in place */ - while (height >= 0) - { - for (i = bytes32; i > bytes16; i--) - lpDst[i - 1] = 0; /* Zero the padding bytes */ - for (; i > 0; i--) - lpDst[i - 1] = lpSrc[i - 1]; /* Move image bytes into alignment */ - lpSrc -= bytes16; - lpDst -= bytes32; - height--; - } -} - -/*********************************************************************** - * Internal helper for MFDRV_CreateBrushIndirect(): - * Reverse order of bitmap rows in going from BMP to DIB. - */ -static inline void MFDRV_Reverse(LPBYTE lpRows, int height, int width) -{ - int bytes = 4 * ((width + 31) / 32); - LPBYTE lpSrc, lpDst; - BYTE temp; - int i; - - if (!height) - return; - - lpSrc = lpRows; - lpDst = lpRows + (height-1) * bytes; - height = height/2; - - while (height > 0) - { - for (i = 0; i < bytes; i++) - { - temp = lpDst[i]; - lpDst[i] = lpSrc[i]; - lpSrc[i] = temp; - } - lpSrc += bytes; - lpDst -= bytes; - height--; - } -} - /****************************************************************** * MFDRV_CreateBrushIndirect */ @@ -238,59 +175,57 @@ INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush ) } case BS_PATTERN: { - BITMAP bm; - BITMAPINFO *info; - DWORD bmSize; + char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; + BITMAPINFO *dst_info, *src_info = (BITMAPINFO *)buffer; + struct gdi_image_bits bits; COLORREF cref; - GetObjectA((HANDLE)logbrush.lbHatch, sizeof(bm), &bm); - if(bm.bmBitsPixel != 1 || bm.bmPlanes != 1) { + if (!get_bitmap_image( (HANDLE)logbrush.lbHatch, src_info, &bits )) goto done; + if (src_info->bmiHeader.biBitCount != 1) + { FIXME("Trying to store a colour pattern brush\n"); + if (bits.free) bits.free( &bits ); goto done; } - bmSize = get_dib_stride( bm.bmWidth, bm.bmBitsPixel) * bm.bmHeight; - - size = sizeof(METARECORD) + sizeof(WORD) + sizeof(BITMAPINFO) + - sizeof(RGBQUAD) + bmSize; + size = FIELD_OFFSET( METARECORD, rdParm[2] ) + + FIELD_OFFSET( BITMAPINFO, bmiColors[2] ) + src_info->bmiHeader.biSizeImage; - mr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); - if(!mr) goto done; + if (!(mr = HeapAlloc( GetProcessHeap(), 0, size ))) + { + if (bits.free) bits.free( &bits ); + goto done; + } mr->rdFunction = META_DIBCREATEPATTERNBRUSH; mr->rdSize = size / 2; mr->rdParm[0] = BS_PATTERN; mr->rdParm[1] = DIB_RGB_COLORS; - info = (BITMAPINFO *)(mr->rdParm + 2); - - info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - info->bmiHeader.biWidth = bm.bmWidth; - info->bmiHeader.biHeight = bm.bmHeight; - info->bmiHeader.biPlanes = 1; - info->bmiHeader.biBitCount = 1; - info->bmiHeader.biSizeImage = bmSize; - - GetBitmapBits((HANDLE)logbrush.lbHatch, - bm.bmHeight * get_bitmap_stride(bm.bmWidth, bm.bmBitsPixel), - (LPBYTE)info + sizeof(BITMAPINFO) + sizeof(RGBQUAD)); - - /* Change the padding to be DIB compatible if needed */ - if(bm.bmWidth & 31) - MFDRV_PadTo32((LPBYTE)info + sizeof(BITMAPINFO) + sizeof(RGBQUAD), - bm.bmWidth, bm.bmHeight); - /* BMP and DIB have opposite row order conventions */ - MFDRV_Reverse((LPBYTE)info + sizeof(BITMAPINFO) + sizeof(RGBQUAD), - bm.bmWidth, bm.bmHeight); - + dst_info = (BITMAPINFO *)(mr->rdParm + 2); + dst_info->bmiHeader = src_info->bmiHeader; cref = GetTextColor( dev->hdc ); - info->bmiColors[0].rgbRed = GetRValue(cref); - info->bmiColors[0].rgbGreen = GetGValue(cref); - info->bmiColors[0].rgbBlue = GetBValue(cref); - info->bmiColors[0].rgbReserved = 0; + dst_info->bmiColors[0].rgbRed = GetRValue(cref); + dst_info->bmiColors[0].rgbGreen = GetGValue(cref); + dst_info->bmiColors[0].rgbBlue = GetBValue(cref); + dst_info->bmiColors[0].rgbReserved = 0; cref = GetBkColor( dev->hdc ); - info->bmiColors[1].rgbRed = GetRValue(cref); - info->bmiColors[1].rgbGreen = GetGValue(cref); - info->bmiColors[1].rgbBlue = GetBValue(cref); - info->bmiColors[1].rgbReserved = 0; + dst_info->bmiColors[1].rgbRed = GetRValue(cref); + dst_info->bmiColors[1].rgbGreen = GetGValue(cref); + dst_info->bmiColors[1].rgbBlue = GetBValue(cref); + dst_info->bmiColors[1].rgbReserved = 0; + + /* always return a bottom-up DIB */ + if (dst_info->bmiHeader.biHeight < 0) + { + int i, width_bytes = get_dib_stride( dst_info->bmiHeader.biWidth, + dst_info->bmiHeader.biBitCount ); + char *dst_ptr = (char *)&dst_info->bmiColors[2]; + dst_info->bmiHeader.biHeight = -dst_info->bmiHeader.biHeight; + dst_ptr += (dst_info->bmiHeader.biHeight - 1) * width_bytes; + for (i = 0; i < dst_info->bmiHeader.biHeight; i++, dst_ptr -= width_bytes) + memcpy( dst_ptr, (char *)bits.ptr + i * width_bytes, width_bytes ); + } + else memcpy( &dst_info->bmiColors[2], bits.ptr, dst_info->bmiHeader.biSizeImage ); + if (bits.free) bits.free( &bits ); break; }
1
0
0
0
Alexandre Julliard : gdi32: Get rid of the SetBitmapBits driver entry point .
by Alexandre Julliard
03 Aug '11
03 Aug '11
Module: wine Branch: master Commit: 6d00196aead1b1dae4263fff6e36bc08e545b8a2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6d00196aead1b1dae4263fff6…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 3 11:46:08 2011 +0200 gdi32: Get rid of the SetBitmapBits driver entry point. --- dlls/gdi32/bitmap.c | 19 ------- dlls/gdi32/dibdrv/dc.c | 1 - dlls/gdi32/driver.c | 1 - dlls/gdi32/enhmfdrv/init.c | 1 - dlls/gdi32/gdi_private.h | 1 - dlls/gdi32/mfdrv/init.c | 1 - dlls/wineps.drv/init.c | 1 - dlls/winex11.drv/bitmap.c | 123 -------------------------------------------- dlls/winex11.drv/init.c | 1 - dlls/winex11.drv/x11drv.h | 1 - include/wine/gdi_driver.h | 3 +- 11 files changed, 1 insertions(+), 152 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=6d00196aead1b1dae4263…
1
0
0
0
Alexandre Julliard : gdi32: Set the initial bits of a bitmap from the gdi side.
by Alexandre Julliard
03 Aug '11
03 Aug '11
Module: wine Branch: master Commit: 09eb59d3c654681f2e6b3246275378c604f88d6a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=09eb59d3c654681f2e6b32462…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 3 11:37:02 2011 +0200 gdi32: Set the initial bits of a bitmap from the gdi side. --- dlls/gdi32/bitmap.c | 14 ++++++++++++-- dlls/gdi32/driver.c | 2 +- dlls/winex11.drv/bitmap.c | 24 ++++++++---------------- dlls/winex11.drv/x11drv.h | 2 +- include/wine/gdi_driver.h | 4 ++-- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index f0c5764..5970d7f 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -657,6 +657,12 @@ HBITMAP BITMAP_CopyBitmap(HBITMAP hbitmap) } +static void set_initial_bitmap_bits( HBITMAP hbitmap, BITMAPOBJ *bmp ) +{ + if (!bmp->bitmap.bmBits) return; + SetBitmapBits( hbitmap, bmp->bitmap.bmHeight * bmp->bitmap.bmWidthBytes, bmp->bitmap.bmBits ); +} + /*********************************************************************** * BITMAP_SetOwnerDC * @@ -681,8 +687,12 @@ BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, PHYSDEV physdev ) { if (physdev->funcs->pCreateBitmap) { - ret = physdev->funcs->pCreateBitmap( physdev, hbitmap, bitmap->bitmap.bmBits ); - if (ret) bitmap->funcs = physdev->funcs; + ret = physdev->funcs->pCreateBitmap( physdev, hbitmap ); + if (ret) + { + bitmap->funcs = physdev->funcs; + set_initial_bitmap_bits( hbitmap, bitmap ); + } } else { diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index dc4a33b..9d958d8 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -213,7 +213,7 @@ static BOOL nulldrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom return TRUE; } -static BOOL nulldrv_CreateBitmap( PHYSDEV dev, HBITMAP bitmap, LPVOID bits ) +static BOOL nulldrv_CreateBitmap( PHYSDEV dev, HBITMAP bitmap ) { return TRUE; } diff --git a/dlls/winex11.drv/bitmap.c b/dlls/winex11.drv/bitmap.c index 15ecb05..503f3bb 100644 --- a/dlls/winex11.drv/bitmap.c +++ b/dlls/winex11.drv/bitmap.c @@ -132,7 +132,7 @@ HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap ) * * Returns TRUE on success else FALSE */ -BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap, LPVOID bmBits ) +BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap ) { X_PHYSBITMAP *physBitmap; BITMAP bitmap; @@ -178,6 +178,13 @@ BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap, LPVOID bmBits ) /* Create the pixmap */ physBitmap->pixmap = XCreatePixmap(gdi_display, root_window, bitmap.bmWidth, bitmap.bmHeight, physBitmap->pixmap_depth); + if (physBitmap->pixmap) + { + GC gc = get_bitmap_gc(physBitmap->pixmap_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) { @@ -185,21 +192,6 @@ BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap, LPVOID bmBits ) HeapFree( GetProcessHeap(), 0, physBitmap ); return FALSE; } - - if (bmBits) /* Set bitmap bits */ - { - X11DRV_SetBitmapBits( hbitmap, bmBits, bitmap.bmHeight * bitmap.bmWidthBytes ); - } - else /* else clear the bitmap */ - { - GC gc = get_bitmap_gc(physBitmap->pixmap_depth); - wine_tsx11_lock(); - 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(); - } return TRUE; } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 30fc62e..d54dda7 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -187,7 +187,7 @@ extern BOOL X11DRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; extern BOOL X11DRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; -extern BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap, LPVOID bmBits ) DECLSPEC_HIDDEN; +extern BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap ) DECLSPEC_HIDDEN; extern HBITMAP X11DRV_CreateDIBSection( PHYSDEV dev, HBITMAP hbitmap, const BITMAPINFO *bmi, UINT usage ) DECLSPEC_HIDDEN; extern BOOL X11DRV_DeleteBitmap( HBITMAP hbitmap ) DECLSPEC_HIDDEN; diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index cffd3f6..5cd867e 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -64,7 +64,7 @@ struct gdi_dc_funcs INT (*pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *); BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT); BOOL (*pCloseFigure)(PHYSDEV); - BOOL (*pCreateBitmap)(PHYSDEV,HBITMAP,LPVOID); + BOOL (*pCreateBitmap)(PHYSDEV,HBITMAP); BOOL (*pCreateDC)(HDC,PHYSDEV *,LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*); HBITMAP (*pCreateDIBSection)(PHYSDEV,HBITMAP,const BITMAPINFO *,UINT); BOOL (*pDeleteBitmap)(HBITMAP); @@ -189,7 +189,7 @@ struct gdi_dc_funcs }; /* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 9 +#define WINE_GDI_DRIVER_VERSION 10 static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset ) {
1
0
0
0
Alexandre Julliard : gdi32: Reimplement SetBitmapBits using the PutImage driver entry point.
by Alexandre Julliard
03 Aug '11
03 Aug '11
Module: wine Branch: master Commit: 107849916fff56e0322bec7901ed5a10d205b345 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=107849916fff56e0322bec790…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 3 11:12:05 2011 +0200 gdi32: Reimplement SetBitmapBits using the PutImage driver entry point. --- dlls/gdi32/bitmap.c | 93 ++++++++++++++++++++++++++++++++++---------------- 1 files changed, 63 insertions(+), 30 deletions(-) diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index bce5183..f0c5764 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -518,8 +518,13 @@ LONG WINAPI SetBitmapBits( LONG count, /* [in] Number of bytes in bitmap array */ LPCVOID bits) /* [in] Address of array with bitmap bits */ { + char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; + BITMAPINFO *info = (BITMAPINFO *)buffer; BITMAPOBJ *bmp; - LONG height, ret; + DWORD err; + int i, src_stride, dst_stride; + struct bitblt_coords src, dst; + struct gdi_image_bits src_bits; if (!bits) return 0; @@ -531,43 +536,71 @@ LONG WINAPI SetBitmapBits( count = -count; } - if (bmp->dib) /* simply copy the bits into the DIB */ - { - DIBSECTION *dib = bmp->dib; - char *dest = dib->dsBm.bmBits; - LONG max = dib->dsBm.bmWidthBytes * dib->dsBm.bmHeight; - if (count > max) count = max; - ret = count; + if (bmp->dib) src_stride = get_bitmap_stride( bmp->dib->dsBmih.biWidth, bmp->dib->dsBmih.biBitCount ); + else src_stride = get_bitmap_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel ); + + dst_stride = get_dib_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel ); + + src.visrect.left = src.x = 0; + src.visrect.top = src.y = 0; + src.visrect.right = src.width = bmp->bitmap.bmWidth; + src.visrect.bottom = src.height = min( count / src_stride, bmp->bitmap.bmHeight ); + dst = src; + + /* Only set entire lines */ + count = src.height * src_stride; - if (bmp->dib->dsBmih.biHeight >= 0) /* not top-down, need to flip contents vertically */ + TRACE("(%p, %d, %p) %dx%d %d bpp fetched height: %d\n", + hbitmap, count, bits, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight, + bmp->bitmap.bmBitsPixel, src.height ); + + if (src_stride == dst_stride) + { + src_bits.ptr = (void *)bits; + src_bits.is_copy = FALSE; + src_bits.free = NULL; + } + else + { + if (!(src_bits.ptr = HeapAlloc( GetProcessHeap(), 0, dst.height * dst_stride ))) { - dest += dib->dsBm.bmWidthBytes * dib->dsBm.bmHeight; - while (count > 0) - { - dest -= dib->dsBm.bmWidthBytes; - memcpy( dest, bits, min( count, dib->dsBm.bmWidthBytes ) ); - bits = (const char *)bits + dib->dsBm.bmWidthBytes; - count -= dib->dsBm.bmWidthBytes; - } + GDI_ReleaseObj( hbitmap ); + return 0; } - else memcpy( dest, bits, count ); - - GDI_ReleaseObj( hbitmap ); - return ret; + src_bits.is_copy = TRUE; + src_bits.free = free_heap_bits; + for (i = 0; i < dst.height; i++) + memcpy( (char *)src_bits.ptr + i * dst_stride, (char *)bits + i * src_stride, src_stride ); } - /* Only get entire lines */ - height = count / bmp->bitmap.bmWidthBytes; - if (height > bmp->bitmap.bmHeight) height = bmp->bitmap.bmHeight; - count = height * bmp->bitmap.bmWidthBytes; + /* query the color info */ + info->bmiHeader.biSize = sizeof(info->bmiHeader); + info->bmiHeader.biPlanes = 1; + info->bmiHeader.biBitCount = bmp->bitmap.bmBitsPixel; + info->bmiHeader.biCompression = BI_RGB; + info->bmiHeader.biXPelsPerMeter = 0; + info->bmiHeader.biYPelsPerMeter = 0; + info->bmiHeader.biClrUsed = 0; + info->bmiHeader.biClrImportant = 0; + info->bmiHeader.biWidth = 0; + info->bmiHeader.biHeight = 0; + info->bmiHeader.biSizeImage = 0; + err = bmp->funcs->pPutImage( NULL, hbitmap, 0, info, NULL, NULL, NULL, SRCCOPY ); - TRACE("(%p, %d, %p) %dx%d %d colors fetched height: %d\n", - hbitmap, count, bits, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight, - 1 << bmp->bitmap.bmBitsPixel, height ); + if (!err || err == ERROR_BAD_FORMAT) + { + info->bmiHeader.biPlanes = 1; + info->bmiHeader.biBitCount = bmp->bitmap.bmBitsPixel; + info->bmiHeader.biWidth = bmp->bitmap.bmWidth; + info->bmiHeader.biHeight = -dst.height; + info->bmiHeader.biSizeImage = dst.height * dst_stride; + err = bmp->funcs->pPutImage( NULL, hbitmap, 0, info, &src_bits, &src, &dst, SRCCOPY ); + } + if (err) count = 0; - ret = bmp->funcs->pSetBitmapBits( hbitmap, bits, count ); + if (src_bits.free) src_bits.free( &src_bits ); GDI_ReleaseObj( hbitmap ); - return ret; + return count; } /**********************************************************************
1
0
0
0
Alexandre Julliard : gdi32: Partial implementation of PutImage in the null driver for DDBs.
by Alexandre Julliard
03 Aug '11
03 Aug '11
Module: wine Branch: master Commit: 76b5c1dcacffdf08c836537f266219cf2c8cdde2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=76b5c1dcacffdf08c836537f2…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 3 10:37:45 2011 +0200 gdi32: Partial implementation of PutImage in the null driver for DDBs. --- dlls/gdi32/bitmap.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/gdi32/driver.c | 7 ---- dlls/gdi32/gdi_private.h | 3 ++ 3 files changed, 78 insertions(+), 7 deletions(-) diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index 93bfe77..bce5183 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -126,6 +126,81 @@ done: return ERROR_SUCCESS; } +DWORD nulldrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info, + const struct gdi_image_bits *bits, struct bitblt_coords *src, + struct bitblt_coords *dst, DWORD rop ) +{ + BITMAPOBJ *bmp; + + if (!hbitmap) return ERROR_SUCCESS; + if (!(bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ))) return ERROR_INVALID_HANDLE; + + if (info->bmiHeader.biPlanes != 1) goto update_format; + if (info->bmiHeader.biBitCount != bmp->bitmap.bmBitsPixel) goto update_format; + /* FIXME: check color masks */ + + if (bits) + { + int i, width_bytes = get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount ); + unsigned char *dst_bits, *src_bits; + + if ((src->width != dst->width) || (src->height != dst->height)) + { + GDI_ReleaseObj( hbitmap ); + return ERROR_TRANSFORM_NOT_SUPPORTED; + } + if (src->visrect.left > 0 || src->visrect.right < bmp->bitmap.bmWidth || + dst->visrect.left > 0 || dst->visrect.right < bmp->bitmap.bmWidth) + { + FIXME( "setting partial rows not supported\n" ); + GDI_ReleaseObj( hbitmap ); + return ERROR_NOT_SUPPORTED; + } + if (clip) + { + FIXME( "clip region not supported\n" ); + GDI_ReleaseObj( hbitmap ); + return ERROR_NOT_SUPPORTED; + } + + if (!bmp->bitmap.bmBits && + !(bmp->bitmap.bmBits = HeapAlloc( GetProcessHeap(), 0, + bmp->bitmap.bmHeight * bmp->bitmap.bmWidthBytes ))) + { + GDI_ReleaseObj( hbitmap ); + return ERROR_OUTOFMEMORY; + } + src_bits = bits->ptr; + if (info->bmiHeader.biHeight > 0) + { + src_bits += (info->bmiHeader.biHeight - 1 - src->visrect.top) * width_bytes; + width_bytes = -width_bytes; + } + else + src_bits += src->visrect.top * width_bytes; + + dst_bits = (unsigned char *)bmp->bitmap.bmBits + dst->visrect.top * bmp->bitmap.bmWidthBytes; + if (width_bytes != bmp->bitmap.bmWidthBytes) + { + for (i = 0; i < dst->visrect.bottom - dst->visrect.top; i++) + { + memcpy( dst_bits, src_bits, min( abs(width_bytes), bmp->bitmap.bmWidthBytes )); + src_bits += width_bytes; + dst_bits += bmp->bitmap.bmWidthBytes; + } + } + else memcpy( dst_bits, src_bits, width_bytes * (dst->visrect.bottom - dst->visrect.top) ); + } + GDI_ReleaseObj( hbitmap ); + return ERROR_SUCCESS; + +update_format: + info->bmiHeader.biPlanes = 1; + info->bmiHeader.biBitCount = bmp->bitmap.bmBitsPixel; + if (info->bmiHeader.biHeight > 0) info->bmiHeader.biHeight = -info->bmiHeader.biHeight; + return ERROR_BAD_FORMAT; +} + /****************************************************************************** * CreateBitmap [GDI32.@] diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 290a30d..dc4a33b 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -421,13 +421,6 @@ static BOOL nulldrv_Polyline( PHYSDEV dev, const POINT *points, INT count ) return TRUE; } -static DWORD nulldrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info, - const struct gdi_image_bits *bits, struct bitblt_coords *src, - struct bitblt_coords *dst, DWORD rop ) -{ - return ERROR_SUCCESS; -} - static UINT nulldrv_RealizeDefaultPalette( PHYSDEV dev ) { return 0; diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 4aeef70..ed5bb8a 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -493,6 +493,9 @@ extern BOOL nulldrv_PolyBezier( PHYSDEV dev, const POINT *points, DWORD count ) extern BOOL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD count ) DECLSPEC_HIDDEN; extern BOOL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types, DWORD count ) DECLSPEC_HIDDEN; extern BOOL nulldrv_PolylineTo( PHYSDEV dev, const POINT *points, INT count ) DECLSPEC_HIDDEN; +extern DWORD nulldrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info, + const struct gdi_image_bits *bits, struct bitblt_coords *src, + struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN; extern BOOL nulldrv_RestoreDC( PHYSDEV dev, INT level ) DECLSPEC_HIDDEN; extern INT nulldrv_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN;
1
0
0
0
Octavian Voicu : configure: Disable gstreamer support if headers are not compatible with build environment .
by Alexandre Julliard
03 Aug '11
03 Aug '11
Module: wine Branch: master Commit: b113af1b134554004761d38c40da27d657aa7275 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b113af1b134554004761d38c4…
Author: Octavian Voicu <octavian.voicu(a)gmail.com> Date: Wed Aug 3 01:38:43 2011 +0300 configure: Disable gstreamer support if headers are not compatible with build environment. --- configure | 25 +++++++++++++++++++++++-- configure.ac | 13 +++++++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 3876127..7a27706 100755 --- a/configure +++ b/configure @@ -10527,7 +10527,23 @@ then if test "x$ac_cv_header_gst_gstpad_h" = xyes; then : ac_fn_c_check_header_mongrel "$LINENO" "gst/app/gstappsink.h" "ac_cv_header_gst_app_gstappsink_h" "$ac_includes_default" if test "x$ac_cv_header_gst_app_gstappsink_h" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gst_pad_get_caps_reffed in -lgstreamer-0.10" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gint64 defined by gst/app/gstappsink.h is indeed 64-bit" >&5 +$as_echo_n "checking whether gint64 defined by gst/app/gstappsink.h is indeed 64-bit... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <gst/app/gstappsink.h> +int +main () +{ +int a[sizeof(gint64) > 4 ? 1 : -1] + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gst_pad_get_caps_reffed in -lgstreamer-0.10" >&5 $as_echo_n "checking for gst_pad_get_caps_reffed in -lgstreamer-0.10... " >&6; } if ${ac_cv_lib_gstreamer_0_10_gst_pad_get_caps_reffed+:} false; then : $as_echo_n "(cached) " >&6 @@ -10603,12 +10619,17 @@ $as_echo "$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" >&6; } if test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" = xyes; then : GSTREAMER_LIBS="$ac_gst_libs" - GSTREAMER_INCL="$ac_gst_incl" + GSTREAMER_INCL="$ac_gst_incl" fi fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi diff --git a/configure.ac b/configure.ac index ecd74d6..df7a355 100644 --- a/configure.ac +++ b/configure.ac @@ -1456,10 +1456,15 @@ then CPPFLAGS="$CPPFLAGS $ac_gst_incl" AC_CHECK_HEADER([gst/gstpad.h], [AC_CHECK_HEADER([gst/app/gstappsink.h], - [AC_CHECK_LIB(gstreamer-0.10,gst_pad_get_caps_reffed, - [AC_CHECK_LIB(gstapp-0.10,gst_app_buffer_new, - [AC_SUBST(GSTREAMER_LIBS,"$ac_gst_libs") - AC_SUBST(GSTREAMER_INCL,"$ac_gst_incl")],,[$ac_gst_libs])])])]) + [AC_MSG_CHECKING([whether gint64 defined by gst/app/gstappsink.h is indeed 64-bit]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gst/app/gstappsink.h>]], + [[int a[sizeof(gint64) > 4 ? 1 : -1]]])], + [AC_MSG_RESULT([yes]) + AC_CHECK_LIB(gstreamer-0.10,gst_pad_get_caps_reffed, + [AC_CHECK_LIB(gstapp-0.10,gst_app_buffer_new, + [AC_SUBST(GSTREAMER_LIBS,"$ac_gst_libs") + AC_SUBST(GSTREAMER_INCL,"$ac_gst_incl")],,[$ac_gst_libs])])], + [AC_MSG_RESULT([no])])])]) fi CPPFLAGS="$ac_save_CPPFLAGS" fi
1
0
0
0
Henri Verbeet : wined3d: Merge wined3d_surface_blt(), surface_blt() and gdi_surface_blt().
by Alexandre Julliard
03 Aug '11
03 Aug '11
Module: wine Branch: master Commit: 41cff1618cfeeb3f0e563bb65b14560744c27165 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=41cff1618cfeeb3f0e563bb65…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Tue Aug 2 21:42:17 2011 +0200 wined3d: Merge wined3d_surface_blt(), surface_blt() and gdi_surface_blt(). --- dlls/wined3d/surface.c | 94 +++++++++++++++------------------------- dlls/wined3d/wined3d_private.h | 3 - 2 files changed, 35 insertions(+), 62 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 267da66..1c0425a 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1281,13 +1281,15 @@ static HRESULT wined3d_surface_depth_blt(struct wined3d_surface *src_surface, co } /* Do not call while under the GL lock. */ -static HRESULT surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect, - struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, +HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect_in, + struct wined3d_surface *src_surface, const RECT *src_rect_in, DWORD flags, const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter) { const struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_device *device = dst_surface->resource.device; DWORD src_ds_flags, dst_ds_flags; + RECT src_rect, dst_rect; + static const DWORD simple_blit = WINEDDBLT_ASYNC | WINEDDBLT_COLORFILL | WINEDDBLT_WAIT @@ -1295,19 +1297,31 @@ static HRESULT surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_ | WINEDDBLT_DONOTWAIT; TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", - dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), + dst_surface, wine_dbgstr_rect(dst_rect_in), src_surface, wine_dbgstr_rect(src_rect_in), flags, fx, debug_d3dtexturefiltertype(filter)); TRACE("Usage is %s.\n", debug_d3dusage(dst_surface->resource.usage)); - if (flags & ~simple_blit) + if ((dst_surface->flags & SFLAG_LOCKED) || (src_surface && (src_surface->flags & SFLAG_LOCKED))) { - WARN("Using fallback for complex blit (%#x).\n", flags); - goto fallback; + WARN("Surface is busy, returning WINEDDERR_SURFACEBUSY.\n"); + return WINEDDERR_SURFACEBUSY; } + surface_get_rect(dst_surface, dst_rect_in, &dst_rect); + if (src_surface) + surface_get_rect(src_surface, src_rect_in, &src_rect); + else + memset(&src_rect, 0, sizeof(src_rect)); + if (!device->d3d_initialized) { WARN("D3D not initialized, using fallback.\n"); + goto cpu; + } + + if (flags & ~simple_blit) + { + WARN("Using fallback for complex blit (%#x).\n", flags); goto fallback; } @@ -1349,7 +1363,7 @@ static HRESULT surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_ if (!surface_convert_depth_to_float(dst_surface, fx->u5.dwFillDepth, &depth)) return WINED3DERR_INVALIDCALL; - if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, dst_rect, depth))) + if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, &dst_rect, depth))) return WINED3D_OK; } else @@ -1368,21 +1382,21 @@ static HRESULT surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_ return WINED3DERR_INVALIDCALL; } - if (src_rect->top || src_rect->left - || src_rect->bottom != src_surface->resource.height - || src_rect->right != src_surface->resource.width) + if (src_rect.top || src_rect.left + || src_rect.bottom != src_surface->resource.height + || src_rect.right != src_surface->resource.width) { WARN("Rejecting depth / stencil blit with invalid source rect %s.\n", - wine_dbgstr_rect(src_rect)); + wine_dbgstr_rect(&src_rect)); return WINED3DERR_INVALIDCALL; } - if (dst_rect->top || dst_rect->left - || dst_rect->bottom != dst_surface->resource.height - || dst_rect->right != dst_surface->resource.width) + if (dst_rect.top || dst_rect.left + || dst_rect.bottom != dst_surface->resource.height + || dst_rect.right != dst_surface->resource.width) { WARN("Rejecting depth / stencil blit with invalid destination rect %s.\n", - wine_dbgstr_rect(src_rect)); + wine_dbgstr_rect(&src_rect)); return WINED3DERR_INVALIDCALL; } @@ -1393,7 +1407,7 @@ static HRESULT surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_ return WINED3DERR_INVALIDCALL; } - if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_rect, dst_surface, dst_rect))) + if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, &src_rect, dst_surface, &dst_rect))) return WINED3D_OK; } } @@ -1404,15 +1418,17 @@ fallback: if ((dst_surface->resource.usage & WINED3DUSAGE_RENDERTARGET) || (src_surface && (src_surface->resource.usage & WINED3DUSAGE_RENDERTARGET))) { - if (SUCCEEDED(IWineD3DSurfaceImpl_BltOverride(dst_surface, dst_rect, - src_surface, src_rect, flags, fx, filter))) + if (SUCCEEDED(IWineD3DSurfaceImpl_BltOverride(dst_surface, &dst_rect, + src_surface, &src_rect, flags, fx, filter))) return WINED3D_OK; } +cpu: + /* For the rest call the X11 surface implementation. For render targets * this should be implemented OpenGL accelerated in BltOverride, other * blits are rather rare. */ - return surface_cpu_blt(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter); + return surface_cpu_blt(dst_surface, &dst_rect, src_surface, &src_rect, flags, fx, filter); } /* Do not call while under the GL lock. */ @@ -1641,7 +1657,6 @@ static const struct wined3d_surface_ops surface_ops = surface_unmap, surface_getdc, surface_flip, - surface_blt, surface_bltfast, surface_set_mem, }; @@ -1826,17 +1841,6 @@ static HRESULT gdi_surface_flip(struct wined3d_surface *surface, struct wined3d_ return WINED3D_OK; } -static HRESULT gdi_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect, - struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, - const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter) -{ - TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", - dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), - flags, fx, debug_d3dtexturefiltertype(filter)); - - return surface_cpu_blt(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter); -} - static HRESULT gdi_surface_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y, struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans) { @@ -1904,7 +1908,6 @@ static const struct wined3d_surface_ops gdi_surface_ops = gdi_surface_unmap, gdi_surface_getdc, gdi_surface_flip, - gdi_surface_blt, gdi_surface_bltfast, gdi_surface_set_mem, }; @@ -3442,33 +3445,6 @@ do { \ } /* Do not call while under the GL lock. */ -HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect_in, - struct wined3d_surface *src_surface, const RECT *src_rect_in, DWORD flags, - const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter) -{ - RECT src_rect, dst_rect; - - TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", - dst_surface, wine_dbgstr_rect(dst_rect_in), src_surface, wine_dbgstr_rect(src_rect_in), - flags, fx, debug_d3dtexturefiltertype(filter)); - - if ((dst_surface->flags & SFLAG_LOCKED) || (src_surface && (src_surface->flags & SFLAG_LOCKED))) - { - WARN("Surface is busy, returning WINEDDERR_SURFACEBUSY.\n"); - return WINEDDERR_SURFACEBUSY; - } - - surface_get_rect(dst_surface, dst_rect_in, &dst_rect); - if (src_surface) - surface_get_rect(src_surface, src_rect_in, &src_rect); - else - memset(&src_rect, 0, sizeof(src_rect)); - - return dst_surface->surface_ops->surface_blt(dst_surface, - &dst_rect, src_surface, &src_rect, flags, fx, filter); -} - -/* Do not call while under the GL lock. */ HRESULT CDECL wined3d_surface_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y, struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index e7cc3eb..0c53d22 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1984,9 +1984,6 @@ struct wined3d_surface_ops void (*surface_unmap)(struct wined3d_surface *surface); HRESULT (*surface_getdc)(struct wined3d_surface *surface); HRESULT (*surface_flip)(struct wined3d_surface *surface, struct wined3d_surface *override); - HRESULT (*surface_blt)(struct wined3d_surface *dst_surface, const RECT *dst_rect, - struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, - const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter); HRESULT (*surface_bltfast)(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y, struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans); HRESULT (*surface_set_mem)(struct wined3d_surface *surface, void *mem);
1
0
0
0
Henri Verbeet : wined3d: Go to the fallbacks for cross-swapchain blits.
by Alexandre Julliard
03 Aug '11
03 Aug '11
Module: wine Branch: master Commit: c12627562b32b36bab095fee59b96a8785e2fa4a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c12627562b32b36bab095fee5…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Tue Aug 2 21:42:16 2011 +0200 wined3d: Go to the fallbacks for cross-swapchain blits. --- dlls/wined3d/surface.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index d9060ff..267da66 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1285,6 +1285,7 @@ static HRESULT surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter) { + const struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_device *device = dst_surface->resource.device; DWORD src_ds_flags, dst_ds_flags; static const DWORD simple_blit = WINEDDBLT_ASYNC @@ -1310,6 +1311,27 @@ static HRESULT surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_ goto fallback; } + if (src_surface && src_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN) + src_swapchain = src_surface->container.u.swapchain; + else + src_swapchain = NULL; + + if (dst_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN) + dst_swapchain = dst_surface->container.u.swapchain; + else + dst_swapchain = NULL; + + /* This isn't strictly needed. FBO blits for example could deal with + * cross-swapchain blits by first downloading the source to a texture + * before switching to the destination context. We just have this here to + * not have to deal with the issue, since cross-swapchain blits should be + * rare. */ + if (src_swapchain && dst_swapchain && src_swapchain != dst_swapchain) + { + FIXME("Using fallback for cross-swapchain blit.\n"); + goto fallback; + } + dst_ds_flags = dst_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL); if (src_surface) src_ds_flags = src_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
1
0
0
0
Henri Verbeet : wined3d: Add WINED3DFMT_P8_UINT support to wined3d_format_convert_from_float().
by Alexandre Julliard
03 Aug '11
03 Aug '11
Module: wine Branch: master Commit: 111e8fe77cc85162cde2eaf35edd290739482920 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=111e8fe77cc85162cde2eaf35…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Tue Aug 2 21:42:15 2011 +0200 wined3d: Add WINED3DFMT_P8_UINT support to wined3d_format_convert_from_float(). --- dlls/wined3d/surface.c | 2 +- dlls/wined3d/utils.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/wined3d/wined3d_private.h | 2 +- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 02bf4c4..d9060ff 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -7355,7 +7355,7 @@ static HRESULT cpu_blit_color_fill(struct wined3d_device *device, struct wined3d memset(&BltFx, 0, sizeof(BltFx)); BltFx.dwSize = sizeof(BltFx); - BltFx.u5.dwFillColor = wined3d_format_convert_from_float(dst_surface->resource.format, color); + BltFx.u5.dwFillColor = wined3d_format_convert_from_float(dst_surface, color); return wined3d_surface_blt(dst_surface, dst_rect, NULL, NULL, WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_POINT); } diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 177f071..68e6d75 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -2622,7 +2622,7 @@ BOOL getDepthStencilBits(const struct wined3d_format *format, BYTE *depthSize, B /* Note: It's the caller's responsibility to ensure values can be expressed * in the requested format. UNORM formats for example can only express values * in the range 0.0f -> 1.0f. */ -DWORD wined3d_format_convert_from_float(const struct wined3d_format *format, const WINED3DCOLORVALUE *color) +DWORD wined3d_format_convert_from_float(const struct wined3d_surface *surface, const WINED3DCOLORVALUE *color) { static const struct { @@ -2653,6 +2653,7 @@ DWORD wined3d_format_convert_from_float(const struct wined3d_format *format, con {WINED3DFMT_B10G10R10A2_UNORM, 1023.0f, 1023.0f, 1023.0f, 3.0f, 20, 10, 0, 30}, {WINED3DFMT_R10G10B10A2_UNORM, 1023.0f, 1023.0f, 1023.0f, 3.0f, 0, 10, 20, 30}, }; + const struct wined3d_format *format = surface->resource.format; unsigned int i; TRACE("Converting color {%.8e %.8e %.8e %.8e} to format %s.\n", @@ -2674,6 +2675,40 @@ DWORD wined3d_format_convert_from_float(const struct wined3d_format *format, con return ret; } + if (format->id == WINED3DFMT_P8_UINT) + { + PALETTEENTRY *e; + BYTE r, g, b, a; + + if (!surface->palette) + { + WARN("Surface doesn't have a palette, returning 0.\n"); + return 0; + } + + r = (BYTE)((color->r * 255.0f) + 0.5f); + g = (BYTE)((color->g * 255.0f) + 0.5f); + b = (BYTE)((color->b * 255.0f) + 0.5f); + a = (BYTE)((color->a * 255.0f) + 0.5f); + + e = &surface->palette->palents[a]; + if (e->peRed == r && e->peGreen == g && e->peBlue == b) + return a; + + WARN("Alpha didn't match index, searching full palette.\n"); + + for (i = 0; i < 256; ++i) + { + e = &surface->palette->palents[i]; + if (e->peRed == r && e->peGreen == g && e->peBlue == b) + return i; + } + + FIXME("Unable to convert color to palette index.\n"); + + return 0; + } + FIXME("Conversion for format %s not implemented.\n", debug_d3dformat(format->id)); return 0; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 17e8b41..e7cc3eb 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2805,7 +2805,7 @@ const struct wined3d_format *wined3d_get_format(const struct wined3d_gl_info *gl enum wined3d_format_id format_id) DECLSPEC_HIDDEN; UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT alignment, UINT width, UINT height) DECLSPEC_HIDDEN; -DWORD wined3d_format_convert_from_float(const struct wined3d_format *format, +DWORD wined3d_format_convert_from_float(const struct wined3d_surface *surface, const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN; static inline BOOL use_vs(const struct wined3d_state *state)
1
0
0
0
Henri Verbeet : wined3d: Fix switching color keying on / off.
by Alexandre Julliard
03 Aug '11
03 Aug '11
Module: wine Branch: master Commit: cf1c641cbbccd986b6192e279217908d5889a6d7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cf1c641cbbccd986b6192e279…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Tue Aug 2 21:42:14 2011 +0200 wined3d: Fix switching color keying on / off. --- dlls/wined3d/surface.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 6fb704e..02bf4c4 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -2539,6 +2539,7 @@ static BOOL surface_convert_color_to_float(const struct wined3d_surface *surface HRESULT surface_load(struct wined3d_surface *surface, BOOL srgb) { DWORD flag = srgb ? SFLAG_INSRGBTEX : SFLAG_INTEXTURE; + BOOL ck_changed; TRACE("surface %p, srgb %#x.\n", surface, srgb); @@ -2548,14 +2549,11 @@ HRESULT surface_load(struct wined3d_surface *surface, BOOL srgb) return WINED3DERR_INVALIDCALL; } - if (!(surface->flags & flag)) - { - TRACE("Reloading because surface is dirty\n"); - } + ck_changed = !(surface->flags & SFLAG_GLCKEY) != !(surface->CKeyFlags & WINEDDSD_CKSRCBLT); + /* Reload if either the texture and sysmem have different ideas about the * color key, or the actual key values changed. */ - else if (!(surface->flags & SFLAG_GLCKEY) != !(surface->CKeyFlags & WINEDDSD_CKSRCBLT) - || ((surface->CKeyFlags & WINEDDSD_CKSRCBLT) + if (ck_changed || ((surface->CKeyFlags & WINEDDSD_CKSRCBLT) && (surface->glCKey.dwColorSpaceLowValue != surface->SrcBltCKey.dwColorSpaceLowValue || surface->glCKey.dwColorSpaceHighValue != surface->SrcBltCKey.dwColorSpaceHighValue))) { @@ -2568,6 +2566,13 @@ HRESULT surface_load(struct wined3d_surface *surface, BOOL srgb) * this kills performance though :( */ /* TODO: This is not necessarily needed with hw palettized texture support. */ surface_modify_location(surface, SFLAG_INSYSMEM, TRUE); + /* Switching color keying on / off may change the internal format. */ + if (ck_changed) + surface_force_reload(surface); + } + else if (!(surface->flags & flag)) + { + TRACE("Reloading because surface is dirty.\n"); } else {
1
0
0
0
← Newer
1
...
62
63
64
65
66
67
68
...
77
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Results per page:
10
25
50
100
200