Initial import of libpixregion

This commit is contained in:
Carl Worth 2003-02-25 08:05:26 +00:00
parent 56e193eaf2
commit a837f75a8b
16 changed files with 2972 additions and 0 deletions

13
pixman/.cvsignore Normal file
View file

@ -0,0 +1,13 @@
Makefile
Makefile.in
aclocal.m4
config.cache
config.h
config.h.in
config.log
config.status
configure
libpixregion.pc
libtool
stamp-h
stamp-h.in

2
pixman/AUTHORS Normal file
View file

@ -0,0 +1,2 @@
X Window System authors
(libpixregion now maintained by Carl Worth <cworth@isi.edu>)

42
pixman/COPYING Normal file
View file

@ -0,0 +1,42 @@
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.

View file

9
pixman/INSTALL Normal file
View file

@ -0,0 +1,9 @@
This code uses automake, in order to generate the Makefiles use:
$ autogen.sh
After that, standard build procedures apply:
$ make
# make install

8
pixman/Makefile.am Normal file
View file

@ -0,0 +1,8 @@
SUBDIRS = . src
EXTRA_DIST = \
COPYING \
libpixregion.pc.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libpixregion.pc

1
pixman/NEWS Normal file
View file

@ -0,0 +1 @@

15
pixman/README Normal file
View file

@ -0,0 +1,15 @@
libpixregion - Pixel region Library
libpixregion is a generic library for manipulating pixel regions. A
PixRegion is a set of Y-X banded rectangles that cover the desired
region.
The original code for libxregion was part of the reference X server
implementation of the X Window System. A modified copy of the code
also exists in the Xlib client library. libpixregion was formed so
that both the X server and client libraries could share common code
for region manipulation.
libpixregion is also intended to be applicable outside of the X Window
System. The public interface of libpixregion does not depend on any
part of the X Window System.

30
pixman/autogen.sh Executable file
View file

@ -0,0 +1,30 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
set -e
ARGV0=$0
if test -z "$*"; then
echo "$ARGV0: Note: \`./configure' will be run with no arguments."
echo " If you wish to pass any to it, please specify them on the"
echo " \`$0' command line."
echo
fi
do_cmd() {
echo "$ARGV0: running \`$@'"
$@
}
do_cmd libtoolize --force --copy
do_cmd aclocal
do_cmd autoheader
do_cmd automake --add-missing
do_cmd autoconf
do_cmd ./configure ${1+"$@"} && echo "Now type \`make' to compile" || exit 1

46
pixman/configure.in Normal file
View file

@ -0,0 +1,46 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(src/pixregion.h)
dnl ===========================================================================
LIBIC_MAJOR_VERSION=0
LIBPIXREGION_MINOR_VERSION=1
LIBPIXREGION_MICRO_VERSION=0
AC_SUBST(LIBPIXREGION_MAJOR_VERSION)
AC_SUBST(LIBPIXREGION_MINOR_VERSION)
AC_SUBST(LIBPIXREGION_MICRO_VERSION)
LIBPIXREGION_VERSION=$LIBPIXREGION_MAJOR_VERSION.$LIBPIXREGION_MINOR_VERSION.$LIBPIXREGION_MICRO_VERSION
VERSION_INFO=`expr $LIBPIXREGION_MAJOR_VERSION + $LIBPIXREGION_MINOR_VERSION`:$LIBPIXREGION_MICRO_VERSION:$LIBPIXREGION_MINOR_VERSION
AC_SUBST(VERSION_INFO)
dnl ===========================================================================
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE(libpixregion, $LIBPIXREGION_VERSION)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AC_PROG_CC
AM_PROG_LIBTOOL
dnl ===========================================================================
AC_PATH_XTRA
dnl ===========================================================================
AC_SUBST(LIBPIXREGION_CFLAGS)
AC_SUBST(LIBPIXREGION_LIBS)
dnl ===========================================================================
AC_OUTPUT([
libpixregion.pc
Makefile
src/Makefile
])

10
pixman/libpixman.pc.in Normal file
View file

@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libpixregion
Description: Pixel region library
Version: @VERSION@
Libs: -L${libdir} -lpixregion
Cflags: -I${includedir}

6
pixman/src/.cvsignore Normal file
View file

@ -0,0 +1,6 @@
Makefile
Makefile.in
*.la
*.lo
.libs
.deps

12
pixman/src/Makefile.am Normal file
View file

@ -0,0 +1,12 @@
lib_LTLIBRARIES = libpixregion.la
include_HEADERS = pixregion.h
libpixregion_la_SOURCES = \
pixregion.c \
pixregion.h \
pixregionint.h
libpixregion_la_LDFLAGS = -version-info @VERSION_INFO@
INCLUDES = $(LIBPIXREGION_CFLAGS)
ldadds = $(LIBPIXREGION_LIBS)

