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
a1ac5f42
Commit
a1ac5f42
authored
Mar 07, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed garbage trying to create a FourCC pixel format.
parent
61b11f87
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
63 deletions
+58
-63
SDL_pixels.c
src/video/SDL_pixels.c
+58
-63
No files found.
src/video/SDL_pixels.c
View file @
a1ac5f42
...
...
@@ -83,6 +83,12 @@ SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask,
{
Uint32
masks
[
4
];
/* This function doesn't work with FourCC pixel formats */
if
(
SDL_ISPIXELFORMAT_FOURCC
(
format
))
{
SDL_SetError
(
"Unknown pixel format"
);
return
SDL_FALSE
;
}
/* Initialize the values here */
if
(
SDL_BYTESPERPIXEL
(
format
)
<=
2
)
{
*
bpp
=
SDL_BITSPERPIXEL
(
format
);
...
...
@@ -444,26 +450,6 @@ SDL_AllocFormat(Uint32 pixel_format)
int
SDL_InitFormat
(
SDL_PixelFormat
*
format
,
Uint32
pixel_format
)
{
/* Set up the format */
SDL_zerop
(
format
);
format
->
format
=
pixel_format
;
format
->
BitsPerPixel
=
SDL_BITSPERPIXEL
(
pixel_format
);
format
->
BytesPerPixel
=
SDL_BYTESPERPIXEL
(
pixel_format
);
if
(
SDL_ISPIXELFORMAT_INDEXED
(
pixel_format
))
{
/* Palettized formats have no mask info */
format
->
Rloss
=
8
;
format
->
Gloss
=
8
;
format
->
Bloss
=
8
;
format
->
Aloss
=
8
;
format
->
Rshift
=
0
;
format
->
Gshift
=
0
;
format
->
Bshift
=
0
;
format
->
Ashift
=
0
;
format
->
Rmask
=
0
;
format
->
Gmask
=
0
;
format
->
Bmask
=
0
;
format
->
Amask
=
0
;
}
else
{
int
bpp
;
Uint32
Rmask
,
Gmask
,
Bmask
,
Amask
;
Uint32
mask
;
...
...
@@ -474,6 +460,13 @@ SDL_InitFormat(SDL_PixelFormat * format, Uint32 pixel_format)
return
-
1
;
}
/* Set up the format */
SDL_zerop
(
format
);
format
->
format
=
pixel_format
;
format
->
BitsPerPixel
=
bpp
;
format
->
BytesPerPixel
=
(
bpp
+
7
)
/
8
;
format
->
Rmask
=
Rmask
;
format
->
Rshift
=
0
;
format
->
Rloss
=
8
;
if
(
Rmask
)
{
...
...
@@ -482,6 +475,8 @@ SDL_InitFormat(SDL_PixelFormat * format, Uint32 pixel_format)
for
(;
(
mask
&
0x01
);
mask
>>=
1
)
--
format
->
Rloss
;
}
format
->
Gmask
=
Gmask
;
format
->
Gshift
=
0
;
format
->
Gloss
=
8
;
if
(
Gmask
)
{
...
...
@@ -490,6 +485,8 @@ SDL_InitFormat(SDL_PixelFormat * format, Uint32 pixel_format)
for
(;
(
mask
&
0x01
);
mask
>>=
1
)
--
format
->
Gloss
;
}
format
->
Bmask
=
Bmask
;
format
->
Bshift
=
0
;
format
->
Bloss
=
8
;
if
(
Bmask
)
{
...
...
@@ -498,6 +495,8 @@ SDL_InitFormat(SDL_PixelFormat * format, Uint32 pixel_format)
for
(;
(
mask
&
0x01
);
mask
>>=
1
)
--
format
->
Bloss
;
}
format
->
Amask
=
Amask
;
format
->
Ashift
=
0
;
format
->
Aloss
=
8
;
if
(
Amask
)
{
...
...
@@ -506,11 +505,7 @@ SDL_InitFormat(SDL_PixelFormat * format, Uint32 pixel_format)
for
(;
(
mask
&
0x01
);
mask
>>=
1
)
--
format
->
Aloss
;
}
format
->
Rmask
=
Rmask
;
format
->
Gmask
=
Gmask
;
format
->
Bmask
=
Bmask
;
format
->
Amask
=
Amask
;
}
format
->
palette
=
NULL
;
format
->
refcount
=
1
;
format
->
next
=
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