Ziqing Hui : windowscodecs: Introduce get_pixel_format_bpp().
Alexandre Julliard
julliard at winehq.org
Tue Aug 18 16:34:23 CDT 2020
Module: wine
Branch: master
Commit: bec58b5e9c250cd337fc6c694e1c14531bdaa372
URL: https://source.winehq.org/git/wine.git/?a=commit;h=bec58b5e9c250cd337fc6c694e1c14531bdaa372
Author: Ziqing Hui <zhui at codeweavers.com>
Date: Mon Aug 17 10:23:14 2020 +0800
windowscodecs: Introduce get_pixel_format_bpp().
Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
Signed-off-by: Esme Povirk <esme at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/windowscodecs/ddsformat.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/dlls/windowscodecs/ddsformat.c b/dlls/windowscodecs/ddsformat.c
index 87cbf4df91..9f6aab4e91 100644
--- a/dlls/windowscodecs/ddsformat.c
+++ b/dlls/windowscodecs/ddsformat.c
@@ -131,6 +131,7 @@ typedef struct dds_frame_info {
UINT width_in_blocks;
UINT height_in_blocks;
const GUID *pixel_format;
+ UINT pixel_format_bpp;
} dds_frame_info;
typedef struct DdsDecoder {
@@ -446,6 +447,27 @@ static void get_dds_info(dds_info* info, DDS_HEADER *header, DDS_HEADER_DXT10 *h
if (info->dimension == WICDdsTextureCube) info->frame_count *= 6;
}
+static UINT get_pixel_format_bpp(const GUID *pixel_format)
+{
+ HRESULT hr;
+ UINT bpp = 0;
+ IWICComponentInfo *info = NULL;
+ IWICPixelFormatInfo* format_info = NULL;
+
+ hr = CreateComponentInfo(pixel_format, &info);
+ if (hr != S_OK) goto end;
+ hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo, (void **)&format_info);
+ if (hr != S_OK) goto end;
+
+ IWICPixelFormatInfo_GetBitsPerPixel(format_info, &bpp);
+
+end:
+ if (format_info) IWICPixelFormatInfo_Release(format_info);
+ if (info) IWICComponentInfo_Release(info);
+
+ return bpp;
+}
+
static inline DdsDecoder *impl_from_IWICBitmapDecoder(IWICBitmapDecoder *iface)
{
return CONTAINING_RECORD(iface, DdsDecoder, IWICBitmapDecoder_iface);
@@ -1090,6 +1112,7 @@ static HRESULT WINAPI DdsDecoder_Dds_GetFrame(IWICDdsDecoder *iface,
frame_decode->info.width_in_blocks = frame_width_in_blocks;
frame_decode->info.height_in_blocks = frame_height_in_blocks;
frame_decode->info.pixel_format = This->info.pixel_format;
+ frame_decode->info.pixel_format_bpp = get_pixel_format_bpp(This->info.pixel_format);
frame_decode->data = HeapAlloc(GetProcessHeap(), 0, frame_size);
hr = IStream_Seek(This->stream, seek, SEEK_SET, NULL);
if (hr != S_OK) goto end;
More information about the wine-cvs
mailing list