Joel Holdsworth : windowscodecs: Implemented GifFrameDecode_GetResolution.

Alexandre Julliard julliard at winehq.org
Thu Oct 7 11:24:26 CDT 2010


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

Author: Joel Holdsworth <joel at airwebreathe.org.uk>
Date:   Thu Oct  7 00:21:10 2010 +0100

windowscodecs: Implemented GifFrameDecode_GetResolution.

---

 dlls/windowscodecs/gifformat.c |   11 +++++++++--
 dlls/windowscodecs/ungif.c     |    1 +
 dlls/windowscodecs/ungif.h     |    3 ++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/windowscodecs/gifformat.c b/dlls/windowscodecs/gifformat.c
index 3443b2c..239d25d 100644
--- a/dlls/windowscodecs/gifformat.c
+++ b/dlls/windowscodecs/gifformat.c
@@ -123,8 +123,15 @@ static HRESULT WINAPI GifFrameDecode_GetPixelFormat(IWICBitmapFrameDecode *iface
 static HRESULT WINAPI GifFrameDecode_GetResolution(IWICBitmapFrameDecode *iface,
     double *pDpiX, double *pDpiY)
 {
-    FIXME("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY);
-    return E_NOTIMPL;
+    GifFrameDecode *This = (GifFrameDecode*)iface;
+    const GifWord aspect_word = This->parent->gif->SAspectRatio;
+    const double aspect = (aspect_word > 0) ? ((aspect_word + 15.0) / 64.0) : 1.0;
+    TRACE("(%p,%p,%p)\n", iface, pDpiX, pDpiY);
+
+    *pDpiX = 96.0 / aspect;
+    *pDpiY = 96.0;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI GifFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,
diff --git a/dlls/windowscodecs/ungif.c b/dlls/windowscodecs/ungif.c
index cfc7613..87a9331 100644
--- a/dlls/windowscodecs/ungif.c
+++ b/dlls/windowscodecs/ungif.c
@@ -285,6 +285,7 @@ DGifGetScreenDesc(GifFileType * GifFile) {
     GifFile->SColorResolution = (((Buf[0] & 0x70) + 1) >> 4) + 1;
     BitsPerPixel = (Buf[0] & 0x07) + 1;
     GifFile->SBackGroundColor = Buf[1];
+    GifFile->SAspectRatio = Buf[2];
     if (Buf[0] & 0x80) {    /* Do we have global color map? */
 
         GifFile->SColorMap = MakeMapObject(1 << BitsPerPixel, NULL);
diff --git a/dlls/windowscodecs/ungif.h b/dlls/windowscodecs/ungif.h
index e71dad8..5e39c56 100644
--- a/dlls/windowscodecs/ungif.h
+++ b/dlls/windowscodecs/ungif.h
@@ -100,7 +100,8 @@ typedef struct GifImageDesc {
 typedef struct GifFileType {
     GifWord SWidth, SHeight,        /* Screen dimensions. */
       SColorResolution,         /* How many colors can we generate? */
-      SBackGroundColor;         /* I hope you understand this one... */
+      SBackGroundColor,         /* I hope you understand this one... */
+      SAspectRatio;             /* Pixel aspect ratio, in 1/64 units, starting at 1:4. */
     ColorMapObject *SColorMap;  /* NULL if not exists. */
     int ImageCount;             /* Number of current image */
     GifImageDesc Image;         /* Block describing current image */




More information about the wine-cvs mailing list