Vincent Povirk : gdiplus: Use one GetDIBits call instead of one per row.
Module: wine Branch: master Commit: 431aa5bc3f4d81b15d95abcd0ed4da6ac15bf8af URL: http://source.winehq.org/git/wine.git/?a=commit;h=431aa5bc3f4d81b15d95abcd0e... Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Wed Dec 5 10:42:49 2012 -0600 gdiplus: Use one GetDIBits call instead of one per row. --- dlls/gdiplus/image.c | 26 +++----------------------- 1 files changed, 3 insertions(+), 23 deletions(-) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index a8f43e3..9d88629 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -4645,7 +4645,6 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi GpStatus retval; PixelFormat format; BitmapData lockeddata; - INT y; TRACE("%p %p %p\n", hbm, hpal, bitmap); @@ -4695,14 +4694,10 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi if (retval == Ok) { HDC hdc; - HBITMAP oldhbm; BITMAPINFO *pbmi; - INT src_height, dst_stride; - BYTE *dst_bits; + INT src_height; hdc = CreateCompatibleDC(NULL); - oldhbm = SelectObject(hdc, hbm); - pbmi = GdipAlloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); if (pbmi) @@ -4713,30 +4708,15 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi GetDIBits(hdc, hbm, 0, 0, NULL, pbmi, DIB_RGB_COLORS); src_height = abs(pbmi->bmiHeader.biHeight); + pbmi->bmiHeader.biHeight = -src_height; - if (pbmi->bmiHeader.biHeight > 0) - { - dst_bits = (BYTE*)lockeddata.Scan0+lockeddata.Stride*(src_height-1); - dst_stride = -lockeddata.Stride; - } - else - { - dst_bits = lockeddata.Scan0; - dst_stride = lockeddata.Stride; - } - - for (y=0; y<src_height; y++) - { - GetDIBits(hdc, hbm, y, 1, dst_bits+dst_stride*y, - pbmi, DIB_RGB_COLORS); - } + GetDIBits(hdc, hbm, 0, src_height, lockeddata.Scan0, pbmi, DIB_RGB_COLORS); GdipFree(pbmi); } else retval = OutOfMemory; - SelectObject(hdc, oldhbm); DeleteDC(hdc); GdipBitmapUnlockBits(*bitmap, &lockeddata);
participants (1)
-
Alexandre Julliard