Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
fc78134d
Commit
fc78134d
authored
Jul 23, 2023
by
Jeff Smith
Committed by
Alexandre Julliard
Aug 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Set PNG palette histogram property when present.
parent
78e6a53d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
1 deletion
+62
-1
image.c
dlls/gdiplus/image.c
+29
-1
image.c
dlls/gdiplus/tests/image.c
+33
-0
No files found.
dlls/gdiplus/image.c
View file @
fc78134d
...
...
@@ -3620,6 +3620,26 @@ static HRESULT png_read_time(IWICMetadataReader *reader, GpBitmap *bitmap)
return
S_OK
;
}
static
HRESULT
png_read_histogram
(
IWICMetadataReader
*
reader
,
GpBitmap
*
bitmap
)
{
HRESULT
hr
;
PropertyItem
*
item
;
PROPVARIANT
value
;
hr
=
IWICMetadataReader_GetValueByIndex
(
reader
,
0
,
NULL
,
NULL
,
&
value
);
if
(
FAILED
(
hr
))
return
hr
;
item
=
create_prop
(
PropertyTagPaletteHistogram
,
&
value
);
if
(
item
)
add_property
(
bitmap
,
item
);
heap_free
(
item
);
PropVariantClear
(
&
value
);
return
S_OK
;
}
static
HRESULT
png_add_unit_properties
(
IWICBitmapFrameDecode
*
frame
,
GpBitmap
*
bitmap
)
{
HRESULT
hr
;
...
...
@@ -3675,7 +3695,7 @@ static void png_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
IWICBitmapFrameDecode
*
frame
;
IWICMetadataBlockReader
*
block_reader
;
UINT
block_count
,
i
;
BOOL
seen_gamma
=
FALSE
,
seen_whitepoint
=
FALSE
,
seen_chrm
=
FALSE
,
seen_time
=
FALSE
;
BOOL
seen_gamma
=
FALSE
,
seen_whitepoint
=
FALSE
,
seen_chrm
=
FALSE
,
seen_time
=
FALSE
,
seen_histogram
=
FALSE
;
BOOL
*
seen_text
=
NULL
;
hr
=
IWICBitmapDecoder_GetFrame
(
decoder
,
active_frame
,
&
frame
);
...
...
@@ -3744,6 +3764,14 @@ static void png_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
seen_time
=
SUCCEEDED
(
hr
);
}
}
else
if
(
IsEqualGUID
(
&
GUID_MetadataFormatChunkhIST
,
&
format
))
{
if
(
!
seen_histogram
)
{
hr
=
png_read_histogram
(
reader
,
bitmap
);
seen_histogram
=
SUCCEEDED
(
hr
);
}
}
IWICMetadataReader_Release
(
reader
);
}
...
...
dlls/gdiplus/tests/image.c
View file @
fc78134d
...
...
@@ -5813,6 +5813,14 @@ static const BYTE png_time[] = {
0x00
,
0x00
,
0x00
,
0x00
,
'I'
,
'E'
,
'N'
,
'D'
,
0xae
,
0x42
,
0x60
,
0x82
};
static
const
BYTE
png_hist
[]
=
{
0x89
,
'P'
,
'N'
,
'G'
,
0x0d
,
0x0a
,
0x1a
,
0x0a
,
0x00
,
0x00
,
0x00
,
0x0d
,
'I'
,
'H'
,
'D'
,
'R'
,
0x00
,
0x00
,
0x00
,
0x01
,
0x00
,
0x00
,
0x00
,
0x01
,
0x08
,
0x02
,
0x00
,
0x00
,
0x00
,
0x90
,
0x77
,
0x53
,
0xde
,
0x00
,
0x00
,
0x00
,
0x08
,
'h'
,
'I'
,
'S'
,
'T'
,
0x00
,
0x01
,
0x00
,
0x02
,
0x00
,
0x03
,
0x00
,
0x04
,
0xff
,
0xff
,
0xff
,
0xff
,
0x00
,
0x00
,
0x00
,
0x0c
,
'I'
,
'D'
,
'A'
,
'T'
,
0x08
,
0xd7
,
0x63
,
0xf8
,
0xff
,
0xff
,
0x3f
,
0x00
,
0x05
,
0xfe
,
0x02
,
0xfe
,
0xdc
,
0xcc
,
0x59
,
0xe7
,
0x00
,
0x00
,
0x00
,
0x00
,
'I'
,
'E'
,
'N'
,
'D'
,
0xae
,
0x42
,
0x60
,
0x82
};
static
void
test_png_unit_properties
(
void
)
{
GpImage
*
image
;
...
...
@@ -5913,6 +5921,30 @@ static void test_png_datetime_property(void)
GdipDisposeImage
(
image
);
}
static
void
test_png_histogram_property
(
void
)
{
struct
property_test_data
td
[]
=
{
{
PropertyTagTypeShort
,
PropertyTagPaletteHistogram
,
8
,
{
1
,
0
,
2
,
0
,
3
,
0
,
4
,
0
}
},
{
PropertyTagTypeByte
,
PropertyTagPixelUnit
,
1
,
{
1
}
},
{
PropertyTagTypeLong
,
PropertyTagPixelPerUnitX
,
4
,
{
0
,
0
,
0
,
0
}
},
{
PropertyTagTypeLong
,
PropertyTagPixelPerUnitY
,
4
,
{
0
,
0
,
0
,
0
}
},
};
GpImage
*
image
=
load_image
(
png_hist
,
sizeof
(
png_hist
),
TRUE
,
FALSE
);
if
(
!
image
)
{
win_skip
(
"broken PNG histogram support
\n
"
);
return
;
}
winetest_push_context
(
"%s"
,
__FUNCTION__
);
check_properties_get_all
(
image
,
td
,
ARRAY_SIZE
(
td
),
NULL
,
0
,
~
0
);
winetest_pop_context
();
GdipDisposeImage
(
image
);
}
static
void
test_GdipLoadImageFromStream
(
void
)
{
IStream
*
stream
;
...
...
@@ -6159,6 +6191,7 @@ START_TEST(image)
test_png_save_palette
();
test_png_unit_properties
();
test_png_datetime_property
();
test_png_histogram_property
();
test_supported_encoders
();
test_CloneBitmapArea
();
test_ARGB_conversion
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment