diff options
author | marha <marha@users.sourceforge.net> | 2011-03-10 09:49:29 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-03-10 09:49:29 +0000 |
commit | f81bb3160c5f39d8f7ad329e99865af88f02b96a (patch) | |
tree | e12e90b1707bed3f4fdd6a3901f4cbcbe76d0b34 /xorg-server/hw/xnest | |
parent | 8c74e7257ed453143c53086f884f6c6ff585379a (diff) | |
download | vcxsrv-f81bb3160c5f39d8f7ad329e99865af88f02b96a.tar.gz vcxsrv-f81bb3160c5f39d8f7ad329e99865af88f02b96a.tar.bz2 vcxsrv-f81bb3160c5f39d8f7ad329e99865af88f02b96a.zip |
xserver mesa git update 10 Mar 2011
Diffstat (limited to 'xorg-server/hw/xnest')
-rw-r--r-- | xorg-server/hw/xnest/Pixmap.c | 273 | ||||
-rw-r--r-- | xorg-server/hw/xnest/XNPixmap.h | 74 |
2 files changed, 173 insertions, 174 deletions
diff --git a/xorg-server/hw/xnest/Pixmap.c b/xorg-server/hw/xnest/Pixmap.c index da81a1d06..c901db19f 100644 --- a/xorg-server/hw/xnest/Pixmap.c +++ b/xorg-server/hw/xnest/Pixmap.c @@ -1,137 +1,136 @@ -/*
-
-Copyright 1993 by Davor Matic
-
-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. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
-
-*/
-
-#ifdef HAVE_XNEST_CONFIG_H
-#include <xnest-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "regionstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "gc.h"
-#include "servermd.h"
-#include "privates.h"
-#include "mi.h"
-
-#include "Xnest.h"
-
-#include "Display.h"
-#include "Screen.h"
-#include "XNPixmap.h"
-
-DevPrivateKeyRec xnestPixmapPrivateKeyRec;
-
-PixmapPtr
-xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint)
-{
- PixmapPtr pPixmap;
-
- pPixmap = AllocatePixmap(pScreen, 0);
- if (!pPixmap)
- return NullPixmap;
- pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
- pPixmap->drawable.depth = depth;
- pPixmap->drawable.bitsPerPixel = depth;
- pPixmap->drawable.id = 0;
- pPixmap->drawable.x = 0;
- pPixmap->drawable.y = 0;
- pPixmap->drawable.width = width;
- pPixmap->drawable.height = height;
- pPixmap->drawable.pScreen = pScreen;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pPixmap->refcnt = 1;
- pPixmap->devKind = PixmapBytePad(width, depth);
- pPixmap->usage_hint = usage_hint;
- if (width && height)
- xnestPixmapPriv(pPixmap)->pixmap =
- XCreatePixmap(xnestDisplay,
- xnestDefaultWindows[pScreen->myNum],
- width, height, depth);
- else
- xnestPixmapPriv(pPixmap)->pixmap = 0;
-
- return pPixmap;
-}
-
-Bool
-xnestDestroyPixmap(PixmapPtr pPixmap)
-{
- if(--pPixmap->refcnt)
- return TRUE;
- XFreePixmap(xnestDisplay, xnestPixmap(pPixmap));
- FreePixmap(pPixmap);
- return TRUE;
-}
-
-RegionPtr
-xnestPixmapToRegion(PixmapPtr pPixmap)
-{
- XImage *ximage;
- register RegionPtr pReg, pTmpReg;
- register int x, y;
- unsigned long previousPixel, currentPixel;
- BoxRec Box = { 0, 0, 0, 0 };
- Bool overlap;
-
- ximage = XGetImage(xnestDisplay, xnestPixmap(pPixmap), 0, 0,
- pPixmap->drawable.width, pPixmap->drawable.height,
- 1, XYPixmap);
-
- pReg = RegionCreate(NULL, 1);
- pTmpReg = RegionCreate(NULL, 1);
- if(!pReg || !pTmpReg) {
- XDestroyImage(ximage);
- return NullRegion;
- }
-
- for (y = 0; y < pPixmap->drawable.height; y++) {
- Box.y1 = y;
- Box.y2 = y + 1;
- previousPixel = 0L;
- for (x = 0; x < pPixmap->drawable.width; x++) {
- currentPixel = XGetPixel(ximage, x, y);
- if (previousPixel != currentPixel) {
- if (previousPixel == 0L) {
- /* left edge */
- Box.x1 = x;
- }
- else if (currentPixel == 0L) {
- /* right edge */
- Box.x2 = x;
- RegionReset(pTmpReg, &Box);
- RegionAppend(pReg, pTmpReg);
- }
- previousPixel = currentPixel;
- }
- }
- if (previousPixel != 0L) {
- /* right edge because of the end of pixmap */
- Box.x2 = pPixmap->drawable.width;
- RegionReset(pTmpReg, &Box);
- RegionAppend(pReg, pTmpReg);
- }
- }
-
- RegionDestroy(pTmpReg);
- XDestroyImage(ximage);
-
- RegionValidate(pReg, &overlap);
-
- return pReg;
-}
+/* + +Copyright 1993 by Davor Matic + +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. Davor Matic makes no representations about +the suitability of this software for any purpose. It is provided "as +is" without express or implied warranty. + +*/ + +#ifdef HAVE_XNEST_CONFIG_H +#include <xnest-config.h> +#endif + +#include <X11/X.h> +#include <X11/Xproto.h> +#include "regionstr.h" +#include "pixmapstr.h" +#include "scrnintstr.h" +#include "regionstr.h" +#include "gc.h" +#include "servermd.h" +#include "privates.h" +#include "mi.h" + +#include "Xnest.h" + +#include "Display.h" +#include "Screen.h" +#include "XNPixmap.h" + +DevPrivateKeyRec xnestPixmapPrivateKeyRec; + +PixmapPtr +xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, + unsigned class) +{ + PixmapPtr pPixmap; + + pPixmap = AllocatePixmap(pScreen, 0); + if (!pPixmap) + return NullPixmap; + pPixmap->drawable.type = DRAWABLE_PIXMAP; + pPixmap->drawable.class = class; + pPixmap->drawable.depth = depth; + pPixmap->drawable.bitsPerPixel = depth; + pPixmap->drawable.id = 0; + pPixmap->drawable.x = 0; + pPixmap->drawable.y = 0; + pPixmap->drawable.width = width; + pPixmap->drawable.height = height; + pPixmap->drawable.pScreen = pScreen; + pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; + pPixmap->refcnt = 1; + pPixmap->devKind = PixmapBytePad(width, depth); + if (width && height) + xnestPixmapPriv(pPixmap)->pixmap = + XCreatePixmap(xnestDisplay, + xnestDefaultWindows[pScreen->myNum], + width, height, depth); + else + xnestPixmapPriv(pPixmap)->pixmap = 0; + + return pPixmap; +} + +Bool +xnestDestroyPixmap(PixmapPtr pPixmap) +{ + if(--pPixmap->refcnt) + return TRUE; + XFreePixmap(xnestDisplay, xnestPixmap(pPixmap)); + FreePixmap(pPixmap); + return TRUE; +} + +RegionPtr +xnestPixmapToRegion(PixmapPtr pPixmap) +{ + XImage *ximage; + register RegionPtr pReg, pTmpReg; + register int x, y; + unsigned long previousPixel, currentPixel; + BoxRec Box = { 0, 0, 0, 0 }; + Bool overlap; + + ximage = XGetImage(xnestDisplay, xnestPixmap(pPixmap), 0, 0, + pPixmap->drawable.width, pPixmap->drawable.height, + 1, XYPixmap); + + pReg = RegionCreate(NULL, 1); + pTmpReg = RegionCreate(NULL, 1); + if(!pReg || !pTmpReg) { + XDestroyImage(ximage); + return NullRegion; + } + + for (y = 0; y < pPixmap->drawable.height; y++) { + Box.y1 = y; + Box.y2 = y + 1; + previousPixel = 0L; + for (x = 0; x < pPixmap->drawable.width; x++) { + currentPixel = XGetPixel(ximage, x, y); + if (previousPixel != currentPixel) { + if (previousPixel == 0L) { + /* left edge */ + Box.x1 = x; + } + else if (currentPixel == 0L) { + /* right edge */ + Box.x2 = x; + RegionReset(pTmpReg, &Box); + RegionAppend(pReg, pTmpReg); + } + previousPixel = currentPixel; + } + } + if (previousPixel != 0L) { + /* right edge because of the end of pixmap */ + Box.x2 = pPixmap->drawable.width; + RegionReset(pTmpReg, &Box); + RegionAppend(pReg, pTmpReg); + } + } + + RegionDestroy(pTmpReg); + XDestroyImage(ximage); + + RegionValidate(pReg, &overlap); + + return pReg; +} diff --git a/xorg-server/hw/xnest/XNPixmap.h b/xorg-server/hw/xnest/XNPixmap.h index 0d7c6b61e..638a43a1a 100644 --- a/xorg-server/hw/xnest/XNPixmap.h +++ b/xorg-server/hw/xnest/XNPixmap.h @@ -1,37 +1,37 @@ -/*
-
-Copyright 1993 by Davor Matic
-
-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. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
-
-*/
-
-#ifndef XNESTPIXMAP_H
-#define XNESTPIXMAP_H
-
-extern DevPrivateKeyRec xnestPixmapPrivateKeyRec;
-#define xnestPixmapPrivateKey (&xnestPixmapPrivateKeyRec)
-
-typedef struct {
- Pixmap pixmap;
-} xnestPrivPixmap;
-
-#define xnestPixmapPriv(pPixmap) ((xnestPrivPixmap *) \
- dixLookupPrivate(&(pPixmap)->devPrivates, xnestPixmapPrivateKey))
-
-#define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap)
-
-#define xnestSharePixmap(pPixmap) ((pPixmap)->refcnt++)
-
-PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height,
- int depth, unsigned usage_hint);
-Bool xnestDestroyPixmap(PixmapPtr pPixmap);
-RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap);
-
-#endif /* XNESTPIXMAP_H */
+/* + +Copyright 1993 by Davor Matic + +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. Davor Matic makes no representations about +the suitability of this software for any purpose. It is provided "as +is" without express or implied warranty. + +*/ + +#ifndef XNESTPIXMAP_H +#define XNESTPIXMAP_H + +extern DevPrivateKeyRec xnestPixmapPrivateKeyRec; +#define xnestPixmapPrivateKey (&xnestPixmapPrivateKeyRec) + +typedef struct { + Pixmap pixmap; +} xnestPrivPixmap; + +#define xnestPixmapPriv(pPixmap) ((xnestPrivPixmap *) \ + dixLookupPrivate(&(pPixmap)->devPrivates, xnestPixmapPrivateKey)) + +#define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap) + +#define xnestSharePixmap(pPixmap) ((pPixmap)->refcnt++) + +PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height, + int depth, unsigned class); +Bool xnestDestroyPixmap(PixmapPtr pPixmap); +RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap); + +#endif /* XNESTPIXMAP_H */ |