gdiplus: Set flags and dpi when images are loaded.
This commit is contained in:
parent
1ce8be01f2
commit
77a5b635aa
|
@ -2606,6 +2606,18 @@ static GpStatus decode_image_wic(IStream* stream, REFCLSID clsid, GpImage **imag
|
||||||
*image = NULL;
|
*image = NULL;
|
||||||
GdipDisposeImage((GpImage*)bitmap);
|
GdipDisposeImage((GpImage*)bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SUCCEEDED(hr) && status == Ok)
|
||||||
|
{
|
||||||
|
double dpix, dpiy;
|
||||||
|
hr = IWICBitmapSource_GetResolution(source, &dpix, &dpiy);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
bitmap->image.xres = dpix;
|
||||||
|
bitmap->image.yres = dpiy;
|
||||||
|
}
|
||||||
|
hr = S_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IWICBitmapSource_Release(source);
|
IWICBitmapSource_Release(source);
|
||||||
|
@ -2621,6 +2633,12 @@ end:
|
||||||
|
|
||||||
if (FAILED(hr) && status == Ok) status = hresult_to_status(hr);
|
if (FAILED(hr) && status == Ok) status = hresult_to_status(hr);
|
||||||
|
|
||||||
|
if (status == Ok)
|
||||||
|
{
|
||||||
|
/* Native GDI+ used to be smarter, but since Win7 it just sets these flags. */
|
||||||
|
bitmap->image.flags |= ImageFlagsReadOnly|ImageFlagsHasRealPixelSize|ImageFlagsHasRealDPI|ImageFlagsColorSpaceRGB;
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue