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
6ec0ef31
Commit
6ec0ef31
authored
Jul 21, 2010
by
Sunny Sachanandani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get SDL_BLENDMODE_MOD to work! Tested on nvidia only ATM.
parent
69847c86
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
43 deletions
+43
-43
SDL_x11render.c
src/video/x11/SDL_x11render.c
+43
-43
No files found.
src/video/x11/SDL_x11render.c
View file @
6ec0ef31
...
@@ -380,20 +380,20 @@ X11_CreateRenderer(SDL_Window * window, Uint32 flags)
...
@@ -380,20 +380,20 @@ X11_CreateRenderer(SDL_Window * window, Uint32 flags)
(
SDL_BLENDMODE_BLEND
|
SDL_BLENDMODE_ADD
|
SDL_BLENDMODE_MASK
|
SDL_BLENDMODE_MOD
);
(
SDL_BLENDMODE_BLEND
|
SDL_BLENDMODE_ADD
|
SDL_BLENDMODE_MASK
|
SDL_BLENDMODE_MOD
);
/* Create a clip mask that is used for rendering primitives. */
/* Create a clip mask that is used for rendering primitives. */
data
->
stencil
=
XCreatePixmap
(
data
->
display
,
data
->
xwindow
,
data
->
stencil
=
XCreatePixmap
(
data
->
display
,
data
->
xwindow
,
window
->
w
,
window
->
h
,
8
);
window
->
w
,
window
->
h
,
32
);
/* Create the GC for the clip mask. */
/* Create the GC for the clip mask. */
data
->
stencil_gc
=
XCreateGC
(
data
->
display
,
data
->
stencil
,
data
->
stencil_gc
=
XCreateGC
(
data
->
display
,
data
->
stencil
,
GCGraphicsExposures
,
&
gcv
);
GCGraphicsExposures
,
&
gcv
);
XSetBackground
(
data
->
display
,
data
->
stencil_gc
,
0
x00
);
XSetBackground
(
data
->
display
,
data
->
stencil_gc
,
0
);
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0
x00
);
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0
);
XFillRectangle
(
data
->
display
,
data
->
stencil
,
data
->
stencil_gc
,
XFillRectangle
(
data
->
display
,
data
->
stencil
,
data
->
stencil_gc
,
0
,
0
,
window
->
w
,
window
->
h
);
0
,
0
,
window
->
w
,
window
->
h
);
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0xFF
);
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0xFF
FFFFFF
);
data
->
stencil_pict
=
data
->
stencil_pict
=
XRenderCreatePicture
(
data
->
display
,
data
->
stencil
,
XRenderCreatePicture
(
data
->
display
,
data
->
stencil
,
XRenderFindStandardFormat
(
data
->
display
,
XRenderFindStandardFormat
(
data
->
display
,
PictStandardA
8
),
PictStandardA
RGB32
),
0
,
NULL
);
0
,
NULL
);
#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
if
(
data
->
use_xdamage
)
{
if
(
data
->
use_xdamage
)
{
...
@@ -935,7 +935,7 @@ X11_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
...
@@ -935,7 +935,7 @@ X11_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
}
}
case
SDL_BLENDMODE_MOD
:
case
SDL_BLENDMODE_MOD
:
if
(
renderdata
->
use_xrender
)
{
if
(
renderdata
->
use_xrender
)
{
data
->
blend_op
=
PictOp
Src
;
data
->
blend_op
=
PictOp
Over
;
return
0
;
return
0
;
}
}
case
SDL_BLENDMODE_MASK
:
case
SDL_BLENDMODE_MASK
:
...
@@ -1211,7 +1211,7 @@ X11_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points,
...
@@ -1211,7 +1211,7 @@ X11_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points,
renderer
->
blendMode
!=
SDL_BLENDMODE_ADD
&&
renderer
->
blendMode
!=
SDL_BLENDMODE_ADD
&&
renderer
->
blendMode
!=
SDL_BLENDMODE_MOD
))
renderer
->
blendMode
!=
SDL_BLENDMODE_MOD
))
{
{
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0
x00000000
);
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0
);
#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
if
(
data
->
use_xdamage
)
if
(
data
->
use_xdamage
)
{
{
...
@@ -1229,7 +1229,7 @@ X11_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points,
...
@@ -1229,7 +1229,7 @@ X11_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points,
XFixesSetGCClipRegion
(
data
->
display
,
data
->
stencil_gc
,
0
,
0
,
None
);
XFixesSetGCClipRegion
(
data
->
display
,
data
->
stencil_gc
,
0
,
0
,
None
);
}
}
#endif
#endif
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0xFF
);
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0xFF
FFFFFF
);
XDrawPoints
(
data
->
display
,
data
->
stencil
,
data
->
stencil_gc
,
xpoints
,
xcount
,
XDrawPoints
(
data
->
display
,
data
->
stencil
,
data
->
stencil_gc
,
xpoints
,
xcount
,
CoordModeOrigin
);
CoordModeOrigin
);
...
@@ -1323,7 +1323,7 @@ X11_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
...
@@ -1323,7 +1323,7 @@ X11_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
drawable
=
data
->
stencil
;
drawable
=
data
->
stencil
;
gc
=
data
->
stencil_gc
;
gc
=
data
->
stencil_gc
;
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0
x00000000
);
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0
);
#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
if
(
data
->
use_xdamage
)
if
(
data
->
use_xdamage
)
XFixesSetGCClipRegion
(
data
->
display
,
data
->
stencil_gc
,
XFixesSetGCClipRegion
(
data
->
display
,
data
->
stencil_gc
,
...
@@ -1336,7 +1336,7 @@ X11_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
...
@@ -1336,7 +1336,7 @@ X11_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
XFixesSetGCClipRegion
(
data
->
display
,
data
->
stencil_gc
,
XFixesSetGCClipRegion
(
data
->
display
,
data
->
stencil_gc
,
0
,
0
,
None
);
0
,
0
,
None
);
#endif
#endif
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0xFF
);
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0xFF
FFFFFF
);
}
}
else
else
#endif
#endif
...
@@ -1536,7 +1536,7 @@ X11_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
...
@@ -1536,7 +1536,7 @@ X11_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
renderer
->
blendMode
!=
SDL_BLENDMODE_ADD
&&
renderer
->
blendMode
!=
SDL_BLENDMODE_ADD
&&
renderer
->
blendMode
!=
SDL_BLENDMODE_MOD
))
renderer
->
blendMode
!=
SDL_BLENDMODE_MOD
))
{
{
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0
x00000000
);
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0
);
#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
#ifdef SDL_VIDEO_DRIVER_X11_XDAMAGE
if
(
data
->
use_xdamage
)
if
(
data
->
use_xdamage
)
XFixesSetGCClipRegion
(
data
->
display
,
data
->
stencil_gc
,
XFixesSetGCClipRegion
(
data
->
display
,
data
->
stencil_gc
,
...
@@ -1549,7 +1549,7 @@ X11_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
...
@@ -1549,7 +1549,7 @@ X11_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
XFixesSetGCClipRegion
(
data
->
display
,
data
->
stencil_gc
,
XFixesSetGCClipRegion
(
data
->
display
,
data
->
stencil_gc
,
0
,
0
,
None
);
0
,
0
,
None
);
#endif
#endif
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0xFF
);
XSetForeground
(
data
->
display
,
data
->
stencil_gc
,
0xFF
FFFFFF
);
XDrawRectangles
(
data
->
display
,
data
->
stencil
,
data
->
stencil_gc
,
xrects
,
xcount
);
XDrawRectangles
(
data
->
display
,
data
->
stencil
,
data
->
stencil_gc
,
xrects
,
xcount
);
...
@@ -1695,35 +1695,35 @@ X11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
...
@@ -1695,35 +1695,35 @@ X11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
dstrect
->
y
,
srcrect
->
w
,
srcrect
->
h
);
dstrect
->
y
,
srcrect
->
w
,
srcrect
->
h
);
}
}
}
}
Picture
src
,
mask
,
dst
;
Picture
mask
;
XRenderPictureAttributes
attr
;
XRenderPictureAttributes
attr
;
const
SDL_Rect
*
mrect
;
if
(
texture
->
blendMode
==
SDL_BLENDMODE_NONE
)
{
if
(
texture
->
blendMode
==
SDL_BLENDMODE_NONE
)
{
src
=
texturedata
->
picture
;
mask
=
None
;
mask
=
None
;
dst
=
data
->
drawable_pict
;
mrect
=
srcrect
;
}
else
if
(
texture
->
blendMode
==
SDL_BLENDMODE_MOD
)
{
mask
=
data
->
stencil_pict
;
mrect
=
dstrect
;
}
}
/*else if (texture->blendMode == SDL_BLENDMODE_MOD) {
src = data->drawable_pict;
mask = texturedata->picture;
dst = data->drawable_pict;
attr.alpha_map = mask;
}*/
else
{
else
{
src
=
texturedata
->
picture
;
mask
=
texturedata
->
picture
;
mask
=
texturedata
->
picture
;
dst
=
data
->
drawable_pi
ct
;
mrect
=
srcre
ct
;
}
}
if
(
srcrect
->
w
==
dstrect
->
w
&&
srcrect
->
h
==
dstrect
->
h
)
{
if
(
srcrect
->
w
==
dstrect
->
w
&&
srcrect
->
h
==
dstrect
->
h
)
{
/*if (texture->blendMode == SDL_BLENDMODE_MOD) {
if
(
texture
->
blendMode
==
SDL_BLENDMODE_MOD
)
{
XRenderComposite
(
data
->
display
,
PictOpSrc
,
data
->
drawable_pict
,
texturedata
->
picture
,
data
->
stencil_pict
,
dstrect
->
x
,
dstrect
->
y
,
srcrect
->
x
,
srcrect
->
y
,
dstrect
->
x
,
dstrect
->
y
,
dstrect
->
w
,
dstrect
->
h
);
attr
.
component_alpha
=
True
;
attr
.
component_alpha
=
True
;
XRenderChangePicture(data->display,
texturedata->picture
,
XRenderChangePicture
(
data
->
display
,
data
->
stencil_pict
,
CPComponentAlpha
,
&
attr
);
CPComponentAlpha
,
&
attr
);
XRenderChangePicture(data->display, src, CPAlphaMap, &attr);
}
}*/
XRenderComposite
(
data
->
display
,
texturedata
->
blend_op
,
texturedata
->
picture
,
XRenderComposite
(
data
->
display
,
texturedata
->
blend_op
,
src
,
mask
,
data
->
drawable_pict
,
srcrect
->
x
,
srcrect
->
y
,
mask
,
dst
,
srcrect
->
x
,
srcrect
->
y
,
mrect
->
x
,
mrect
->
y
,
dstrect
->
x
,
dstrect
->
y
,
srcrect
->
x
,
srcrect
->
y
,
dstrect
->
x
,
dstrect
->
y
,
dstrect
->
w
,
dstrect
->
h
);
srcrect
->
w
,
srcrect
->
h
);
}
else
{
}
else
{
double
xscale
=
((
double
)
dstrect
->
w
)
/
srcrect
->
w
;
double
xscale
=
((
double
)
dstrect
->
w
)
/
srcrect
->
w
;
double
yscale
=
((
double
)
dstrect
->
h
)
/
srcrect
->
h
;
double
yscale
=
((
double
)
dstrect
->
h
)
/
srcrect
->
h
;
...
@@ -1733,19 +1733,22 @@ X11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
...
@@ -1733,19 +1733,22 @@ X11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
{
XDoubleToFixed
(
0
),
XDoubleToFixed
(
0
),
XDoubleToFixed
(
xscale
*
yscale
)}}};
{
XDoubleToFixed
(
0
),
XDoubleToFixed
(
0
),
XDoubleToFixed
(
xscale
*
yscale
)}}};
XRenderSetPictureTransform
(
data
->
display
,
texturedata
->
picture
,
&
xform
);
XRenderSetPictureTransform
(
data
->
display
,
texturedata
->
picture
,
&
xform
);
/*if (texture->blendMode == SDL_BLENDMODE_MOD) {
if
(
texture
->
blendMode
==
SDL_BLENDMODE_MOD
)
{
XRenderComposite
(
data
->
display
,
PictOpSrc
,
data
->
drawable_pict
,
texturedata
->
picture
,
data
->
stencil_pict
,
dstrect
->
x
,
dstrect
->
y
,
srcrect
->
x
,
srcrect
->
y
,
dstrect
->
x
,
dstrect
->
y
,
dstrect
->
w
,
dstrect
->
h
);
attr
.
component_alpha
=
True
;
attr
.
component_alpha
=
True
;
XRenderChangePicture(data->display,
texturedata->picture
,
XRenderChangePicture
(
data
->
display
,
data
->
stencil_pict
,
CPComponentAlpha
,
&
attr
);
CPComponentAlpha
,
&
attr
);
XRenderChangePicture(data->display, src, CPAlphaMap, &attr);
}
}*/
XRenderSetPictureFilter
(
data
->
display
,
texturedata
->
picture
,
XRenderSetPictureFilter
(
data
->
display
,
texturedata
->
picture
,
texturedata
->
filter
,
0
,
0
);
texturedata
->
filter
,
0
,
0
);
XRenderComposite
(
data
->
display
,
texturedata
->
blend_op
,
XRenderComposite
(
data
->
display
,
texturedata
->
blend_op
,
src
,
mask
,
ds
t
,
texturedata
->
picture
,
mask
,
data
->
drawable_pic
t
,
srcrect
->
x
,
srcrect
->
y
,
srcrect
->
x
,
src
rect
->
y
,
srcrect
->
x
,
srcrect
->
y
,
mrect
->
x
,
m
rect
->
y
,
dstrect
->
x
,
dstrect
->
y
,
dstrect
->
w
,
dstrect
->
h
);
dstrect
->
x
,
dstrect
->
y
,
dstrect
->
w
,
dstrect
->
h
);
XTransform
identity
=
{{
XTransform
identity
=
{{
...
@@ -1754,14 +1757,11 @@ X11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
...
@@ -1754,14 +1757,11 @@ X11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
{
XDoubleToFixed
(
0
),
XDoubleToFixed
(
0
),
XDoubleToFixed
(
1
)}}};
{
XDoubleToFixed
(
0
),
XDoubleToFixed
(
0
),
XDoubleToFixed
(
1
)}}};
XRenderSetPictureTransform
(
data
->
display
,
texturedata
->
picture
,
&
identity
);
XRenderSetPictureTransform
(
data
->
display
,
texturedata
->
picture
,
&
identity
);
}
}
/*
if (renderer->blendMode == SDL_BLENDMODE_MOD) {
if
(
renderer
->
blendMode
==
SDL_BLENDMODE_MOD
)
{
attr
.
component_alpha
=
False
;
attr
.
component_alpha
=
False
;
XRenderChangePicture(data->display,
texturedata->picture
,
XRenderChangePicture
(
data
->
display
,
data
->
stencil_pict
,
CPComponentAlpha
,
&
attr
);
CPComponentAlpha
,
&
attr
);
attr.alpha_map = None;
}
XRenderChangePicture(data->display, data->drawable_pict,
CPAlphaMap, &attr);
}*/
}
}
else
else
#endif
#endif
...
...
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