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
373a02c6
Commit
373a02c6
authored
Mar 16, 2016
by
Bruno Jesus
Committed by
Alexandre Julliard
Mar 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msrle32: Use the correct number of colors when biClrUsed = 0.
Signed-off-by:
Bruno Jesus
<
00cpxxx@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7b8929e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
10 deletions
+24
-10
msrle32.c
dlls/msrle32/msrle32.c
+24
-10
No files found.
dlls/msrle32/msrle32.c
View file @
373a02c6
...
...
@@ -1567,8 +1567,16 @@ static LRESULT DecompressGetFormat(CodecInfo *pi, LPCBITMAPINFOHEADER lpbiIn,
size
=
lpbiIn
->
biSize
;
if
(
lpbiIn
->
biBitCount
<=
8
)
size
+=
lpbiIn
->
biClrUsed
*
sizeof
(
RGBQUAD
);
if
(
lpbiIn
->
biBitCount
<=
8
)
{
int
colors
;
if
(
lpbiIn
->
biClrUsed
==
0
)
colors
=
1
<<
lpbiIn
->
biBitCount
;
else
colors
=
lpbiIn
->
biClrUsed
;
size
+=
colors
*
sizeof
(
RGBQUAD
);
}
if
(
lpbiOut
!=
NULL
)
{
memcpy
(
lpbiOut
,
lpbiIn
,
size
);
...
...
@@ -1647,27 +1655,33 @@ static LRESULT DecompressBegin(CodecInfo *pi, LPCBITMAPINFOHEADER lpbiIn,
if
(
lpbiIn
->
biCompression
!=
BI_RGB
)
{
int
colors
;
if
(
lpbiIn
->
biBitCount
<=
8
&&
lpbiIn
->
biClrUsed
==
0
)
colors
=
1
<<
lpbiIn
->
biBitCount
;
else
colors
=
lpbiIn
->
biClrUsed
;
rgbIn
=
(
const
RGBQUAD
*
)((
const
BYTE
*
)
lpbiIn
+
lpbiIn
->
biSize
);
rgbOut
=
(
const
RGBQUAD
*
)((
const
BYTE
*
)
lpbiOut
+
lpbiOut
->
biSize
);
switch
(
lpbiOut
->
biBitCount
)
{
case
4
:
case
8
:
pi
->
palette_map
=
LocalAlloc
(
LPTR
,
lpbiIn
->
biClrUsed
);
pi
->
palette_map
=
LocalAlloc
(
LPTR
,
colors
);
if
(
pi
->
palette_map
==
NULL
)
return
ICERR_MEMORY
;
for
(
i
=
0
;
i
<
lpbiIn
->
biClrUsed
;
i
++
)
{
pi
->
palette_map
[
i
]
=
MSRLE32_GetNearestPaletteIndex
(
lpbiOut
->
biClrUsed
,
rgbOut
,
rgbIn
[
i
]);
}
for
(
i
=
0
;
i
<
colors
;
i
++
)
pi
->
palette_map
[
i
]
=
MSRLE32_GetNearestPaletteIndex
(
colors
,
rgbOut
,
rgbIn
[
i
]);
break
;
case
15
:
case
16
:
pi
->
palette_map
=
LocalAlloc
(
LPTR
,
lpbiIn
->
biClrUsed
*
2
);
pi
->
palette_map
=
LocalAlloc
(
LPTR
,
colors
*
2
);
if
(
pi
->
palette_map
==
NULL
)
return
ICERR_MEMORY
;
for
(
i
=
0
;
i
<
lpbiIn
->
biClrUsed
;
i
++
)
{
for
(
i
=
0
;
i
<
colors
;
i
++
)
{
WORD
color
;
if
(
lpbiOut
->
biBitCount
==
15
)
...
...
@@ -1683,10 +1697,10 @@ static LRESULT DecompressBegin(CodecInfo *pi, LPCBITMAPINFOHEADER lpbiIn,
break
;
case
24
:
case
32
:
pi
->
palette_map
=
LocalAlloc
(
LPTR
,
lpbiIn
->
biClrUsed
*
sizeof
(
RGBQUAD
));
pi
->
palette_map
=
LocalAlloc
(
LPTR
,
colors
*
sizeof
(
RGBQUAD
));
if
(
pi
->
palette_map
==
NULL
)
return
ICERR_MEMORY
;
memcpy
(
pi
->
palette_map
,
rgbIn
,
lpbiIn
->
biClrUsed
*
sizeof
(
RGBQUAD
));
memcpy
(
pi
->
palette_map
,
rgbIn
,
colors
*
sizeof
(
RGBQUAD
));
break
;
};
}
...
...
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