Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
d8392622
Commit
d8392622
authored
Mar 07, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better error reporting in allocating a pixel format.
parent
a1ac5f42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
SDL_pixels.c
src/video/SDL_pixels.c
+6
-9
No files found.
src/video/SDL_pixels.c
View file @
d8392622
...
...
@@ -85,7 +85,7 @@ SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask,
/* This function doesn't work with FourCC pixel formats */
if
(
SDL_ISPIXELFORMAT_FOURCC
(
format
))
{
SDL_SetError
(
"
Unknown pixel format
"
);
SDL_SetError
(
"
FOURCC pixel formats are not supported
"
);
return
SDL_FALSE
;
}
...
...
@@ -418,11 +418,6 @@ SDL_AllocFormat(Uint32 pixel_format)
{
SDL_PixelFormat
*
format
;
if
(
SDL_ISPIXELFORMAT_FOURCC
(
pixel_format
))
{
SDL_SetError
(
"FOURCC pixel formats are not supported"
);
return
NULL
;
}
/* Look it up in our list of previously allocated formats */
for
(
format
=
formats
;
format
;
format
=
format
->
next
)
{
if
(
pixel_format
==
format
->
format
)
{
...
...
@@ -435,9 +430,12 @@ SDL_AllocFormat(Uint32 pixel_format)
format
=
SDL_malloc
(
sizeof
(
*
format
));
if
(
format
==
NULL
)
{
SDL_OutOfMemory
();
return
(
NULL
);
return
NULL
;
}
if
(
SDL_InitFormat
(
format
,
pixel_format
)
<
0
)
{
SDL_free
(
format
);
return
NULL
;
}
SDL_InitFormat
(
format
,
pixel_format
);
if
(
!
SDL_ISPIXELFORMAT_INDEXED
(
pixel_format
))
{
/* Cache the RGB formats */
...
...
@@ -456,7 +454,6 @@ SDL_InitFormat(SDL_PixelFormat * format, Uint32 pixel_format)
if
(
!
SDL_PixelFormatEnumToMasks
(
pixel_format
,
&
bpp
,
&
Rmask
,
&
Gmask
,
&
Bmask
,
&
Amask
))
{
SDL_SetError
(
"Unknown pixel format"
);
return
-
1
;
}
...
...
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