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
91e4d535
Commit
91e4d535
authored
Aug 05, 2010
by
egottlieb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correcting minor bugs and adding assertions to help me track down a NULL pointer bug in Cocoa code.
parent
f77e383d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
SDL_shape.c
src/video/SDL_shape.c
+2
-0
SDL_cocoashape.m
src/video/cocoa/SDL_cocoashape.m
+4
-3
SDL_x11shape.c
src/video/x11/SDL_x11shape.c
+5
-4
No files found.
src/video/SDL_shape.c
View file @
91e4d535
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "SDL_config.h"
#include "SDL_config.h"
#include "SDL.h"
#include "SDL.h"
#include "SDL_assert.h"
#include "SDL_video.h"
#include "SDL_video.h"
#include "SDL_sysvideo.h"
#include "SDL_sysvideo.h"
#include "SDL_pixels.h"
#include "SDL_pixels.h"
...
@@ -197,6 +198,7 @@ SDL_ShapeTree* SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shap
...
@@ -197,6 +198,7 @@ SDL_ShapeTree* SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shap
}
}
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
)
{
if
(
tree
->
kind
==
QuadShape
)
{
SDL_TraverseShapeTree
((
SDL_ShapeTree
*
)
tree
->
data
.
children
.
upleft
,
function
,
closure
);
SDL_TraverseShapeTree
((
SDL_ShapeTree
*
)
tree
->
data
.
children
.
upleft
,
function
,
closure
);
SDL_TraverseShapeTree
((
SDL_ShapeTree
*
)
tree
->
data
.
children
.
upright
,
function
,
closure
);
SDL_TraverseShapeTree
((
SDL_ShapeTree
*
)
tree
->
data
.
children
.
upright
,
function
,
closure
);
...
...
src/video/cocoa/SDL_cocoashape.m
View file @
91e4d535
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
SDL
_
WindowShaper
*
Cocoa
_
CreateShaper
(
SDL
_
Window
*
window
)
{
SDL
_
WindowShaper
*
Cocoa
_
CreateShaper
(
SDL
_
Window
*
window
)
{
SDL
_
WindowData
*
data
=
(
SDL
_
WindowData
*
)
window
->
driverdata
;
SDL
_
WindowData
*
data
=
(
SDL
_
WindowData
*
)
window
->
driverdata
;
[
data
->
nswindow
setAlpha
:
1.0
]
;
[
data
->
nswindow
setAlpha
Value
:
1.0
]
;
[
data
->
nswindow
setOpaque
:
YES
]
;
[
data
->
nswindow
setOpaque
:
YES
]
;
[
data
->
nswindow
setStyleMask
:
NSBorderlessWindowMask
]
;
[
data
->
nswindow
setStyleMask
:
NSBorderlessWindowMask
]
;
SDL
_
WindowShaper
*
result
=
SDL
_
malloc
(
sizeof
(
SDL
_
WindowShaper
))
;
SDL
_
WindowShaper
*
result
=
SDL
_
malloc
(
sizeof
(
SDL
_
WindowShaper
))
;
...
@@ -45,7 +45,7 @@ SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) {
...
@@ -45,7 +45,7 @@ SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) {
shape
_
data
->
shape
=
NULL
;
shape
_
data
->
shape
=
NULL
;
int
resized
_
properly
=
Cocoa
_
ResizeWindowShape
(
window
)
;
int
resized
_
properly
=
Cocoa
_
ResizeWindowShape
(
window
)
;
assert
(
resized
_
properly
==
0
)
;
SDL
_
assert
(
resized
_
properly
==
0
)
;
return
result
;
return
result
;
}
}
...
@@ -60,6 +60,7 @@ NSRect convert_rect(SDL_Rect rect,SDL_Window* window) {
...
@@ -60,6 +60,7 @@ NSRect convert_rect(SDL_Rect rect,SDL_Window* window) {
}
}
void
ConglomerateShapeTree
(
SDL
_
ShapeTree
*
tree
,
SDL
_
PathConglomeration
*
cong
)
{
void
ConglomerateShapeTree
(
SDL
_
ShapeTree
*
tree
,
SDL
_
PathConglomeration
*
cong
)
{
SDL
_
assert
(
tree
!=
NULL
)
;
if
(
tree
->
kind
==
OpaqueShape
)
{
if
(
tree
->
kind
==
OpaqueShape
)
{
NSRect
rect
=
convert
_
rect
(
tree
->
data
.
shape
,
cong
->
window
)
;
NSRect
rect
=
convert
_
rect
(
tree
->
data
.
shape
,
cong
->
window
)
;
[
cong
->
clipPath
appendBezierPathWithRect
:
rect
]
;
[
cong
->
clipPath
appendBezierPathWithRect
:
rect
]
;
...
@@ -91,7 +92,7 @@ int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowS
...
@@ -91,7 +92,7 @@ int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowS
int
Cocoa
_
ResizeWindowShape
(
SDL
_
Window
*
window
)
{
int
Cocoa
_
ResizeWindowShape
(
SDL
_
Window
*
window
)
{
SDL
_
ShapeData
*
data
=
window
->
shaper
->
driverdata
;
SDL
_
ShapeData
*
data
=
window
->
shaper
->
driverdata
;
assert
(
data
!=
NULL
)
;
SDL
_
assert
(
data
!=
NULL
)
;
if
(
data
->
shape
!=
NULL
)
if
(
data
->
shape
!=
NULL
)
SDL
_
FreeShapeTree
(
&
data
->
shape
)
;
SDL
_
FreeShapeTree
(
&
data
->
shape
)
;
...
...
src/video/x11/SDL_x11shape.c
View file @
91e4d535
...
@@ -20,7 +20,8 @@
...
@@ -20,7 +20,8 @@
eligottlieb@gmail.com
eligottlieb@gmail.com
*/
*/
#include <assert.h>
#include "SDL_assert.h"
#include "SDL_malloc.h"
#include "SDL_x11video.h"
#include "SDL_x11video.h"
#include "SDL_x11shape.h"
#include "SDL_x11shape.h"
#include "SDL_x11window.h"
#include "SDL_x11window.h"
...
@@ -39,13 +40,13 @@ SDL_WindowShaper* X11_CreateShaper(SDL_Window* window) {
...
@@ -39,13 +40,13 @@ SDL_WindowShaper* X11_CreateShaper(SDL_Window* window) {
result
->
mode
.
mode
=
ShapeModeDefault
;
result
->
mode
.
mode
=
ShapeModeDefault
;
result
->
mode
.
parameters
.
binarizationCutoff
=
1
;
result
->
mode
.
parameters
.
binarizationCutoff
=
1
;
result
->
usershownflag
=
0
;
result
->
usershownflag
=
0
;
SDL_ShapeData
*
data
=
malloc
(
sizeof
(
SDL_ShapeData
));
SDL_ShapeData
*
data
=
SDL_
malloc
(
sizeof
(
SDL_ShapeData
));
result
->
driverdata
=
data
;
result
->
driverdata
=
data
;
data
->
bitmapsize
=
0
;
data
->
bitmapsize
=
0
;
data
->
bitmap
=
NULL
;
data
->
bitmap
=
NULL
;
window
->
shaper
=
result
;
window
->
shaper
=
result
;
int
resized_properly
=
X11_ResizeWindowShape
(
window
);
int
resized_properly
=
X11_ResizeWindowShape
(
window
);
assert
(
resized_properly
==
0
);
SDL_
assert
(
resized_properly
==
0
);
}
}
#endif
#endif
...
@@ -54,7 +55,7 @@ SDL_WindowShaper* X11_CreateShaper(SDL_Window* window) {
...
@@ -54,7 +55,7 @@ SDL_WindowShaper* X11_CreateShaper(SDL_Window* window) {
int
X11_ResizeWindowShape
(
SDL_Window
*
window
)
{
int
X11_ResizeWindowShape
(
SDL_Window
*
window
)
{
SDL_ShapeData
*
data
=
window
->
shaper
->
driverdata
;
SDL_ShapeData
*
data
=
window
->
shaper
->
driverdata
;
assert
(
data
!=
NULL
);
SDL_
assert
(
data
!=
NULL
);
unsigned
int
bitmapsize
=
window
->
w
/
8
;
unsigned
int
bitmapsize
=
window
->
w
/
8
;
if
(
window
->
w
%
8
>
0
)
if
(
window
->
w
%
8
>
0
)
...
...
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