[PATCH 7/7] mi: Remove miGetImage
Adam Jackson
ajax at redhat.com
Wed Oct 8 05:17:19 PDT 2014
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
mi/Makefile.am | 1 -
mi/mi.h | 12 ---
mi/mibitblt.c | 259 ---------------------------------------------------------
3 files changed, 272 deletions(-)
delete mode 100644 mi/mibitblt.c
diff --git a/mi/Makefile.am b/mi/Makefile.am
index 407900a..c3e26e3 100644
--- a/mi/Makefile.am
+++ b/mi/Makefile.am
@@ -11,7 +11,6 @@ AM_CFLAGS = $(DIX_CFLAGS)
libmi_la_SOURCES = \
mi.h \
miarc.c \
- mibitblt.c \
micmap.c \
micmap.h \
micoord.h \
diff --git a/mi/mi.h b/mi/mi.h
index 356f494..6a773c3 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -78,18 +78,6 @@ extern _X_EXPORT void miPolyArc(DrawablePtr /*pDraw */ ,
xArc * /*parcs */
);
-/* mibitblt.c */
-
-extern _X_EXPORT void miGetImage(DrawablePtr /*pDraw */ ,
- int /*sx */ ,
- int /*sy */ ,
- int /*w */ ,
- int /*h */ ,
- unsigned int /*format */ ,
- unsigned long /*planeMask */ ,
- char * /*pdstLine */
- );
-
/* micopy.c */
#define miGetCompositeClip(pGC) ((pGC)->pCompositeClip)
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
deleted file mode 100644
index bbba14b..0000000
--- a/mi/mibitblt.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-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 THE
-OPEN GROUP 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.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* Author: Todd Newman (aided and abetted by Mr. Drewry) */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-
-#include "misc.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "mi.h"
-#include "regionstr.h"
-#include <X11/Xmd.h>
-#include "servermd.h"
-
-#ifndef HAVE_FFS
-extern int ffs(int);
-#endif
-
-/* MIGETPLANE -- gets a bitmap representing one plane of pDraw
- * A helper used for CopyPlane and XY format GetImage
- * No clever strategy here, we grab a scanline at a time, pull out the
- * bits and then stuff them in a 1 bit deep map.
- */
-/*
- * This should be replaced with something more general. mi shouldn't have to
- * care about such things as scanline padding et alia.
- */
-static
-MiBits *
-miGetPlane(DrawablePtr pDraw, int planeNum, /* number of the bitPlane */
- int sx, int sy, int w, int h, MiBits * result)
-{
- int i, j, k, width, bitsPerPixel, widthInBytes;
- DDXPointRec pt = { 0, 0 };
- MiBits pixel;
- MiBits bit;
- unsigned char *pCharsOut = NULL;
-
-#if BITMAP_SCANLINE_UNIT == 8
-#define OUT_TYPE unsigned char
-#endif
-#if BITMAP_SCANLINE_UNIT == 16
-#define OUT_TYPE CARD16
-#endif
-#if BITMAP_SCANLINE_UNIT == 32
-#define OUT_TYPE CARD32
-#endif
-#if BITMAP_SCANLINE_UNIT == 64
-#define OUT_TYPE CARD64
-#endif
-
- OUT_TYPE *pOut;
- int delta = 0;
-
- sx += pDraw->x;
- sy += pDraw->y;
- widthInBytes = BitmapBytePad(w);
- if (!result)
- result = calloc(h, widthInBytes);
- if (!result)
- return NULL;
- bitsPerPixel = pDraw->bitsPerPixel;
- pOut = (OUT_TYPE *) result;
- if (bitsPerPixel == 1) {
- pCharsOut = (unsigned char *) result;
- width = w;
- }
- else {
- delta = (widthInBytes / (BITMAP_SCANLINE_UNIT / 8)) -
- (w / BITMAP_SCANLINE_UNIT);
- width = 1;
-#if IMAGE_BYTE_ORDER == MSBFirst
- planeNum += (32 - bitsPerPixel);
-#endif
- }
- pt.y = sy;
- for (i = h; --i >= 0; pt.y++) {
- pt.x = sx;
- if (bitsPerPixel == 1) {
- (*pDraw->pScreen->GetSpans) (pDraw, width, &pt, &width, 1,
- (char *) pCharsOut);
- pCharsOut += widthInBytes;
- }
- else {
- k = 0;
- for (j = w; --j >= 0; pt.x++) {
- /* Fetch the next pixel */
- (*pDraw->pScreen->GetSpans) (pDraw, width, &pt, &width, 1,
- (char *) &pixel);
- /*
- * Now get the bit and insert into a bitmap in XY format.
- */
- bit = (pixel >> planeNum) & 1;
-#if 0
- /* XXX assuming bit order == byte order */
-#if BITMAP_BIT_ORDER == LSBFirst
- bit <<= k;
-#else
- bit <<= ((BITMAP_SCANLINE_UNIT - 1) - k);
-#endif
-#else
- /* XXX assuming byte order == LSBFirst */
- if (screenInfo.bitmapBitOrder == LSBFirst)
- bit <<= k;
- else
- bit <<= ((screenInfo.bitmapScanlineUnit - 1) -
- (k % screenInfo.bitmapScanlineUnit)) +
- ((k / screenInfo.bitmapScanlineUnit) *
- screenInfo.bitmapScanlineUnit);
-#endif
- *pOut |= (OUT_TYPE) bit;
- k++;
- if (k == BITMAP_SCANLINE_UNIT) {
- pOut++;
- k = 0;
- }
- }
- pOut += delta;
- }
- }
- return result;
-
-}
-
-/* MIGETIMAGE -- public entry for the GetImage Request
- * We're getting the image into a memory buffer. While we have to use GetSpans
- * to read a line from the device (since we don't know what that looks like),
- * we can just write into the destination buffer
- *
- * two different strategies are used, depending on whether we're getting the
- * image in Z format or XY format
- * Z format:
- * Line at a time, GetSpans a line into the destination buffer, then if the
- * planemask is not all ones, we do a SetSpans into a temporary buffer (to get
- * bits turned off) and then another GetSpans to get stuff back (because
- * pixmaps are opaque, and we are passed in the memory to write into). This is
- * pretty ugly and slow but works. Life is hard.
- * XY format:
- * get the single plane specified in planemask
- */
-void
-miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h,
- unsigned int format, unsigned long planeMask, char *pDst)
-{
- unsigned char depth;
- int i, linelength, width, srcx, srcy;
- DDXPointRec pt = { 0, 0 };
- PixmapPtr pPixmap = NULL;
- GCPtr pGC = NULL;
-
- depth = pDraw->depth;
- if (format == ZPixmap) {
- if ((((1LL << depth) - 1) & planeMask) != (1LL << depth) - 1) {
- ChangeGCVal gcv;
- xPoint xpt;
-
- pGC = GetScratchGC(depth, pDraw->pScreen);
- if (!pGC)
- return;
- pPixmap = (*pDraw->pScreen->CreatePixmap)
- (pDraw->pScreen, w, 1, depth, CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pPixmap) {
- FreeScratchGC(pGC);
- return;
- }
- /*
- * Clear the pixmap before doing anything else
- */
- ValidateGC((DrawablePtr) pPixmap, pGC);
- xpt.x = xpt.y = 0;
- width = w;
- (*pGC->ops->FillSpans) ((DrawablePtr) pPixmap, pGC, 1, &xpt, &width,
- TRUE);
-
- /* alu is already GXCopy */
- gcv.val = (XID) planeMask;
- ChangeGC(NullClient, pGC, GCPlaneMask, &gcv);
- ValidateGC((DrawablePtr) pPixmap, pGC);
- }
-
- linelength = PixmapBytePad(w, depth);
- srcx = sx + pDraw->x;
- srcy = sy + pDraw->y;
- for (i = 0; i < h; i++) {
- pt.x = srcx;
- pt.y = srcy + i;
- width = w;
- (*pDraw->pScreen->GetSpans) (pDraw, w, &pt, &width, 1, pDst);
- if (pPixmap) {
- pt.x = 0;
- pt.y = 0;
- width = w;
- (*pGC->ops->SetSpans) ((DrawablePtr) pPixmap, pGC, pDst,
- &pt, &width, 1, TRUE);
- (*pDraw->pScreen->GetSpans) ((DrawablePtr) pPixmap, w, &pt,
- &width, 1, pDst);
- }
- pDst += linelength;
- }
- if (pPixmap) {
- (*pGC->pScreen->DestroyPixmap) (pPixmap);
- FreeScratchGC(pGC);
- }
- }
- else {
- (void) miGetPlane(pDraw, ffs(planeMask) - 1, sx, sy, w, h,
- (MiBits *) pDst);
- }
-}
--
1.9.3
More information about the xorg-devel
mailing list