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
25775cdb
Commit
25775cdb
authored
Aug 10, 2010
by
Eli Gottlieb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug in X11 shaping that refused to use color-key mode.
parent
5f2c8902
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
SDL_shape.h
include/SDL_shape.h
+3
-0
SDL_shape.c
src/video/SDL_shape.c
+1
-2
SDL_x11shape.c
src/video/x11/SDL_x11shape.c
+2
-2
No files found.
include/SDL_shape.h
View file @
25775cdb
...
@@ -89,6 +89,9 @@ typedef enum {
...
@@ -89,6 +89,9 @@ typedef enum {
/** \brief A color key is applied. */
/** \brief A color key is applied. */
ShapeModeColorKey
ShapeModeColorKey
}
WindowShapeMode
;
}
WindowShapeMode
;
#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
/** \brief A union containing parameters for shaped windows. */
/** \brief A union containing parameters for shaped windows. */
typedef
union
{
typedef
union
{
/** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
/** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
...
...
src/video/SDL_shape.c
View file @
25775cdb
...
@@ -104,7 +104,7 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm
...
@@ -104,7 +104,7 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm
break
;
break
;
case
(
ShapeModeColorKey
):
case
(
ShapeModeColorKey
):
key
=
mode
.
parameters
.
colorKey
;
key
=
mode
.
parameters
.
colorKey
;
mask_value
=
((
key
.
r
!=
r
&&
key
.
g
!=
g
&&
key
.
b
!=
b
)
?
1
:
0
);
mask_value
=
((
key
.
r
!=
r
||
key
.
g
!=
g
||
key
.
b
!=
b
)
?
1
:
0
);
break
;
break
;
}
}
bitmap
[
bitmap_pixel
/
ppb
]
|=
mask_value
<<
(
7
-
((
ppb
-
1
)
-
(
bitmap_pixel
%
ppb
)));
bitmap
[
bitmap_pixel
/
ppb
]
|=
mask_value
<<
(
7
-
((
ppb
-
1
)
-
(
bitmap_pixel
%
ppb
)));
...
@@ -237,7 +237,6 @@ SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *sh
...
@@ -237,7 +237,6 @@ SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *sh
if
(
shapeMode
!=
NULL
)
if
(
shapeMode
!=
NULL
)
window
->
shaper
->
mode
=
*
shapeMode
;
window
->
shaper
->
mode
=
*
shapeMode
;
//TODO: Platform-specific implementations of SetWindowShape. X11 is finished. Win32 is finished. Debugging is in progress on both.
result
=
window
->
display
->
device
->
shape_driver
.
SetWindowShape
(
window
->
shaper
,
shape
,
shapeMode
);
result
=
window
->
display
->
device
->
shape_driver
.
SetWindowShape
(
window
->
shaper
,
shape
,
shapeMode
);
window
->
shaper
->
hasshape
=
SDL_TRUE
;
window
->
shaper
->
hasshape
=
SDL_TRUE
;
if
((
window
->
shaper
->
usershownflag
&
SDL_WINDOW_SHOWN
)
==
SDL_WINDOW_SHOWN
)
{
if
((
window
->
shaper
->
usershownflag
&
SDL_WINDOW_SHOWN
)
==
SDL_WINDOW_SHOWN
)
{
...
...
src/video/x11/SDL_x11shape.c
View file @
25775cdb
...
@@ -81,12 +81,12 @@ X11_ResizeWindowShape(SDL_Window* window) {
...
@@ -81,12 +81,12 @@ X11_ResizeWindowShape(SDL_Window* window) {
}
}
int
int
X11_SetWindowShape
(
SDL_WindowShaper
*
shaper
,
SDL_Surface
*
shape
,
SDL_WindowShapeMode
*
shape
M
ode
)
{
X11_SetWindowShape
(
SDL_WindowShaper
*
shaper
,
SDL_Surface
*
shape
,
SDL_WindowShapeMode
*
shape
_m
ode
)
{
if
(
shaper
==
NULL
||
shape
==
NULL
||
shaper
->
driverdata
==
NULL
)
if
(
shaper
==
NULL
||
shape
==
NULL
||
shaper
->
driverdata
==
NULL
)
return
-
1
;
return
-
1
;
#if SDL_VIDEO_DRIVER_X11_XSHAPE
#if SDL_VIDEO_DRIVER_X11_XSHAPE
if
(
!
SDL_ISPIXELFORMAT_ALPHA
(
SDL_MasksToPixelFormatEnum
(
shape
->
format
->
BitsPerPixel
,
shape
->
format
->
Rmask
,
shape
->
format
->
Gmask
,
shape
->
format
->
Bmask
,
shape
->
format
->
Amask
)
))
if
(
shape
->
format
->
Amask
==
0
&&
SDL_SHAPEMODEALPHA
(
shape_mode
->
mode
))
return
-
2
;
return
-
2
;
if
(
shape
->
w
!=
shaper
->
window
->
w
||
shape
->
h
!=
shaper
->
window
->
h
)
if
(
shape
->
w
!=
shaper
->
window
->
w
||
shape
->
h
!=
shaper
->
window
->
h
)
return
-
3
;
return
-
3
;
...
...
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