[PATCH xserver 03/11] dix: Don't special-case a 1bpp scratch GC
Adam Jackson
ajax at redhat.com
Fri Dec 9 19:52:30 UTC 2016
The comment in CreateGCperDepth here is wrong, there is already a 1bpp
entry in the pixmap format list.
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
dix/gc.c | 10 ++++------
hw/dmx/dmxextension.c | 4 ++--
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/dix/gc.c b/dix/gc.c
index cb8db85..73bb3b4 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -825,7 +825,7 @@ FreeGCperDepth(int screenNum)
pScreen = screenInfo.screens[screenNum];
ppGC = pScreen->GCperDepth;
- for (i = 0; i <= pScreen->numDepths; i++) {
+ for (i = 0; i < pScreen->numDepths; i++) {
(void) FreeGC(ppGC[i], (XID) 0);
ppGC[i] = NULL;
}
@@ -841,16 +841,14 @@ CreateGCperDepth(int screenNum)
pScreen = screenInfo.screens[screenNum];
ppGC = pScreen->GCperDepth;
- /* do depth 1 separately because it's not included in list */
- if (!(ppGC[0] = CreateScratchGC(pScreen, 1)))
- return FALSE;
+
/* Make sure we don't overflow GCperDepth[] */
if (pScreen->numDepths > MAXFORMATS)
return FALSE;
pDepth = pScreen->allowedDepths;
for (i = 0; i < pScreen->numDepths; i++, pDepth++) {
- if (!(ppGC[i + 1] = CreateScratchGC(pScreen, pDepth->depth))) {
+ if (!(ppGC[i] = CreateScratchGC(pScreen, pDepth->depth))) {
for (; i >= 0; i--)
(void) FreeGC(ppGC[i], (XID) 0);
return FALSE;
@@ -1041,7 +1039,7 @@ GetScratchGC(unsigned depth, ScreenPtr pScreen)
int i;
GCPtr pGC;
- for (i = 0; i <= pScreen->numDepths; i++) {
+ for (i = 0; i < pScreen->numDepths; i++) {
pGC = pScreen->GCperDepth[i];
if (pGC && pGC->depth == depth && !pGC->scratch_inuse) {
pGC->scratch_inuse = TRUE;
diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c
index 4f5ca72..82a02f0 100644
--- a/hw/dmx/dmxextension.c
+++ b/hw/dmx/dmxextension.c
@@ -716,7 +716,7 @@ dmxBECreateScratchGCs(int scrnNum)
GCPtr *ppGC = pScreen->GCperDepth;
int i;
- for (i = 0; i <= pScreen->numDepths; i++)
+ for (i = 0; i < pScreen->numDepths; i++)
dmxBECreateGC(pScreen, ppGC[i]);
}
@@ -1586,7 +1586,7 @@ dmxBEDestroyScratchGCs(int scrnNum)
GCPtr *ppGC = pScreen->GCperDepth;
int i;
- for (i = 0; i <= pScreen->numDepths; i++)
+ for (i = 0; i < pScreen->numDepths; i++)
dmxBEFreeGC(ppGC[i]);
}
--
2.9.3
More information about the xorg-devel
mailing list