Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
dimbor
nx-libs
Commits
53f4386b
Commit
53f4386b
authored
Oct 22, 2019
by
Ulrich Sibiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GC.c: scope improvements
parent
95940104
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
52 deletions
+24
-52
GC.c
nx-X11/programs/Xserver/hw/nxagent/GC.c
+24
-52
No files found.
nx-X11/programs/Xserver/hw/nxagent/GC.c
View file @
53f4386b
...
...
@@ -142,8 +142,6 @@ static GCOps nxagentOps =
Bool
nxagentCreateGC
(
GCPtr
pGC
)
{
FbGCPrivPtr
pPriv
;
pGC
->
clientClipType
=
CT_NONE
;
pGC
->
clientClip
=
NULL
;
...
...
@@ -178,7 +176,7 @@ Bool nxagentCreateGC(GCPtr pGC)
fprintf
(
stderr
,
"nxagentCreateGC: GC [%p]
\n
"
,
(
void
*
)
pGC
);
#endif
pPriv
=
(
pGC
)
->
devPrivates
[
fbGCPrivateIndex
].
ptr
;
FbGCPrivPtr
pPriv
=
(
pGC
)
->
devPrivates
[
fbGCPrivateIndex
].
ptr
;
fbGetRotatedPixmap
(
pGC
)
=
0
;
fbGetExpose
(
pGC
)
=
1
;
...
...
@@ -214,8 +212,6 @@ Bool nxagentCreateGC(GCPtr pGC)
void
nxagentValidateGC
(
GCPtr
pGC
,
unsigned
long
changes
,
DrawablePtr
pDrawable
)
{
PixmapPtr
lastTile
,
lastStipple
;
DrawablePtr
pVirtual
=
(
pDrawable
->
type
==
DRAWABLE_PIXMAP
)
?
nxagentVirtualDrawable
(
pDrawable
)
:
pDrawable
;
...
...
@@ -233,9 +229,9 @@ void nxagentValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
pGC
->
tile
.
pixmap
=
nxagentVirtualPixmap
(
pGC
->
tile
.
pixmap
);
}
lastTile
=
pGC
->
tile
.
pixmap
;
PixmapPtr
lastTile
=
pGC
->
tile
.
pixmap
;
lastStipple
=
pGC
->
stipple
;
PixmapPtr
lastStipple
=
pGC
->
stipple
;
if
(
lastStipple
)
{
...
...
@@ -510,9 +506,6 @@ void nxagentDestroyGC(GCPtr pGC)
void
nxagentChangeClip
(
GCPtr
pGC
,
int
type
,
void
*
pValue
,
int
nRects
)
{
int
i
,
size
;
BoxPtr
pBox
;
XRectangle
*
pRects
;
int
clipsMatch
=
0
;
#ifdef TEST
...
...
@@ -577,12 +570,13 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects)
{
if
(
clipsMatch
==
0
&&
nxagentGCTrap
==
0
)
{
XRectangle
*
pRects
;
nRects
=
RegionNumRects
((
RegionPtr
)
pValue
);
size
=
nRects
*
sizeof
(
*
pRects
);
int
size
=
nRects
*
sizeof
(
*
pRects
);
pRects
=
(
XRectangle
*
)
malloc
(
size
);
pBox
=
RegionRects
((
RegionPtr
)
pValue
);
BoxPtr
pBox
=
RegionRects
((
RegionPtr
)
pValue
);
for
(
i
=
nRects
;
i
--
>
0
;)
for
(
i
nt
i
=
nRects
;
i
--
>
0
;)
{
pRects
[
i
].
x
=
pBox
[
i
].
x1
;
pRects
[
i
].
y
=
pBox
[
i
].
y1
;
...
...
@@ -742,8 +736,6 @@ void nxagentDestroyClipHelper(GCPtr pGC)
void
nxagentCopyClip
(
GCPtr
pGCDst
,
GCPtr
pGCSrc
)
{
RegionPtr
pRgn
;
#ifdef TEST
fprintf
(
stderr
,
"nxagentCopyClip: Going to copy clip from GC [%p] to GC [%p]
\n
"
,
(
void
*
)
pGCDst
,
(
void
*
)
pGCSrc
);
...
...
@@ -754,7 +746,7 @@ void nxagentCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
case
CT_REGION
:
if
(
nxagentGCPriv
(
pGCSrc
)
->
pPixmap
==
NULL
)
{
pRgn
=
RegionCreate
(
NULL
,
1
);
RegionPtr
pRgn
=
RegionCreate
(
NULL
,
1
);
RegionCopy
(
pRgn
,
pGCSrc
->
clientClip
);
nxagentChangeClip
(
pGCDst
,
CT_REGION
,
pRgn
,
0
);
}
...
...
@@ -1029,7 +1021,6 @@ static void nxagentReconnectGC(void *param0, XID param1, void * param2)
Bool
nxagentReconnectAllGCs
(
void
*
p0
)
{
int
cid
;
Bool
GCSuccess
=
True
;
#ifdef DEBUG
...
...
@@ -1044,7 +1035,7 @@ Bool nxagentReconnectAllGCs(void *p0)
FindClientResourcesByType
(
clients
[
serverClient
->
index
],
RT_NX_GC
,
nxagentReconnectGC
,
&
GCSuccess
);
for
(
cid
=
0
;
(
cid
<
MAXCLIENTS
)
&&
GCSuccess
;
cid
++
)
for
(
int
cid
=
0
;
(
cid
<
MAXCLIENTS
)
&&
GCSuccess
;
cid
++
)
{
if
(
clients
[
cid
])
{
...
...
@@ -1090,7 +1081,6 @@ void nxagentDisconnectGC(void * p0, XID x1, void * p2)
Bool
nxagentDisconnectAllGCs
(
void
)
{
int
cid
;
Bool
success
=
True
;
#ifdef DEBUG
...
...
@@ -1106,7 +1096,7 @@ Bool nxagentDisconnectAllGCs(void)
FindClientResourcesByType
(
clients
[
serverClient
->
index
],
RT_NX_GC
,
(
FindResType
)
nxagentDisconnectGC
,
&
success
);
for
(
cid
=
0
;
(
cid
<
MAXCLIENTS
)
&&
success
;
cid
++
)
for
(
int
cid
=
0
;
(
cid
<
MAXCLIENTS
)
&&
success
;
cid
++
)
{
if
(
clients
[
cid
])
{
...
...
@@ -1132,10 +1122,6 @@ Bool nxagentDisconnectAllGCs(void)
static
void
nxagentReconnectClip
(
GCPtr
pGC
,
int
type
,
void
*
pValue
,
int
nRects
)
{
int
i
,
size
;
BoxPtr
pBox
;
XRectangle
*
pRects
;
#ifdef TEST
fprintf
(
stderr
,
"nxagentReconnectClip: going to change clip on GC [%p]
\n
"
,
(
void
*
)
pGC
);
...
...
@@ -1156,11 +1142,12 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects)
case
CT_REGION
:
if
(
nxagentGCPriv
(
pGC
)
->
pPixmap
==
NULL
)
{
XRectangle
*
pRects
;
nRects
=
RegionNumRects
((
RegionPtr
)
pValue
);
size
=
nRects
*
sizeof
(
*
pRects
);
int
size
=
nRects
*
sizeof
(
*
pRects
);
pRects
=
(
XRectangle
*
)
malloc
(
size
);
pBox
=
RegionRects
((
RegionPtr
)
pValue
);
for
(
i
=
nRects
;
i
--
>
0
;)
{
BoxPtr
pBox
=
RegionRects
((
RegionPtr
)
pValue
);
for
(
i
nt
i
=
nRects
;
i
--
>
0
;)
{
pRects
[
i
].
x
=
pBox
[
i
].
x1
;
pRects
[
i
].
y
=
pBox
[
i
].
y1
;
pRects
[
i
].
width
=
pBox
[
i
].
x2
-
pBox
[
i
].
x1
;
...
...
@@ -1262,8 +1249,6 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects)
static
int
nxagentCompareRegions
(
RegionPtr
r1
,
RegionPtr
r2
)
{
int
i
;
/*
* It returns 1 if regions are equal, 0 otherwise
*/
...
...
@@ -1292,7 +1277,7 @@ static int nxagentCompareRegions(RegionPtr r1, RegionPtr r2)
else
if
((
*
RegionExtents
(
r1
)).
y2
!=
(
*
RegionExtents
(
r2
)).
y2
)
return
0
;
else
{
for
(
i
=
0
;
i
<
RegionNumRects
(
r1
);
i
++
)
for
(
i
nt
i
=
0
;
i
<
RegionNumRects
(
r1
);
i
++
)
{
if
(
RegionRects
(
r1
)[
i
].
x1
!=
RegionRects
(
r2
)[
i
].
x1
)
return
0
;
else
if
(
RegionRects
(
r1
)[
i
].
x2
!=
RegionRects
(
r2
)[
i
].
x2
)
return
0
;
...
...
@@ -1394,10 +1379,7 @@ void nxagentFreeScratchGC(GCPtr pGC)
GCPtr
nxagentGetGraphicContext
(
DrawablePtr
pDrawable
)
{
int
i
;
int
result
;
for
(
i
=
0
;
i
<
nxagentGraphicContextsSize
;
i
++
)
for
(
int
i
=
0
;
i
<
nxagentGraphicContextsSize
;
i
++
)
{
if
(
pDrawable
->
depth
==
nxagentGraphicContexts
[
i
].
depth
)
{
...
...
@@ -1416,7 +1398,7 @@ GCPtr nxagentGetGraphicContext(DrawablePtr pDrawable)
fprintf
(
stderr
,
"nxagentGetGraphicContext: Going to reconnect the GC.
\n
"
);
#endif
result
=
1
;
int
result
=
1
;
nxagentReconnectGC
(
nxagentGraphicContexts
[
i
].
pGC
,
(
XID
)
0
,
&
result
);
...
...
@@ -1441,18 +1423,12 @@ GCPtr nxagentGetGraphicContext(DrawablePtr pDrawable)
GCPtr
nxagentCreateGraphicContext
(
int
depth
)
{
GCPtr
pGC
;
nxagentGraphicContextsPtr
nxagentGCs
;
XID
attributes
[
2
];
/*
* We have not found a GC, so we have
* to spread the list and add a new GC.
*/
nxagentGCs
=
realloc
(
nxagentGraphicContexts
,
(
nxagentGraphicContextsSize
+
1
)
*
sizeof
(
nxagentGraphicContextsRec
));
nxagentG
raphicContextsPtr
nxagentG
Cs
=
realloc
(
nxagentGraphicContexts
,
(
nxagentGraphicContextsSize
+
1
)
*
sizeof
(
nxagentGraphicContextsRec
));
if
(
nxagentGCs
==
NULL
)
{
...
...
@@ -1465,7 +1441,7 @@ GCPtr nxagentCreateGraphicContext(int depth)
nxagentGraphicContexts
=
nxagentGCs
;
pGC
=
CreateScratchGC
(
nxagentDefaultScreen
,
depth
);
GCPtr
pGC
=
CreateScratchGC
(
nxagentDefaultScreen
,
depth
);
if
(
pGC
==
NULL
)
{
...
...
@@ -1477,6 +1453,8 @@ GCPtr nxagentCreateGraphicContext(int depth)
return
NULL
;
}
XID
attributes
[
2
];
/*
* Color used in nxagentFillRemoteRegion().
*/
...
...
@@ -1520,13 +1498,9 @@ GCPtr nxagentCreateGraphicContext(int depth)
void
nxagentAllocateGraphicContexts
(
void
)
{
int
*
depths
;
int
i
;
int
*
depths
=
nxagentDepths
;
depths
=
nxagentDepths
;
for
(
i
=
0
;
i
<
nxagentNumDepths
;
i
++
)
for
(
int
i
=
0
;
i
<
nxagentNumDepths
;
i
++
)
{
nxagentCreateGraphicContext
(
*
depths
);
...
...
@@ -1536,9 +1510,7 @@ void nxagentAllocateGraphicContexts(void)
void
nxagentDisconnectGraphicContexts
(
void
)
{
int
i
;
for
(
i
=
0
;
i
<
nxagentGraphicContextsSize
;
i
++
)
for
(
int
i
=
0
;
i
<
nxagentGraphicContextsSize
;
i
++
)
{
nxagentGraphicContexts
[
i
].
dirty
=
1
;
}
...
...
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