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
14cca6ee
Commit
14cca6ee
authored
Sep 15, 2017
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Sep 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Add support for palette image formats to PNG encoder.
Signed-off-by:
Vincent Povirk
<
vincent@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
be1f61e2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
pngformat.c
dlls/windowscodecs/pngformat.c
+36
-0
regsvr.c
dlls/windowscodecs/regsvr.c
+4
-0
No files found.
dlls/windowscodecs/pngformat.c
View file @
14cca6ee
/*
* Copyright 2009 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
...
...
@@ -325,8 +326,10 @@ MAKE_FUNCPTR(png_set_gray_to_rgb);
MAKE_FUNCPTR
(
png_set_interlace_handling
);
MAKE_FUNCPTR
(
png_set_IHDR
);
MAKE_FUNCPTR
(
png_set_pHYs
);
MAKE_FUNCPTR
(
png_set_PLTE
);
MAKE_FUNCPTR
(
png_set_read_fn
);
MAKE_FUNCPTR
(
png_set_strip_16
);
MAKE_FUNCPTR
(
png_set_tRNS
);
MAKE_FUNCPTR
(
png_set_tRNS_to_alpha
);
MAKE_FUNCPTR
(
png_set_write_fn
);
MAKE_FUNCPTR
(
png_read_end
);
...
...
@@ -389,8 +392,10 @@ static void *load_libpng(void)
LOAD_FUNCPTR
(
png_set_interlace_handling
);
LOAD_FUNCPTR
(
png_set_IHDR
);
LOAD_FUNCPTR
(
png_set_pHYs
);
LOAD_FUNCPTR
(
png_set_PLTE
);
LOAD_FUNCPTR
(
png_set_read_fn
);
LOAD_FUNCPTR
(
png_set_strip_16
);
LOAD_FUNCPTR
(
png_set_tRNS
);
LOAD_FUNCPTR
(
png_set_tRNS_to_alpha
);
LOAD_FUNCPTR
(
png_set_write_fn
);
LOAD_FUNCPTR
(
png_read_end
);
...
...
@@ -1349,6 +1354,10 @@ static const struct png_pixelformat formats[] = {
{
&
GUID_WICPixelFormat32bppBGR
,
32
,
8
,
PNG_COLOR_TYPE_RGB
,
1
,
1
},
{
&
GUID_WICPixelFormat48bppRGB
,
48
,
16
,
PNG_COLOR_TYPE_RGB
,
0
,
0
},
{
&
GUID_WICPixelFormat64bppRGBA
,
64
,
16
,
PNG_COLOR_TYPE_RGB_ALPHA
,
0
,
0
},
{
&
GUID_WICPixelFormat1bppIndexed
,
1
,
1
,
PNG_COLOR_TYPE_PALETTE
,
0
,
0
},
{
&
GUID_WICPixelFormat2bppIndexed
,
2
,
2
,
PNG_COLOR_TYPE_PALETTE
,
0
,
0
},
{
&
GUID_WICPixelFormat4bppIndexed
,
4
,
4
,
PNG_COLOR_TYPE_PALETTE
,
0
,
0
},
{
&
GUID_WICPixelFormat8bppIndexed
,
8
,
8
,
PNG_COLOR_TYPE_PALETTE
,
0
,
0
},
{
NULL
},
};
...
...
@@ -1651,6 +1660,33 @@ static HRESULT WINAPI PngFrameEncode_WritePixels(IWICBitmapFrameEncode *iface,
(
This
->
yres
+
0
.
0127
)
/
0
.
0254
,
PNG_RESOLUTION_METER
);
}
if
(
This
->
format
->
color_type
==
PNG_COLOR_TYPE_PALETTE
&&
This
->
colors
)
{
png_color
png_palette
[
256
];
png_byte
trans
[
256
];
UINT
i
,
num_trans
=
0
,
colors
;
/* Newer libpng versions don't accept larger palettes than the declared
* bit depth, so we need to generate the palette of the correct length.
*/
colors
=
min
(
This
->
colors
,
1
<<
This
->
format
->
bit_depth
);
for
(
i
=
0
;
i
<
colors
;
i
++
)
{
png_palette
[
i
].
red
=
(
This
->
palette
[
i
]
>>
16
)
&
0xff
;
png_palette
[
i
].
green
=
(
This
->
palette
[
i
]
>>
8
)
&
0xff
;
png_palette
[
i
].
blue
=
This
->
palette
[
i
]
&
0xff
;
trans
[
i
]
=
(
This
->
palette
[
i
]
>>
24
)
&
0xff
;
if
(
trans
[
i
]
!=
0xff
)
num_trans
=
i
+
1
;
}
ppng_set_PLTE
(
This
->
png_ptr
,
This
->
info_ptr
,
png_palette
,
colors
);
if
(
num_trans
)
ppng_set_tRNS
(
This
->
png_ptr
,
This
->
info_ptr
,
trans
,
num_trans
,
NULL
);
}
ppng_write_info
(
This
->
png_ptr
,
This
->
info_ptr
);
if
(
This
->
format
->
remove_filler
)
...
...
dlls/windowscodecs/regsvr.c
View file @
14cca6ee
...
...
@@ -1359,6 +1359,10 @@ static GUID const * const png_encode_formats[] = {
&
GUID_WICPixelFormat32bppBGRA
,
&
GUID_WICPixelFormat48bppRGB
,
&
GUID_WICPixelFormat64bppRGBA
,
&
GUID_WICPixelFormat1bppIndexed
,
&
GUID_WICPixelFormat2bppIndexed
,
&
GUID_WICPixelFormat4bppIndexed
,
&
GUID_WICPixelFormat8bppIndexed
,
NULL
};
...
...
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