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
20ae4187
Commit
20ae4187
authored
Feb 16, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Needed to allocate memory for the shadow surface if we needed to create one.
parent
3c7c3d8d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
SDL_compat.c
src/SDL_compat.c
+19
-10
No files found.
src/SDL_compat.c
View file @
20ae4187
...
...
@@ -847,14 +847,14 @@ SDL_WM_ToggleFullScreen(SDL_Surface * surface)
}
/* Copy the old bits out */
length
=
SDL_
VideoSurface
->
w
*
SDL_Video
Surface
->
format
->
BytesPerPixel
;
pixels
=
SDL_malloc
(
SDL_
Video
Surface
->
h
*
length
);
length
=
SDL_
PublicSurface
->
w
*
SDL_Public
Surface
->
format
->
BytesPerPixel
;
pixels
=
SDL_malloc
(
SDL_
Public
Surface
->
h
*
length
);
if
(
pixels
)
{
src
=
(
Uint8
*
)
SDL_
Video
Surface
->
pixels
;
src
=
(
Uint8
*
)
SDL_
Public
Surface
->
pixels
;
dst
=
(
Uint8
*
)
pixels
;
for
(
row
=
0
;
row
<
SDL_
Video
Surface
->
h
;
++
row
)
{
for
(
row
=
0
;
row
<
SDL_
Public
Surface
->
h
;
++
row
)
{
SDL_memcpy
(
dst
,
src
,
length
);
src
+=
SDL_
Video
Surface
->
pitch
;
src
+=
SDL_
Public
Surface
->
pitch
;
dst
+=
length
;
}
}
...
...
@@ -894,8 +894,8 @@ SDL_WM_ToggleFullScreen(SDL_Surface * surface)
SDL_VideoSurface
->
flags
&=
~
SDL_DONTFREE
;
SDL_FreeSurface
(
SDL_VideoSurface
);
SDL_free
(
SDL_ShadowSurface
->
pixels
);
SDL_ShadowSurface
->
flags
|=
SDL_PREALLOC
;
SDL_VideoSurface
=
SDL_ShadowSurface
;
SDL_VideoSurface
->
flags
|=
SDL_PREALLOC
;
SDL_ShadowSurface
=
NULL
;
}
else
{
/* No problem, just change the video surface format */
...
...
@@ -907,9 +907,18 @@ SDL_WM_ToggleFullScreen(SDL_Surface * surface)
}
else
{
/* We can make the video surface the shadow surface */
SDL_ShadowSurface
=
SDL_VideoSurface
;
SDL_ShadowSurface
->
pitch
=
SDL_CalculatePitch
(
SDL_ShadowSurface
);
SDL_ShadowSurface
->
pixels
=
SDL_malloc
(
SDL_ShadowSurface
->
h
*
SDL_ShadowSurface
->
pitch
);
if
(
!
SDL_ShadowSurface
->
pixels
)
{
/* Uh oh, we're hosed */
SDL_ShadowSurface
=
NULL
;
return
0
;
}
SDL_ShadowSurface
->
flags
&=
~
SDL_PREALLOC
;
SDL_VideoSurface
=
SDL_CreateRGBSurfaceFrom
(
NULL
,
0
,
0
,
32
,
0
,
0
,
0
,
0
,
0
);
SDL_VideoSurface
->
flags
=
SDL_ShadowSurface
->
flags
;
SDL_VideoSurface
->
flags
|=
SDL_PREALLOC
;
SDL_FreeFormat
(
SDL_VideoSurface
->
format
);
SDL_VideoSurface
->
format
=
SDL_WindowSurface
->
format
;
SDL_VideoSurface
->
format
->
refcount
++
;
...
...
@@ -928,13 +937,13 @@ SDL_WM_ToggleFullScreen(SDL_Surface * surface)
/* Copy the old bits back */
if
(
pixels
)
{
src
=
(
Uint8
*
)
pixels
;
dst
=
(
Uint8
*
)
SDL_
Video
Surface
->
pixels
;
for
(
row
=
0
;
row
<
SDL_
Video
Surface
->
h
;
++
row
)
{
dst
=
(
Uint8
*
)
SDL_
Public
Surface
->
pixels
;
for
(
row
=
0
;
row
<
SDL_
Public
Surface
->
h
;
++
row
)
{
SDL_memcpy
(
dst
,
src
,
length
);
src
+=
length
;
dst
+=
SDL_
Video
Surface
->
pitch
;
dst
+=
SDL_
Public
Surface
->
pitch
;
}
SDL_Flip
(
SDL_
Video
Surface
);
SDL_Flip
(
SDL_
Public
Surface
);
SDL_free
(
pixels
);
}
...
...
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