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
57c8f6a4
Commit
57c8f6a4
authored
Aug 04, 2010
by
egottlieb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented shaped windows for Cocoa. Still need to see if they actually work.
parent
2d2a93ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
SDL_revision.h
include/SDL_revision.h
+0
-1
SDL_cocoashape.m
src/video/cocoa/SDL_cocoashape.m
+26
-2
No files found.
include/SDL_revision.h
deleted
100644 → 0
View file @
2d2a93ff
#define SDL_REVISION "hg-4526:d532a5a114cd"
src/video/cocoa/SDL_cocoashape.m
View file @
57c8f6a4
...
...
@@ -49,6 +49,23 @@ SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) {
return
result
;
}
typedef
struct
{
NSBezierPath
*
clipPath
;
SDL
_
Window
*
window
;
}
SDL
_
PathConglomeration
;
NSRect
convert
_
rect
(
SDL
_
Rect
rect
,
SDL
_
Window
*
window
)
{
NSRect
nsrect
=
NSMakeRect
(
rect
.
x
,
window
->
h
-
(
rect
.
y
+
rect
.
h
)
,
rect
.
w
,
rect
.
h
)
;
return
[[((
SDL
_
WindowData
*
)
window
->
driverdata
)
->
nswindow
contentView
]
convertRectFromBase
:
nsrect
]
;
}
void
ConglomerateShapeTree
(
SDL
_
ShapeTree
*
tree
,
SDL
_
PathConglomeration
cong
)
{
if
(
tree
->
kind
==
OpaqueShape
)
{
NSRect
rect
=
convert
_
rect
(
tree
->
data
.
shape
,
cong
->
window
)
;
[
cong
->
clipPath
appendBezierPathWithRect
:
rect
]
;
}
}
int
Cocoa
_
SetWindowShape
(
SDL
_
WindowShaper
*
shaper
,
SDL
_
Surface
*
shape
,
SDL
_
WindowShapeMode
*
shapeMode
)
{
SDL
_
ShapeData
*
data
=
(
SDL
_
ShapeData
*
)
shaper
->
driverdata
;
if
(
data
->
saved
==
SDL
_
TRUE
)
{
...
...
@@ -59,10 +76,17 @@ int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowS
[
data
->
context
saveGraphicsState
]
;
data
->
saved
=
SDL
_
TRUE
;
[[
NSColor
clearColor
]
set
]
;
NSRectFill
([[((
SDL
_
WindowData
*
)
shaper
->
window
->
driverdata
)
->
nswindow
contentView
]
frame
])
;
//
[[
NSColor
clearColor
]
set
]
;
//
NSRectFill
([[((
SDL
_
WindowData
*
)
shaper
->
window
->
driverdata
)
->
nswindow
contentView
]
frame
])
;
/*
TODO
:
It
looks
like
Cocoa
can
set
a
clipping
path
based
on
a
list
of
rectangles
.
That
'
s
what
we
get
from
the
Windoze
shape
-
calculation
code
:
a
list
of
rectangles
.
This
will
work
...
I
think
.
*/
NSBezierPath
*
clipPath
=
[
NSBezierPath
bezierPath
]
;
SDL
_
PathConglomeration
cong
=
{
clipPath
,
shaper
->
window
}
;
SDL
_
TraverseShapeTree
(
data
->
shape
,&
ConglomerateShapeTree
,
cong
)
;
[
clipPath
addClip
]
;
}
int
Cocoa
_
ResizeWindowShape
(
SDL
_
Window
*
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