157
pixman/src/pixman.h Normal file
View file

@ -0,0 +1,157 @@
/* $Xorg: $ */
/***********************************************************
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.
******************************************************************/
/* $XFree86: $ */
#ifndef PIXREGION_H
#define PIXREGION_H
typedef struct _PixRegion PixRegion;
typedef struct _PixRegionBox {
short x1, y1, x2, y2;
} PixRegionBox;
typedef enum {
PixRegionStatusFailure,
PixRegionStatusSuccess
} PixRegionStatus;
/* creation/destruction */
PixRegion *
PixRegionCreate (void);
PixRegion *
PixRegionCreateSized (PixRegionBox *extents_or_null, int size);
void
PixRegionDestroy (PixRegion *region);
/* manipulation */
void
PixRegionTranslate (PixRegion *pReg, int x, int y);
PixRegionStatus
PixRegionCopy (PixRegion *dest, PixRegion *source);
PixRegionStatus
PixRegionIntersect (PixRegion *newReg, PixRegion *reg1, PixRegion *reg2);
PixRegionStatus
PixRegionUnion (PixRegion *newReg, PixRegion *reg1, PixRegion *reg2);
PixRegionStatus
PixRegionUnionRect(PixRegion *dest, PixRegion *source,
int x, int y, unsigned int width, unsigned int height);
PixRegionStatus
PixRegionSubtract (PixRegion *regD, PixRegion *regM, PixRegion *regS);
PixRegionStatus
PixRegionInverse (PixRegion *newReg, PixRegion *reg1, PixRegionBox *invRect);
/* XXX: Need to fix this so it doesn't depend on an X data structure
PixRegion *
RectsToPixRegion (int nrects, xRectanglePtr prect, int ctype);
*/
/* querying */
/* XXX: These should proably be combined: PixRegionGetRects? */
int
PixRegionNumRects (PixRegion *region);
PixRegionBox *
PixRegionRects (PixRegion *region);
/* XXX: Change to an enum */
#define rgnOUT 0
#define rgnIN 1
#define rgnPART 2
int
PixRegionPointInRegion (PixRegion *pReg, int x, int y, PixRegionBox *box);
int
PixRegionRectIn (PixRegion *PixRegion, PixRegionBox *prect);
int
PixRegionNotEmpty (PixRegion *pReg);
PixRegionBox *
PixRegionExtents (PixRegion *pReg);
/* mucking around */
/* WARNING: calling PixRegionAppend may leave dest as an invalid
region. Follow-up with PixRegionValidate to fix it up. */
PixRegionStatus
PixRegionAppend (PixRegion *dest, PixRegion *region);
PixRegionStatus
PixRegionValidate (PixRegion *badreg, int *pOverlap);
/* Unclassified functionality */
void
PixRegionReset (PixRegion *pReg, PixRegionBox *pBox);
PixRegionStatus
PixRegionBreak (PixRegion *pReg);
void
PixRegionInit (PixRegion *region, PixRegionBox *rect, int size);
void
PixRegionUninit (PixRegion *region);
void
PixRegionEmpty (PixRegion *pReg);
#endif /* PIXREGION_H */

2538
pixman/src/pixregion.c Normal file

File diff suppressed because it is too large Load diff

83
pixman/src/pixregionint.h Normal file
View file

@ -0,0 +1,83 @@
/***********************************************************
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.
******************************************************************/
/* $XFree86: $ */
#ifndef PIXREGIONINT_H
#define PIXREGIONINT_H
#include "pixregion.h"
typedef struct _PixRegionData {
long size;
long numRects;
/* XXX: And why, exactly, do we have this bogus struct definition? */
/* PixRegionBox rects[size]; in memory but not explicitly declared */
} PixRegionData;
struct _PixRegion {
PixRegionBox extents;
PixRegionData *data;
};
typedef struct _PixRegionPoint {
int x, y;
} PixRegionPoint;
#define PIXREGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)
/* not a region */
#define PIXREGION_NAR(reg) ((reg)->data == &PixRegionBrokenData)
#define PIXREGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1)
#define PIXREGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0)
#define PIXREGION_RECTS(reg) ((reg)->data ? (PixRegionBox *)((reg)->data + 1) \
: &(reg)->extents)
#define PIXREGION_BOXPTR(reg) ((PixRegionBox *)((reg)->data + 1))
#define PIXREGION_BOX(reg,i) (&PIXREGION_BOXPTR(reg)[i])
#define PIXREGION_TOP(reg) PIXREGION_BOX(reg, (reg)->data->numRects)
#define PIXREGION_END(reg) PIXREGION_BOX(reg, (reg)->data->numRects - 1)
#define PIXREGION_SZOF(n) (sizeof(PixRegionData) + ((n) * sizeof(PixRegionBox)))
#endif