Vincent Povirk : windowscodecs: Implement SetResolution for the PNG encoder .

Alexandre Julliard julliard at winehq.org
Fri Oct 9 09:24:16 CDT 2009


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Sep 23 16:56:56 2009 -0500

windowscodecs: Implement SetResolution for the PNG encoder.

---

 dlls/windowscodecs/pngformat.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index af074e8..48295b2 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -700,6 +700,7 @@ typedef struct PngEncoder {
     const struct png_pixelformat *format;
     BOOL info_written;
     UINT width, height;
+    double xres, yres;
 } PngEncoder;
 
 static inline PngEncoder *encoder_from_frame(IWICBitmapFrameEncode *iface)
@@ -772,8 +773,15 @@ static HRESULT WINAPI PngFrameEncode_SetSize(IWICBitmapFrameEncode *iface,
 static HRESULT WINAPI PngFrameEncode_SetResolution(IWICBitmapFrameEncode *iface,
     double dpiX, double dpiY)
 {
-    FIXME("(%p,%0.2f,%0.2f): stub\n", iface, dpiX, dpiY);
-    return E_NOTIMPL;
+    PngEncoder *This = encoder_from_frame(iface);
+    TRACE("(%p,%0.2f,%0.2f)\n", iface, dpiX, dpiY);
+
+    if (!This->frame_initialized || This->info_written) return WINCODEC_ERR_WRONGSTATE;
+
+    This->xres = dpiX;
+    This->yres = dpiY;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI PngFrameEncode_SetPixelFormat(IWICBitmapFrameEncode *iface,
@@ -1099,6 +1107,8 @@ HRESULT PngEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
     This->info_written = FALSE;
     This->width = 0;
     This->height = 0;
+    This->xres = 0.0;
+    This->yres = 0.0;
 
     ret = IUnknown_QueryInterface((IUnknown*)This, iid, ppv);
     IUnknown_Release((IUnknown*)This);




More information about the wine-cvs mailing list