aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/mi
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/mi')
-rw-r--r--xorg-server/mi/makefile42
-rw-r--r--xorg-server/mi/micmap.c17
-rw-r--r--xorg-server/mi/micoord.h8
-rw-r--r--xorg-server/mi/mieq.c7
-rw-r--r--xorg-server/mi/mioverlay.c4
-rw-r--r--xorg-server/mi/misprite.c13
6 files changed, 77 insertions, 14 deletions
diff --git a/xorg-server/mi/makefile b/xorg-server/mi/makefile
new file mode 100644
index 000000000..bff870d6e
--- /dev/null
+++ b/xorg-server/mi/makefile
@@ -0,0 +1,42 @@
+CSRCS=miarc.c \
+ mibank.c \
+ mibitblt.c \
+ mibstore.c \
+ micmap.c \
+ micopy.c \
+ micursor.c \
+ midash.c \
+ midispcur.c \
+ mieq.c \
+ miexpose.c \
+ mifillarc.c \
+ mifillrct.c \
+ mifpolycon.c \
+ migc.c \
+ miglblt.c \
+ mioverlay.c \
+ mipointer.c \
+ mipoly.c \
+ mipolycon.c \
+ mipolygen.c \
+ mipolypnt.c \
+ mipolyrect.c \
+ mipolyseg.c \
+ mipolytext.c \
+ mipolyutil.c \
+ mipushpxl.c \
+ miregion.c \
+ miscrinit.c \
+ mispans.c \
+ misprite.c \
+ mivaltree.c \
+ miwideline.c \
+ miwindow.c \
+ mizerarc.c \
+ mizerclip.c \
+ mizerline.c \
+ miinitext.c
+
+LIBRARY=libmi
+
+
diff --git a/xorg-server/mi/micmap.c b/xorg-server/mi/micmap.c
index 1d26a5232..f6d760b2f 100644
--- a/xorg-server/mi/micmap.c
+++ b/xorg-server/mi/micmap.c
@@ -134,18 +134,29 @@ miInitializeColormap(ColormapPtr pmap)
unsigned limr, limg, limb;
limr = pVisual->redMask >> pVisual->offsetRed;
- limg = pVisual->greenMask >> pVisual->offsetGreen;
- limb = pVisual->blueMask >> pVisual->offsetBlue;
- for(i = 0; i <= maxent; i++)
+ for(i = 0; i <= min(limr,maxent); i++)
{
/* rescale to [0..65535] then rgb bits */
pmap->red[i].co.local.red =
((((i * 65535) / limr) >> shift) * 65535) / lim;
+ }
+ for(; i <= maxent; i++) pmap->red[i].co.local.red = 65535;
+ limg = pVisual->greenMask >> pVisual->offsetGreen;
+ for(i = 0; i <= min(limg,maxent); i++)
+ {
+ /* rescale to [0..65535] then rgb bits */
pmap->green[i].co.local.green =
((((i * 65535) / limg) >> shift) * 65535) / lim;
+ }
+ for(; i <= maxent; i++) pmap->green[i].co.local.green = 65535;
+ limb = pVisual->blueMask >> pVisual->offsetBlue;
+ for(i = 0; i <= min(limb,maxent); i++)
+ {
+ /* rescale to [0..65535] then rgb bits */
pmap->blue[i].co.local.blue =
((((i * 65535) / limb) >> shift) * 65535) / lim;
}
+ for(; i <= maxent; i++) pmap->blue[i].co.local.blue = 65535;
}
else if (pVisual->class == StaticColor)
{
diff --git a/xorg-server/mi/micoord.h b/xorg-server/mi/micoord.h
index e6d814fc8..fe4adac56 100644
--- a/xorg-server/mi/micoord.h
+++ b/xorg-server/mi/micoord.h
@@ -55,14 +55,14 @@
#endif
#if IMAGE_BYTE_ORDER == MSBFirst
-#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i))))
+#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) ((i)&0xffff))))
#define coordToInt(x,y) (((x) << 16) | ((y) & 0xffff))
#define intToX(i) (GetHighWord(i))
-#define intToY(i) ((int) ((short) i))
+#define intToY(i) ((int) ((short) ((i)&0xffff)))
#else
-#define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i)))
+#define intToCoord(i,x,y) (((x) = (int) ((short) ((i)&0xffff))), ((y) = GetHighWord(i)))
#define coordToInt(x,y) (((y) << 16) | ((x) & 0xffff))
-#define intToX(i) ((int) ((short) (i)))
+#define intToX(i) ((int) ((short) ((i)&0xffff)))
#define intToY(i) (GetHighWord(i))
#endif
diff --git a/xorg-server/mi/mieq.c b/xorg-server/mi/mieq.c
index 9b6d0c901..2d5f23ea6 100644
--- a/xorg-server/mi/mieq.c
+++ b/xorg-server/mi/mieq.c
@@ -439,10 +439,13 @@ mieqProcessInputEvents(void)
evlen = e->events->evlen;
if(evlen > event_size)
+ {
+ event_size=evlen;
event = xrealloc(event, evlen);
+ if (!event)
+ FatalError("[mi] No memory left for event processing.\n");
+ }
- if (!event)
- FatalError("[mi] No memory left for event processing.\n");
memcpy(event, e->events->event, evlen);
diff --git a/xorg-server/mi/mioverlay.c b/xorg-server/mi/mioverlay.c
index e0aa88017..0577e8c9f 100644
--- a/xorg-server/mi/mioverlay.c
+++ b/xorg-server/mi/mioverlay.c
@@ -3,6 +3,10 @@
#include <dix-config.h>
#endif
+#ifdef CreateWindow
+#undef CreateWindow
+#endif
+
#include <X11/X.h>
#include "scrnintstr.h"
#include "validate.h"
diff --git a/xorg-server/mi/misprite.c b/xorg-server/mi/misprite.c
index 2ec67827e..714c42944 100644
--- a/xorg-server/mi/misprite.c
+++ b/xorg-server/mi/misprite.c
@@ -502,7 +502,7 @@ miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width,
if (DevHasCursor(pDev))
{
pCursorInfo = MISPRITE(pDev);
- if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
+ if (pCursorInfo && pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y,
x, y, width, height))
{
@@ -539,7 +539,7 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
/*
* Damage will take care of destination check
*/
- if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
+ if (pCursorInfo && pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
miRectIn(prgnSrc, &pCursorInfo->saved) != rgnOUT)
{
SPRITE_DEBUG (("CopyWindow remove\n"));
@@ -622,9 +622,12 @@ miSpriteInstallColormap (ColormapPtr pMap)
if (DevHasCursor(pDev))
{
pCursorInfo = MISPRITE(pDev);
- pCursorInfo->checkPixels = TRUE;
- if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen)
- miSpriteRemoveCursor(pDev, pScreen);
+ if (pCursorInfo)
+ {
+ pCursorInfo->checkPixels = TRUE;
+ if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen)
+ miSpriteRemoveCursor(pDev, pScreen);
+ }
}
}