diff options
author | kem <kem> | 2002-02-28 16:23:27 +0000 |
---|---|---|
committer | kem <kem> | 2002-02-28 16:23:27 +0000 |
commit | 2d740ae70e2faf9d7a58ef956bc01667c89e70d1 (patch) | |
tree | 4f0ab5efc399f4b0f435515b2fb1983674054257 | |
parent | 2830e6c10e3d8de7760c0d3405c39163dc045791 (diff) |
- Implement PolyText16 supportdmx-0-1-20020228-alpha
- Fix cursor realization code
-rw-r--r-- | xc/programs/Xserver/hw/dmx/dmxcursor.c | 76 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/dmx/dmxgcops.c | 10 |
2 files changed, 53 insertions, 33 deletions
diff --git a/xc/programs/Xserver/hw/dmx/dmxcursor.c b/xc/programs/Xserver/hw/dmx/dmxcursor.c index 0e1d2f4c3..2656ff775 100644 --- a/xc/programs/Xserver/hw/dmx/dmxcursor.c +++ b/xc/programs/Xserver/hw/dmx/dmxcursor.c @@ -511,33 +511,60 @@ static Bool dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; CursorBitsPtr pBits = pCursor->bits; dmxCursorPrivPtr pCursorPriv; - Pixmap source, mask; + Pixmap src, msk; XColor fg, bg; + XImage *img; + XlibGC gc; + XGCValues v; + unsigned long m; + int i; pCursor->devPriv[pScreen->myNum] = xalloc(sizeof(*pCursorPriv)); if (!pCursor->devPriv[pScreen->myNum]) return FALSE; - source = XCreateBitmapFromData(dmxScreen->display, dmxScreen->window, - (char *)pBits->source, - pBits->width, pBits->height); - if (source == None) { - XFreePixmap(dmxScreen->display, source); - xfree(pCursor->devPriv[pScreen->myNum]); - pCursor->devPriv[pScreen->myNum] = NULL; - return FALSE; + m = GCFunction | GCPlaneMask | GCForeground | GCBackground | GCClipMask; + v.function = GXcopy; + v.plane_mask = AllPlanes; + v.foreground = 1L; + v.background = 0L; + v.clip_mask = None; + + for (i = 0; i < dmxScreen->numPixmapFormats; i++) { + if (dmxScreen->pixmapFormats[i].depth == 1) { + /* Create GC in the back-end servers */ + gc = XCreateGC(dmxScreen->display, dmxScreen->defDrawables[i], + m, &v); + break; + } } - mask = XCreateBitmapFromData(dmxScreen->display, dmxScreen->window, - (char *)pBits->mask, - pBits->width, pBits->height); - if (mask == None) { - XFreePixmap(dmxScreen->display, source); - XFreePixmap(dmxScreen->display, mask); - xfree(pCursor->devPriv[pScreen->myNum]); - pCursor->devPriv[pScreen->myNum] = NULL; - return FALSE; - } + src = XCreatePixmap(dmxScreen->display, dmxScreen->window, + pBits->width, pBits->height, 1); + msk = XCreatePixmap(dmxScreen->display, dmxScreen->window, + pBits->width, pBits->height, 1); + + img = XCreateImage(dmxScreen->display, + dmxScreen->visuals[dmxScreen->defVisualIndex].visual, + 1, XYBitmap, 0, (char *)pBits->source, + pBits->width, pBits->height, + BitmapPad(dmxScreen->display), 0); + + XPutImage(dmxScreen->display, src, gc, img, 0, 0, 0, 0, + pBits->width, pBits->height); + + XFree(img); + + img = XCreateImage(dmxScreen->display, + dmxScreen->visuals[dmxScreen->defVisualIndex].visual, + 1, XYBitmap, 0, (char *)pBits->mask, + pBits->width, pBits->height, + BitmapPad(dmxScreen->display), 0); + + XPutImage(dmxScreen->display, msk, gc, img, 0, 0, 0, 0, + pBits->width, pBits->height); + + XFree(img); fg.red = pCursor->foreRed; fg.green = pCursor->foreGreen; @@ -549,12 +576,13 @@ static Bool dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen); pCursorPriv->cursor = XCreatePixmapCursor(dmxScreen->display, - source, mask, + src, msk, &fg, &bg, pBits->xhot, pBits->yhot); - XFreePixmap(dmxScreen->display, source); - XFreePixmap(dmxScreen->display, mask); + XFreePixmap(dmxScreen->display, src); + XFreePixmap(dmxScreen->display, msk); + XFreeGC(dmxScreen->display, gc); XSync(dmxScreen->display, False); return TRUE; @@ -586,16 +614,12 @@ static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; if (pCursor) { -#if 0 dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen); if (dmxScreen->curCursor != pCursorPriv->cursor) { XDefineCursor(dmxScreen->display, dmxScreen->window, pCursorPriv->cursor); dmxScreen->curCursor = pCursorPriv->cursor; } -#else - XDefineCursor(dmxScreen->display, dmxScreen->window, None); -#endif dmxMoveCursor(pScreen, x, y); } else { XDefineCursor(dmxScreen->display, dmxScreen->window, diff --git a/xc/programs/Xserver/hw/dmx/dmxgcops.c b/xc/programs/Xserver/hw/dmx/dmxgcops.c index 539e55bc5..692b7746b 100644 --- a/xc/programs/Xserver/hw/dmx/dmxgcops.c +++ b/xc/programs/Xserver/hw/dmx/dmxgcops.c @@ -326,10 +326,6 @@ int dmxPolyText8(DrawablePtr pDrawable, GCPtr pGC, int dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars) { -#if 1 - /* KEM: Implement PolyText16 properly */ - return 0; -#else DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); unsigned long n, i; @@ -340,7 +336,8 @@ int dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC, DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars, - Linear8Bit, &n, charinfo); + (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit, + &n, charinfo); /* Calculate text width */ w = 0; @@ -348,12 +345,11 @@ int dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC, if (n != 0) { XDrawString16(dmxScreen->display, draw, pGCPriv->gc, - x, y, (XChars2b *)chars, count); + x, y, (XChar2b *)chars, count); XSync(dmxScreen->display, False); } return x+w; -#endif } void dmxImageText8(DrawablePtr pDrawable, GCPtr pGC, |