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
a5a7d6c9
Commit
a5a7d6c9
authored
Oct 20, 2010
by
Vincent Povirk
Committed by
Alexandre Julliard
Oct 22, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Support Run-length encoded TGA images.
parent
a64400ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
2 deletions
+58
-2
tgaformat.c
dlls/windowscodecs/tgaformat.c
+58
-2
No files found.
dlls/windowscodecs/tgaformat.c
View file @
a5a7d6c9
...
...
@@ -577,6 +577,63 @@ static HRESULT WINAPI TgaDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface,
return
E_NOTIMPL
;
}
static
HRESULT
TgaDecoder_ReadRLE
(
TgaDecoder
*
This
,
BYTE
*
imagebits
,
int
datasize
)
{
int
i
=
0
,
j
,
bytesperpixel
;
ULONG
bytesread
;
HRESULT
hr
=
S_OK
;
bytesperpixel
=
This
->
header
.
depth
/
8
;
while
(
i
<
datasize
)
{
BYTE
rc
;
int
count
,
size
;
BYTE
pixeldata
[
4
];
hr
=
IStream_Read
(
This
->
stream
,
&
rc
,
1
,
&
bytesread
);
if
(
bytesread
!=
1
)
hr
=
E_FAIL
;
if
(
FAILED
(
hr
))
break
;
count
=
(
rc
&
0x7f
)
+
1
;
size
=
count
*
bytesperpixel
;
if
(
size
+
i
>
datasize
)
{
WARN
(
"RLE packet too large
\n
"
);
hr
=
E_FAIL
;
break
;
}
if
(
rc
&
0x80
)
{
/* Run-length packet */
hr
=
IStream_Read
(
This
->
stream
,
pixeldata
,
bytesperpixel
,
&
bytesread
);
if
(
bytesread
!=
bytesperpixel
)
hr
=
E_FAIL
;
if
(
FAILED
(
hr
))
break
;
if
(
bytesperpixel
==
1
)
memset
(
&
imagebits
[
i
],
pixeldata
[
0
],
count
);
else
{
for
(
j
=
0
;
j
<
count
;
j
++
)
memcpy
(
&
imagebits
[
i
+
j
*
bytesperpixel
],
pixeldata
,
bytesperpixel
);
}
}
else
{
/* Raw packet */
hr
=
IStream_Read
(
This
->
stream
,
&
imagebits
[
i
],
size
,
&
bytesread
);
if
(
bytesread
!=
size
)
hr
=
E_FAIL
;
if
(
FAILED
(
hr
))
break
;
}
i
+=
size
;
}
return
hr
;
}
static
HRESULT
TgaDecoder_ReadImage
(
TgaDecoder
*
This
)
{
HRESULT
hr
=
S_OK
;
...
...
@@ -614,8 +671,7 @@ static HRESULT TgaDecoder_ReadImage(TgaDecoder *This)
{
if
(
This
->
header
.
image_type
&
IMAGETYPE_RLE
)
{
FIXME
(
"RLE decoding not implemented
\n
"
);
hr
=
E_NOTIMPL
;
hr
=
TgaDecoder_ReadRLE
(
This
,
This
->
imagebits
,
datasize
);
}
else
{
...
...
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