diff options
author | Julien Cristau <jcristau@debian.org> | 2012-05-12 14:43:20 +0200 |
---|---|---|
committer | Julien Cristau <jcristau@debian.org> | 2012-05-12 15:20:23 +0200 |
commit | 4ab11d54c1fb012feda8c3c59f97734431f009bb (patch) | |
tree | 6eb8441e6cb2ee69f87061682dd0950ab627b617 | |
parent | 68516ee7434c895dfa6edf4a54e54a5880cb8fcb (diff) |
Drop unused acceleration code
Looks like this has been dead code since the switch from cfb to fb.
Signed-off-by: Julien Cristau <jcristau@debian.org>
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/leo_checks.c | 185 | ||||
-rw-r--r-- | src/leo_frect.c | 239 | ||||
-rw-r--r-- | src/leo_frectsp.c | 280 | ||||
-rw-r--r-- | src/leo_fspans.c | 132 | ||||
-rw-r--r-- | src/leo_fspanssp.c | 171 | ||||
-rw-r--r-- | src/leo_glyph.c | 332 |
7 files changed, 0 insertions, 1345 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 63479c6..c5c8b92 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -30,13 +30,7 @@ sunleo_drv_ladir = @moduledir@/drivers sunleo_drv_la_SOURCES = \ leo_accel.c \ - leo_checks.c \ leo_cursor.c \ leo_driver.c \ - leo_frect.c \ - leo_frectsp.c \ - leo_fspans.c \ - leo_fspanssp.c \ - leo_glyph.c \ leo.h \ leo_regs.h diff --git a/src/leo_checks.c b/src/leo_checks.c deleted file mode 100644 index ae250c3..0000000 --- a/src/leo_checks.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Acceleration for the Leo (ZX) framebuffer - stipple/tile verification. - * - * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define PSZ 32 - -#include "leo.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "fb.h" - -int -LeoCheckTile (PixmapPtr pPixmap, LeoStipplePtr stipple, int ox, int oy) -{ - unsigned int *sbits; - unsigned int fg = 0, bg = 0; - int fgset = 0, bgset = 0; - unsigned int *tilebitsLine, *tilebits, tilebit; - unsigned int sbit, mask; - int nbwidth; - int h, w; - int x, y; - int s_y, s_x; - - h = pPixmap->drawable.height; - if (h > 32 || (h & (h - 1))) - return FALSE; - w = pPixmap->drawable.width; - if (w > 32 || (w & (w - 1))) - return FALSE; - stipple->patalign = (oy << 16) | ox; - sbits = stipple->bits; - tilebitsLine = (unsigned int *) pPixmap->devPrivate.ptr; - nbwidth = pPixmap->devKind / sizeof(unsigned int); - - for (y = 0; y < h; y++) { - tilebits = tilebitsLine; - tilebitsLine += nbwidth; - sbit = 0; - mask = 1 << 31; - for (x = 0; x < w; x++) { - tilebit = *tilebits++; - if (fgset && tilebit == fg) - sbit |= mask; - else if (!bgset || tilebit != bg) { - if (!fgset) { - fgset = 1; - fg = tilebit; - sbit |= mask; - } else if (!bgset) { - bgset = 1; - bg = tilebit; - } else - return FALSE; - } - mask >>= 1; - } - for (s_x = w; s_x < 32; s_x <<= 1) - sbit = sbit | (sbit >> s_x); - sbit = (sbit >> ox) | (sbit << (32 - ox)); - for (s_y = y; s_y < 32; s_y += h) - sbits[(s_y + oy) & 31] = sbit; - } - stipple->fg = fg; - stipple->bg = bg; - return TRUE; -} - -int -LeoCheckStipple (PixmapPtr pPixmap, LeoStipplePtr stipple, int ox, int oy) -{ - unsigned int *sbits; - unsigned int *stippleBits; - unsigned int sbit, mask, nbwidth; - int h, w; - int y; - int s_y, s_x; - - h = pPixmap->drawable.height; - if (h > 32 || (h & (h - 1))) - return FALSE; - w = pPixmap->drawable.width; - if (w > 32 || (w & (w - 1))) - return FALSE; - stipple->patalign = (oy << 16) | ox; - sbits = stipple->bits; - stippleBits = (unsigned int *) pPixmap->devPrivate.ptr; - nbwidth = pPixmap->devKind / sizeof(unsigned int); - mask = ~0 << (32 - w); - for (y = 0; y < h; y++) { - sbit = (*stippleBits) & mask; - stippleBits += nbwidth; - for (s_x = w; s_x < 32; s_x <<= 1) - sbit = sbit | (sbit >> s_x); - sbit = (sbit >> ox) | (sbit << (32 - ox)); - for (s_y = y; s_y < 32; s_y += h) - sbits[(s_y + oy) & 31] = sbit; - } - return TRUE; -} - -int -LeoCheckFill (GCPtr pGC, DrawablePtr pDrawable) -{ - LeoPrivGCPtr gcPriv = LeoGetGCPrivate (pGC); - ScreenPtr pScreen = pDrawable->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn); - LeoStipplePtr stipple; - unsigned int alu; - int xrot, yrot; - - if (pGC->fillStyle == FillSolid) { - if (gcPriv->stipple) { - free (gcPriv->stipple); - gcPriv->stipple = 0; - } - return TRUE; - } - if (!(stipple = gcPriv->stipple)) { - if (!pLeo->tmpStipple) { - pLeo->tmpStipple = (LeoStipplePtr) malloc (sizeof *pLeo->tmpStipple); - if (!pLeo->tmpStipple) - return FALSE; - } - stipple = pLeo->tmpStipple; - } - xrot = (pGC->patOrg.x + pDrawable->x) & 31; - yrot = (pGC->patOrg.y + pDrawable->y) & 31; - alu = pGC->alu; - switch (pGC->fillStyle) { - case FillTiled: - if (!LeoCheckTile (pGC->tile.pixmap, stipple, xrot, yrot)) { - if (gcPriv->stipple) { - free (gcPriv->stipple); - gcPriv->stipple = 0; - } - return FALSE; - } - break; - case FillStippled: - alu |= 0x80; - case FillOpaqueStippled: - if (!LeoCheckStipple (pGC->stipple, stipple, xrot, yrot)) { - if (gcPriv->stipple) { - free (gcPriv->stipple); - gcPriv->stipple = 0; - } - return FALSE; - } - stipple->fg = pGC->fgPixel; - stipple->bg = pGC->bgPixel; - break; - } - stipple->alu = alu; - gcPriv->stipple = stipple; - if (stipple == pLeo->tmpStipple) - pLeo->tmpStipple = 0; - return TRUE; -} diff --git a/src/leo_frect.c b/src/leo_frect.c deleted file mode 100644 index e81075e..0000000 --- a/src/leo_frect.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Acceleration for the Leo (ZX) framebuffer - Rectangle filling. - * - * Copyright (C) 1999, 2000 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define PSZ 32 - -#include "leo.h" -#include "leo_regs.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "fb.h" - -void -LeoPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit) -{ - ScreenPtr pScreen = pDrawable->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn); - LeoCommand0 *lc0 = pLeo->lc0; - LeoDraw *ld0 = pLeo->ld0; - xRectangle *prect; - RegionPtr prgnClip; - register BoxPtr pbox; - BoxPtr pextent; - int n; - int xorg, yorg; - - /* No garbage please. */ - if(nrectFill <= 0) - return; - - prgnClip = fbGetCompositeClip(pGC); - - prect = prectInit; - xorg = pDrawable->x; - yorg = pDrawable->y; - if (xorg || yorg) { - prect = prectInit; - n = nrectFill; - while(n--) { - prect->x += xorg; - prect->y += yorg; - prect++; - } - } - - prect = prectInit; - - if (pGC->alu != GXcopy) - ld0->rop = leoRopTable[pGC->alu]; - if (pGC->planemask != 0xffffff) - ld0->planemask = pGC->planemask; - ld0->fg = pGC->fgPixel; - - if (REGION_NUM_RECTS(prgnClip) == 1) { - int x1, y1, x2, y2; - int x, y, xx, yy; - - pextent = REGION_RECTS(prgnClip); - x1 = pextent->x1; - y1 = pextent->y1; - x2 = pextent->x2; - y2 = pextent->y2; - while (nrectFill--) { - x = prect->x; - y = prect->y; - xx = x + prect->width; - yy = y + prect->height; - if (x < x1) - x = x1; - if (y < y1) - y = y1; - prect++; - if (xx > x2) xx = x2; - if (yy > y2) yy = y2; - if (x >= xx) continue; - if (y >= yy) continue; - - lc0->extent = (xx - x - 1) | ((yy - y - 1) << 11); - lc0->fill = x | (y << 11); - while (lc0->csr & LEO_CSR_BLT_BUSY); - } - } else { - int x1, y1, x2, y2, bx1, by1, bx2, by2; - int x, y, w, h; - - pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); - x1 = pextent->x1; - y1 = pextent->y1; - x2 = pextent->x2; - y2 = pextent->y2; - while (nrectFill--) { - if ((bx1 = prect->x) < x1) - bx1 = x1; - - if ((by1 = prect->y) < y1) - by1 = y1; - - bx2 = (int) prect->x + (int) prect->width; - if (bx2 > x2) - bx2 = x2; - - by2 = (int) prect->y + (int) prect->height; - if (by2 > y2) - by2 = y2; - - prect++; - - if (bx1 >= bx2 || by1 >= by2) - continue; - - n = REGION_NUM_RECTS (prgnClip); - pbox = REGION_RECTS(prgnClip); - - /* clip the rectangle to each box in the clip region - this is logically equivalent to calling Intersect() - */ - while(n--) { - x = max(bx1, pbox->x1); - y = max(by1, pbox->y1); - w = min(bx2, pbox->x2) - x; - h = min(by2, pbox->y2) - y; - pbox++; - - /* see if clipping left anything */ - if (w > 0 && h > 0) { - lc0->extent = (w - 1) | ((h - 1) << 11); - lc0->fill = x | (y << 11); - - while (lc0->csr & LEO_CSR_BLT_BUSY); - } - } - } - } - - if (pGC->alu != GXcopy) - ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; - if (pGC->planemask != 0xffffff) - ld0->planemask = 0xffffff; -} - -void -LeoPolyFillRect1Rect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit) -{ - ScreenPtr pScreen = pDrawable->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn); - LeoCommand0 *lc0 = pLeo->lc0; - LeoDraw *ld0 = pLeo->ld0; - xRectangle *prect; - RegionPtr prgnClip; - BoxPtr pextent; - int n; - int xorg, yorg; - int x1, y1, x2, y2; - int x, y, xx, yy; - - /* No garbage please. */ - if(nrectFill <= 0) - return; - - prgnClip = fbGetCompositeClip(pGC); - - prect = prectInit; - xorg = pDrawable->x; - yorg = pDrawable->y; - if (xorg || yorg) { - prect = prectInit; - n = nrectFill; - while(n--) { - prect->x += xorg; - prect->y += yorg; - prect++; - } - } - - prect = prectInit; - - if (pGC->alu != GXcopy) - ld0->rop = leoRopTable[pGC->alu]; - if (pGC->planemask != 0xffffff) - ld0->planemask = pGC->planemask; - ld0->fg = pGC->fgPixel; - - pextent = REGION_RECTS(prgnClip); - x1 = pextent->x1; - y1 = pextent->y1; - x2 = pextent->x2; - y2 = pextent->y2; - while (nrectFill--) { - x = prect->x; - y = prect->y; - xx = x + prect->width; - yy = y + prect->height; - if (x < x1) - x = x1; - if (y < y1) - y = y1; - prect++; - if (xx > x2) xx = x2; - if (x >= xx) continue; - if (yy > y2) yy = y2; - if (y >= yy) continue; - - lc0->extent = (xx - x - 1) | ((yy - y - 1) << 11); - lc0->fill = x | (y << 11); - while (lc0->csr & LEO_CSR_BLT_BUSY); - } - - if (pGC->alu != GXcopy) - ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; - if (pGC->planemask != 0xffffff) - ld0->planemask = 0xffffff; -} diff --git a/src/leo_frectsp.c b/src/leo_frectsp.c deleted file mode 100644 index e140eaa..0000000 --- a/src/leo_frectsp.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Acceleration for the Leo (ZX) framebuffer - Tiled/stippled rectangle filling. - * - * Copyright (C) 1999, 2000 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define PSZ 32 - -#include "leo.h" -#include "leo_regs.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "fb.h" - -void -LeoPolyFillStippledRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit) -{ - ScreenPtr pScreen = pDrawable->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn); - LeoPrivGCPtr gcPriv = LeoGetGCPrivate (pGC); - LeoCommand0 *lc0 = pLeo->lc0; - LeoDraw *ld0 = pLeo->ld0; - xRectangle *prect; - RegionPtr prgnClip; - register BoxPtr pbox; - BoxPtr pextent; - int n; - int xorg, yorg; - unsigned char *fb; - unsigned int *dst, *dline, *src, *srcstart, *srcend; - - /* No garbage please. */ - if(nrectFill <= 0) - return; - - prgnClip = fbGetCompositeClip(pGC); - - prect = prectInit; - xorg = pDrawable->x; - yorg = pDrawable->y; - if (xorg || yorg) { - prect = prectInit; - n = nrectFill; - while(n--) { - prect->x += xorg; - prect->y += yorg; - prect++; - } - } - - prect = prectInit; - - if ((gcPriv->stipple->alu & 0xf) != GXcopy) - ld0->rop = leoRopTable[gcPriv->stipple->alu & 0xf]; - if (pGC->planemask != 0xffffff) - ld0->planemask = pGC->planemask; - ld0->fg = gcPriv->stipple->fg; - lc0->addrspace = LEO_ADDRSPC_FONT_OBGR; - if (gcPriv->stipple->alu & 0x80) { - lc0->fontt = 1; - } else { - lc0->fontt = 0; - ld0->bg = gcPriv->stipple->bg; - } - fb = (unsigned char *)pLeo->fb; - srcstart = &gcPriv->stipple->bits[0]; - srcend = &gcPriv->stipple->bits[32]; - - if (REGION_NUM_RECTS(prgnClip) == 1) { - int x1, y1, x2, y2; - int x, y, xx, yy, w, h; - int i, j, sw, sm, ew, em, s; - - pextent = REGION_RECTS(prgnClip); - x1 = pextent->x1; - y1 = pextent->y1; - x2 = pextent->x2; - y2 = pextent->y2; - while (nrectFill--) { - x = prect->x; - y = prect->y; - xx = x + prect->width; - yy = y + prect->height; - if (x < x1) x = x1; - if (y < y1) y = y1; - if (xx > x2) xx = x2; - if (yy > y2) yy = y2; - prect++; - if (x >= xx) continue; - if (y >= yy) continue; - prect++; - w = xx - x; - h = yy - y; - if (x & 31) { - sw = 32 - (x & 31); - sm = 0xffffffff >> (x & 31); - } else { - sw = 0; - sm = 0xffffffff; - } - dline = (unsigned int *)(fb + (y << 13) + ((x & ~31) << 2)); - src = srcstart + (y & 31); - w -= sw; - if (w <= 0) { - if (w) - sm &= 0xffffffff << (32 - (w & 31)); - lc0->fontmsk = sm; - - for (i = 0; i < h; i++) { - s = *src++; - *dline = s; - if (src == srcend) - src = srcstart; - dline += 2048; - } - } else { - ew = w & 31; - em = 0xffffffff << (32 - ew); - w &= ~31; - - if (!sw && !ew) - lc0->fontmsk = 0xffffffff; - for (i = 0; i < h; i++) { - s = *src++; - dst = dline; - if (sw) { - lc0->fontmsk = sm; - *dst = s; - dst += 32; - lc0->fontmsk = 0xffffffff; - } else if (ew) - lc0->fontmsk = 0xffffffff; - for (j = 0; j < w; j += 32) { - *dst = s; - dst += 32; - } - if (ew) { - lc0->fontmsk = em; - *dst = s; - } - if (src == srcend) - src = srcstart; - dline += 2048; - } - } - } - } else { - int x1, y1, x2, y2, bx1, by1, bx2, by2; - int x, y, w, h; - int i, j, sw, sm, ew, em, s; - - pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); - x1 = pextent->x1; - y1 = pextent->y1; - x2 = pextent->x2; - y2 = pextent->y2; - while (nrectFill--) { - if ((bx1 = prect->x) < x1) - bx1 = x1; - - if ((by1 = prect->y) < y1) - by1 = y1; - - bx2 = (int) prect->x + (int) prect->width; - if (bx2 > x2) - bx2 = x2; - - by2 = (int) prect->y + (int) prect->height; - if (by2 > y2) - by2 = y2; - - prect++; - - if (bx1 >= bx2 || by1 >= by2) - continue; - - n = REGION_NUM_RECTS (prgnClip); - pbox = REGION_RECTS(prgnClip); - - /* clip the rectangle to each box in the clip region - this is logically equivalent to calling Intersect() - */ - while(n--) { - x = max(bx1, pbox->x1); - y = max(by1, pbox->y1); - w = min(bx2, pbox->x2) - x; - h = min(by2, pbox->y2) - y; - pbox++; - - /* see if clipping left anything */ - if (w > 0 && h > 0) { - if (x & 31) { - sw = 32 - (x & 31); - sm = 0xffffffff >> (x & 31); - } else { - sw = 0; - sm = 0xffffffff; - } - dline = (unsigned int *)(fb + (y << 13) + ((x & ~31) << 2)); - src = srcstart + (y & 31); - w -= sw; - if (w <= 0) { - w += 32; - if (w != 32) - sm &= 0xffffffff << (32 - (w & 31)); - lc0->fontmsk = sm; - - for (i = 0; i < h; i++) { - s = *src++; - *dline = s; - if (src == srcend) - src = srcstart; - dline += 2048; - } - } else { - ew = w & 31; - em = 0xffffffff << (32 - ew); - w &= ~31; - - if (!sw && !ew) - lc0->fontmsk = 0xffffffff; - - for (i = 0; i < h; i++) { - s = *src++; - dst = dline; - if (sw) { - lc0->fontmsk = sm; - *dst = s; - dst += 32; - lc0->fontmsk = 0xffffffff; - } else if (ew) - lc0->fontmsk = 0xffffffff; - for (j = 0; j < w; j += 32) { - *dst = s; - dst += 32; - } - if (ew) { - lc0->fontmsk = em; - *dst = s; - } - if (src == srcend) - src = srcstart; - dline += 2048; - } - } - } - } - } - } - - if (pGC->alu != GXcopy) - ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; - if (pGC->planemask != 0xffffff) - ld0->planemask = 0xffffff; - lc0->addrspace = LEO_ADDRSPC_OBGR; -} diff --git a/src/leo_fspans.c b/src/leo_fspans.c deleted file mode 100644 index 816351e..0000000 --- a/src/leo_fspans.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Acceleration for the Leo (ZX) framebuffer - Fill spans. - * - * Copyright (C) 1999, 2000 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define PSZ 32 - -#include "leo.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "fb.h" -#include "mi.h" -#include "mispans.h" - -void -LeoFillSpansSolid (DrawablePtr pDrawable, GCPtr pGC, - int n, DDXPointPtr ppt, - int *pwidth, int fSorted) -{ - ScreenPtr pScreen = pDrawable->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn); - LeoCommand0 *lc0 = pLeo->lc0; - LeoDraw *ld0 = pLeo->ld0; - int numRects, *pwidthFree; - DDXPointPtr pptFree; - RegionPtr clip; - unsigned char *fb; - int fg; - int cx1 = 0, cy1 = 0, cx2 = 0, cy2 = 0; - - clip = fbGetCompositeClip(pGC); - numRects = REGION_NUM_RECTS(clip); - - if (!numRects) - return; - - if (numRects == 1) { - cx1 = clip->extents.x1; - cx2 = clip->extents.x2; - cy1 = clip->extents.y1; - cy2 = clip->extents.y2; - } else { - int nTmp = n * miFindMaxBand(clip); - - pwidthFree = (int *)malloc(nTmp * sizeof(int)); - pptFree = (DDXPointRec *)malloc(nTmp * sizeof(DDXPointRec)); - if (!pptFree || !pwidthFree) { - if (pptFree) free(pptFree); - if (pwidthFree) free(pwidthFree); - return; - } - n = miClipSpans(clip, - ppt, pwidth, n, - pptFree, pwidthFree, fSorted); - pwidth = pwidthFree; - ppt = pptFree; - } - - if (pGC->alu != GXcopy) - ld0->rop = leoRopTable[pGC->alu]; - if (pGC->planemask != 0xffffff) - ld0->planemask = pGC->planemask; - ld0->fg = fg = pGC->fgPixel; - fb = (unsigned char *)pLeo->fb; - - while (n--) { - int x, y, w; - unsigned int *fbf; - - w = *pwidth++; - x = ppt->x; - y = ppt->y; - ppt++; - - if (numRects == 1) { - if (y < cy1 || y >= cy2) continue; - if (x < cx1) { - w -= (cx1 - x); - if (w <= 0) continue; - x = cx1; - } - if (x + w > cx2) { - if (x >= cx2) continue; - w = cx2 - x; - } - } - - if (w > 12) { - lc0->extent = w - 1; - lc0->fill = (y << 11) | x; - while (lc0->csr & LEO_CSR_BLT_BUSY); - } else { - fbf = (unsigned int *)(fb + (y << 13) + (x << 2)); - while (w--) - *fbf++ = fg; - } - } - - if (numRects != 1) { - free(pptFree); - free(pwidthFree); - } - if (pGC->alu != GXcopy) - ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; - if (pGC->planemask != 0xffffff) - ld0->planemask = 0xffffff; -} diff --git a/src/leo_fspanssp.c b/src/leo_fspanssp.c deleted file mode 100644 index 958e61b..0000000 --- a/src/leo_fspanssp.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Acceleration for the Leo (ZX) framebuffer - Fill tiled/stippled spans. - * - * Copyright (C) 1999, 2000 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define PSZ 32 - -#include "leo.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "fb.h" -#include "mi.h" -#include "mispans.h" - -void -LeoFillSpansStippled (DrawablePtr pDrawable, GCPtr pGC, - int n, DDXPointPtr ppt, - int *pwidth, int fSorted) -{ - LeoPrivGCPtr gcPriv = LeoGetGCPrivate (pGC); - ScreenPtr pScreen = pDrawable->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn); - LeoCommand0 *lc0 = pLeo->lc0; - LeoDraw *ld0 = pLeo->ld0; - int numRects, *pwidthFree; - DDXPointPtr pptFree; - RegionPtr clip; - unsigned char *fb; - unsigned int *bits, msk; - int cx1 = 0, cy1 = 0, cx2 = 0, cy2 = 0; - - clip = fbGetCompositeClip(pGC); - numRects = REGION_NUM_RECTS(clip); - - if (!numRects) - return; - - if (numRects == 1) { - cx1 = clip->extents.x1; - cx2 = clip->extents.x2; - cy1 = clip->extents.y1; - cy2 = clip->extents.y2; - } else { - int nTmp = n * miFindMaxBand(clip); - - pwidthFree = (int *)malloc(nTmp * sizeof(int)); - pptFree = (DDXPointRec *)malloc(nTmp * sizeof(DDXPointRec)); - if (!pptFree || !pwidthFree) { - if (pptFree) free(pptFree); - if (pwidthFree) free(pwidthFree); - return; - } - n = miClipSpans(clip, - ppt, pwidth, n, - pptFree, pwidthFree, fSorted); - pwidth = pwidthFree; - ppt = pptFree; - } - - if (pGC->alu != GXcopy) - ld0->rop = leoRopTable[pGC->alu]; - if (pGC->planemask != 0xffffff) - ld0->planemask = pGC->planemask; - ld0->fg = gcPriv->stipple->fg; - fb = (unsigned char *)pLeo->fb; - lc0->addrspace = LEO_ADDRSPC_FONT_OBGR; - if (gcPriv->stipple->alu & 0x80) { - lc0->fontt = 1; - } else { - lc0->fontt = 0; - ld0->bg = gcPriv->stipple->bg; - } - lc0->fontmsk = 0xffffffff; - msk = 0xffffffff; - bits = &gcPriv->stipple->bits[0]; - while (n--) { - int x, y, w; - unsigned int *dst, s, i, sw, sm; - - w = *pwidth++; - x = ppt->x; - y = ppt->y; - ppt++; - if (numRects == 1) { - if (y < cy1 || y >= cy2) continue; - if (x < cx1) { - w -= (cx1 - x); - if (w <= 0) continue; - x = cx1; - } - if (x + w > cx2) { - if (x >= cx2) continue; - w = cx2 - x; - } - } - s = bits[y & 31]; - dst = (unsigned int *)(fb + (y << 13) + ((x & ~31) << 2)); - if (x & 31) { - sw = 32 - (x & 31); - sm = 0xffffffff >> (x & 31); - w -= sw; - if (w <= 0) { - if (w) sm &= 0xffffffff << (32 - (w & 31)); - if (msk != sm) { - msk = sm; - lc0->fontmsk = sm; - } - *dst = s; - continue; - } - if (msk != sm) { - msk = sm; - lc0->fontmsk = sm; - } - *dst = s; - dst += 32; - } else { - sw = 0; - } - sw = w & 31; - w &= ~31; - if (w && msk != 0xffffffff) { - msk = 0xffffffff; - lc0->fontmsk = 0xffffffff; - for (i = 0; i < w; i += 32) { - *dst = s; - dst += 32; - } - } - if (sw) { - msk = 0xffffffff << (32 - sw); - lc0->fontmsk = msk; - *dst = s; - } - } - - if (numRects != 1) { - free(pptFree); - free(pwidthFree); - } - if (pGC->alu != GXcopy) - ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; - if (pGC->planemask != 0xffffff) - ld0->planemask = 0xffffff; - lc0->addrspace = LEO_ADDRSPC_OBGR; -} diff --git a/src/leo_glyph.c b/src/leo_glyph.c deleted file mode 100644 index 3119b6d..0000000 --- a/src/leo_glyph.c +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Acceleration for the Leo (ZX) framebuffer - Glyph rops. - * - * Copyright (C) 1999, 2000 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define PSZ 32 - -#include "leo.h" - -#include "pixmapstr.h" -#include "scrnintstr.h" -#include <X11/fonts/fontstruct.h> -#include "dixfontstr.h" - -#include "fb.h" -#include "mi.h" - -void -LeoPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase) -{ - ScreenPtr pScreen = pDrawable->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn); - LeoCommand0 *lc0 = pLeo->lc0; - LeoDraw *ld0 = pLeo->ld0; - RegionPtr clip; - CharInfoPtr pci; - int w, h, x0, y0, i; - unsigned int *bits; - BoxRec box; - int curw = -1; - unsigned int *fbf; - unsigned char *fb; - int height, width; - - clip = fbGetCompositeClip(pGC); - /* compute an approximate (but covering) bounding box */ - box.x1 = 0; - if (ppci[0]->metrics.leftSideBearing < 0) - box.x1 = ppci[0]->metrics.leftSideBearing; - h = nglyph - 1; - w = ppci[h]->metrics.rightSideBearing; - while (--h >= 0) - w += ppci[h]->metrics.characterWidth; - box.x2 = w; - box.y1 = -FONTMAXBOUNDS(pGC->font,ascent); - box.y2 = FONTMAXBOUNDS(pGC->font,descent); - - box.x1 += pDrawable->x + x; - box.x2 += pDrawable->x + x; - box.y1 += pDrawable->y + y; - box.y2 += pDrawable->y + y; - - switch (RECT_IN_REGION(pGC->pScreen, clip, &box)) { - case rgnPART: - if (REGION_NUM_RECTS(clip) == 1) { - ld0->vclipmin = (clip->extents.y1 << 16) | clip->extents.x1; - ld0->vclipmax = ((clip->extents.y2 - 1) << 16) | (clip->extents.x2 - 1); - break; - } - fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pGlyphBase); - case rgnOUT: - return; - default: - clip = NULL; - break; - } - - x += pDrawable->x; - y += pDrawable->y; - - lc0->fontt = 1; - lc0->addrspace = LEO_ADDRSPC_FONT_OBGR; - ld0->fg = pGC->fgPixel; - if (pGC->alu != GXcopy) - ld0->rop = leoRopTable[pGC->alu]; - if (pGC->planemask != 0xffffff) - ld0->planemask = pGC->planemask; - height = pLeo->height; - width = pLeo->width; - - fb = (unsigned char *)pLeo->fb; - - while (nglyph--) { - pci = *ppci++; - - w = GLYPHWIDTHPIXELS (pci); - h = GLYPHHEIGHTPIXELS (pci); - if (!w || !h) - goto next_glyph; - - x0 = x + pci->metrics.leftSideBearing; - y0 = y - pci->metrics.ascent; - - /* We're off the screen to the left, making our way - * back onto the screen. - */ - if((x0 >> 31) == -1) - goto next_glyph; - - /* We walked off the screen (to the right or downwards) - * or we started there, we're never going to work our - * way back so stop now. - */ - if(x0 >= width || y0 >= height) - break; - - bits = (unsigned int *) pci->bits; - - if (w != curw) { - curw = w; - if (w) - lc0->fontmsk = 0xffffffff << (32 - w); - else - lc0->fontmsk = 0; - } - - fbf = (unsigned *)(fb + (y0 << 13) + (x0 << 2)); - if (y0 + h <= height) - for (i = 0; i < h; i++) { - *fbf = *bits++; - fbf += 2048; - } - else - for (i = 0; i < h && y0 + i < height; i++) { - *fbf = *bits++; - fbf += 2048; - } - next_glyph: - x += pci->metrics.characterWidth; - } - - lc0->addrspace = LEO_ADDRSPC_OBGR; - if (pGC->alu != GXcopy) - ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; - if (pGC->planemask != 0xffffff) - ld0->planemask = 0xffffff; - if (clip) { - ld0->vclipmin = 0; - ld0->vclipmax = pLeo->vclipmax; - } -} - -void -LeoTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase) -{ - ScreenPtr pScreen = pDrawable->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn); - LeoCommand0 *lc0 = pLeo->lc0; - LeoDraw *ld0 = pLeo->ld0; - RegionPtr clip; - int h, hTmp; - int widthGlyph, widthGlyphs; - BoxRec bbox; - FontPtr pfont = pGC->font; - int curw = -1; - unsigned int *fbf; - unsigned char *fb; - int height, width; - - widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); - h = FONTASCENT(pfont) + FONTDESCENT(pfont); - clip = fbGetCompositeClip(pGC); - bbox.x1 = x + pDrawable->x; - bbox.x2 = bbox.x1 + (widthGlyph * nglyph); - bbox.y1 = y + pDrawable->y - FONTASCENT(pfont); - bbox.y2 = bbox.y1 + h; - - /* If fully out of range, and we have no chance of getting back - * in range, no work to do. - */ - y = y + pDrawable->y - FONTASCENT(pfont); - x += pDrawable->x; - height = pLeo->height; - width = pLeo->width; - - if (x >= width) - return; - - switch (RECT_IN_REGION(pGC->pScreen, clip, &bbox)) { - case rgnPART: - if (REGION_NUM_RECTS(clip) == 1) { - ld0->vclipmin = (clip->extents.y1 << 16) | clip->extents.x1; - ld0->vclipmax = ((clip->extents.y2 - 1) << 16) | (clip->extents.x2 - 1); - break; - } - x -= pDrawable->x; - y = y - pDrawable->y + FONTASCENT(pfont); - if (pGlyphBase) - fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, NULL); - else - miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pGlyphBase); - case rgnOUT: - return; - default: - clip = NULL; - break; - } - - lc0->addrspace = LEO_ADDRSPC_FONT_OBGR; - ld0->fg = pGC->fgPixel; - if (pGC->alu != GXcopy) - ld0->rop = leoRopTable[pGC->alu]; - if (pGC->planemask != 0xffffff) - ld0->planemask = pGC->planemask; - - fb = (unsigned char *)pLeo->fb; - - if(pGlyphBase) - lc0->fontt = 1; - else { - lc0->fontt = 0; - ld0->bg = pGC->bgPixel; - } - -#define LoopIt(count, w, loadup, fetch) \ - if (w != curw) { \ - curw = w; \ - lc0->fontmsk = 0xffffffff << (32 - w); \ - } \ - while (nglyph >= count) { \ - loadup \ - nglyph -= count; \ - fbf = (unsigned *)(fb + (y << 13) + (x << 2)); \ - hTmp = h; \ - if (y + h <= height) \ - while (hTmp--) { \ - *fbf = fetch; \ - fbf += 2048; \ - } \ - else \ - for (hTmp = 0; hTmp < h && y + hTmp < height; hTmp++) { \ - *fbf = fetch; \ - fbf += 2048; \ - } \ - x += w; \ - if(x >= width) \ - goto out; \ - } - - if (widthGlyph <= 8) { - widthGlyphs = widthGlyph << 2; - LoopIt(4, widthGlyphs, - unsigned int *char1 = (unsigned int *) (*ppci++)->bits; - unsigned int *char2 = (unsigned int *) (*ppci++)->bits; - unsigned int *char3 = (unsigned int *) (*ppci++)->bits; - unsigned int *char4 = (unsigned int *) (*ppci++)->bits;, - (*char1++ | ((*char2++ | ((*char3++ | (*char4++ - >> widthGlyph)) - >> widthGlyph)) - >> widthGlyph))) - } else if (widthGlyph <= 10) { - widthGlyphs = (widthGlyph << 1) + widthGlyph; - LoopIt(3, widthGlyphs, - unsigned int *char1 = (unsigned int *) (*ppci++)->bits; - unsigned int *char2 = (unsigned int *) (*ppci++)->bits; - unsigned int *char3 = (unsigned int *) (*ppci++)->bits;, - (*char1++ | ((*char2++ | (*char3++ >> widthGlyph)) >> widthGlyph))) - } else if (widthGlyph <= 16) { - widthGlyphs = widthGlyph << 1; - LoopIt(2, widthGlyphs, - unsigned int *char1 = (unsigned int *) (*ppci++)->bits; - unsigned int *char2 = (unsigned int *) (*ppci++)->bits;, - (*char1++ | (*char2++ >> widthGlyph))) - } - if(nglyph != 0) { - if (widthGlyph != curw) { - curw = widthGlyph; - lc0->fontmsk = 0xffffffff << (32 - widthGlyph); - } - while (nglyph--) { - unsigned int *char1 = (unsigned int *) (*ppci++)->bits; - fbf = (unsigned *)(fb + (y << 13) + (x << 2)); - hTmp = h; - if (y + h <= height) - while (hTmp--) { - *fbf = *char1++; - fbf += 2048; - } - else - for (hTmp = 0; hTmp < h && y + hTmp < height; hTmp++) { - *fbf = *char1++; - fbf += 2048; - } - x += widthGlyph; - if (x >= width) - goto out; - } - } - -out: lc0->addrspace = LEO_ADDRSPC_OBGR; - if (pGC->alu != GXcopy) - ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; - if (pGC->planemask != 0xffffff) - ld0->planemask = 0xffffff; - if (clip) { - ld0->vclipmin = 0; - ld0->vclipmax = pLeo->vclipmax; - } -} - -void -LeoPolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase) -{ - LeoTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (char *) 1); -} |