Alexandre Julliard : gdi32: Add a placeholder function for DIB stretching.

Alexandre Julliard julliard at winehq.org
Wed Sep 14 12:25:39 CDT 2011


Module: wine
Branch: master
Commit: 7696168dce19d182191a12e509a8c80d814c85cd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7696168dce19d182191a12e509a8c80d814c85cd

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Sep 14 11:17:02 2011 +0200

gdi32: Add a placeholder function for DIB stretching.

---

 dlls/gdi32/bitblt.c        |   17 +++++++++++++++--
 dlls/gdi32/dibdrv/bitblt.c |   14 ++++++++++++++
 dlls/gdi32/gdi_private.h   |    3 +++
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index 9f37ab0..e023872 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -230,8 +230,21 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
     if (err == ERROR_TRANSFORM_NOT_SUPPORTED &&
         ((src->width != dst->width) || (src->height != dst->height)))
     {
-        FIXME( "should stretch %dx%d -> %dx%d\n",
-               src->width, src->height, dst->width, dst->height );
+        memcpy( src_info, dst_info, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ));
+        dst_info->bmiHeader.biWidth = dst->visrect.right - dst->visrect.left;
+        dst_info->bmiHeader.biHeight = dst->visrect.bottom - dst->visrect.top;
+        if (src_info->bmiHeader.biHeight < 0) dst_info->bmiHeader.biHeight = -dst_info->bmiHeader.biHeight;
+        if ((ptr = HeapAlloc( GetProcessHeap(), 0, get_dib_image_size( dst_info ))))
+        {
+            err = stretch_bitmapinfo( src_info, bits.ptr, src, dst_info, ptr, dst,
+                                      GetStretchBltMode( dst_dev->hdc ) );
+            if (bits.free) bits.free( &bits );
+            bits.ptr = ptr;
+            bits.is_copy = TRUE;
+            bits.free = free_heap_bits;
+            if (!err) err = dst_dev->funcs->pPutImage( dst_dev, 0, 0, dst_info, &bits, src, dst, rop );
+        }
+        else err = ERROR_OUTOFMEMORY;
     }
 
     if (bits.free) bits.free( &bits );
diff --git a/dlls/gdi32/dibdrv/bitblt.c b/dlls/gdi32/dibdrv/bitblt.c
index 0bb37fb..1d41e11 100644
--- a/dlls/gdi32/dibdrv/bitblt.c
+++ b/dlls/gdi32/dibdrv/bitblt.c
@@ -793,3 +793,17 @@ done:
 
     return ret;
 }
+
+DWORD stretch_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitblt_coords *src,
+                          const BITMAPINFO *dst_info, void *dst_bits, const struct bitblt_coords *dst,
+                          INT mode )
+{
+    FIXME( "should stretch %dx%d -> %dx%d\n", src->width, src->height, dst->width, dst->height );
+
+    /* update coordinates, the destination rectangle is always stored at 0,0 */
+    *src = *dst;
+    src->x -= src->visrect.left;
+    src->y -= src->visrect.top;
+    offset_rect( &src->visrect, -src->visrect.left, -src->visrect.top );
+    return ERROR_SUCCESS;
+}
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index a06a593..4fe2e59 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -254,6 +254,9 @@ extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_H
 extern DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitblt_coords *src,
                                  const BITMAPINFO *dst_info, void *dst_bits ) DECLSPEC_HIDDEN;
 
+extern DWORD stretch_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitblt_coords *src,
+                                 const BITMAPINFO *dst_info, void *dst_bits, const struct bitblt_coords *dst,
+                                 INT mode ) DECLSPEC_HIDDEN;
 
 /* driver.c */
 extern const DC_FUNCTIONS null_driver DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list