Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
218fdaea
Commit
218fdaea
authored
5 years ago
by
Lactozilla
Browse files
Options
Downloads
Patches
Plain Diff
Fix patch conversion
parent
d5c44350
No related branches found
No related tags found
1 merge request
!675
PNG conversion refactoring
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/r_picformats.c
+16
-7
16 additions, 7 deletions
src/r_picformats.c
src/r_plane.c
+1
-1
1 addition, 1 deletion
src/r_plane.c
with
17 additions
and
8 deletions
src/r_picformats.c
+
16
−
7
View file @
218fdaea
...
...
@@ -926,9 +926,15 @@ void *Picture_PNGConvert(
png_bytep
*
row_pointers
=
PNG_Read
(
png
,
w
,
h
,
topoffset
,
leftoffset
,
insize
);
png_uint_32
width
=
*
w
,
height
=
*
h
;
outbpp
=
Picture_FormatBPP
(
outformat
);
if
(
!
outbpp
)
I_Error
(
"Picture_PNGConvert: unknown output bits per pixel?!"
);
// Hack for patches because you'll want to preserve transparency.
if
(
Picture_IsPatchFormat
(
outformat
))
outbpp
=
16
;
else
{
outbpp
=
Picture_FormatBPP
(
outformat
);
if
(
!
outbpp
)
I_Error
(
"Picture_PNGConvert: unknown output bits per pixel?!"
);
}
// Figure out the size
flatsize
=
(
width
*
height
)
*
(
outbpp
/
8
);
...
...
@@ -936,7 +942,9 @@ void *Picture_PNGConvert(
*
outsize
=
flatsize
;
// Convert the image
flat
=
Z_Malloc
(
flatsize
,
PU_STATIC
,
NULL
);
flat
=
Z_Calloc
(
flatsize
,
PU_STATIC
,
NULL
);
// Set transparency
if
(
outbpp
==
8
)
memset
(
flat
,
TRANSPARENTPIXEL
,
(
width
*
height
));
...
...
@@ -980,7 +988,7 @@ void *Picture_PNGConvert(
}
}
// Free the row pointers that
libpng
allocated.
// Free the row pointers that
we
allocated
for libpng
.
free
(
row_pointers
);
// But wait, there's more!
...
...
@@ -990,7 +998,7 @@ void *Picture_PNGConvert(
pictureformat_t
informat
=
PICFMT_NONE
;
INT16
patleftoffset
=
0
,
pattopoffset
=
0
;
// Figure out the
input form
at, from the bitdepth of the
in
put format
// Figure out the
format of the fl
at, from the bit
depth of the
out
put format
switch
(
outbpp
)
{
case
32
:
...
...
@@ -1000,7 +1008,7 @@ void *Picture_PNGConvert(
informat
=
PICFMT_FLAT16
;
break
;
default:
informat
=
PICFMT_FLAT
;
// Assumed 8bpp
informat
=
PICFMT_FLAT
;
break
;
}
...
...
@@ -1016,6 +1024,7 @@ void *Picture_PNGConvert(
return
converted
;
}
// Return the converted flat!
return
flat
;
}
...
...
This diff is collapsed.
Click to expand it.
src/r_plane.c
+
1
−
1
View file @
218fdaea
...
...
@@ -824,7 +824,7 @@ static UINT8 *R_GetTextureFlat(levelflat_t *levelflat, boolean leveltexture, boo
{
INT32
pngwidth
,
pngheight
;
levelflat
->
flatpatch
=
Picture_PNGConvert
(
ds_source
,
PICFMT_FLAT
32
,
&
pngwidth
,
&
pngheight
,
NULL
,
NULL
,
W_LumpLength
(
levelflat
->
u
.
flat
.
lumpnum
),
NULL
,
0
);
levelflat
->
flatpatch
=
Picture_PNGConvert
(
ds_source
,
PICFMT_FLAT
,
&
pngwidth
,
&
pngheight
,
NULL
,
NULL
,
W_LumpLength
(
levelflat
->
u
.
flat
.
lumpnum
),
NULL
,
0
);
levelflat
->
topoffset
=
levelflat
->
leftoffset
=
0
;
levelflat
->
width
=
(
UINT16
)
pngwidth
;
levelflat
->
height
=
(
UINT16
)
pngheight
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment