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
f294cf6a
Commit
f294cf6a
authored
Aug 10, 2010
by
Eli Gottlieb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed formatting of SDL_shape.c post-merge again.
parent
4e4cf1ce
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
224 additions
and
214 deletions
+224
-214
SDL_shape.c
src/video/SDL_shape.c
+224
-214
No files found.
src/video/SDL_shape.c
View file @
f294cf6a
...
...
@@ -30,7 +30,8 @@
#include "SDL_shape.h"
#include "SDL_shape_internals.h"
SDL_Window
*
SDL_CreateShapedWindow
(
const
char
*
title
,
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
w
,
unsigned
int
h
,
Uint32
flags
)
{
SDL_Window
*
SDL_CreateShapedWindow
(
const
char
*
title
,
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
w
,
unsigned
int
h
,
Uint32
flags
)
{
SDL_Window
*
result
=
SDL_CreateWindow
(
title
,
x
,
y
,
w
,
h
,
SDL_WINDOW_BORDERLESS
|
flags
&
!
SDL_WINDOW_FULLSCREEN
&
!
SDL_WINDOW_SHOWN
);
if
(
result
!=
NULL
)
{
result
->
shaper
=
result
->
display
->
device
->
shape_driver
.
CreateShaper
(
result
);
...
...
@@ -50,7 +51,8 @@ SDL_Window* SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int
return
NULL
;
}
SDL_bool
SDL_IsShapedWindow
(
const
SDL_Window
*
window
)
{
SDL_bool
SDL_IsShapedWindow
(
const
SDL_Window
*
window
)
{
if
(
window
==
NULL
)
return
SDL_FALSE
;
else
...
...
@@ -58,7 +60,8 @@ SDL_bool SDL_IsShapedWindow(const SDL_Window *window) {
}
/* REQUIRES that bitmap point to a w-by-h bitmap with ppb pixels-per-byte. */
void
SDL_CalculateShapeBitmap
(
SDL_WindowShapeMode
mode
,
SDL_Surface
*
shape
,
Uint8
*
bitmap
,
Uint8
ppb
)
{
void
SDL_CalculateShapeBitmap
(
SDL_WindowShapeMode
mode
,
SDL_Surface
*
shape
,
Uint8
*
bitmap
,
Uint8
ppb
)
{
int
x
=
0
;
int
y
=
0
;
Uint8
r
=
0
,
g
=
0
,
b
=
0
,
alpha
=
0
;
...
...
@@ -111,7 +114,8 @@ void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8*
SDL_UnlockSurface
(
shape
);
}
SDL_ShapeTree
*
RecursivelyCalculateShapeTree
(
SDL_WindowShapeMode
mode
,
SDL_Surface
*
mask
,
SDL_Rect
dimensions
)
{
SDL_ShapeTree
*
RecursivelyCalculateShapeTree
(
SDL_WindowShapeMode
mode
,
SDL_Surface
*
mask
,
SDL_Rect
dimensions
)
{
int
x
=
0
,
y
=
0
;
Uint8
*
pixel
=
NULL
;
Uint32
pixel_value
=
0
;
...
...
@@ -184,7 +188,8 @@ SDL_ShapeTree* RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surfac
return
result
;
}
SDL_ShapeTree
*
SDL_CalculateShapeTree
(
SDL_WindowShapeMode
mode
,
SDL_Surface
*
shape
)
{
SDL_ShapeTree
*
SDL_CalculateShapeTree
(
SDL_WindowShapeMode
mode
,
SDL_Surface
*
shape
)
{
SDL_Rect
dimensions
=
{
0
,
0
,
shape
->
w
,
shape
->
h
};
SDL_ShapeTree
*
result
=
NULL
;
if
(
SDL_MUSTLOCK
(
shape
))
...
...
@@ -195,7 +200,8 @@ SDL_ShapeTree* SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shap
return
result
;
}
void
SDL_TraverseShapeTree
(
SDL_ShapeTree
*
tree
,
SDL_TraversalFunction
function
,
void
*
closure
)
{
void
SDL_TraverseShapeTree
(
SDL_ShapeTree
*
tree
,
SDL_TraversalFunction
function
,
void
*
closure
)
{
SDL_assert
(
tree
!=
NULL
);
if
(
tree
->
kind
==
QuadShape
)
{
SDL_TraverseShapeTree
((
SDL_ShapeTree
*
)
tree
->
data
.
children
.
upleft
,
function
,
closure
);
...
...
@@ -207,7 +213,8 @@ void SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,vo
function
(
tree
,
closure
);
}
void
SDL_FreeShapeTree
(
SDL_ShapeTree
**
shapeTree
)
{
void
SDL_FreeShapeTree
(
SDL_ShapeTree
**
shapeTree
)
{
if
((
*
shapeTree
)
->
kind
==
QuadShape
)
{
SDL_FreeShapeTree
((
SDL_ShapeTree
**
)
&
(
*
shapeTree
)
->
data
.
children
.
upleft
);
SDL_FreeShapeTree
((
SDL_ShapeTree
**
)
&
(
*
shapeTree
)
->
data
.
children
.
upright
);
...
...
@@ -218,7 +225,8 @@ void SDL_FreeShapeTree(SDL_ShapeTree** shapeTree) {
*
shapeTree
=
NULL
;
}
int
SDL_SetWindowShape
(
SDL_Window
*
window
,
SDL_Surface
*
shape
,
SDL_WindowShapeMode
*
shapeMode
)
{
int
SDL_SetWindowShape
(
SDL_Window
*
window
,
SDL_Surface
*
shape
,
SDL_WindowShapeMode
*
shapeMode
)
{
int
result
;
if
(
window
==
NULL
||
!
SDL_IsShapedWindow
(
window
))
//The window given was not a shapeable window.
...
...
@@ -239,13 +247,15 @@ int SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode
return
result
;
}
SDL_bool
SDL_WindowHasAShape
(
SDL_Window
*
window
)
{
SDL_bool
SDL_WindowHasAShape
(
SDL_Window
*
window
)
{
if
(
window
==
NULL
||
!
SDL_IsShapedWindow
(
window
))
return
SDL_FALSE
;
return
window
->
shaper
->
hasshape
;
}
int
SDL_GetShapedWindowMode
(
SDL_Window
*
window
,
SDL_WindowShapeMode
*
shapeMode
)
{
int
SDL_GetShapedWindowMode
(
SDL_Window
*
window
,
SDL_WindowShapeMode
*
shapeMode
)
{
if
(
window
!=
NULL
&&
SDL_IsShapedWindow
(
window
))
{
if
(
shapeMode
==
NULL
)
{
if
(
SDL_WindowHasAShape
(
window
))
...
...
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