From 57e00c851e572dd97909d7f9fd3d198f9671dbbd Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Thu, 7 Oct 2010 00:21:10 +0100 Subject: [PATCH] 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 3443b2c1ae..239d25d841 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 cfc7613cd4..87a933175b 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 e71dad8b3a..5e39c5681b 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 */