[4/4] gdiplus: Add support for reading png gAMA chunks.
Vincent Povirk
madewokherd at gmail.com
Wed Apr 1 17:26:37 CDT 2015
-------------- next part --------------
From 36978ee9548b8a3d8ff180418b62091484495e8f Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Wed, 1 Apr 2015 15:26:00 -0500
Subject: [PATCH 4/6] gdiplus: Add support for reading png gAMA chunks.
---
dlls/gdiplus/image.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 643cf6c..4d58834 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -3456,6 +3456,7 @@ static void png_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
{ "Source", PropertyTagEquipModel },
{ "Comment", PropertyTagExifUserComment },
};
+ BOOL seen_gamma=FALSE;
hr = IWICBitmapDecoder_GetFrame(decoder, active_frame, &frame);
if (hr != S_OK) return;
@@ -3502,6 +3503,35 @@ static void png_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
PropVariantClear(&value);
}
}
+ else if (SUCCEEDED(hr) && IsEqualGUID(&GUID_MetadataFormatChunkgAMA, &format))
+ {
+ PROPVARIANT value;
+ PropertyItem* item;
+
+ hr = IWICMetadataReader_GetValueByIndex(reader, 0, NULL, NULL, &value);
+
+ if (SUCCEEDED(hr))
+ {
+ if (!seen_gamma && value.vt == VT_UI4)
+ {
+ item = GdipAlloc(sizeof(PropertyItem) + sizeof(ULONG) * 2);
+ if (item)
+ {
+ ULONG *rational;
+ item->length = sizeof(ULONG) * 2;
+ item->type = PropertyTagTypeRational;
+ item->id = PropertyTagGamma;
+ rational = item->value = item + 1;
+ rational[0] = 100000;
+ rational[1] = value.u.ulVal;
+ add_property(bitmap, item);
+ seen_gamma = TRUE;
+ GdipFree(item);
+ }
+ }
+ PropVariantClear(&value);
+ }
+ }
IWICMetadataReader_Release(reader);
}
--
2.1.0
More information about the wine-patches
mailing list