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
ba0ff6d7
Commit
ba0ff6d7
authored
Feb 12, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a crash caused by the 1.2 code path getting a YV12 texture. :)
parent
e74e437b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
SDL_render.c
src/render/SDL_render.c
+17
-6
SDL_video.c
src/video/SDL_video.c
+2
-1
No files found.
src/render/SDL_render.c
View file @
ba0ff6d7
...
...
@@ -206,12 +206,22 @@ static Uint32
GetClosestSupportedFormat
(
SDL_Renderer
*
renderer
,
Uint32
format
)
{
Uint32
i
;
SDL_bool
hasAlpha
=
SDL_ISPIXELFORMAT_ALPHA
(
format
);
/* We just want to match the first format that has the same channels */
for
(
i
=
0
;
i
<
renderer
->
info
.
num_texture_formats
;
++
i
)
{
if
(
SDL_ISPIXELFORMAT_ALPHA
(
renderer
->
info
.
texture_formats
[
i
])
==
hasAlpha
)
{
return
renderer
->
info
.
texture_formats
[
i
];
if
(
SDL_ISPIXELFORMAT_FOURCC
(
format
))
{
/* Look for an exact match */
for
(
i
=
0
;
i
<
renderer
->
info
.
num_texture_formats
;
++
i
)
{
if
(
renderer
->
info
.
texture_formats
[
i
]
==
format
)
{
return
renderer
->
info
.
texture_formats
[
i
];
}
}
}
else
{
SDL_bool
hasAlpha
=
SDL_ISPIXELFORMAT_ALPHA
(
format
);
/* We just want to match the first format that has the same channels */
for
(
i
=
0
;
i
<
renderer
->
info
.
num_texture_formats
;
++
i
)
{
if
(
SDL_ISPIXELFORMAT_ALPHA
(
renderer
->
info
.
texture_formats
[
i
])
==
hasAlpha
)
{
return
renderer
->
info
.
texture_formats
[
i
];
}
}
}
return
renderer
->
info
.
texture_formats
[
0
];
...
...
@@ -313,7 +323,8 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
}
format
=
renderer
->
info
.
texture_formats
[
0
];
for
(
i
=
0
;
i
<
renderer
->
info
.
num_texture_formats
;
++
i
)
{
if
(
SDL_ISPIXELFORMAT_ALPHA
(
renderer
->
info
.
texture_formats
[
i
])
==
needAlpha
)
{
if
(
!
SDL_ISPIXELFORMAT_FOURCC
(
renderer
->
info
.
texture_formats
[
i
])
&&
SDL_ISPIXELFORMAT_ALPHA
(
renderer
->
info
.
texture_formats
[
i
])
==
needAlpha
)
{
format
=
renderer
->
info
.
texture_formats
[
i
];
break
;
}
...
...
src/video/SDL_video.c
View file @
ba0ff6d7
...
...
@@ -274,7 +274,8 @@ SDL_CreateWindowTexture(_THIS, SDL_Window * window, Uint32 * format, void ** pix
/* Find the first format without an alpha channel */
*
format
=
info
.
texture_formats
[
0
];
for
(
i
=
0
;
i
<
info
.
num_texture_formats
;
++
i
)
{
if
(
!
SDL_ISPIXELFORMAT_ALPHA
(
info
.
texture_formats
[
i
]))
{
if
(
!
SDL_ISPIXELFORMAT_FOURCC
(
info
.
texture_formats
[
i
])
&&
!
SDL_ISPIXELFORMAT_ALPHA
(
info
.
texture_formats
[
i
]))
{
*
format
=
info
.
texture_formats
[
i
];
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