[WINDOWSCODECS] Sync with Wine Staging 4.18. CORE-16441
[reactos.git] / dll / win32 / windowscodecs / scaler.c
index d19e219..d6e56d0 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright 2010 Vincent Povirk for CodeWeavers
+ * Copyright 2016 Dmitry Timoshkov
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -224,7 +225,7 @@ static HRESULT WINAPI BitmapScaler_CopyPixels(IWICBitmapScaler *iface,
 
     if (!This->source)
     {
-        hr = WINCODEC_ERR_WRONGSTATE;
+        hr = WINCODEC_ERR_NOTINITIALIZED;
         goto end;
     }
 
@@ -395,30 +396,8 @@ static HRESULT WINAPI IMILBitmapScaler_QueryInterface(IMILBitmapScaler *iface, R
     void **ppv)
 {
     BitmapScaler *This = impl_from_IMILBitmapScaler(iface);
-
     TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
-
-    if (!ppv) return E_INVALIDARG;
-
-    if (IsEqualIID(&IID_IUnknown, iid) ||
-        IsEqualIID(&IID_IMILBitmapScaler, iid) ||
-        IsEqualIID(&IID_IMILBitmapSource, iid))
-    {
-        IUnknown_AddRef(&This->IMILBitmapScaler_iface);
-        *ppv = &This->IMILBitmapScaler_iface;
-        return S_OK;
-    }
-    else if (IsEqualIID(&IID_IWICBitmapScaler, iid) ||
-             IsEqualIID(&IID_IWICBitmapSource, iid))
-    {
-        IUnknown_AddRef(&This->IWICBitmapScaler_iface);
-        *ppv = &This->IWICBitmapScaler_iface;
-        return S_OK;
-    }
-
-    FIXME("unknown interface %s\n", debugstr_guid(iid));
-    *ppv = NULL;
-    return E_NOINTERFACE;
+    return IWICBitmapScaler_QueryInterface(&This->IWICBitmapScaler_iface, iid, ppv);
 }
 
 static ULONG WINAPI IMILBitmapScaler_AddRef(IMILBitmapScaler *iface)
@@ -437,12 +416,7 @@ static HRESULT WINAPI IMILBitmapScaler_GetSize(IMILBitmapScaler *iface,
     UINT *width, UINT *height)
 {
     BitmapScaler *This = impl_from_IMILBitmapScaler(iface);
-
     TRACE("(%p,%p,%p)\n", iface, width, height);
-
-    if (!This->source)
-        return WINCODEC_ERR_NOTINITIALIZED;
-
     return IWICBitmapScaler_GetSize(&This->IWICBitmapScaler_iface, width, height);
 }
 
@@ -473,12 +447,7 @@ static HRESULT WINAPI IMILBitmapScaler_GetResolution(IMILBitmapScaler *iface,
     double *dpix, double *dpiy)
 {
     BitmapScaler *This = impl_from_IMILBitmapScaler(iface);
-
     TRACE("(%p,%p,%p)\n", iface, dpix, dpiy);
-
-    if (!This->source)
-        return WINCODEC_ERR_NOTINITIALIZED;
-
     return IWICBitmapScaler_GetResolution(&This->IWICBitmapScaler_iface, dpix, dpiy);
 }
 
@@ -499,12 +468,7 @@ static HRESULT WINAPI IMILBitmapScaler_CopyPixels(IMILBitmapScaler *iface,
     const WICRect *rc, UINT stride, UINT size, BYTE *buffer)
 {
     BitmapScaler *This = impl_from_IMILBitmapScaler(iface);
-
     TRACE("(%p,%p,%u,%u,%p)\n", iface, rc, stride, size, buffer);
-
-    if (!This->source)
-        return WINCODEC_ERR_NOTINITIALIZED;
-
     return IWICBitmapScaler_CopyPixels(&This->IWICBitmapScaler_iface, rc, stride, size, buffer);
 }