mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-27 05:50:06 +01:00
Death to mfb.
Anyone still interested in 1 or 4 bpp framebuffers, talk to fb.
This commit is contained in:
parent
af86c3b7ce
commit
f31bd087e8
100 changed files with 8 additions and 26217 deletions
|
|
@ -9,10 +9,6 @@ if XTRAP
|
|||
XTRAP_DIR=XTrap
|
||||
endif
|
||||
|
||||
if MFB
|
||||
MFB_DIR=mfb
|
||||
endif
|
||||
|
||||
if GLX
|
||||
GLX_DIR=glx
|
||||
endif
|
||||
|
|
@ -39,7 +35,6 @@ SUBDIRS = \
|
|||
Xi \
|
||||
xkb \
|
||||
$(DBE_DIR) \
|
||||
$(MFB_DIR) \
|
||||
$(RECORD_DIR) \
|
||||
xfixes \
|
||||
damageext \
|
||||
|
|
@ -82,7 +77,6 @@ DIST_SUBDIRS = \
|
|||
Xi \
|
||||
xkb \
|
||||
dbe \
|
||||
mfb \
|
||||
record \
|
||||
xfixes \
|
||||
damageext \
|
||||
|
|
|
|||
|
|
@ -1976,8 +1976,6 @@ hw/xfree86/vbe/Makefile
|
|||
hw/xfree86/vgahw/Makefile
|
||||
hw/xfree86/x86emu/Makefile
|
||||
hw/xfree86/xaa/Makefile
|
||||
hw/xfree86/xf1bpp/Makefile
|
||||
hw/xfree86/xf4bpp/Makefile
|
||||
hw/xfree86/xf8_16bpp/Makefile
|
||||
hw/xfree86/utils/Makefile
|
||||
hw/xfree86/utils/cvt/Makefile
|
||||
|
|
|
|||
3
fb/fb.h
3
fb/fb.h
|
|
@ -101,9 +101,6 @@
|
|||
#if GLYPHPADBYTES != 4
|
||||
#error "GLYPHPADBYTES must be 4"
|
||||
#endif
|
||||
#if GETLEFTBITS_ALIGNMENT != 1
|
||||
#error "GETLEFTBITS_ALIGNMENT must be 1"
|
||||
#endif
|
||||
/* whether to bother to include 24bpp support */
|
||||
#ifndef FBNO24BIT
|
||||
#define FB_24BIT
|
||||
|
|
|
|||
|
|
@ -12,19 +12,15 @@ if XF86UTILS
|
|||
XF86UTILS_SUBDIR = utils
|
||||
endif
|
||||
|
||||
if MFB
|
||||
MFB_SUBDIR = xf1bpp xf4bpp
|
||||
endif
|
||||
|
||||
DOC_SUBDIR = doc
|
||||
|
||||
SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
|
||||
ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) \
|
||||
ramdac shadowfb vbe vgahw xaa \
|
||||
xf8_16bpp loader dixmods exa modes \
|
||||
$(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR)
|
||||
|
||||
DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
|
||||
parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
|
||||
parser rac ramdac shadowfb vbe vgahw xaa \
|
||||
xf8_16bpp loader dixmods dri dri2 exa modes \
|
||||
utils doc
|
||||
|
||||
|
|
|
|||
|
|
@ -14,17 +14,12 @@ if DBE
|
|||
DBEMOD = libdbe.la
|
||||
endif
|
||||
|
||||
if MFB
|
||||
MFBMOD = libmfb.la
|
||||
endif
|
||||
|
||||
if RECORD
|
||||
RECORDMOD = librecord.la
|
||||
endif
|
||||
|
||||
module_LTLIBRARIES = libfb.la \
|
||||
libwfb.la \
|
||||
$(MFBMOD) \
|
||||
libshadow.la
|
||||
|
||||
extsmoduledir = $(moduledir)/extensions
|
||||
|
|
@ -66,10 +61,6 @@ libglx_la_LIBADD = \
|
|||
$(GLXDRI_LIBRARY)
|
||||
libglx_la_SOURCES = glxmodule.c
|
||||
|
||||
libmfb_la_LDFLAGS = -avoid-version
|
||||
libmfb_la_LIBADD = $(top_builddir)/mfb/libmfb.la
|
||||
libmfb_la_SOURCES = mfbmodule.c
|
||||
|
||||
librecord_la_LDFLAGS = -avoid-version
|
||||
librecord_la_LIBADD = $(top_builddir)/record/librecord.la
|
||||
librecord_la_SOURCES = recordmod.c
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ endif
|
|||
|
||||
AM_CFLAGS = @DIX_CFLAGS@ @XORG_CFLAGS@
|
||||
INCLUDES = @XORG_INCS@ \
|
||||
-I$(top_srcdir)/mfb \
|
||||
-I$(top_srcdir)/dbe \
|
||||
-I$(top_srcdir)/hw/xfree86/loader \
|
||||
-I$(top_srcdir)/miext/shadow
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 THE
|
||||
* XFREE86 PROJECT 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 XFree86 Project 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
|
||||
* XFree86 Project.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf86Module.h"
|
||||
|
||||
static XF86ModuleVersionInfo VersRec =
|
||||
{
|
||||
"mfb",
|
||||
MODULEVENDORSTRING,
|
||||
MODINFOSTRING1,
|
||||
MODINFOSTRING2,
|
||||
XORG_VERSION_CURRENT,
|
||||
1, 0, 0,
|
||||
ABI_CLASS_ANSIC, /* Only need the ansic layer */
|
||||
ABI_ANSIC_VERSION,
|
||||
MOD_CLASS_NONE,
|
||||
{0,0,0,0} /* signature, to be patched into the file by a tool */
|
||||
};
|
||||
|
||||
_X_EXPORT XF86ModuleData mfbModuleData = { &VersRec, NULL, NULL };
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
module_LTLIBRARIES = libxf1bpp.la
|
||||
|
||||
sdk_HEADERS = xf1bpp.h mfbmap.h mfbunmap.h
|
||||
|
||||
libxf1bpp_la_LDFLAGS = -avoid-version
|
||||
|
||||
libxf1bppgen_a_SOURCES = \
|
||||
mfbseg.c \
|
||||
mfbpgbwht.c \
|
||||
mfbpgbblak.c \
|
||||
mfbpgbinv.c \
|
||||
mfbigbwht.c \
|
||||
mfbigbblak.c \
|
||||
mfbpawhite.c \
|
||||
mfbpablack.c \
|
||||
mfbpainv.c \
|
||||
mfbtewhite.c \
|
||||
mfbteblack.c \
|
||||
mfbplywhite.c \
|
||||
mfbplyblack.c \
|
||||
mfbplyinv.c \
|
||||
mfbbltC.c \
|
||||
mfbbltX.c \
|
||||
mfbbltCI.c \
|
||||
mfbbltO.c \
|
||||
mfbbltG.c \
|
||||
mfbtileC.c \
|
||||
mfbtileG.c
|
||||
|
||||
libxf1bppmfb_a_SOURCES = \
|
||||
maskbits.c \
|
||||
mfbbitblt.c \
|
||||
mfbbres.c \
|
||||
mfbbresd.c \
|
||||
mfbclip.c \
|
||||
mfbcmap.c \
|
||||
mfbfillarc.c \
|
||||
mfbfillrct.c \
|
||||
mfbfillsp.c \
|
||||
mfbfont.c \
|
||||
mfbgc.c \
|
||||
mfbgetsp.c \
|
||||
mfbhrzvert.c \
|
||||
mfbimage.c \
|
||||
mfbline.c \
|
||||
mfbmisc.c \
|
||||
mfbpixmap.c \
|
||||
mfbpolypnt.c \
|
||||
mfbpushpxl.c \
|
||||
mfbscrclse.c \
|
||||
mfbscrinit.c \
|
||||
mfbsetsp.c \
|
||||
mfbwindow.c \
|
||||
mfbzerarc.c
|
||||
|
||||
BUILT_SOURCES = $(libxf1bppmfb_a_SOURCES) $(libxf1bppgen_a_SOURCES)
|
||||
|
||||
libxf1bpp_la_SOURCES = $(libxf1bppmfb_a_SOURCES) $(libxf1bppgen_a_SOURCES) \
|
||||
mfbmodule.c
|
||||
|
||||
AM_CFLAGS = -DXF86MONO $(DIX_CFLAGS) $(XORG_CFLAGS)
|
||||
INCLUDES = $(XORG_INCS) -I$(top_srcdir)/mfb
|
||||
|
||||
mfbseg.c:
|
||||
echo "#define POLYSEGMENT" > $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbline.c\"" >> $@
|
||||
mfbpgbwht.c:
|
||||
echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltWhite" > $@
|
||||
echo "#define OPEQ |=" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
|
||||
mfbpgbblak.c:
|
||||
echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltBlack" > $@
|
||||
echo "#define OPEQ &=~" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
|
||||
mfbpgbinv.c:
|
||||
echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltInvert" > $@
|
||||
echo "#define OPEQ ^=" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
|
||||
mfbigbwht.c:
|
||||
echo "#define MFBIMAGEGLYPHBLT xf1bppImageGlyphBltWhite" > $@
|
||||
echo "#define OPEQ |=" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbimggblt.c\"" >> $@
|
||||
mfbigbblak.c:
|
||||
echo "#define MFBIMAGEGLYPHBLT xf1bppImageGlyphBltBlack" > $@
|
||||
echo "#define OPEQ &=~" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbimggblt.c\"" >> $@
|
||||
mfbpawhite.c:
|
||||
echo "#define MFBSOLIDFILLAREA xf1bppSolidWhiteArea" > $@
|
||||
echo "#define MFBSTIPPLEFILLAREA xf1bppStippleWhiteArea" >> $@
|
||||
echo "#define OPEQ |=" >> $@
|
||||
echo "#define EQWHOLEWORD =~0" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
|
||||
mfbpablack.c:
|
||||
echo "#define MFBSOLIDFILLAREA xf1bppSolidBlackArea" > $@
|
||||
echo "#define MFBSTIPPLEFILLAREA xf1bppStippleBlackArea" >> $@
|
||||
echo "#define OPEQ &=~" >> $@
|
||||
echo "#define EQWHOLEWORD =0" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
|
||||
mfbpainv.c:
|
||||
echo "#define MFBSOLIDFILLAREA xf1bppSolidInvertArea" > $@
|
||||
echo "#define MFBSTIPPLEFILLAREA xf1bppStippleInvertArea" >> $@
|
||||
echo "#define OPEQ ^=" >> $@
|
||||
echo "#define EQWHOLEWORD ^=~0" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
|
||||
mfbtewhite.c:
|
||||
echo "#define OP" > $@
|
||||
echo "#define CLIPTETEXT xf1bppImageGlyphBltWhite" >> $@
|
||||
echo "#define MFBTEGLYPHBLT xf1bppTEGlyphBltWhite" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbtegblt.c\"" >> $@
|
||||
mfbteblack.c:
|
||||
echo "#define OP ~" > $@
|
||||
echo "#define CLIPTETEXT xf1bppImageGlyphBltBlack" >> $@
|
||||
echo "#define MFBTEGLYPHBLT xf1bppTEGlyphBltBlack" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbtegblt.c\"" >> $@
|
||||
mfbplywhite.c:
|
||||
echo "#define MFBFILLPOLY1RECT xf1bppFillPolyWhite" > $@
|
||||
echo "#define OPEQ |=" >> $@
|
||||
echo "#define EQWHOLEWORD =~0" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
|
||||
mfbplyblack.c:
|
||||
echo "#define MFBFILLPOLY1RECT xf1bppFillPolyBlack" > $@
|
||||
echo "#define OPEQ &=~" >> $@
|
||||
echo "#define EQWHOLEWORD =0" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
|
||||
mfbplyinv.c:
|
||||
echo "#define MFBFILLPOLY1RECT xf1bppFillPolyInvert" > $@
|
||||
echo "#define OPEQ ^=" >> $@
|
||||
echo "#define EQWHOLEWORD ^=~0" >> $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
|
||||
mfbbltC.c:
|
||||
echo "#define MROP Mcopy" > $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
|
||||
mfbbltX.c:
|
||||
echo "#define MROP Mxor" > $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
|
||||
mfbbltCI.c:
|
||||
echo "#define MROP McopyInverted" > $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
|
||||
mfbbltO.c:
|
||||
echo "#define MROP Mor" > $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
|
||||
mfbbltG.c:
|
||||
echo "#define MROP M0" > $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
|
||||
mfbtileC.c:
|
||||
echo "#define MROP Mcopy" > $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbtile.c\"" >> $@
|
||||
mfbtileG.c:
|
||||
echo "#define MRop M0" > $@
|
||||
echo "#include \"mfbmap.h\"" >> $@
|
||||
echo "#include \"$(top_srcdir)/mfb/mfbtile.c\"" >> $@
|
||||
|
||||
$(libxf1bppmfb_a_SOURCES):
|
||||
echo "#include \"mfbmap.h\"" > $@
|
||||
echo "#include \"$(top_srcdir)/mfb/$@\"" >> $@
|
||||
|
||||
EXTRA_DIST = mfbmap.sh mfbunmap.sh
|
||||
DISTCLEANFILES = $(BUILT_SOURCES)
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
|
||||
#ifndef _MFBMAP_H
|
||||
#define _MFBMAP_H
|
||||
|
||||
#define InverseAlu xf1bppInverseAlu
|
||||
#define endtab xf1bppendtab
|
||||
#define mask xf1bppmask
|
||||
#define mergeRopBits xf1bppmergeRopBits
|
||||
#define mergeGetRopBits xf1bppmergeGetRopBits
|
||||
#define mfbAllocatePrivates xf1bppAllocatePrivates
|
||||
#define mfbBSFuncRec xf1bppBSFuncRec
|
||||
#define mfbBlackSolidFS xf1bppBlackSolidFS
|
||||
#define mfbBlackStippleFS xf1bppBlackStippleFS
|
||||
#define mfbBresD xf1bppBresD
|
||||
#define mfbBresS xf1bppBresS
|
||||
#define mfbChangeWindowAttributes xf1bppChangeWindowAttributes
|
||||
#define mfbCloseScreen xf1bppCloseScreen
|
||||
#define mfbCopyArea xf1bppCopyArea
|
||||
#define mfbCopyPixmap xf1bppCopyPixmap
|
||||
#define mfbCopyPlane xf1bppCopyPlane
|
||||
#define mfbCopyRotatePixmap xf1bppCopyRotatePixmap
|
||||
#define mfbCopyWindow xf1bppCopyWindow
|
||||
#define mfbCreateColormap xf1bppCreateColormap
|
||||
#define mfbCreateDefColormap xf1bppCreateDefColormap
|
||||
#define mfbCreateGC xf1bppCreateGC
|
||||
#define mfbCreatePixmap xf1bppCreatePixmap
|
||||
#define mfbCreateWindow xf1bppCreateWindow
|
||||
#define mfbDestroyColormap xf1bppDestroyColormap
|
||||
#define mfbDestroyPixmap xf1bppDestroyPixmap
|
||||
#define mfbDestroyWindow xf1bppDestroyWindow
|
||||
#define mfbDoBitblt xf1bppDoBitblt
|
||||
#define mfbDoBitbltCopy xf1bppDoBitbltCopy
|
||||
#define mfbDoBitbltCopyInverted xf1bppDoBitbltCopyInverted
|
||||
#define mfbDoBitbltGeneral xf1bppDoBitbltGeneral
|
||||
#define mfbDoBitbltOr xf1bppDoBitbltOr
|
||||
#define mfbDoBitbltXor xf1bppDoBitbltXor
|
||||
#define mfbFillInScreen xf1bppFillInScreen
|
||||
#define mfbFillPolyBlack xf1bppFillPolyBlack
|
||||
#define mfbFillPolyInvert xf1bppFillPolyInvert
|
||||
#define mfbFillPolyWhite xf1bppFillPolyWhite
|
||||
#define mfbGCPrivateIndex xf1bppGCPrivateIndex
|
||||
#define mfbGetGCPrivateIndex xf1bppGetGCPrivateIndex
|
||||
#define mfbGetImage xf1bppGetImage
|
||||
#define mfbGetInverseAlu xf1bppGetInverseAlu
|
||||
#define mfbGetSpans xf1bppGetSpans
|
||||
#define mfbGetWindowPixmap xf1bppGetWindowPixmap
|
||||
#define mfbGetWindowPrivateIndex xf1bppGetWindowPrivateIndex
|
||||
#define mfbGetmask xf1bppGetmask
|
||||
#define mfbGetpartmasks xf1bppGetpartmasks
|
||||
#define mfbGetrmask xf1bppGetrmask
|
||||
#define mfbGetstarttab xf1bppGetstarttab
|
||||
#define mfbGetendtab xf1bppGetendtab
|
||||
#define mfbHorzS xf1bppHorzS
|
||||
#define mfbImageGlyphBltBlack xf1bppImageGlyphBltBlack
|
||||
#define mfbImageGlyphBltWhite xf1bppImageGlyphBltWhite
|
||||
#define mfbInstallColormap xf1bppInstallColormap
|
||||
#define mfbInvertSolidFS xf1bppInvertSolidFS
|
||||
#define mfbInvertStippleFS xf1bppInvertStippleFS
|
||||
#define mfbLineSD xf1bppLineSD
|
||||
#define mfbLineSS xf1bppLineSS
|
||||
#define mfbListInstalledColormaps xf1bppListInstalledColormaps
|
||||
#define mfbMapWindow xf1bppMapWindow
|
||||
#define mfbPadPixmap xf1bppPadPixmap
|
||||
#define mfbPixmapToRegion xf1bppPixmapToRegion
|
||||
#define mfbPixmapToRegionWeak xf1bppPixmapToRegionWeak
|
||||
#define mfbPolyFillArcSolid xf1bppPolyFillArcSolid
|
||||
#define mfbPolyFillRect xf1bppPolyFillRect
|
||||
#define mfbPolyGlyphBltBlack xf1bppPolyGlyphBltBlack
|
||||
#define mfbPolyGlyphBltInvert xf1bppPolyGlyphBltInvert
|
||||
#define mfbPolyGlyphBltWhite xf1bppPolyGlyphBltWhite
|
||||
#define mfbPolyPoint xf1bppPolyPoint
|
||||
#define mfbPositionWindow xf1bppPositionWindow
|
||||
#define mfbPushPixels xf1bppPushPixels
|
||||
#define mfbPushPixelsWeak xf1bppPushPixelsWeak
|
||||
#define mfbPutImage xf1bppPutImage
|
||||
#define mfbQueryBestSize xf1bppQueryBestSize
|
||||
#define mfbQueryBestSizeWeak xf1bppQueryBestSizeWeak
|
||||
#define mfbRealizeFont xf1bppRealizeFont
|
||||
#define mfbRealizeFontWeak xf1bppRealizeFontWeak
|
||||
#define mfbReduceRop xf1bppReduceRop
|
||||
#define mfbRegisterCopyPlaneProc xf1bppRegisterCopyPlaneProc
|
||||
#define mfbResolveColor xf1bppResolveColor
|
||||
#define mfbRestoreAreas xf1bppRestoreAreas
|
||||
#define mfbSaveAreas xf1bppSaveAreas
|
||||
#define mfbScreenInit xf1bppScreenInit
|
||||
#define mfbSegmentSD xf1bppSegmentSD
|
||||
#define mfbSegmentSS xf1bppSegmentSS
|
||||
#define mfbSetScanline xf1bppSetScanline
|
||||
#define mfbSetSpans xf1bppSetSpans
|
||||
#define mfbSetWindowPixmap xf1bppSetWindowPixmap
|
||||
#define mfbSolidBlackArea xf1bppSolidBlackArea
|
||||
#define mfbSolidInvertArea xf1bppSolidInvertArea
|
||||
#define mfbSolidPP xf1bppSolidPP
|
||||
#define mfbSolidWhiteArea xf1bppSolidWhiteArea
|
||||
#define mfbStippleBlackArea xf1bppStippleBlackArea
|
||||
#define mfbStippleInvertArea xf1bppStippleInvertArea
|
||||
#define mfbStippleWhiteArea xf1bppStippleWhiteArea
|
||||
#define mfbTEGlyphBltBlack xf1bppTEGlyphBltBlack
|
||||
#define mfbTEGlyphBltWhite xf1bppTEGlyphBltWhite
|
||||
#define mfbTileAreaPPW xf1bppTileAreaPPW
|
||||
#define mfbTileAreaPPWCopy xf1bppTileAreaPPWCopy
|
||||
#define mfbTileAreaPPWGeneral xf1bppTileAreaPPWGeneral
|
||||
#define mfbTileFS xf1bppTileFS
|
||||
#define mfbUninstallColormap xf1bppUninstallColormap
|
||||
#define mfbUnmapWindow xf1bppUnmapWindow
|
||||
#define mfbUnnaturalStippleFS xf1bppUnnaturalStippleFS
|
||||
#define mfbUnnaturalTileFS xf1bppUnnaturalTileFS
|
||||
#define mfbUnrealizeFont xf1bppUnrealizeFont
|
||||
#define mfbUnrealizeFontWeak xf1bppUnrealizeFontWeak
|
||||
#define mfbValidateGC xf1bppValidateGC
|
||||
#define mfbVertS xf1bppVertS
|
||||
#define mfbWhiteSolidFS xf1bppWhiteSolidFS
|
||||
#define mfbWhiteStippleFS xf1bppWhiteStippleFS
|
||||
#define mfbWindowPrivateIndex xf1bppWindowPrivateIndex
|
||||
#define mfbXRotatePixmap xf1bppXRotatePixmap
|
||||
#define mfbYRotatePixmap xf1bppYRotatePixmap
|
||||
#define mfbZeroPolyArcSS xf1bppZeroPolyArcSS
|
||||
#define partmasks xf1bpppartmasks
|
||||
#define rmask xf1bpprmask
|
||||
#define starttab xf1bppstarttab
|
||||
|
||||
#endif
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# $XFree86: xc/programs/Xserver/hw/xfree86/xf1bpp/mfbmap.sh,v 1.1.2.3 1998/06/27 14:48:23 dawes Exp $
|
||||
#
|
||||
# This script recreates the mapping list that maps the mfb external
|
||||
# symbols * to xf1bpp* (without "mfb")
|
||||
# This should only be rerun if there have been changes in the mfb code
|
||||
# that affect the external symbols.
|
||||
# It assumes that Xserver/mfb has been compiled.
|
||||
# The output goes to stdout.
|
||||
echo ""
|
||||
echo "#ifndef _MFBMAP_H"
|
||||
echo "#define _MFBMAP_H"
|
||||
echo ""
|
||||
|
||||
nm ../../../mfb/*.o | \
|
||||
awk "{ if ((\$2 == \"D\") || (\$2 == \"T\") || (\$2 == \"C\")) print \$3 }" | \
|
||||
sed s/^_// | \
|
||||
grep -v "ModuleInit$" | \
|
||||
sort | \
|
||||
awk "{ print \"#define \" \$1 \" xf1bpp\"\$1 }" | \
|
||||
sed s/xf1bppmfb/xf1bpp/
|
||||
|
||||
echo ""
|
||||
echo "#endif"
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 1997 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 THE
|
||||
* XFREE86 PROJECT 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 XFree86 Project 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
|
||||
* XFree86 Project.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf86Module.h"
|
||||
|
||||
static XF86ModuleVersionInfo VersRec =
|
||||
{
|
||||
"xf1bpp",
|
||||
MODULEVENDORSTRING,
|
||||
MODINFOSTRING1,
|
||||
MODINFOSTRING2,
|
||||
XORG_VERSION_CURRENT,
|
||||
1, 0, 0,
|
||||
ABI_CLASS_ANSIC, /* Only need ansic layer */
|
||||
ABI_ANSIC_VERSION,
|
||||
MOD_CLASS_NONE,
|
||||
{0,0,0,0} /* signature, to be patched into the file by a tool */
|
||||
};
|
||||
|
||||
_X_EXPORT XF86ModuleData xf1bppModuleData = { &VersRec, NULL, NULL };
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
|
||||
#ifdef _MFBMAP_H
|
||||
#undef _MFBMAP_H
|
||||
|
||||
#undef InverseAlu
|
||||
#undef endtab
|
||||
#undef mask
|
||||
#undef mergeRopBits
|
||||
#undef mergeGetRopBits
|
||||
#undef mfbAllocatePrivates
|
||||
#undef mfbBSFuncRec
|
||||
#undef mfbBlackSolidFS
|
||||
#undef mfbBlackStippleFS
|
||||
#undef mfbBresD
|
||||
#undef mfbBresS
|
||||
#undef mfbChangeWindowAttributes
|
||||
#undef mfbCloseScreen
|
||||
#undef mfbCopyArea
|
||||
#undef mfbCopyPixmap
|
||||
#undef mfbCopyPlane
|
||||
#undef mfbCopyRotatePixmap
|
||||
#undef mfbCopyWindow
|
||||
#undef mfbCreateColormap
|
||||
#undef mfbCreateDefColormap
|
||||
#undef mfbCreateGC
|
||||
#undef mfbCreatePixmap
|
||||
#undef mfbCreateWindow
|
||||
#undef mfbDestroyColormap
|
||||
#undef mfbDestroyPixmap
|
||||
#undef mfbDestroyWindow
|
||||
#undef mfbDoBitblt
|
||||
#undef mfbDoBitbltCopy
|
||||
#undef mfbDoBitbltCopyInverted
|
||||
#undef mfbDoBitbltGeneral
|
||||
#undef mfbDoBitbltOr
|
||||
#undef mfbDoBitbltXor
|
||||
#undef mfbFillPolyBlack
|
||||
#undef mfbFillPolyInvert
|
||||
#undef mfbFillPolyWhite
|
||||
#undef mfbGCPrivateIndex
|
||||
#undef mfbGetImage
|
||||
#undef mfbGetInverseAlu
|
||||
#undef mfbGetSpans
|
||||
#undef mfbGetWindowPixmap
|
||||
#undef mfbHorzS
|
||||
#undef mfbImageGlyphBltBlack
|
||||
#undef mfbImageGlyphBltWhite
|
||||
#undef mfbInstallColormap
|
||||
#undef mfbInvertSolidFS
|
||||
#undef mfbInvertStippleFS
|
||||
#undef mfbLineSD
|
||||
#undef mfbLineSS
|
||||
#undef mfbListInstalledColormaps
|
||||
#undef mfbMapWindow
|
||||
#undef mfbPadPixmap
|
||||
#undef mfbPixmapToRegion
|
||||
#undef mfbPixmapToRegionWeak
|
||||
#undef mfbPolyFillArcSolid
|
||||
#undef mfbPolyFillRect
|
||||
#undef mfbPolyGlyphBltBlack
|
||||
#undef mfbPolyGlyphBltInvert
|
||||
#undef mfbPolyGlyphBltWhite
|
||||
#undef mfbPolyPoint
|
||||
#undef mfbPositionWindow
|
||||
#undef mfbPushPixels
|
||||
#undef mfbPushPixelsWeak
|
||||
#undef mfbPutImage
|
||||
#undef mfbQueryBestSize
|
||||
#undef mfbQueryBestSizeWeak
|
||||
#undef mfbRealizeFont
|
||||
#undef mfbRealizeFontWeak
|
||||
#undef mfbReduceRop
|
||||
#undef mfbRegisterCopyPlaneProc
|
||||
#undef mfbResolveColor
|
||||
#undef mfbRestoreAreas
|
||||
#undef mfbSaveAreas
|
||||
#undef mfbScreenInit
|
||||
#undef mfbSegmentSD
|
||||
#undef mfbSegmentSS
|
||||
#undef mfbSetScanline
|
||||
#undef mfbSetSpans
|
||||
#undef mfbSetWindowPixmap
|
||||
#undef mfbSolidBlackArea
|
||||
#undef mfbSolidInvertArea
|
||||
#undef mfbSolidPP
|
||||
#undef mfbSolidWhiteArea
|
||||
#undef mfbStippleBlackArea
|
||||
#undef mfbStippleInvertArea
|
||||
#undef mfbStippleWhiteArea
|
||||
#undef mfbTEGlyphBltBlack
|
||||
#undef mfbTEGlyphBltWhite
|
||||
#undef mfbTileAreaPPW
|
||||
#undef mfbTileAreaPPWCopy
|
||||
#undef mfbTileAreaPPWGeneral
|
||||
#undef mfbTileFS
|
||||
#undef mfbUninstallColormap
|
||||
#undef mfbUnmapWindow
|
||||
#undef mfbUnnaturalStippleFS
|
||||
#undef mfbUnnaturalTileFS
|
||||
#undef mfbUnrealizeFont
|
||||
#undef mfbUnrealizeFontWeak
|
||||
#undef mfbValidateGC
|
||||
#undef mfbVertS
|
||||
#undef mfbWhiteSolidFS
|
||||
#undef mfbWhiteStippleFS
|
||||
#undef mfbWindowPrivateIndex
|
||||
#undef mfbXRotatePixmap
|
||||
#undef mfbYRotatePixmap
|
||||
#undef mfbZeroPolyArcSS
|
||||
#undef partmasks
|
||||
#undef rmask
|
||||
#undef starttab
|
||||
|
||||
#endif
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# $XFree86: xc/programs/Xserver/hw/xfree86/xf1bpp/mfbunmap.sh,v 1.1.2.1 1998/06/27 14:48:24 dawes Exp $
|
||||
#
|
||||
# This script recreates a header that undoes the effect of mfbmap.h
|
||||
# This should only be rerun if there have been changes in the mfb code
|
||||
# that affect the external symbols.
|
||||
# It assumes that Xserver/mfb has been compiled.
|
||||
# The output goes to stdout.
|
||||
echo ""
|
||||
echo "#ifdef _MFBMAP_H"
|
||||
echo "#undef _MFBMAP_H"
|
||||
echo ""
|
||||
|
||||
nm ../../../mfb/*.o | \
|
||||
awk "{ if ((\$2 == \"D\") || (\$2 == \"T\") || (\$2 == \"C\")) print \$3 }" | \
|
||||
sed s/^_// | \
|
||||
grep -v "ModuleInit$" | \
|
||||
sort | \
|
||||
awk "{ print \"#undef \" \$1 }"
|
||||
|
||||
echo ""
|
||||
echo "#endif"
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 THE
|
||||
* XFREE86 PROJECT 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 XFree86 Project 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
|
||||
* XFree86 Project.
|
||||
*/
|
||||
|
||||
#ifndef __XF1BPP_H__
|
||||
#define __XF1BPP_H__
|
||||
|
||||
#define MFB_PROTOTYPES_ONLY
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "mfbunmap.h"
|
||||
#undef MFB_PROTOTYPES_ONLY
|
||||
|
||||
#endif
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
module_LTLIBRARIES = libxf4bpp.la
|
||||
|
||||
sdk_HEADERS = xf4bpp.h
|
||||
|
||||
libxf4bpp_la_LDFLAGS = -avoid-version
|
||||
|
||||
libxf4bpp_la_SOURCES = \
|
||||
ppcArea.c \
|
||||
ppcClip.c \
|
||||
ppcCpArea.c \
|
||||
ppcCReduce.c \
|
||||
ppcDepth.c \
|
||||
ppcFillRct.c \
|
||||
ppcWinFS.c \
|
||||
ppcPixFS.c \
|
||||
ppcGC.c \
|
||||
ppcGetSp.c \
|
||||
ppcImg.c \
|
||||
ppcPixmap.c \
|
||||
ppcPolyPnt.c \
|
||||
ppcQuery.c \
|
||||
ppcRslvC.c \
|
||||
ppcSetSp.c \
|
||||
ppcWindow.c \
|
||||
ppcIO.c \
|
||||
emulOpStip.c \
|
||||
emulRepAre.c \
|
||||
emulTile.c \
|
||||
vgaGC.c \
|
||||
vgaBitBlt.c \
|
||||
vgaImages.c \
|
||||
vgaStipple.c \
|
||||
vgaSolid.c \
|
||||
offscreen.c \
|
||||
wm3.c \
|
||||
mfbimggblt.c \
|
||||
mfbline.c \
|
||||
mfbseg.c \
|
||||
mfbhrzvert.c \
|
||||
mfbbres.c \
|
||||
mfbbresd.c \
|
||||
mfbfillarc.c \
|
||||
mfbzerarc.c \
|
||||
vgamodule.c
|
||||
|
||||
EXTRA_DIST = OScompiler.h ibmTrace.h ppcGCstr.h ppcSpMcro.h vgaReg.h \
|
||||
vgaVideo.h wm3.h NOTES
|
||||
|
||||
DISTCLEANFILES = mfbseg.c
|
||||
|
||||
mfbseg.c:
|
||||
echo "#define POLYSEGMENT" > $@
|
||||
echo "#include \"$(srcdir)/mfbline.c\"" >> $@
|
||||
|
||||
INCLUDES = $(XORG_INCS) -I$(srcdir)/../xf1bpp -I$(top_srcdir)/mfb
|
||||
|
||||
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
This code originally hails from IBM. It was ported to an early XFree86 by
|
||||
Gertjan Akkerman, whose BUGS file I append here.
|
||||
|
||||
In turn, this is a port of Gertjan's work to the new server design. Among the
|
||||
changes are:
|
||||
|
||||
- The removal of almost all unreferenced code.
|
||||
- The removal of this code's own copy of mfb (xf1bpp is used instead).
|
||||
- The removal of banking support (mibank is used instead).
|
||||
- External symbols were made static where this was sufficient.
|
||||
- The remaining external names were renamed to xf4bpp*.
|
||||
- Several minor cleanups too many to mention here.
|
||||
|
||||
To understate the matter, this code is >UGLY<. This seems inherent in IBM's
|
||||
corporate culture. Be that as it may, it *does* survive X11R4's xtest
|
||||
(whatever that means these days...). For now, this is sufficient for 4bpp
|
||||
support in the new design, but at some point, I'll have to sit down and
|
||||
rewrite this from scratch. A more technical justification for a rewrite is
|
||||
that the pixmap format is 8bpp, instead of 4bpp, which is causing me to
|
||||
pepper the rest of the server with unclean accomodations.
|
||||
|
||||
Marc.
|
||||
|
||||
===============================================================================
|
||||
Section 1: From IBM's X11R4 contribution towards XFree86.
|
||||
|
||||
This section describes what I did to obtain a 16 colour vga server.
|
||||
|
||||
I started with the SYSV, ppc, vga and common directories from IBM's X11R4
|
||||
contribution. Those directories have the following function:
|
||||
1. SYSV implements the mouse and keyboard.
|
||||
2. ppc is a generic layer implementing ddx in terms of drawing operations
|
||||
through rectangles. (With spans as a boundary case: height = 1.)
|
||||
3. vga implements a layer of operations drawing through rectangles.
|
||||
4. common implements ddx initialization and quitting, and screen saving.
|
||||
|
||||
I eliminated SYSV and common since the functionality provided therein is
|
||||
already provided in XFree86. Since XFree86 is actively being ported to
|
||||
new operating systems, while X11R4 is out of date, I preferred the XFree86
|
||||
code here above the SYSV and common code.
|
||||
Whatever functionality was still needed from common (default colormap
|
||||
initialization -- not much code) was moved into ppc.
|
||||
|
||||
Since XFree86 uses the mi-provided software cursor code, IBM's software
|
||||
cursor code was deleted from ppc and vga. This is a pity, since it is
|
||||
expected that it is more efficient than mi's code, but the XFree86 mouse and
|
||||
keyboard code directly call mi, and I do not want to maintain the XFree86
|
||||
mouse and keyboard code.
|
||||
|
||||
Since we cannot support a monolithic multi-screen server using all of the
|
||||
x11r4 contributed code yet, all multi screen code was deleted. This includes
|
||||
one header file containing a nasty copyright statement.
|
||||
|
||||
Since glyph handling has changed between X11R4 and X11R5, the code handling
|
||||
glyphs was replaced by appropriate calls to mi.
|
||||
I hope it can be modified and put back one day.
|
||||
|
||||
Provisionally, some code was added (viz. file vga/offscreen.c) to intercept
|
||||
calls to the rectangle drawing code when we are switched out of the VT.
|
||||
I hope this can be replaced by some window tree invalidation and GC validation
|
||||
scheme.
|
||||
|
||||
|
||||
Section 2: BUGS
|
||||
|
||||
This section describes fixed and still unfixed bugs in this code.
|
||||
All bugs not labeled otherwise also occur in IBM's X11R4 code, and may be of
|
||||
interest to anybody using that code.
|
||||
|
||||
1. (Fixed.)
|
||||
I found (and provisionally fixed) a bug in the IBM bitblit code:
|
||||
In file ddx/ibm/vga/vgaImages.c a function vgaReadColorImage is defined.
|
||||
When this function is used to read less than 8 pixels starting on a byte
|
||||
boundary it will always read precisely 8 pixels.
|
||||
Thus, when space is allocated for 4 or less pixels, it will write beyond
|
||||
the allocated space.
|
||||
Since the code is rather convoluted, this may not be apparent at first sight,
|
||||
but going through the code with an example shows the error.
|
||||
|
||||
2. (Fixed.)
|
||||
In ppcPixmapFS.c, function ppcStipplePixmapFS there was a bug
|
||||
regarding the stipple origin: The horizontal origin is added while
|
||||
the vertical one is subtracted. The horizontal origin should be subtracted
|
||||
instead of added here.
|
||||
This bug gets visible when backing-store is enabled and one uses twm:
|
||||
the submenu icons get truncated on their left hand side.
|
||||
(In case you wonder why this bug appears: under those circumstances
|
||||
twm prepares its menus by drawing into an unmapped window.
|
||||
The miCopyPlane function uses the ppcStipplePixmap (and many others)
|
||||
to get the plane copied.)
|
||||
I also fixed this bug in the other routines (ppcOpStipplePixmapFS,
|
||||
ppcTilePixmapFS) in this file, although I had no visible clues for this.
|
||||
I hope this is appropriate.
|
||||
|
||||
3. (Fixed.)
|
||||
I find it suspect that ppcSetSpans gives different output when one
|
||||
claims that an actually sorted list of spans is unsorted.
|
||||
The unsorted code is wrong, and should be made to look more like the sorted
|
||||
code. I.e., use ( xStart - ppt->x ) instead of ( xStart - pbox->x1 )
|
||||
|
||||
4. (Fixed.)
|
||||
There used to be another bug that became visible when using twm and backing
|
||||
store: popping up a submenu, and moving the cursor upwards til it leaves the
|
||||
submenu, the submenu would disappears, as it should.
|
||||
But the submenu icon would not get restored, while it should be.
|
||||
10b. By replacing the clip-computing code in ppcValidateGC by that in
|
||||
cfbValidateGC, I *finally* fixed the disappearing twm menu icon problem.
|
||||
|
||||
5. Added mfbRegisterCopyplaneProc call. [Its omission was an error on my
|
||||
part.]
|
||||
Fixing a server core dump in XTest.
|
||||
|
||||
6. Fixed not-very-high tile bug in function ppcTileRect, file emulTile.c
|
||||
(I.e., if the tile was higher than the area to be tiled, far too much
|
||||
was drawn, causing server core dumps in XTest.)
|
||||
Actually, "savey" ought to be used to determine the height of the tiles in
|
||||
the top line to be tiled, instead of "pTile->drawable.height".
|
||||
7. A use of height where width was intended was fixed in ppcTileRect:
|
||||
"savehcount = w / pTile->drawable.height;" should use "... .width" and
|
||||
"savehcount = ( x + w - htarget ) / pTile->drawable.height;" too.
|
||||
|
||||
8. Deleted overly clever code in ppcCReduce.c
|
||||
(All code that tried to pre-compute how alu's could be replaced by
|
||||
other alu's with inverted colors, etc. was deleted. I think it is
|
||||
at least wrong for FillSolid.)
|
||||
|
||||
9. Looked at suspicious code in ppcSetSp.c
|
||||
"tmpx = *pdst;" was never updated during the loop. We took it out of the
|
||||
initialization position of the for and moved it into the loop.
|
||||
|
||||
10. Add xSrc := GC->patOrg.x + pDrawable.x and ySrc := ... in ppcPixmapFS.c,
|
||||
functions ppcStipplePixmapFS, ppcOpStipplePixmapFS, and ppcTilePixmapFS.
|
||||
This because stipple and tile origins are taken relative to the drawable.
|
||||
Also use a "modulo" function that gets the cases of a negative stipple
|
||||
or tile offset right. (When the stipple origin is to the right of or
|
||||
below the origin of the drawable.)
|
||||
|
||||
11. File vgaSolid.c, function vgaFillSolid:
|
||||
Inverting is XORing with all ones. Not with the color we want to AND/OR
|
||||
later. So we'll have to set the color to VGA_ALLPLANES
|
||||
whenever we want to invert existing data, and reset it before the
|
||||
AND/OR is done.
|
||||
Also we replaced an outb( 0x3CF, tmp2 ) by the SetVideoGraphicsData( tmp2 )
|
||||
it is representing. (Just a cosmetic replacement.)
|
||||
|
||||
12. File vgaImages, function vgaDrawColorImage.
|
||||
Moved a line "invert_existing_data = TRUE;" two lines down, past a case
|
||||
label. Now it is also part of the code executed for GXorReverse, as it
|
||||
should be.
|
||||
|
||||
13. The pixmap FillSpans routines (file ppcPixmapFS.c) got somewhat better
|
||||
after importing some code from ddx/ibm/vga. (A getbits function that does
|
||||
wrapping.)
|
||||
They were wrong for the FillStippled and FillOpaqueStippled modes.
|
||||
I don't understand the old code. How could it handle stipples of a size not
|
||||
an exact multiple of 32? (or 8, for that matter.)
|
||||
|
||||
14. In function vgaBitBlt file vgaBitBlt.c, in the shortcuts for
|
||||
GXSet, GXClear and GXInvert, the source (x0,y0) is accidentally operated
|
||||
upon by vgaFillSolid, instead of the destination (x1,y1).
|
||||
|
||||
15. Notice that in DoMonoSingle and DoMonoMany in file vgaStipple.c, the left
|
||||
edge of the square to be stippled is treated wrong.
|
||||
Correct would be to get the bits with getbits using offset xshift, and
|
||||
to shift them right (x & 07) places.
|
||||
[One might wish to use the variable tmp1 at this place, since it had been
|
||||
set to (x & 07) at this place; but that is already re-used at this point.]
|
||||
Also note that NeedValX is set wrong: The implicit assumption was that
|
||||
stipples are more than 8 wide.
|
||||
This only fixes the problem when miPushPixel is used instead of ppcPushPixel.
|
||||
I think I should look some more into this.
|
||||
|
||||
16. I took out some code of the CopyArea function, in which a no-op function
|
||||
was called while a real one was needed. My fix does not completely work,
|
||||
although it improved the behaviour of GetImage somewhat.
|
||||
|
||||
17. After finding three kinds of errors in this single function,
|
||||
-- the new kinds being the right side not being always written due to
|
||||
an incorrect if scope, and the lower end not always being written due
|
||||
to variables being updated at the wrong place --
|
||||
(requiring modifications to be made at at least 10 places,
|
||||
I decided to REWRITE the body of the ppcTileRect function from scratch.
|
||||
This version simply computes all relevant margins in advance, and does
|
||||
not try to reuse temporary variables. I leave that to the compiler.
|
||||
(This was a maintenance and robustness nightmare anyway.)
|
||||
|
||||
MORE NOTES:
|
||||
It is funny that there are two files in mi that require compilation
|
||||
with the proper #defines ( -DXF86VGA16 in my case ):
|
||||
Besides the obvious mibitblt.c, there is also mipushpxl.c.
|
||||
|
||||
|
||||
|
||||
$XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/NOTES,v 1.1.2.2 1998/06/27 15:15:45 dawes Exp $
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef __COMPILER_DEPENDANCIES__
|
||||
#define __COMPILER_DEPENDANCIES__
|
||||
|
||||
#define MOVE( src, dst, length ) memcpy( dst, src, length)
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#define ABS(x) (((x)>0)?(x):-(x))
|
||||
|
||||
#include "misc.h"
|
||||
#include "compiler.h"
|
||||
|
||||
#ifdef lint
|
||||
/* So that lint doesn't complain about constructs it doesn't understand */
|
||||
#ifdef volatile
|
||||
#undef volatile
|
||||
#endif
|
||||
#define volatile
|
||||
#ifdef const
|
||||
#undef const
|
||||
#endif
|
||||
#define const
|
||||
#ifdef signed
|
||||
#undef signed
|
||||
#endif
|
||||
#define signed
|
||||
#ifdef _ANSI_DECLS_
|
||||
#undef _ANSI_DECLS_
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* !__COMPILER_DEPENDANCIES__ */
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* ppc OpaqueStipple
|
||||
*
|
||||
* Based on the private stipple; does a foreground, and then an inverted
|
||||
* on the background
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
|
||||
void
|
||||
xf4bppOpaqueStipple( pWin, pStipple, fg, bg, alu, planes, x, y, w, h, xSrc, ySrc )
|
||||
WindowPtr pWin; /* GJA */
|
||||
register PixmapPtr pStipple ;
|
||||
unsigned long int fg ;
|
||||
unsigned long int bg ;
|
||||
int alu ;
|
||||
unsigned long int planes ;
|
||||
register int x, y, w, h ;
|
||||
int xSrc, ySrc ;
|
||||
{
|
||||
/* DO BACKGROUND */
|
||||
switch ( alu ) {
|
||||
/* Easy Cases -- i.e. Final Result Doesn't Depend On Initial Dest. */
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
case GXset: /* 0xf 1 */
|
||||
/* Foreground And Background Are Both The Same !! */
|
||||
xf4bppFillSolid( pWin, bg, alu, planes, x, y, w, h ) ;
|
||||
case GXnoop: /* 0x5 dst */
|
||||
break ;
|
||||
case GXcopy: /* 0x3 src */
|
||||
case GXcopyInverted: /* 0xc NOT src */
|
||||
{ /* Special Case Code */
|
||||
register int vtarget, htarget ;
|
||||
|
||||
/* We Can Draw Just One Copy Then Blit The Rest !! */
|
||||
/* Draw The One Copy */
|
||||
htarget = MIN( w, pStipple->drawable.width ) ;
|
||||
vtarget = MIN( h, pStipple->drawable.height ) ;
|
||||
|
||||
/* First The Background */
|
||||
xf4bppFillSolid( pWin, bg, alu, planes, x, y,
|
||||
htarget, vtarget ) ;
|
||||
/* Then The Foreground */
|
||||
xf4bppFillStipple( pWin, pStipple, fg, alu, planes,
|
||||
x, y, htarget, vtarget,
|
||||
xSrc, ySrc ) ;
|
||||
|
||||
/* Here We Double The Size Of The BLIT Each Iteration */
|
||||
xf4bppReplicateArea(pWin, x, y, planes, w, h, htarget, vtarget);
|
||||
}
|
||||
break ;
|
||||
default:
|
||||
/* Hard Cases -- i.e. Final Result DOES Depend On Initial Dest. */
|
||||
{ /* Do The Background */
|
||||
register int i, j;
|
||||
register PixmapPtr pInvPixmap = xf4bppCopyPixmap( pStipple ) ;
|
||||
register unsigned char *data = pInvPixmap->devPrivate.ptr ;
|
||||
|
||||
/* INVERT PIXMAP OK, jeff, this is for you */
|
||||
for ( i = pInvPixmap->drawable.height ; i-- ; )
|
||||
for ( j = pInvPixmap->devKind ; j-- ; data++ )
|
||||
*data = ~ ( *data ) ;
|
||||
|
||||
xf4bppFillStipple( pWin, pInvPixmap, bg, alu, planes, x, y, w, h, xSrc, ySrc );
|
||||
mfbDestroyPixmap( pInvPixmap ) ;
|
||||
/* DO FOREGROUND */
|
||||
xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc );
|
||||
}
|
||||
break ;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* ppc Replicate Area -- A Divide & Conquer Algorithm
|
||||
* a "ppc" Helper Function For Stipples And Tiling
|
||||
* P. Shupak 1/88
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
|
||||
void xf4bppReplicateArea( pWin, x, y, planeMask, goalWidth, goalHeight,
|
||||
currentHoriz, currentVert)
|
||||
WindowPtr pWin; /* GJA */
|
||||
register int x, y, planeMask ;
|
||||
int goalWidth, goalHeight ;
|
||||
int currentHoriz, currentVert ;
|
||||
{
|
||||
for ( ;
|
||||
currentHoriz <= ( goalWidth >> 1 ) ;
|
||||
currentHoriz <<= 1 ) {
|
||||
xf4bppBitBlt( pWin, GXcopy, planeMask,
|
||||
x, y,
|
||||
x + currentHoriz, y,
|
||||
currentHoriz, currentVert ) ;
|
||||
}
|
||||
if ( goalWidth - currentHoriz )
|
||||
xf4bppBitBlt( pWin, GXcopy, planeMask,
|
||||
x, y,
|
||||
x + currentHoriz, y,
|
||||
goalWidth - currentHoriz, currentVert ) ;
|
||||
for ( ;
|
||||
currentVert <= ( goalHeight >> 1 ) ;
|
||||
currentVert <<= 1 ) {
|
||||
xf4bppBitBlt( pWin, GXcopy, planeMask,
|
||||
x, y,
|
||||
x, y + currentVert,
|
||||
goalWidth, currentVert ) ;
|
||||
}
|
||||
if ( goalHeight - currentVert )
|
||||
xf4bppBitBlt( pWin, GXcopy, planeMask,
|
||||
x, y,
|
||||
x, y + currentVert,
|
||||
goalWidth, goalHeight - currentVert ) ;
|
||||
return ;
|
||||
}
|
||||
|
|
@ -1,352 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* ppc Tile
|
||||
* P. Shupak 11/87
|
||||
* Modified From original ppc Tile
|
||||
* T. Paquin 9/87
|
||||
* Uses private imageFill a bunch of times
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "ibmTrace.h"
|
||||
|
||||
static void
|
||||
DrawFirstTile
|
||||
(
|
||||
WindowPtr pWin, /* GJA */
|
||||
register PixmapPtr pTile,
|
||||
register int x,
|
||||
register int y,
|
||||
int w,
|
||||
int h,
|
||||
int alu,
|
||||
unsigned long int planes,
|
||||
int xOffset,
|
||||
int yOffset
|
||||
)
|
||||
{
|
||||
register int htarget ;
|
||||
register int vtarget ;
|
||||
|
||||
if ( xOffset ) { /* Not X-Aligned */
|
||||
if ( yOffset ) { /* Nor Y-Aligned */
|
||||
htarget = MIN( pTile->drawable.width - xOffset, w ),
|
||||
vtarget = MIN( pTile->drawable.height - yOffset, h ),
|
||||
yOffset *= pTile->devKind ;
|
||||
xf4bppDrawColorImage( pWin,x, y,
|
||||
htarget,
|
||||
vtarget,
|
||||
(unsigned char *)pTile->devPrivate.ptr + yOffset + xOffset,
|
||||
pTile->devKind,
|
||||
alu, planes ) ;
|
||||
if ( w > htarget ) {
|
||||
w = MIN( w, pTile->drawable.width ) ;
|
||||
if ( h > vtarget ) {
|
||||
h = MIN( h, pTile->drawable.height ) ;
|
||||
xf4bppDrawColorImage( pWin, x, y + vtarget,
|
||||
htarget,
|
||||
h - vtarget,
|
||||
(unsigned char *)pTile->devPrivate.ptr + xOffset,
|
||||
pTile->devKind,
|
||||
alu, planes ) ;
|
||||
xf4bppDrawColorImage( pWin, x + htarget, y,
|
||||
w - htarget,
|
||||
vtarget,
|
||||
(unsigned char *)pTile->devPrivate.ptr + yOffset,
|
||||
pTile->devKind,
|
||||
alu, planes ) ;
|
||||
xf4bppDrawColorImage( pWin, x + htarget,
|
||||
y + vtarget,
|
||||
w - htarget,
|
||||
h - vtarget,
|
||||
pTile->devPrivate.ptr,
|
||||
pTile->devKind,
|
||||
alu, planes ) ;
|
||||
}
|
||||
else { /* h <= vtarget */
|
||||
xf4bppDrawColorImage( pWin, x + htarget, y,
|
||||
w - htarget,
|
||||
vtarget,
|
||||
(unsigned char *)pTile->devPrivate.ptr + yOffset,
|
||||
pTile->devKind,
|
||||
alu, planes ) ;
|
||||
}
|
||||
}
|
||||
else if ( h > vtarget ) {
|
||||
xf4bppDrawColorImage( pWin, x, y + vtarget,
|
||||
htarget,
|
||||
MIN( h, pTile->drawable.height ) - vtarget,
|
||||
(unsigned char *)pTile->devPrivate.ptr + xOffset,
|
||||
pTile->devKind,
|
||||
alu, planes ) ;
|
||||
vtarget = pTile->drawable.height ;
|
||||
}
|
||||
}
|
||||
else { /* No Y Offset */
|
||||
xf4bppDrawColorImage( pWin, x, y,
|
||||
htarget = MIN( pTile->drawable.width - xOffset, w ),
|
||||
vtarget = MIN( pTile->drawable.height, h ),
|
||||
(unsigned char *)pTile->devPrivate.ptr + xOffset,
|
||||
pTile->devKind,
|
||||
alu, planes ) ;
|
||||
if ( w > htarget ) {
|
||||
xf4bppDrawColorImage( pWin, x + htarget, y,
|
||||
MIN( pTile->drawable.width, w ) - htarget,
|
||||
vtarget,
|
||||
pTile->devPrivate.ptr,
|
||||
pTile->devKind,
|
||||
alu, planes ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( yOffset ) {
|
||||
xf4bppDrawColorImage( pWin, x, y,
|
||||
htarget = MIN( pTile->drawable.width, w ),
|
||||
vtarget = MIN( pTile->drawable.height - yOffset, h ),
|
||||
(unsigned char *)pTile->devPrivate.ptr + ( yOffset * pTile->devKind ),
|
||||
pTile->devKind,
|
||||
alu, planes ) ;
|
||||
if ( h > vtarget ) {
|
||||
xf4bppDrawColorImage( pWin, x, y + vtarget,
|
||||
htarget,
|
||||
MIN( pTile->drawable.height, h ) - vtarget,
|
||||
pTile->devPrivate.ptr,
|
||||
pTile->devKind,
|
||||
alu, planes ) ;
|
||||
}
|
||||
}
|
||||
else { /* NO Offset */
|
||||
xf4bppDrawColorImage( pWin, x, y,
|
||||
htarget = MIN( pTile->drawable.width, w ),
|
||||
vtarget = MIN( pTile->drawable.height, h ),
|
||||
pTile->devPrivate.ptr,
|
||||
pTile->devKind,
|
||||
alu, planes ) ;
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
/* GJA --
|
||||
* After finding three kinds of errors in this single function,
|
||||
* (requiring modifications to be made at at least 10 places,
|
||||
* I decided to REWRITE the body of the xf4bppTileRect function from scratch.
|
||||
* This version simply computes all relevant margins in advance, and does
|
||||
* not try to reuse temporary variables. I leave that to the compiler.
|
||||
* (This was a maintenance and robustness nightmare anyway.)
|
||||
* The code is pretty obvious: all margins, coordinates, and numbers of tiles
|
||||
* are computed before drawing starts.
|
||||
* Notice that the margins consist of incompletely drawn tiles. Therefore
|
||||
* we need offsets in the data for the left and upper margins.
|
||||
* The right and lower margins are also incomplete, but start at offset 0
|
||||
* in the data. They just end at awkward offsets.
|
||||
* The center block, by definition, consists of fully drawn tiles.
|
||||
* Perhaps we could leave out some if's. But why bother? It would decrease
|
||||
* robustness.
|
||||
*/
|
||||
void
|
||||
xf4bppTileRect( pWin, pTile, alu, planes, x0, y0, w, h, xSrc, ySrc )
|
||||
WindowPtr pWin; /* GJA */
|
||||
register PixmapPtr pTile ;
|
||||
const int alu ;
|
||||
const unsigned long int planes ;
|
||||
register int x0, y0, w, h ;
|
||||
int xSrc ;
|
||||
int ySrc ;
|
||||
{
|
||||
int xOffset ;
|
||||
int yOffset ;
|
||||
int width, height;
|
||||
|
||||
TRACE( ( "xf4bppTileRect(pTile=x%x,alu=x%x,planes=x%02x,x0=%d,y0=%d,w=%d,h=%d,xSrc=%d,ySrc=%d\n",
|
||||
pTile, alu, planes, x0, y0, w, h, xSrc, ySrc ) ) ;
|
||||
|
||||
switch ( alu ) {
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
case GXinvert: /* 0xa NOT dst */
|
||||
case GXset: /* 0xf 1 */
|
||||
xf4bppFillSolid
|
||||
( pWin, 0xFF, alu, planes, x0, y0, w, h ) ;
|
||||
case GXnoop: /* 0x5 dst */
|
||||
return ;
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
|
||||
width = pTile->drawable.width;
|
||||
if ( ( xOffset = ( x0 - xSrc ) ) > 0 )
|
||||
xOffset %= width ;
|
||||
else
|
||||
xOffset = width - (( - xOffset ) % width ) ;
|
||||
if ( xOffset == width ) xOffset = 0; /* For else case */
|
||||
|
||||
height = pTile->drawable.height;
|
||||
if ( ( yOffset = ( y0 - ySrc ) ) > 0 )
|
||||
yOffset %= height ;
|
||||
else
|
||||
yOffset = height - (( - yOffset ) % height ) ;
|
||||
if ( yOffset == height ) yOffset = 0; /* For else case */
|
||||
|
||||
switch ( alu ) {
|
||||
case GXcopyInverted: /* 0xc NOT src */
|
||||
case GXcopy: /* 0x3 src */
|
||||
/* Special Case Code */
|
||||
DrawFirstTile( pWin, pTile, x0, y0, w, h,
|
||||
alu, planes, xOffset, yOffset ) ;
|
||||
/* Here We Double The Size Of The BLIT Each Iteration */
|
||||
xf4bppReplicateArea( pWin, x0, y0, planes, w, h,
|
||||
MIN( w, pTile->drawable.width ),
|
||||
MIN( h, pTile->drawable.height ) ) ;
|
||||
break ;
|
||||
case GXnor: /* 0x8 NOT src AND NOT dst */
|
||||
case GXandReverse: /* 0x2 src AND NOT dst */
|
||||
case GXorReverse: /* 0xb src OR NOT dst */
|
||||
case GXnand: /* 0xe NOT src OR NOT dst */
|
||||
case GXandInverted: /* 0x4 NOT src AND dst */
|
||||
case GXand: /* 0x1 src AND dst */
|
||||
case GXequiv: /* 0x9 NOT src XOR dst */
|
||||
case GXxor: /* 0x6 src XOR dst */
|
||||
case GXorInverted: /* 0xd NOT src OR dst */
|
||||
case GXor: /* 0x7 src OR dst */
|
||||
default:
|
||||
{
|
||||
register unsigned char *data ;
|
||||
register int hcount, vcount ; /* Number of tiles in center */
|
||||
int xcount, ycount; /* Temporaries */
|
||||
int x1, y1; /* Left upper corner of center */
|
||||
int x2, y2; /* Left upper corner of lower right margin */
|
||||
int leftmgn, rightmgn, topmgn, botmgn; /* Margins */
|
||||
|
||||
int htarget, vtarget ;
|
||||
|
||||
data = pTile->devPrivate.ptr;
|
||||
|
||||
/* Compute the various sizes and coordinates. */
|
||||
leftmgn = MIN( w, width - xOffset ) ;
|
||||
x1 = x0 + leftmgn;
|
||||
topmgn = MIN( h, height - yOffset ) ;
|
||||
y1 = y0 + topmgn;
|
||||
|
||||
rightmgn = (w - leftmgn) % width;
|
||||
hcount = (w - leftmgn) / width;
|
||||
x2 = x0 + w - rightmgn;
|
||||
botmgn = (h - topmgn) % height;
|
||||
vcount = (h - topmgn) / height;
|
||||
y2 = y0 + h - botmgn;
|
||||
|
||||
/* We'll use yOffset as offset in data.
|
||||
* This requires yOffset != height (ditto xOffset).
|
||||
*/
|
||||
yOffset *= pTile->devKind;
|
||||
|
||||
/* Draw top margin, including corners */
|
||||
if ( topmgn ) {
|
||||
if ( leftmgn ) {
|
||||
xf4bppDrawColorImage( pWin, x0, y0, leftmgn, topmgn,
|
||||
data + yOffset + xOffset,
|
||||
pTile->devKind, alu, planes ) ;
|
||||
}
|
||||
for ( xcount = hcount, htarget = x1;
|
||||
xcount ;
|
||||
xcount--, htarget += width )
|
||||
{
|
||||
xf4bppDrawColorImage( pWin, htarget, y0, width, topmgn,
|
||||
data + yOffset,
|
||||
pTile->devKind, alu, planes ) ;
|
||||
}
|
||||
if ( rightmgn ) {
|
||||
xf4bppDrawColorImage( pWin, x2, y0, rightmgn, topmgn,
|
||||
data + yOffset,
|
||||
pTile->devKind, alu, planes ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw bottom margin, including corners */
|
||||
if ( botmgn ) {
|
||||
if ( leftmgn ) {
|
||||
xf4bppDrawColorImage( pWin, x0, y2, leftmgn, botmgn,
|
||||
data + xOffset,
|
||||
pTile->devKind, alu, planes ) ;
|
||||
}
|
||||
for ( xcount = hcount, htarget = x1;
|
||||
xcount ;
|
||||
xcount--, htarget += width )
|
||||
{
|
||||
xf4bppDrawColorImage( pWin, htarget, y2, width, botmgn,
|
||||
data,
|
||||
pTile->devKind, alu, planes ) ;
|
||||
}
|
||||
if ( rightmgn ) {
|
||||
xf4bppDrawColorImage( pWin, x2, y2, rightmgn, botmgn,
|
||||
data,
|
||||
pTile->devKind, alu, planes ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw left margin, excluding corners */
|
||||
if ( leftmgn ) {
|
||||
for ( ycount = vcount, vtarget = y1 ;
|
||||
ycount ;
|
||||
ycount--, vtarget += height )
|
||||
{
|
||||
xf4bppDrawColorImage( pWin, x0, vtarget, leftmgn, height,
|
||||
data + xOffset,
|
||||
pTile->devKind, alu, planes ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw right margin, excluding corners */
|
||||
if ( rightmgn ) {
|
||||
for ( ycount = vcount, vtarget = y1 ;
|
||||
ycount ;
|
||||
ycount--, vtarget += height )
|
||||
{
|
||||
xf4bppDrawColorImage( pWin, x2, vtarget, rightmgn, height,
|
||||
data,
|
||||
pTile->devKind, alu, planes ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw center consisting of full tiles */
|
||||
for ( ycount = vcount, vtarget = y1 ;
|
||||
ycount ;
|
||||
ycount--, vtarget += height )
|
||||
{
|
||||
for ( xcount = hcount, htarget = x1 ;
|
||||
xcount ;
|
||||
xcount--, htarget += width )
|
||||
{
|
||||
xf4bppDrawColorImage( pWin, htarget, vtarget, width, height,
|
||||
data,
|
||||
pTile->devKind, alu, planes ) ;
|
||||
|
||||
}
|
||||
}
|
||||
} } /* Block + switch */
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
#define TRACE(x) /* empty */
|
||||
|
|
@ -1,164 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE
|
||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
/* GJA -- modified this file for vga16 */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "miline.h"
|
||||
#include "wm3.h"
|
||||
|
||||
/* Solid bresenham line */
|
||||
/* NOTES
|
||||
e2 is used less often than e1, so it's not in a register
|
||||
*/
|
||||
|
||||
void
|
||||
xf4bppBresS(addrlbase, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len)
|
||||
PixelType *addrlbase; /* pointer to base of bitmap */
|
||||
int nlwidth; /* width in longwords of bitmap */
|
||||
int signdx, signdy; /* signs of directions */
|
||||
int axis; /* major axis (Y_AXIS or X_AXIS) */
|
||||
int x1, y1; /* initial point */
|
||||
register int e; /* error accumulator */
|
||||
register int e1; /* bresenham increments */
|
||||
int e2;
|
||||
int len; /* length of line */
|
||||
{
|
||||
register int yinc; /* increment to next scanline, in bytes */
|
||||
register PixelType *addrl; /* bitmask long pointer
|
||||
*dont* * cast to char pointer */
|
||||
register PixelType bit; /* current bit being set/cleared/etc. */
|
||||
PixelType leftbit = mfbGetmask(0); /* leftmost bit to process in new word */
|
||||
PixelType rightbit = mfbGetmask(PPW-1); /* rightmost bit to process in new word */
|
||||
|
||||
register int e3 = e2-e1;
|
||||
|
||||
/* point to longword containing first point */
|
||||
addrl = mfbScanline(addrlbase, x1, y1, nlwidth);
|
||||
yinc = signdy * nlwidth;
|
||||
e = e-e1; /* to make looping easier */
|
||||
bit = mfbGetmask(x1 & PIM);
|
||||
|
||||
if (!len)
|
||||
return;
|
||||
|
||||
if (axis == X_AXIS)
|
||||
{
|
||||
if (signdx > 0)
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
UPDRW(addrl,bit);
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
addrl += yinc;
|
||||
e += e3;
|
||||
}
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit; addrl++; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
UPDRW(addrl,bit);
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
addrl += yinc;
|
||||
e += e3;
|
||||
}
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit; addrl--; }
|
||||
}
|
||||
}
|
||||
} /* if X_AXIS */
|
||||
else
|
||||
{
|
||||
if (signdx > 0)
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
UPDRW(addrl,bit);
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit; addrl++; }
|
||||
e += e3;
|
||||
}
|
||||
addrl += yinc;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
UPDRW(addrl,bit);
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit; addrl--; }
|
||||
e += e3;
|
||||
}
|
||||
addrl += yinc;
|
||||
}
|
||||
}
|
||||
} /* else Y_AXIS */
|
||||
}
|
||||
|
|
@ -1,205 +0,0 @@
|
|||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE
|
||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
/* GJA -- modified this file for vga16 */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "miline.h"
|
||||
#include "wm3.h"
|
||||
#include "xf86.h"
|
||||
|
||||
/* Dashed bresenham line */
|
||||
|
||||
#define NO_INK (-1) /* GJA -- means: dash is off */
|
||||
|
||||
#define StepDash\
|
||||
if (!--dashRemaining) { \
|
||||
if (++ dashIndex == numInDashList) \
|
||||
dashIndex = 0; \
|
||||
dashRemaining = pDash[dashIndex]; \
|
||||
ink = fgink; \
|
||||
if (dashIndex & 1) \
|
||||
ink = bgink; \
|
||||
if (isDoubleDash) \
|
||||
WM3_SET_INK(ink); \
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppBresD(pDrawable, fgink, bgink,
|
||||
pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
|
||||
addrlbase, nlwidth,
|
||||
signdx, signdy, axis, x1, y1, e, e1, e2, len)
|
||||
DrawablePtr pDrawable;
|
||||
int fgink, bgink;
|
||||
int *pdashIndex; /* current dash */
|
||||
unsigned char *pDash; /* dash list */
|
||||
int numInDashList; /* total length of dash list */
|
||||
int *pdashOffset; /* offset into current dash */
|
||||
int isDoubleDash;
|
||||
PixelType *addrlbase; /* pointer to base of bitmap */
|
||||
int nlwidth; /* width in longwords of bitmap */
|
||||
int signdx, signdy; /* signs of directions */
|
||||
int axis; /* major axis (Y_AXIS or X_AXIS) */
|
||||
int x1, y1; /* initial point */
|
||||
register int e; /* error accumulator */
|
||||
register int e1; /* bresenham increments */
|
||||
int e2;
|
||||
int len; /* length of line */
|
||||
{
|
||||
IOADDRESS REGBASE =
|
||||
xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300;
|
||||
register int yinc; /* increment to next scanline, in bytes */
|
||||
register PixelType *addrl;
|
||||
register int e3 = e2-e1;
|
||||
register unsigned long bit;
|
||||
PixelType leftbit = mfbGetmask(0); /* leftmost bit to process in new word */
|
||||
PixelType rightbit = mfbGetmask(PPW-1); /* rightmost bit to process in new word */
|
||||
int dashIndex;
|
||||
int dashOffset;
|
||||
int dashRemaining;
|
||||
int ink;
|
||||
|
||||
fgink &= 0x0F; bgink &= 0x0F; /* GJA -- so they're != NO_INK */
|
||||
|
||||
dashOffset = *pdashOffset;
|
||||
dashIndex = *pdashIndex;
|
||||
dashRemaining = pDash[dashIndex] - dashOffset;
|
||||
ink = fgink;
|
||||
if (!isDoubleDash)
|
||||
bgink = NO_INK;
|
||||
if (dashIndex & 1)
|
||||
ink = bgink;
|
||||
if ( ink != NO_INK ) WM3_SET_INK(ink);
|
||||
|
||||
/* point to longword containing first point */
|
||||
addrl = mfbScanline(addrlbase, x1, y1, nlwidth);
|
||||
yinc = signdy * nlwidth;
|
||||
e = e-e1; /* to make looping easier */
|
||||
bit = mfbGetmask(x1 & PIM);
|
||||
if (axis == X_AXIS)
|
||||
{
|
||||
if (signdx > 0)
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
if ( ink != NO_INK ) UPDRW(addrl,bit);
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
addrl += yinc;
|
||||
e += e3;
|
||||
}
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit; addrl++; }
|
||||
StepDash
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
|
||||
if ( ink != NO_INK ) UPDRW(addrl,bit);
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
addrl += yinc;
|
||||
e += e3;
|
||||
}
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit; addrl--; }
|
||||
StepDash
|
||||
}
|
||||
}
|
||||
} /* if X_AXIS */
|
||||
else
|
||||
{
|
||||
if (signdx > 0)
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
if ( ink != NO_INK ) UPDRW(addrl,bit);
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit; addrl++; }
|
||||
e += e3;
|
||||
}
|
||||
addrl += yinc;
|
||||
StepDash
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
|
||||
if ( ink != NO_INK ) UPDRW(addrl,bit);
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit; addrl--; }
|
||||
e += e3;
|
||||
}
|
||||
addrl += yinc;
|
||||
StepDash
|
||||
}
|
||||
}
|
||||
} /* else Y_AXIS */
|
||||
*pdashIndex = dashIndex;
|
||||
*pdashOffset = pDash[dashIndex] - dashRemaining;
|
||||
}
|
||||
|
|
@ -1,301 +0,0 @@
|
|||
/************************************************************
|
||||
|
||||
Copyright (c) 1989 X Consortium
|
||||
|
||||
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 THE
|
||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/* GJA -- Took mfb code and modified it. */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "mi.h"
|
||||
#include "mifillarc.h"
|
||||
#include "wm3.h"
|
||||
|
||||
#include "xf86str.h" /* for pScrn->vtSema */
|
||||
extern ScrnInfoPtr *xf86Screens;
|
||||
|
||||
static void
|
||||
v16FillEllipseSolid
|
||||
(
|
||||
DrawablePtr pDraw,
|
||||
xArc *arc
|
||||
)
|
||||
{
|
||||
int x, y, e;
|
||||
int yk, xk, ym, xm, dx, dy, xorg, yorg;
|
||||
register int slw;
|
||||
miFillArcRec info;
|
||||
int *addrlt, *addrlb;
|
||||
register int *addrl;
|
||||
register int n;
|
||||
int nlwidth;
|
||||
register int xpos;
|
||||
int startmask, endmask, nlmiddle;
|
||||
|
||||
if (pDraw->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
addrlt = (int *)
|
||||
(((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr);
|
||||
nlwidth = (int)
|
||||
(((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
addrlt = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr);
|
||||
nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2;
|
||||
}
|
||||
|
||||
miFillArcSetup(arc, &info);
|
||||
MIFILLARCSETUP();
|
||||
xorg += pDraw->x;
|
||||
yorg += pDraw->y;
|
||||
addrlb = addrlt;
|
||||
addrlt += nlwidth * (yorg - y);
|
||||
addrlb += nlwidth * (yorg + y + dy);
|
||||
while (y)
|
||||
{
|
||||
addrlt += nlwidth;
|
||||
addrlb -= nlwidth;
|
||||
MIFILLARCSTEP(slw);
|
||||
if (!slw)
|
||||
continue;
|
||||
xpos = xorg - x;
|
||||
addrl = addrlt + (xpos >> PWSH);
|
||||
if (((xpos & PIM) + slw) < PPW)
|
||||
{
|
||||
maskpartialbits(xpos, slw, startmask);
|
||||
UPDRW(addrl,startmask);
|
||||
if (miFillArcLower(slw))
|
||||
{
|
||||
addrl = addrlb + (xpos >> PWSH);
|
||||
UPDRW(addrl,startmask);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
maskbits(xpos, slw, startmask, endmask, nlmiddle);
|
||||
if (startmask)
|
||||
{
|
||||
UPDRW(addrl,startmask); addrl++;
|
||||
}
|
||||
n = nlmiddle;
|
||||
while (n--) {
|
||||
UPDRW(addrl,~0); addrl++;
|
||||
}
|
||||
if (endmask)
|
||||
{
|
||||
UPDRW(addrl,endmask);
|
||||
}
|
||||
if (!miFillArcLower(slw))
|
||||
continue;
|
||||
addrl = addrlb + (xpos >> PWSH);
|
||||
if (startmask)
|
||||
{
|
||||
UPDRW(addrl,startmask); addrl++;
|
||||
}
|
||||
n = nlmiddle;
|
||||
while (n--) {
|
||||
UPDRW(addrl,~0); addrl++;
|
||||
}
|
||||
if (endmask)
|
||||
{
|
||||
UPDRW(addrl,endmask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define FILLSPAN(xl,xr,addr) \
|
||||
if (xr >= xl) \
|
||||
{ \
|
||||
width = xr - xl + 1; \
|
||||
addrl = addr + (xl >> PWSH); \
|
||||
if (((xl & PIM) + width) < PPW) \
|
||||
{ \
|
||||
maskpartialbits(xl, width, startmask); \
|
||||
UPDRW(addrl,startmask); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
maskbits(xl, width, startmask, endmask, nlmiddle); \
|
||||
if (startmask) \
|
||||
{ \
|
||||
UPDRW(addrl,startmask); addrl++; \
|
||||
} \
|
||||
n = nlmiddle; \
|
||||
while (n--) { \
|
||||
UPDRW(addrl,~0); addrl++; \
|
||||
} \
|
||||
if (endmask) \
|
||||
{ \
|
||||
UPDRW(addrl,endmask); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define FILLSLICESPANS(flip,addr) \
|
||||
if (!flip) \
|
||||
{ \
|
||||
FILLSPAN(xl, xr, addr); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
xc = xorg - x; \
|
||||
FILLSPAN(xc, xr, addr); \
|
||||
xc += slw - 1; \
|
||||
FILLSPAN(xl, xc, addr); \
|
||||
}
|
||||
|
||||
static void
|
||||
v16FillArcSliceSolidCopy
|
||||
(
|
||||
DrawablePtr pDraw,
|
||||
GCPtr pGC,
|
||||
xArc *arc
|
||||
)
|
||||
{
|
||||
register int *addrl;
|
||||
register int n;
|
||||
int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
|
||||
register int x, y, e;
|
||||
miFillArcRec info;
|
||||
miArcSliceRec slice;
|
||||
int xl, xr, xc;
|
||||
int *addrlt, *addrlb;
|
||||
int nlwidth;
|
||||
int width;
|
||||
int startmask, endmask, nlmiddle;
|
||||
|
||||
if (pDraw->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
addrlt = (int *)
|
||||
(((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr);
|
||||
nlwidth = (int)
|
||||
(((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
addrlt = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr);
|
||||
nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2;
|
||||
}
|
||||
|
||||
miFillArcSetup(arc, &info);
|
||||
miFillArcSliceSetup(arc, &slice, pGC);
|
||||
MIFILLARCSETUP();
|
||||
xorg += pDraw->x;
|
||||
yorg += pDraw->y;
|
||||
addrlb = addrlt;
|
||||
addrlt += nlwidth * (yorg - y);
|
||||
addrlb += nlwidth * (yorg + y + dy);
|
||||
slice.edge1.x += pDraw->x;
|
||||
slice.edge2.x += pDraw->x;
|
||||
while (y > 0)
|
||||
{
|
||||
addrlt += nlwidth;
|
||||
addrlb -= nlwidth;
|
||||
MIFILLARCSTEP(slw);
|
||||
MIARCSLICESTEP(slice.edge1);
|
||||
MIARCSLICESTEP(slice.edge2);
|
||||
if (miFillSliceUpper(slice))
|
||||
{
|
||||
MIARCSLICEUPPER(xl, xr, slice, slw);
|
||||
FILLSLICESPANS(slice.flip_top, addrlt);
|
||||
}
|
||||
if (miFillSliceLower(slice))
|
||||
{
|
||||
MIARCSLICELOWER(xl, xr, slice, slw);
|
||||
FILLSLICESPANS(slice.flip_bot, addrlb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xf4bppPolyFillArcSolid
|
||||
(
|
||||
register DrawablePtr pDraw,
|
||||
GCPtr pGC,
|
||||
int narcs,
|
||||
xArc *parcs
|
||||
)
|
||||
{
|
||||
register xArc *arc;
|
||||
register int i;
|
||||
BoxRec box;
|
||||
RegionPtr cclip;
|
||||
#if 0
|
||||
mfbPrivGC *priv;
|
||||
int rop;
|
||||
|
||||
priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
mfbGetGCPrivateKey());
|
||||
rop = priv->rop;
|
||||
if ((rop == RROP_NOP) || !(pGC->planemask & 1))
|
||||
#else
|
||||
if ( !(pGC->planemask & 0x0F))
|
||||
#endif
|
||||
return;
|
||||
cclip = pGC->pCompositeClip;
|
||||
for (arc = parcs, i = narcs; --i >= 0; arc++)
|
||||
{
|
||||
if (miFillArcEmpty(arc))
|
||||
continue;
|
||||
if (miCanFillArc(arc))
|
||||
{
|
||||
box.x1 = arc->x + pDraw->x;
|
||||
box.y1 = arc->y + pDraw->y;
|
||||
box.x2 = box.x1 + (int)arc->width + 1;
|
||||
box.y2 = box.y1 + (int)arc->height + 1;
|
||||
if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN)
|
||||
{
|
||||
if ((arc->angle2 >= FULLCIRCLE) ||
|
||||
(arc->angle2 <= -FULLCIRCLE))
|
||||
DO_WM3(pGC,v16FillEllipseSolid(pDraw, arc))
|
||||
else
|
||||
DO_WM3(pGC,v16FillArcSliceSolidCopy(pDraw, pGC, arc))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
miPolyFillArc(pDraw, pGC, 1, arc);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppPolyFillArc(pDraw, pGC, narcs, parcs)
|
||||
register DrawablePtr pDraw;
|
||||
GCPtr pGC;
|
||||
int narcs;
|
||||
xArc *parcs;
|
||||
{
|
||||
if ( !xf86Screens[pDraw->pScreen->myNum]->vtSema || (pGC->fillStyle != FillSolid) ) {
|
||||
miPolyFillArc(pDraw, pGC, narcs, parcs);
|
||||
} else {
|
||||
xf4bppPolyFillArcSolid(pDraw, pGC, narcs, parcs);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,135 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE
|
||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
/* GJA -- modified this file for vga16 */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "wm3.h"
|
||||
|
||||
/* horizontal solid line
|
||||
abs(len) > 1
|
||||
*/
|
||||
|
||||
void
|
||||
xf4bppHorzS(addrl, nlwidth, x1, y1, len)
|
||||
register PixelType *addrl; /* pointer to base of bitmap */
|
||||
register int nlwidth; /* width in longwords of bitmap */
|
||||
int x1; /* initial point */
|
||||
int y1;
|
||||
int len; /* length of line */
|
||||
{
|
||||
register PixelType startmask;
|
||||
register PixelType endmask;
|
||||
register int nlmiddle;
|
||||
|
||||
|
||||
/* force the line to go left to right
|
||||
but don't draw the last point
|
||||
*/
|
||||
if (len < 0)
|
||||
{
|
||||
x1 += len;
|
||||
x1 += 1;
|
||||
len = -len;
|
||||
}
|
||||
|
||||
addrl = mfbScanline(addrl, x1, y1, nlwidth);
|
||||
|
||||
/* all bits inside same longword */
|
||||
if ( ((x1 & PIM) + len) < PPW)
|
||||
{
|
||||
maskpartialbits(x1, len, startmask);
|
||||
UPDRW(addrl,startmask);
|
||||
}
|
||||
else
|
||||
{
|
||||
maskbits(x1, len, startmask, endmask, nlmiddle);
|
||||
if (startmask) {
|
||||
UPDRW(addrl,startmask); addrl++;
|
||||
}
|
||||
Duff (nlmiddle, UPDRW(addrl,~0); addrl++);
|
||||
if (endmask) {
|
||||
UPDRW(addrl,endmask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* vertical solid line
|
||||
this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates
|
||||
better code. sigh. we know that len will never be 0 or 1, so
|
||||
it's OK to use it.
|
||||
*/
|
||||
|
||||
void
|
||||
xf4bppVertS(addrl, nlwidth, x1, y1, len)
|
||||
register PixelType *addrl; /* pointer to base of bitmap */
|
||||
register int nlwidth; /* width in longwords of bitmap */
|
||||
int x1, y1; /* initial point */
|
||||
register int len; /* length of line */
|
||||
{
|
||||
register PixelType bitmask;
|
||||
|
||||
addrl = mfbScanline(addrl, x1, y1, nlwidth);
|
||||
|
||||
if (len < 0)
|
||||
{
|
||||
nlwidth = -nlwidth;
|
||||
len = -len;
|
||||
}
|
||||
|
||||
bitmask = mfbGetmask(x1 & PIM);
|
||||
Duff(len, UPDRW(addrl,bitmask); addrl += nlwidth);
|
||||
}
|
||||
|
|
@ -1,505 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE
|
||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "mi.h"
|
||||
#include "dixfontstr.h"
|
||||
#include "ppcGCstr.h"
|
||||
#include "wm3.h"
|
||||
|
||||
#include "xf86str.h" /* for pScrn->vtSema */
|
||||
extern ScrnInfoPtr *xf86Screens;
|
||||
|
||||
/*
|
||||
we should eventually special-case fixed-width fonts for ImageText.
|
||||
|
||||
this works for fonts with glyphs <= 32 bits wide.
|
||||
|
||||
the clipping calculations are done for worst-case fonts.
|
||||
we make no assumptions about the heights, widths, or bearings
|
||||
of the glyphs. if we knew that the glyphs are all the same height,
|
||||
we could clip the tops and bottoms per clipping box, rather
|
||||
than per character per clipping box. if we knew that the glyphs'
|
||||
left and right bearings were wlle-behaved, we could clip a single
|
||||
character at the start, output until the last unclipped
|
||||
character, and then clip the last one. this is all straightforward
|
||||
to determine based on max-bounds and min-bounds from the font.
|
||||
there is some inefficiency introduced in the per-character
|
||||
clipping to make what's going on clearer.
|
||||
|
||||
(it is possible, for example, for a font to be defined in which the
|
||||
next-to-last character in a font would be clipped out, but the last
|
||||
one wouldn't. the code below deals with this.)
|
||||
|
||||
Image text looks at the bits in the glyph and the fg and bg in the
|
||||
GC. it paints a rectangle, as defined in the protocol dcoument,
|
||||
and the paints the characters.
|
||||
|
||||
to avoid source proliferation, this file is compiled
|
||||
three times:
|
||||
MFBIMAGEGLYPHBLT OPEQ
|
||||
mfbImageGlyphBltWhite |=
|
||||
mfbImageGlyphBltBlack &=~
|
||||
|
||||
the register allocations for startmask and endmask may not
|
||||
be the right thing. are there two other deserving candidates?
|
||||
xoff, pdst, pglyph, and tmpSrc seem like the right things, though.
|
||||
*/
|
||||
|
||||
/* Forward declarations -- GJA */
|
||||
static void doImageGlyphBlt(
|
||||
DrawablePtr,
|
||||
GC *,
|
||||
int,
|
||||
int,
|
||||
unsigned int,
|
||||
CharInfoPtr *,
|
||||
unsigned char *,
|
||||
ExtentInfoRec *
|
||||
);
|
||||
|
||||
void
|
||||
xf4bppImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
|
||||
DrawablePtr pDrawable;
|
||||
GC *pGC;
|
||||
int x, y;
|
||||
unsigned int nglyph;
|
||||
CharInfoPtr *ppci; /* array of character info */
|
||||
pointer pglyphBase; /* start of array of glyphs */
|
||||
{
|
||||
ExtentInfoRec info; /* used by QueryGlyphExtents() */
|
||||
xRectangle backrect;/* backing rectangle to paint.
|
||||
in the general case, NOT necessarily
|
||||
the same as the string's bounding box
|
||||
*/
|
||||
/* GJA -- I agree, this ALL should be moved to GC validation. */
|
||||
if ( (pDrawable->type != DRAWABLE_WINDOW) || (pGC->alu != GXcopy) ||
|
||||
!xf86Screens[pDrawable->pScreen->myNum]->vtSema ||
|
||||
((pGC->font) &&
|
||||
(FONTMAXBOUNDS(pGC->font,rightSideBearing) -
|
||||
FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
|
||||
FONTMINBOUNDS(pGC->font,characterWidth) < 0)) ) {
|
||||
miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
|
||||
} else {
|
||||
ppcPrivGC *pPrivGC;
|
||||
int oldfillStyle, oldfg, oldalu;
|
||||
|
||||
if (!(pGC->planemask & 0x0F))
|
||||
return;
|
||||
|
||||
QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
|
||||
|
||||
backrect.x = x;
|
||||
backrect.y = y - FONTASCENT(pGC->font);
|
||||
backrect.width = info.overallWidth;
|
||||
backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
|
||||
|
||||
|
||||
pPrivGC = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
mfbGetGCPrivateKey());
|
||||
oldfillStyle = pPrivGC->colorRrop.fillStyle; /* GJA */
|
||||
oldfg = pPrivGC->colorRrop.fgPixel; /* GJA */
|
||||
oldalu = pPrivGC->colorRrop.alu; /* GJA */
|
||||
|
||||
pPrivGC->colorRrop.fillStyle = FillSolid; /* GJA */
|
||||
pPrivGC->colorRrop.fgPixel = pGC->bgPixel; /* GJA */
|
||||
pGC->fgPixel = pGC->bgPixel;
|
||||
pPrivGC->colorRrop.alu = GXcopy; /* GJA */
|
||||
pGC->alu = GXcopy;
|
||||
|
||||
/* Required fields:
|
||||
* colorRrop.alu, colorRrop.planemask, colorRrop.fgPixel
|
||||
*/
|
||||
xf4bppPolyFillRect(pDrawable, pGC, 1, &backrect);
|
||||
|
||||
pPrivGC->colorRrop.fgPixel = oldfg; /* GJA */
|
||||
pGC->fgPixel = oldfg;
|
||||
|
||||
/* the faint-hearted can open their eyes now */
|
||||
|
||||
DO_WM3(pGC,doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci,
|
||||
pglyphBase,&info))
|
||||
|
||||
pPrivGC->colorRrop.fillStyle = oldfillStyle; /* GJA */
|
||||
pPrivGC->colorRrop.alu = oldalu; /* GJA */
|
||||
pGC->alu = oldalu;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop)
|
||||
DrawablePtr pDrawable;
|
||||
GC *pGC;
|
||||
int x, y;
|
||||
unsigned int nglyph;
|
||||
CharInfoPtr *ppci; /* array of character info */
|
||||
unsigned char *pglyphBase; /* start of array of glyphs */
|
||||
ExtentInfoRec* infop; /* used by QueryGlyphExtents() */
|
||||
{
|
||||
BoxRec bbox; /* string's bounding box */
|
||||
|
||||
CharInfoPtr pci;
|
||||
int xorg, yorg; /* origin of drawable in bitmap */
|
||||
int widthDst; /* width of dst in longwords */
|
||||
|
||||
/* these keep track of the character origin */
|
||||
CARD32 *pdstBase;
|
||||
/* points to longword with character origin */
|
||||
int xchar; /* xorigin of char (mod 32) */
|
||||
|
||||
/* these are used for placing the glyph */
|
||||
register int xoff; /* x offset of left edge of glyph (mod 32) */
|
||||
register CARD32 *pdst;
|
||||
/* pointer to current longword in dst */
|
||||
|
||||
int w; /* width of glyph in bits */
|
||||
int h; /* height of glyph */
|
||||
int widthGlyph; /* width of glyph, in bytes */
|
||||
register unsigned char *pglyph;
|
||||
/* pointer to current row of glyph */
|
||||
|
||||
/* used for putting down glyph */
|
||||
register unsigned int tmpSrc;
|
||||
/* for getting bits from glyph */
|
||||
register int startmask;
|
||||
register int endmask;
|
||||
|
||||
register int nFirst;/* bits of glyph in current longword */
|
||||
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pdstBase = (CARD32 *)
|
||||
(((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
|
||||
widthDst = (int)
|
||||
(((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
pdstBase = (CARD32 *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
|
||||
widthDst = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
|
||||
}
|
||||
|
||||
x += xorg;
|
||||
y += yorg;
|
||||
bbox.x1 = x + infop->overallLeft;
|
||||
bbox.x2 = x + infop->overallRight;
|
||||
bbox.y1 = y - infop->overallAscent;
|
||||
bbox.y2 = y + infop->overallDescent;
|
||||
|
||||
/* UNCLEAN CODE
|
||||
we know the mfbPolyFillRect uses only three fields in
|
||||
devPrivate[mfbGetGCPrivateIndex()].ptr, two of which (the rotated
|
||||
tile/stipple and the ropFillArea) are
|
||||
irrelevant for solid filling, so we just poke the FillArea
|
||||
field. the GC is now in an inconsistent state, but we'll fix
|
||||
it as soon as PolyFillRect returns. fortunately, the server
|
||||
is single threaded.
|
||||
|
||||
NOTE:
|
||||
if you are not using the standard mfbFillRectangle code, you
|
||||
need to poke any fields in the GC the rectangle stuff need
|
||||
(probably alu, fgPixel, and fillStyle) and in devPrivate[mfbGetGCPrivateIndex()].ptr
|
||||
(probably rop or ropFillArea.) You could just call ValidateGC,
|
||||
but that is usually not a cheap thing to do.
|
||||
*/
|
||||
|
||||
switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
|
||||
{
|
||||
case rgnOUT:
|
||||
break;
|
||||
case rgnIN:
|
||||
pdstBase = pdstBase + (widthDst * y) + (x >> PWSH);
|
||||
xchar = x & PIM;
|
||||
|
||||
while(nglyph--)
|
||||
{
|
||||
pci = *ppci;
|
||||
pglyph = FONTGLYPHBITS(pglyphBase, pci);
|
||||
w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
|
||||
h = pci->metrics.ascent + pci->metrics.descent;
|
||||
widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
||||
|
||||
/* start at top scanline of glyph */
|
||||
pdst = pdstBase - (pci->metrics.ascent * widthDst);
|
||||
|
||||
/* find correct word in scanline and x offset within it
|
||||
for left edge of glyph
|
||||
*/
|
||||
xoff = xchar + pci->metrics.leftSideBearing;
|
||||
if (xoff > PIM)
|
||||
{
|
||||
pdst++;
|
||||
xoff &= PIM;
|
||||
}
|
||||
else if (xoff < 0)
|
||||
{
|
||||
xoff += PPW;
|
||||
pdst--;
|
||||
}
|
||||
|
||||
if ((xoff + w) <= PPW)
|
||||
{
|
||||
/* glyph all in one longword */
|
||||
maskpartialbits(xoff, w, startmask);
|
||||
|
||||
while (h--)
|
||||
{
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
|
||||
pglyph += widthGlyph;
|
||||
pdst += widthDst;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* glyph crosses longword boundary */
|
||||
maskPPWbits(xoff, w, startmask, endmask);
|
||||
nFirst = PPW - xoff;
|
||||
while (h--)
|
||||
{
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
|
||||
UPDRW(&(pdst[1]),(SCRLEFT(tmpSrc, nFirst) & endmask));
|
||||
pglyph += widthGlyph;
|
||||
pdst += widthDst;
|
||||
}
|
||||
} /* glyph crosses longwords boundary */
|
||||
|
||||
/* update character origin */
|
||||
x += pci->metrics.characterWidth;
|
||||
xchar += pci->metrics.characterWidth;
|
||||
if (xchar > PLST)
|
||||
{
|
||||
xchar -= PPW;
|
||||
pdstBase++;
|
||||
}
|
||||
else if (xchar < 0)
|
||||
{
|
||||
xchar += PPW;
|
||||
pdstBase--;
|
||||
}
|
||||
ppci++;
|
||||
} /* while nglyph-- */
|
||||
break;
|
||||
case rgnPART:
|
||||
{
|
||||
TEXTPOS *ppos;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
RegionPtr cclip;
|
||||
int xpos; /* x position of char origin */
|
||||
unsigned int i;
|
||||
BoxRec clip;
|
||||
int leftEdge, rightEdge;
|
||||
int topEdge, bottomEdge;
|
||||
int glyphRow; /* first row of glyph not wholly
|
||||
clipped out */
|
||||
int glyphCol; /* leftmost visible column of glyph */
|
||||
#if GETLEFTBITS_ALIGNMENT > 1
|
||||
int getWidth; /* bits to get from glyph */
|
||||
#endif
|
||||
|
||||
if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS))))
|
||||
return;
|
||||
|
||||
pdstBase = pdstBase + (widthDst * y) + (x >> PWSH);
|
||||
xpos = x;
|
||||
xchar = xpos & PIM;
|
||||
|
||||
for (i=0; i<nglyph; i++)
|
||||
{
|
||||
pci = ppci[i];
|
||||
|
||||
ppos[i].xpos = xpos;
|
||||
ppos[i].xchar = xchar;
|
||||
ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
|
||||
ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
|
||||
ppos[i].topEdge = y - pci->metrics.ascent;
|
||||
ppos[i].bottomEdge = y + pci->metrics.descent;
|
||||
ppos[i].pdstBase = pdstBase;
|
||||
ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
||||
|
||||
xpos += pci->metrics.characterWidth;
|
||||
xchar += pci->metrics.characterWidth;
|
||||
if (xchar > PLST)
|
||||
{
|
||||
xchar &= PIM;
|
||||
pdstBase++;
|
||||
}
|
||||
else if (xchar < 0)
|
||||
{
|
||||
xchar += PPW;
|
||||
pdstBase--;
|
||||
}
|
||||
}
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
pbox = REGION_RECTS(cclip);
|
||||
nbox = REGION_NUM_RECTS(cclip);
|
||||
|
||||
/* HACK ALERT
|
||||
since we continue out of the loop below so often, it
|
||||
is easier to increment pbox at the top than at the end.
|
||||
don't try this at home.
|
||||
*/
|
||||
pbox--;
|
||||
while(nbox--)
|
||||
{
|
||||
pbox++;
|
||||
clip.x1 = max(bbox.x1, pbox->x1);
|
||||
clip.y1 = max(bbox.y1, pbox->y1);
|
||||
clip.x2 = min(bbox.x2, pbox->x2);
|
||||
clip.y2 = min(bbox.y2, pbox->y2);
|
||||
if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
|
||||
continue;
|
||||
|
||||
for(i=0; i<nglyph; i++)
|
||||
{
|
||||
pci = ppci[i];
|
||||
xchar = ppos[i].xchar;
|
||||
|
||||
/* clip the left and right edges */
|
||||
if (ppos[i].leftEdge < clip.x1)
|
||||
leftEdge = clip.x1;
|
||||
else
|
||||
leftEdge = ppos[i].leftEdge;
|
||||
|
||||
if (ppos[i].rightEdge > clip.x2)
|
||||
rightEdge = clip.x2;
|
||||
else
|
||||
rightEdge = ppos[i].rightEdge;
|
||||
|
||||
w = rightEdge - leftEdge;
|
||||
if (w <= 0)
|
||||
continue;
|
||||
|
||||
/* clip the top and bottom edges */
|
||||
if (ppos[i].topEdge < clip.y1)
|
||||
topEdge = clip.y1;
|
||||
else
|
||||
topEdge = ppos[i].topEdge;
|
||||
|
||||
if (ppos[i].bottomEdge > clip.y2)
|
||||
bottomEdge = clip.y2;
|
||||
else
|
||||
bottomEdge = ppos[i].bottomEdge;
|
||||
|
||||
h = bottomEdge - topEdge;
|
||||
if (h <= 0)
|
||||
continue;
|
||||
|
||||
glyphRow = (topEdge - y) + pci->metrics.ascent;
|
||||
widthGlyph = ppos[i].widthGlyph;
|
||||
pglyph = FONTGLYPHBITS(pglyphBase, pci);
|
||||
pglyph += (glyphRow * widthGlyph);
|
||||
|
||||
pdst = ppos[i].pdstBase - ((y-topEdge) * widthDst);
|
||||
|
||||
glyphCol = (leftEdge - ppos[i].xpos) -
|
||||
(pci->metrics.leftSideBearing);
|
||||
#if GETLEFTBITS_ALIGNMENT > 1
|
||||
getWidth = w + glyphCol;
|
||||
#endif
|
||||
xoff = xchar + (leftEdge - ppos[i].xpos);
|
||||
if (xoff > PLST)
|
||||
{
|
||||
xoff &= PIM;
|
||||
pdst++;
|
||||
}
|
||||
else if (xoff < 0)
|
||||
{
|
||||
xoff += PPW;
|
||||
pdst--;
|
||||
}
|
||||
|
||||
if ((xoff + w) <= PPW)
|
||||
{
|
||||
maskpartialbits(xoff, w, startmask);
|
||||
while (h--)
|
||||
{
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
|
||||
pglyph += widthGlyph;
|
||||
pdst += widthDst;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
maskPPWbits(xoff, w, startmask, endmask);
|
||||
nFirst = PPW - xoff;
|
||||
while (h--)
|
||||
{
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
|
||||
UPDRW(&(pdst[1]),(SCRLEFT(tmpSrc, nFirst) & endmask));
|
||||
pglyph += widthGlyph;
|
||||
pdst += widthDst;
|
||||
}
|
||||
}
|
||||
} /* for each glyph */
|
||||
} /* while nbox-- */
|
||||
xfree(ppos);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,976 +0,0 @@
|
|||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE
|
||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
/* GJA -- modified this file for vga16 */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "mi.h"
|
||||
#include "miline.h"
|
||||
#include "vgaVideo.h"
|
||||
#include "wm3.h"
|
||||
|
||||
#include "xf86str.h" /* for pScrn->vtSema */
|
||||
extern ScrnInfoPtr *xf86Screens;
|
||||
|
||||
/* single-pixel lines on a color frame buffer
|
||||
|
||||
NON-SLOPED LINES
|
||||
horizontal lines are always drawn left to right; we have to
|
||||
move the endpoints right by one after they're swapped.
|
||||
horizontal lines will be confined to a single band of a
|
||||
region. the code finds that band (giving up if the lower
|
||||
bound of the band is above the line we're drawing); then it
|
||||
finds the first box in that band that contains part of the
|
||||
line. we clip the line to subsequent boxes in that band.
|
||||
vertical lines are always drawn top to bottom (y-increasing.)
|
||||
this requires adding one to the y-coordinate of each endpoint
|
||||
after swapping.
|
||||
|
||||
SLOPED LINES
|
||||
when clipping a sloped line, we bring the second point inside
|
||||
the clipping box, rather than one beyond it, and then add 1 to
|
||||
the length of the line before drawing it. this lets us use
|
||||
the same box for finding the outcodes for both endpoints. since
|
||||
the equation for clipping the second endpoint to an edge gives us
|
||||
1 beyond the edge, we then have to move the point towards the
|
||||
first point by one step on the major axis.
|
||||
eventually, there will be a diagram here to explain what's going
|
||||
on. the method uses Cohen-Sutherland outcodes to determine
|
||||
outsideness, and a method similar to Pike's layers for doing the
|
||||
actual clipping.
|
||||
|
||||
*/
|
||||
#ifdef POLYSEGMENT
|
||||
static void DoV16SegmentSS(
|
||||
DrawablePtr, GCPtr, int, xSegment*
|
||||
);
|
||||
|
||||
void
|
||||
xf4bppSegmentSS (pDrawable, pGC, nseg, pSeg)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int nseg;
|
||||
register xSegment *pSeg;
|
||||
{
|
||||
if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
|
||||
miPolySegment(pDrawable, pGC, nseg, pSeg);
|
||||
} else {
|
||||
DO_WM3(pGC,DoV16SegmentSS (pDrawable, pGC, nseg, pSeg));
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
static void DoV16LineSS(
|
||||
DrawablePtr, GCPtr, int, int, DDXPointPtr
|
||||
);
|
||||
|
||||
void
|
||||
xf4bppLineSS (pDrawable, pGC, mode, npt, pptInit)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int mode; /* Origin or Previous */
|
||||
int npt; /* number of points */
|
||||
DDXPointPtr pptInit;
|
||||
{
|
||||
if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
|
||||
miZeroLine(pDrawable, pGC, mode, npt, pptInit);
|
||||
} else {
|
||||
DO_WM3(pGC,DoV16LineSS (pDrawable, pGC, mode, npt, pptInit));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
#ifdef POLYSEGMENT
|
||||
DoV16SegmentSS (pDrawable, pGC, nseg, pSeg)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int nseg;
|
||||
register xSegment *pSeg;
|
||||
#else
|
||||
DoV16LineSS (pDrawable, pGC, mode, npt, pptInit)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int mode; /* Origin or Previous */
|
||||
int npt; /* number of points */
|
||||
DDXPointPtr pptInit;
|
||||
#endif
|
||||
{
|
||||
int nboxInit;
|
||||
register int nbox;
|
||||
BoxPtr pboxInit;
|
||||
register BoxPtr pbox;
|
||||
#ifndef POLYSEGMENT
|
||||
register DDXPointPtr ppt; /* pointer to list of translated points */
|
||||
#endif
|
||||
|
||||
unsigned int oc1; /* outcode of point 1 */
|
||||
unsigned int oc2; /* outcode of point 2 */
|
||||
|
||||
PixelType *addrlBase; /* pointer to start of drawable */
|
||||
#ifndef POLYSEGMENT
|
||||
PixelType *addrl; /* address of destination pixmap */
|
||||
#endif
|
||||
int nlwidth; /* width in longwords of destination pixmap */
|
||||
int xorg, yorg; /* origin of window */
|
||||
|
||||
int adx; /* abs values of dx and dy */
|
||||
int ady;
|
||||
int signdx; /* sign of dx and dy */
|
||||
int signdy;
|
||||
int e, e1, e2; /* bresenham error and increments */
|
||||
int len; /* length of segment */
|
||||
int axis; /* major axis */
|
||||
int octant;
|
||||
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
|
||||
|
||||
/* a bunch of temporaries */
|
||||
register int y1, y2;
|
||||
register int x1, x2;
|
||||
RegionPtr cclip;
|
||||
#ifndef POLYSEGMENT
|
||||
int alu = pGC->alu; /* GJA */
|
||||
#endif
|
||||
|
||||
if (!(pGC->planemask & 0x0F))
|
||||
return;
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
pboxInit = REGION_RECTS(cclip);
|
||||
nboxInit = REGION_NUM_RECTS(cclip);
|
||||
|
||||
nlwidth = BYTES_PER_LINE(pDrawable) >> 2; /* GJA */
|
||||
addrlBase = (PixelType *)VIDBASE(pDrawable); /* GJA */
|
||||
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
#ifdef POLYSEGMENT
|
||||
while (nseg--)
|
||||
#else
|
||||
ppt = pptInit;
|
||||
x2 = ppt->x + xorg;
|
||||
y2 = ppt->y + yorg;
|
||||
while(--npt)
|
||||
#endif
|
||||
{
|
||||
nbox = nboxInit;
|
||||
pbox = pboxInit;
|
||||
|
||||
#ifdef POLYSEGMENT
|
||||
x1 = pSeg->x1 + xorg;
|
||||
y1 = pSeg->y1 + yorg;
|
||||
x2 = pSeg->x2 + xorg;
|
||||
y2 = pSeg->y2 + yorg;
|
||||
pSeg++;
|
||||
#else
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
++ppt;
|
||||
if (mode == CoordModePrevious)
|
||||
{
|
||||
xorg = x1;
|
||||
yorg = y1;
|
||||
}
|
||||
x2 = ppt->x + xorg;
|
||||
y2 = ppt->y + yorg;
|
||||
#endif
|
||||
|
||||
if (x1 == x2) /* vertical line */
|
||||
{
|
||||
/* make the line go top to bottom of screen, keeping
|
||||
endpoint semantics
|
||||
*/
|
||||
if (y1 > y2)
|
||||
{
|
||||
register int tmp;
|
||||
|
||||
tmp = y2;
|
||||
y2 = y1 + 1;
|
||||
y1 = tmp + 1;
|
||||
#ifdef POLYSEGMENT
|
||||
if (pGC->capStyle != CapNotLast)
|
||||
y1--;
|
||||
#endif
|
||||
}
|
||||
#ifdef POLYSEGMENT
|
||||
else if (pGC->capStyle != CapNotLast)
|
||||
y2++;
|
||||
#endif
|
||||
/* get to first band that might contain part of line */
|
||||
while ((nbox) && (pbox->y2 <= y1))
|
||||
{
|
||||
pbox++;
|
||||
nbox--;
|
||||
}
|
||||
|
||||
if (nbox)
|
||||
{
|
||||
/* stop when lower edge of box is beyond end of line */
|
||||
while((nbox) && (y2 >= pbox->y1))
|
||||
{
|
||||
if ((x1 >= pbox->x1) && (x1 < pbox->x2))
|
||||
{
|
||||
int y1t, y2t;
|
||||
/* this box has part of the line in it */
|
||||
y1t = max(y1, pbox->y1);
|
||||
y2t = min(y2, pbox->y2);
|
||||
if (y1t != y2t)
|
||||
{
|
||||
xf4bppVertS (addrlBase, nlwidth,
|
||||
x1, y1t, y2t-y1t);
|
||||
}
|
||||
}
|
||||
nbox--;
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
#ifndef POLYSEGMENT
|
||||
y2 = ppt->y + yorg;
|
||||
#endif
|
||||
}
|
||||
else if (y1 == y2) /* horizontal line */
|
||||
{
|
||||
/* force line from left to right, keeping
|
||||
endpoint semantics
|
||||
*/
|
||||
if (x1 > x2)
|
||||
{
|
||||
register int tmp;
|
||||
|
||||
tmp = x2;
|
||||
x2 = x1 + 1;
|
||||
x1 = tmp + 1;
|
||||
#ifdef POLYSEGMENT
|
||||
if (pGC->capStyle != CapNotLast)
|
||||
x1--;
|
||||
#endif
|
||||
}
|
||||
#ifdef POLYSEGMENT
|
||||
else if (pGC->capStyle != CapNotLast)
|
||||
x2++;
|
||||
#endif
|
||||
|
||||
/* find the correct band */
|
||||
while( (nbox) && (pbox->y2 <= y1))
|
||||
{
|
||||
pbox++;
|
||||
nbox--;
|
||||
}
|
||||
|
||||
/* try to draw the line, if we haven't gone beyond it */
|
||||
if ((nbox) && (pbox->y1 <= y1))
|
||||
{
|
||||
int tmp;
|
||||
|
||||
/* when we leave this band, we're done */
|
||||
tmp = pbox->y1;
|
||||
while((nbox) && (pbox->y1 == tmp))
|
||||
{
|
||||
int x1t, x2t;
|
||||
|
||||
if (pbox->x2 <= x1)
|
||||
{
|
||||
/* skip boxes until one might contain start point */
|
||||
nbox--;
|
||||
pbox++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* stop if left of box is beyond right of line */
|
||||
if (pbox->x1 >= x2)
|
||||
{
|
||||
nbox = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
x1t = max(x1, pbox->x1);
|
||||
x2t = min(x2, pbox->x2);
|
||||
if (x1t != x2t)
|
||||
{
|
||||
xf4bppHorzS (addrlBase, nlwidth,
|
||||
x1t, y1, x2t-x1t);
|
||||
}
|
||||
nbox--;
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
#ifndef POLYSEGMENT
|
||||
x2 = ppt->x + xorg;
|
||||
#endif
|
||||
}
|
||||
else /* sloped line */
|
||||
{
|
||||
CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
|
||||
1, 1, octant);
|
||||
|
||||
if (adx > ady)
|
||||
{
|
||||
axis = X_AXIS;
|
||||
e1 = ady << 1;
|
||||
e2 = e1 - (adx << 1);
|
||||
e = e1 - adx;
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = Y_AXIS;
|
||||
e1 = adx << 1;
|
||||
e2 = e1 - (ady << 1);
|
||||
e = e1 - ady;
|
||||
SetYMajorOctant(octant);
|
||||
}
|
||||
|
||||
FIXUP_ERROR(e, octant, bias);
|
||||
|
||||
/* we have bresenham parameters and two points.
|
||||
all we have to do now is clip and draw.
|
||||
*/
|
||||
|
||||
while(nbox--)
|
||||
{
|
||||
oc1 = 0;
|
||||
oc2 = 0;
|
||||
OUTCODES(oc1, x1, y1, pbox);
|
||||
OUTCODES(oc2, x2, y2, pbox);
|
||||
if ((oc1 | oc2) == 0)
|
||||
{
|
||||
if (axis == X_AXIS)
|
||||
len = adx;
|
||||
else
|
||||
len = ady;
|
||||
#ifdef POLYSEGMENT
|
||||
if (pGC->capStyle != CapNotLast)
|
||||
len++;
|
||||
#endif
|
||||
xf4bppBresS (addrlBase, nlwidth,
|
||||
signdx, signdy, axis, x1, y1,
|
||||
e, e1, e2, len);
|
||||
break;
|
||||
}
|
||||
else if (oc1 & oc2)
|
||||
{
|
||||
pbox++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
|
||||
int clip1 = 0, clip2 = 0;
|
||||
int clipdx, clipdy;
|
||||
int err;
|
||||
|
||||
if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
|
||||
pbox->y2-1,
|
||||
&new_x1, &new_y1, &new_x2, &new_y2,
|
||||
adx, ady, &clip1, &clip2,
|
||||
octant, bias, oc1, oc2) == -1)
|
||||
{
|
||||
pbox++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (axis == X_AXIS)
|
||||
len = abs(new_x2 - new_x1);
|
||||
else
|
||||
len = abs(new_y2 - new_y1);
|
||||
#ifdef POLYSEGMENT
|
||||
if (clip2 != 0 || pGC->capStyle != CapNotLast)
|
||||
len++;
|
||||
#else
|
||||
len += (clip2 != 0);
|
||||
#endif
|
||||
if (len)
|
||||
{
|
||||
/* unwind bresenham error term to first point */
|
||||
if (clip1)
|
||||
{
|
||||
clipdx = abs(new_x1 - x1);
|
||||
clipdy = abs(new_y1 - y1);
|
||||
if (axis == X_AXIS)
|
||||
err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
|
||||
else
|
||||
err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
|
||||
}
|
||||
else
|
||||
err = e;
|
||||
xf4bppBresS (addrlBase, nlwidth,
|
||||
signdx, signdy, axis, new_x1, new_y1,
|
||||
err, e1, e2, len);
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
} /* while (nbox--) */
|
||||
} /* sloped line */
|
||||
} /* while (nline--) */
|
||||
|
||||
#ifndef POLYSEGMENT
|
||||
|
||||
/* paint the last point if the end style isn't CapNotLast.
|
||||
(Assume that a projecting, butt, or round cap that is one
|
||||
pixel wide is the same as the single pixel of the endpoint.)
|
||||
*/
|
||||
|
||||
if ((pGC->capStyle != CapNotLast) &&
|
||||
((ppt->x + xorg != pptInit->x + pDrawable->x) ||
|
||||
(ppt->y + yorg != pptInit->y + pDrawable->y) ||
|
||||
(ppt == pptInit + 1)))
|
||||
{
|
||||
PixelType _mask;
|
||||
|
||||
if (alu == RROP_BLACK)
|
||||
_mask = mfbGetrmask(x2 & PIM);
|
||||
else
|
||||
_mask = mfbGetmask(x2 & PIM);
|
||||
|
||||
nbox = nboxInit;
|
||||
pbox = pboxInit;
|
||||
while (nbox--)
|
||||
{
|
||||
if ((x2 >= pbox->x1) &&
|
||||
(y2 >= pbox->y1) &&
|
||||
(x2 < pbox->x2) &&
|
||||
(y2 < pbox->y2))
|
||||
{
|
||||
addrl = mfbScanline(addrlBase, x2, y2, nlwidth);
|
||||
UPDRW(addrl,_mask);
|
||||
break;
|
||||
}
|
||||
else
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw dashed 1-pixel lines.
|
||||
*/
|
||||
|
||||
#ifdef POLYSEGMENT
|
||||
static void DoV16SegmentSD(
|
||||
DrawablePtr, GCPtr, int, xSegment*
|
||||
);
|
||||
|
||||
void
|
||||
xf4bppSegmentSD (pDrawable, pGC, nseg, pSeg)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int nseg;
|
||||
register xSegment *pSeg;
|
||||
{
|
||||
if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
|
||||
miPolySegment(pDrawable, pGC, nseg, pSeg);
|
||||
} else {
|
||||
DO_WM3(pGC,DoV16SegmentSD (pDrawable, pGC, nseg, pSeg));
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
static void DoV16LineSD(
|
||||
DrawablePtr, GCPtr, int, int, DDXPointPtr
|
||||
);
|
||||
|
||||
void
|
||||
xf4bppLineSD (pDrawable, pGC, mode, npt, pptInit)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int mode; /* Origin or Previous */
|
||||
int npt; /* number of points */
|
||||
DDXPointPtr pptInit;
|
||||
{
|
||||
if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
|
||||
miZeroDashLine(pDrawable, pGC, mode, npt, pptInit);
|
||||
} else {
|
||||
DO_WM3(pGC,DoV16LineSD (pDrawable, pGC, mode, npt, pptInit));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
#ifdef POLYSEGMENT
|
||||
DoV16SegmentSD (pDrawable, pGC, nseg, pSeg)
|
||||
DrawablePtr pDrawable;
|
||||
register GCPtr pGC;
|
||||
int nseg;
|
||||
register xSegment *pSeg;
|
||||
#else
|
||||
DoV16LineSD( pDrawable, pGC, mode, npt, pptInit)
|
||||
DrawablePtr pDrawable;
|
||||
register GCPtr pGC;
|
||||
int mode; /* Origin or Previous */
|
||||
int npt; /* number of points */
|
||||
DDXPointPtr pptInit;
|
||||
#endif
|
||||
{
|
||||
int nboxInit;
|
||||
register int nbox;
|
||||
BoxPtr pboxInit;
|
||||
register BoxPtr pbox;
|
||||
#ifndef POLYSEGMENT
|
||||
register DDXPointPtr ppt; /* pointer to list of translated points */
|
||||
#endif
|
||||
|
||||
register unsigned int oc1; /* outcode of point 1 */
|
||||
register unsigned int oc2; /* outcode of point 2 */
|
||||
|
||||
PixelType *addrl; /* address of destination pixmap */
|
||||
int nlwidth; /* width in longwords of destination pixmap */
|
||||
int xorg, yorg; /* origin of window */
|
||||
|
||||
int adx; /* abs values of dx and dy */
|
||||
int ady;
|
||||
int signdx; /* sign of dx and dy */
|
||||
int signdy;
|
||||
int e, e1, e2; /* bresenham error and increments */
|
||||
int len; /* length of segment */
|
||||
int axis; /* major axis */
|
||||
int octant;
|
||||
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
|
||||
int x1, x2, y1, y2;
|
||||
RegionPtr cclip;
|
||||
int fgink, bgink; /* GJA */
|
||||
unsigned char *pDash;
|
||||
int dashOffset;
|
||||
int numInDashList;
|
||||
int dashIndex;
|
||||
int isDoubleDash;
|
||||
int dashIndexTmp, dashOffsetTmp;
|
||||
int unclippedlen;
|
||||
|
||||
if (!(pGC->planemask & 0x0F))
|
||||
return;
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
fgink = bgink = pGC->fgPixel; /* GJA */
|
||||
pboxInit = REGION_RECTS(cclip);
|
||||
nboxInit = REGION_NUM_RECTS(cclip);
|
||||
|
||||
nlwidth = BYTES_PER_LINE(pDrawable) >> 2; /* GJA */
|
||||
addrl = (PixelType *)VIDBASE(pDrawable); /* GJA */
|
||||
|
||||
/* compute initial dash values */
|
||||
|
||||
pDash = (unsigned char *) pGC->dash;
|
||||
numInDashList = pGC->numInDashList;
|
||||
isDoubleDash = (pGC->lineStyle == LineDoubleDash);
|
||||
dashIndex = 0;
|
||||
dashOffset = 0;
|
||||
miStepDash ((int)pGC->dashOffset, &dashIndex, pDash,
|
||||
numInDashList, &dashOffset);
|
||||
|
||||
if (isDoubleDash)
|
||||
bgink = pGC->bgPixel; /* GJA */
|
||||
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
#ifdef POLYSEGMENT
|
||||
while (nseg--)
|
||||
#else
|
||||
ppt = pptInit;
|
||||
x2 = ppt->x + xorg;
|
||||
y2 = ppt->y + yorg;
|
||||
while(--npt)
|
||||
#endif
|
||||
{
|
||||
nbox = nboxInit;
|
||||
pbox = pboxInit;
|
||||
|
||||
#ifdef POLYSEGMENT
|
||||
x1 = pSeg->x1 + xorg;
|
||||
y1 = pSeg->y1 + yorg;
|
||||
x2 = pSeg->x2 + xorg;
|
||||
y2 = pSeg->y2 + yorg;
|
||||
pSeg++;
|
||||
#else
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
++ppt;
|
||||
if (mode == CoordModePrevious)
|
||||
{
|
||||
xorg = x1;
|
||||
yorg = y1;
|
||||
}
|
||||
x2 = ppt->x + xorg;
|
||||
y2 = ppt->y + yorg;
|
||||
#endif
|
||||
|
||||
CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
|
||||
|
||||
if (adx > ady)
|
||||
{
|
||||
axis = X_AXIS;
|
||||
e1 = ady << 1;
|
||||
e2 = e1 - (adx << 1);
|
||||
e = e1 - adx;
|
||||
unclippedlen = adx;
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = Y_AXIS;
|
||||
e1 = adx << 1;
|
||||
e2 = e1 - (ady << 1);
|
||||
e = e1 - ady;
|
||||
unclippedlen = ady;
|
||||
SetYMajorOctant(octant);
|
||||
}
|
||||
|
||||
FIXUP_ERROR(e, octant, bias);
|
||||
|
||||
/* we have bresenham parameters and two points.
|
||||
all we have to do now is clip and draw.
|
||||
*/
|
||||
|
||||
while(nbox--)
|
||||
{
|
||||
oc1 = 0;
|
||||
oc2 = 0;
|
||||
OUTCODES(oc1, x1, y1, pbox);
|
||||
OUTCODES(oc2, x2, y2, pbox);
|
||||
if ((oc1 | oc2) == 0)
|
||||
{
|
||||
#ifdef POLYSEGMENT
|
||||
if (pGC->capStyle != CapNotLast)
|
||||
unclippedlen++;
|
||||
dashIndexTmp = dashIndex;
|
||||
dashOffsetTmp = dashOffset;
|
||||
xf4bppBresD (pDrawable, fgink, bgink,
|
||||
&dashIndexTmp, pDash, numInDashList,
|
||||
&dashOffsetTmp, isDoubleDash,
|
||||
addrl, nlwidth,
|
||||
signdx, signdy, axis, x1, y1,
|
||||
e, e1, e2, unclippedlen);
|
||||
break;
|
||||
#else
|
||||
xf4bppBresD (pDrawable, fgink, bgink,
|
||||
&dashIndex, pDash, numInDashList,
|
||||
&dashOffset, isDoubleDash,
|
||||
addrl, nlwidth,
|
||||
signdx, signdy, axis, x1, y1,
|
||||
e, e1, e2, unclippedlen);
|
||||
goto dontStep;
|
||||
#endif
|
||||
}
|
||||
else if (oc1 & oc2)
|
||||
{
|
||||
pbox++;
|
||||
}
|
||||
else /* have to clip */
|
||||
{
|
||||
int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
|
||||
int clip1 = 0, clip2 = 0;
|
||||
int clipdx, clipdy;
|
||||
int err;
|
||||
|
||||
if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, pbox->y2-1,
|
||||
&new_x1, &new_y1, &new_x2, &new_y2,
|
||||
adx, ady, &clip1, &clip2,
|
||||
octant, bias, oc1, oc2) == -1)
|
||||
{
|
||||
pbox++;
|
||||
continue;
|
||||
}
|
||||
dashIndexTmp = dashIndex;
|
||||
dashOffsetTmp = dashOffset;
|
||||
if (clip1)
|
||||
{
|
||||
int dlen;
|
||||
|
||||
if (axis == X_AXIS)
|
||||
dlen = abs(new_x1 - x1);
|
||||
else
|
||||
dlen = abs(new_y1 - y1);
|
||||
miStepDash (dlen, &dashIndexTmp, pDash,
|
||||
numInDashList, &dashOffsetTmp);
|
||||
}
|
||||
if (axis == X_AXIS)
|
||||
len = abs(new_x2 - new_x1);
|
||||
else
|
||||
len = abs(new_y2 - new_y1);
|
||||
#ifdef POLYSEGMENT
|
||||
if (clip2 != 0 || pGC->capStyle != CapNotLast)
|
||||
len++;
|
||||
#else
|
||||
len += (clip2 != 0);
|
||||
#endif
|
||||
if (len)
|
||||
{
|
||||
/* unwind bresenham error term to first point */
|
||||
if (clip1)
|
||||
{
|
||||
clipdx = abs(new_x1 - x1);
|
||||
clipdy = abs(new_y1 - y1);
|
||||
if (axis == X_AXIS)
|
||||
err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
|
||||
else
|
||||
err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
|
||||
}
|
||||
else
|
||||
err = e;
|
||||
xf4bppBresD (pDrawable, fgink, bgink,
|
||||
&dashIndexTmp, pDash, numInDashList,
|
||||
&dashOffsetTmp, isDoubleDash,
|
||||
addrl, nlwidth,
|
||||
signdx, signdy, axis, new_x1, new_y1,
|
||||
err, e1, e2, len);
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
} /* while (nbox--) */
|
||||
#ifndef POLYSEGMENT
|
||||
/*
|
||||
* walk the dash list around to the next line
|
||||
*/
|
||||
miStepDash (unclippedlen, &dashIndex, pDash,
|
||||
numInDashList, &dashOffset);
|
||||
dontStep: ;
|
||||
#endif
|
||||
} /* while (nline--) */
|
||||
|
||||
#ifndef POLYSEGMENT
|
||||
/* paint the last point if the end style isn't CapNotLast.
|
||||
(Assume that a projecting, butt, or round cap that is one
|
||||
pixel wide is the same as the single pixel of the endpoint.)
|
||||
*/
|
||||
|
||||
if ((pGC->capStyle != CapNotLast) &&
|
||||
((dashIndex & 1) == 0 || isDoubleDash) &&
|
||||
((ppt->x + xorg != pptInit->x + pDrawable->x) ||
|
||||
(ppt->y + yorg != pptInit->y + pDrawable->y) ||
|
||||
(ppt == pptInit + 1)))
|
||||
{
|
||||
nbox = nboxInit;
|
||||
pbox = pboxInit;
|
||||
while (nbox--)
|
||||
{
|
||||
if ((x2 >= pbox->x1) &&
|
||||
(y2 >= pbox->y1) &&
|
||||
(x2 < pbox->x2) &&
|
||||
(y2 < pbox->y2))
|
||||
{
|
||||
unsigned long _mask;
|
||||
|
||||
_mask = mfbGetmask(x2 & PIM);
|
||||
addrl = mfbScanline(addrl, x2, y2, nlwidth);
|
||||
UPDRW(addrl,_mask);
|
||||
break;
|
||||
}
|
||||
else
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
#ifndef POLYSEGMENT
|
||||
/*
|
||||
the clipping code could be cleaned up some; most of its
|
||||
mess derives from originally being inline in the line code,
|
||||
then pulled out to make clipping dashes easier.
|
||||
*/
|
||||
|
||||
int
|
||||
mfbClipLine(pbox, box,
|
||||
ppt1Orig, ppt1, ppt2,
|
||||
adx, ady, signdx, signdy, axis,
|
||||
pclip1, pclip2)
|
||||
BoxPtr pbox; /* box to clip to */
|
||||
BoxRec box; /* box to do calculations with */
|
||||
DDXPointPtr ppt1Orig, ppt1, ppt2;
|
||||
int adx, ady;
|
||||
int signdx, signdy;
|
||||
register int axis;
|
||||
int *pclip1, *pclip2;
|
||||
{
|
||||
DDXPointRec pt1Orig, pt1, pt2;
|
||||
register int swapped = 0;
|
||||
int clipDone = 0;
|
||||
register unsigned int utmp;
|
||||
register int oc1, oc2;
|
||||
int clip1, clip2;
|
||||
|
||||
pt1Orig = *ppt1Orig;
|
||||
pt1 = *ppt1;
|
||||
pt2 = *ppt2;
|
||||
clip1 = 0;
|
||||
clip2 = 0;
|
||||
|
||||
do
|
||||
{
|
||||
oc1 = 0;
|
||||
oc2 = 0;
|
||||
OUTCODES(oc1, pt1.x, pt1.y, pbox);
|
||||
OUTCODES(oc2, pt2.x, pt2.y, pbox);
|
||||
|
||||
if (oc1 & oc2)
|
||||
clipDone = -1;
|
||||
else if ((oc1 | oc2) == 0)
|
||||
{
|
||||
clipDone = 1;
|
||||
if (swapped)
|
||||
{
|
||||
SWAPPT(pt1, pt2);
|
||||
SWAPINT(oc1, oc2);
|
||||
SWAPINT(clip1, clip2);
|
||||
}
|
||||
}
|
||||
else /* have to clip */
|
||||
{
|
||||
/* only clip one point at a time */
|
||||
if (!oc1)
|
||||
{
|
||||
SWAPPT(pt1, pt2);
|
||||
SWAPINT(oc1, oc2);
|
||||
SWAPINT(clip1, clip2);
|
||||
swapped = !swapped;
|
||||
}
|
||||
|
||||
clip1 |= oc1;
|
||||
if (oc1 & OUT_LEFT)
|
||||
{
|
||||
pt1.x = box.x1;
|
||||
utmp = abs(box.x1 - pt1Orig.x);
|
||||
utmp *= ady;
|
||||
if(axis==X_AXIS)
|
||||
{
|
||||
pt1.y = pt1Orig.y + SignTimes(signdy, round(utmp, adx));
|
||||
}
|
||||
else
|
||||
{
|
||||
utmp <<= 1;
|
||||
if (swapped)
|
||||
utmp += ady;
|
||||
else
|
||||
utmp -= ady;
|
||||
pt1.y = pt1Orig.y + SignTimes(signdy, ceiling(utmp, 2*adx));
|
||||
if (swapped)
|
||||
pt1.y -= signdy;
|
||||
}
|
||||
}
|
||||
else if (oc1 & OUT_ABOVE)
|
||||
{
|
||||
pt1.y = box.y1;
|
||||
utmp = abs(box.y1 - pt1Orig.y);
|
||||
utmp *= adx;
|
||||
if (axis == Y_AXIS)
|
||||
{
|
||||
pt1.x = pt1Orig.x + SignTimes(signdx, round(utmp, ady));
|
||||
}
|
||||
else
|
||||
{
|
||||
utmp <<= 1;
|
||||
if (swapped)
|
||||
utmp += adx;
|
||||
else
|
||||
utmp -= adx;
|
||||
pt1.x = pt1Orig.x + SignTimes(signdx, ceiling(utmp, 2*ady));
|
||||
if (swapped)
|
||||
pt1.x -= signdx;
|
||||
}
|
||||
}
|
||||
else if (oc1 & OUT_RIGHT)
|
||||
{
|
||||
pt1.x = box.x2;
|
||||
utmp = abs(pt1Orig.x - box.x2);
|
||||
utmp *= ady;
|
||||
if (axis == X_AXIS)
|
||||
{
|
||||
pt1.y = pt1Orig.y + SignTimes(signdy, round(utmp, adx));
|
||||
}
|
||||
else
|
||||
{
|
||||
utmp <<= 1;
|
||||
if (swapped)
|
||||
utmp += ady;
|
||||
else
|
||||
utmp -= ady;
|
||||
pt1.y = pt1Orig.y + SignTimes(signdy, ceiling(utmp, 2*adx));
|
||||
if (swapped)
|
||||
pt1.y -= signdy;
|
||||
}
|
||||
}
|
||||
else if (oc1 & OUT_BELOW)
|
||||
{
|
||||
pt1.y = box.y2;
|
||||
utmp = abs(pt1Orig.y - box.y2);
|
||||
utmp *= adx;
|
||||
if (axis == Y_AXIS)
|
||||
{
|
||||
pt1.x = pt1Orig.x + SignTimes(signdx, round(utmp, ady));
|
||||
}
|
||||
else
|
||||
{
|
||||
utmp <<= 1;
|
||||
if (swapped)
|
||||
utmp += adx;
|
||||
else
|
||||
utmp -= adx;
|
||||
pt1.x = pt1Orig.x + SignTimes(signdx, ceiling(utmp, 2*ady));
|
||||
if (swapped)
|
||||
pt1.x -= signdx;
|
||||
}
|
||||
}
|
||||
} /* else have to clip */
|
||||
} while(!clipDone);
|
||||
*ppt1 = pt1;
|
||||
*ppt2 = pt2;
|
||||
*pclip1 = clip1;
|
||||
*pclip2 = clip2;
|
||||
|
||||
return clipDone;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,267 +0,0 @@
|
|||
/************************************************************
|
||||
|
||||
Copyright (c) 1989 X Consortium
|
||||
|
||||
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 THE
|
||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
********************************************************/
|
||||
/* GJA -- Took mfb code and modified it. */
|
||||
|
||||
/* Derived from:
|
||||
* "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
|
||||
* by M. L. V. Pitteway
|
||||
* The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "mi.h"
|
||||
#include "mizerarc.h"
|
||||
#include "wm3.h"
|
||||
|
||||
#include "xf86str.h" /* for pScrn->vtSema */
|
||||
extern ScrnInfoPtr *xf86Screens;
|
||||
|
||||
/*
|
||||
* Note, LEFTMOST must be the bit leftmost in the actual screen
|
||||
* representation. This depends on both BITMAP_BIT_ORDER and
|
||||
* IMAGE_BYTE_ORDER
|
||||
* DHD 10/92
|
||||
*/
|
||||
|
||||
#if (BITMAP_BIT_ORDER == MSBFirst)
|
||||
#if (IMAGE_BYTE_ORDER == MSBFirst)
|
||||
#define LEFTMOST ((unsigned int) 0x80000000)
|
||||
#else
|
||||
#define LEFTMOST ((unsigned int) 0x80)
|
||||
#endif
|
||||
#else
|
||||
#if (IMAGE_BYTE_ORDER == LSBFirst)
|
||||
#define LEFTMOST ((unsigned int) 1)
|
||||
#else
|
||||
#define LEFTMOST ((unsigned int) 0x1000000)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define PixelateWhite(addr,off) \
|
||||
{ \
|
||||
register int *tmpaddr = &((addr)[(off)>>PWSH]); \
|
||||
UPDRW(tmpaddr,SCRRIGHT (LEFTMOST, ((off) & PIM))); \
|
||||
}
|
||||
#define PixelateBlack(addr,off) \
|
||||
{ \
|
||||
register int *tmpaddr = &((addr)[(off)>>PWSH]); \
|
||||
UPDRW(tmpaddr,~(SCRRIGHT (LEFTMOST, ((off) & PIM)))); \
|
||||
}
|
||||
|
||||
#define Pixelate(base,off) \
|
||||
{ \
|
||||
paddr = base + ((off)>>PWSH); \
|
||||
pmask = SCRRIGHT(LEFTMOST, (off) & PIM); \
|
||||
UPDRW(paddr,(pixel & pmask)); \
|
||||
}
|
||||
|
||||
#define DoPix(bit,base,off) if (msk & bit) Pixelate(base,off);
|
||||
|
||||
static void
|
||||
v16ZeroArcSS
|
||||
(
|
||||
DrawablePtr pDraw,
|
||||
GCPtr pGC,
|
||||
xArc *arc
|
||||
)
|
||||
{
|
||||
miZeroArcRec info;
|
||||
Bool do360;
|
||||
register int x, y, a, b, d, msk;
|
||||
register int k1, k3, dx, dy;
|
||||
int *addrl;
|
||||
int *yorgl, *yorgol;
|
||||
unsigned long pixel;
|
||||
int nlwidth, yoffset, dyoffset;
|
||||
int pmask;
|
||||
register int *paddr;
|
||||
|
||||
if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
mfbGetGCPrivateKey()))->rop ==
|
||||
RROP_BLACK)
|
||||
pixel = 0;
|
||||
else
|
||||
pixel = ~0UL;
|
||||
|
||||
if (pDraw->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
addrl = (int *)
|
||||
(((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr);
|
||||
nlwidth = (int)
|
||||
(((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
addrl = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr);
|
||||
nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2;
|
||||
}
|
||||
|
||||
do360 = miZeroArcSetup(arc, &info, TRUE);
|
||||
yorgl = addrl + ((info.yorg + pDraw->y) * nlwidth);
|
||||
yorgol = addrl + ((info.yorgo + pDraw->y) * nlwidth);
|
||||
info.xorg += pDraw->x;
|
||||
info.xorgo += pDraw->x;
|
||||
MIARCSETUP();
|
||||
yoffset = y ? nlwidth : 0;
|
||||
dyoffset = 0;
|
||||
msk = info.initialMask;
|
||||
if (!(arc->width & 1))
|
||||
{
|
||||
DoPix(2, yorgl, info.xorgo);
|
||||
DoPix(8, yorgol, info.xorgo);
|
||||
}
|
||||
if (!info.end.x || !info.end.y)
|
||||
{
|
||||
msk = info.end.mask;
|
||||
info.end = info.altend;
|
||||
}
|
||||
if (do360 && (arc->width == arc->height) && !(arc->width & 1))
|
||||
{
|
||||
int xoffset = nlwidth;
|
||||
int *yorghl = yorgl + (info.h * nlwidth);
|
||||
int xorghp = info.xorg + info.h;
|
||||
int xorghn = info.xorg - info.h;
|
||||
|
||||
while (1)
|
||||
{
|
||||
PixelateWhite(yorgl + yoffset, info.xorg + x);
|
||||
PixelateWhite(yorgl + yoffset, info.xorg - x);
|
||||
PixelateWhite(yorgol- yoffset, info.xorg - x);
|
||||
PixelateWhite(yorgol - yoffset, info.xorg + x);
|
||||
if (a < 0)
|
||||
break;
|
||||
PixelateWhite(yorghl - xoffset, xorghp - y);
|
||||
PixelateWhite(yorghl - xoffset, xorghn + y);
|
||||
PixelateWhite(yorghl + xoffset, xorghn + y);
|
||||
PixelateWhite(yorghl + xoffset, xorghp - y);
|
||||
xoffset += nlwidth;
|
||||
MIARCCIRCLESTEP(yoffset += nlwidth;);
|
||||
}
|
||||
x = info.w;
|
||||
yoffset = info.h * nlwidth;
|
||||
}
|
||||
else if (do360)
|
||||
{
|
||||
while (y < info.h || x < info.w)
|
||||
{
|
||||
MIARCOCTANTSHIFT(dyoffset = nlwidth;);
|
||||
Pixelate(yorgl + yoffset, info.xorg + x);
|
||||
Pixelate(yorgl + yoffset, info.xorgo - x);
|
||||
Pixelate(yorgol - yoffset, info.xorgo - x);
|
||||
Pixelate(yorgol - yoffset, info.xorg + x);
|
||||
MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (y < info.h || x < info.w)
|
||||
{
|
||||
MIARCOCTANTSHIFT(dyoffset = nlwidth;);
|
||||
if ((x == info.start.x) || (y == info.start.y))
|
||||
{
|
||||
msk = info.start.mask;
|
||||
info.start = info.altstart;
|
||||
}
|
||||
DoPix(1, yorgl + yoffset, info.xorg + x);
|
||||
DoPix(2, yorgl + yoffset, info.xorgo - x);
|
||||
DoPix(4, yorgol - yoffset, info.xorgo - x);
|
||||
DoPix(8, yorgol - yoffset, info.xorg + x);
|
||||
if ((x == info.end.x) || (y == info.end.y))
|
||||
{
|
||||
msk = info.end.mask;
|
||||
info.end = info.altend;
|
||||
}
|
||||
MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
|
||||
}
|
||||
}
|
||||
if ((x == info.start.x) || (y == info.start.y))
|
||||
msk = info.start.mask;
|
||||
DoPix(1, yorgl + yoffset, info.xorg + x);
|
||||
DoPix(4, yorgol - yoffset, info.xorgo - x);
|
||||
if (arc->height & 1)
|
||||
{
|
||||
DoPix(2, yorgl + yoffset, info.xorgo - x);
|
||||
DoPix(8, yorgol - yoffset, info.xorg + x);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xf4bppZeroPolyArcSS
|
||||
(
|
||||
DrawablePtr pDraw,
|
||||
GCPtr pGC,
|
||||
int narcs,
|
||||
xArc *parcs
|
||||
)
|
||||
{
|
||||
register xArc *arc;
|
||||
register int i;
|
||||
BoxRec box;
|
||||
RegionPtr cclip;
|
||||
|
||||
if (!pGC->planemask & 0x0F)
|
||||
return;
|
||||
cclip = pGC->pCompositeClip;
|
||||
for (arc = parcs, i = narcs; --i >= 0; arc++)
|
||||
{
|
||||
if (miCanZeroArc(arc))
|
||||
{
|
||||
box.x1 = arc->x + pDraw->x;
|
||||
box.y1 = arc->y + pDraw->y;
|
||||
box.x2 = box.x1 + (int)arc->width + 1;
|
||||
box.y2 = box.y1 + (int)arc->height + 1;
|
||||
if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN)
|
||||
v16ZeroArcSS(pDraw, pGC, arc);
|
||||
else
|
||||
miZeroPolyArc(pDraw, pGC, 1, arc);
|
||||
}
|
||||
else
|
||||
miPolyArc(pDraw, pGC, 1, arc);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppZeroPolyArc(pDraw, pGC, narcs, parcs)
|
||||
DrawablePtr pDraw;
|
||||
GCPtr pGC;
|
||||
int narcs;
|
||||
xArc *parcs;
|
||||
{
|
||||
if ( !xf86Screens[pDraw->pScreen->myNum]->vtSema ) {
|
||||
miZeroPolyArc(pDraw, pGC, narcs, parcs);
|
||||
} else {
|
||||
DO_WM3(pGC,xf4bppZeroPolyArcSS(pDraw, pGC, narcs, parcs));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,342 +0,0 @@
|
|||
/*
|
||||
* Copyright 1993 Gerrit Jan Akkerman
|
||||
*
|
||||
* 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 Gerrit Jan Akkerman not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* GERRIT JAN AKKERMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
|
||||
* IN NO EVENT SHALL GERRIT JAN AKKERMAN 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.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "vgaVideo.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
|
||||
#define saved_screen(pWin) \
|
||||
((unsigned char *)(((PixmapPtr)((pWin)->drawable.pScreen->devPrivate))->devPrivate.ptr))
|
||||
|
||||
#define SAVEDSCREEN(pWin, x, y) \
|
||||
(*(saved_screen(pWin) + (y) * (BYTES_PER_LINE(pWin)) + (x)))
|
||||
|
||||
#define DO_ROP(src,dst,alu,planes) \
|
||||
((dst) = do_rop((src),(dst),(alu),(planes)))
|
||||
|
||||
/* NOTE:
|
||||
* The following to functions don't do anything. They're just there to
|
||||
* provide a stable interface to the rest of the system.
|
||||
*/
|
||||
|
||||
static int
|
||||
do_rop
|
||||
(
|
||||
int src,
|
||||
int dst,
|
||||
int alu,
|
||||
const unsigned long planes
|
||||
)
|
||||
{
|
||||
int _dst; /* New dst */
|
||||
|
||||
switch ( alu ) {
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
_dst = 0; break ;
|
||||
case GXinvert: /* 0xa NOT dst */
|
||||
_dst = ~dst; break ;
|
||||
case GXset: /* 0xf 1 */
|
||||
_dst = src; break ;
|
||||
default:
|
||||
case GXnoop: /* 0x5 dst */
|
||||
return dst;
|
||||
case GXnor: /* 0x8 NOT src AND NOT dst */
|
||||
_dst = ~src & ~dst; break ;
|
||||
case GXandInverted: /* 0x4 NOT src AND dst */
|
||||
_dst = ~src & dst; break ;
|
||||
case GXand: /* 0x1 src AND dst */
|
||||
_dst = src & dst; break ;
|
||||
case GXequiv: /* 0x9 NOT src XOR dst */
|
||||
_dst = ~src ^ dst; break ;
|
||||
case GXxor: /* 0x6 src XOR dst */
|
||||
_dst = src ^ dst; break ;
|
||||
case GXandReverse: /* 0x2 src AND NOT dst */
|
||||
_dst = src & ~dst; break ;
|
||||
case GXnand: /* 0xe NOT src OR NOT dst */
|
||||
_dst = ~src | ~dst; break ;
|
||||
case GXorReverse: /* 0xb src OR NOT dst */
|
||||
_dst = src | ~dst; break ;
|
||||
case GXorInverted: /* 0xd NOT src OR dst */
|
||||
_dst = ~src | dst; break ;
|
||||
case GXor: /* 0x7 src OR dst */
|
||||
_dst = src | dst; break ;
|
||||
case GXcopyInverted: /* 0xc NOT src */
|
||||
_dst = ~src; break ;
|
||||
case GXcopy: /* 0x3 src */
|
||||
_dst = src; break ;
|
||||
}
|
||||
return (dst & ~planes) | (_dst & planes);
|
||||
}
|
||||
|
||||
/* File vgaBitBlt.c */
|
||||
void
|
||||
xf4bppOffBitBlt( pWin, alu, writeplanes, x0, y0, x1, y1, w, h )
|
||||
WindowPtr pWin; /* GJA */
|
||||
const int alu, writeplanes ;
|
||||
register int x0 ;
|
||||
int y0 ;
|
||||
register int x1 ;
|
||||
int y1 ;
|
||||
register int w, h ;
|
||||
{
|
||||
int x,y;
|
||||
|
||||
switch ( alu ) {
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
case GXinvert: /* 0xa NOT dst */
|
||||
case GXset: /* 0xf 1 */
|
||||
xf4bppOffFillSolid( pWin, VGA_ALLPLANES, alu, writeplanes,
|
||||
x0, y0, w, h ) ;
|
||||
case GXnoop: /* 0x5 dst */
|
||||
return ;
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
|
||||
if ( (w <= 0) || (h <= 0) ) return;
|
||||
|
||||
for ( y = 0 ; y < h ; y++ ) {
|
||||
for ( x = 0 ; x < w ; x++ ) {
|
||||
DO_ROP(SAVEDSCREEN(pWin,x0+x,y0+y),SAVEDSCREEN(pWin,x1+x,y1+y),
|
||||
alu,writeplanes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* for file vgaImages.c */
|
||||
|
||||
void
|
||||
xf4bppOffDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes )
|
||||
WindowPtr pWin; /* GJA */
|
||||
int x, y ;
|
||||
register int w, h ;
|
||||
unsigned char *data ;
|
||||
register int RowIncrement ;
|
||||
const int alu ;
|
||||
const unsigned long int planes ;
|
||||
{
|
||||
int dx,dy;
|
||||
|
||||
for ( dy = 0 ; dy < h ; dy++ ) {
|
||||
for ( dx = 0 ; dx < w ; dx++ ) {
|
||||
DO_ROP( data[dy * RowIncrement + dx],
|
||||
SAVEDSCREEN(pWin,x+dx,y+dy), alu, planes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppOffReadColorImage( pWin, x, y, lx, ly, data, RowIncrement )
|
||||
WindowPtr pWin; /* GJA */
|
||||
int x, y ;
|
||||
int lx, ly ;
|
||||
unsigned char *data ;
|
||||
int RowIncrement ;
|
||||
{
|
||||
int dx, dy;
|
||||
|
||||
if ( ( lx <= 0 ) || ( ly <= 0 ) )
|
||||
return ;
|
||||
|
||||
for ( dy = 0 ; dy < ly ; dy++ ) {
|
||||
for ( dx = 0 ; dx < lx ; dx++ ) {
|
||||
data[dy*RowIncrement+dx] = SAVEDSCREEN(pWin,x+dx,y+dy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* For file vgaSolid.c */
|
||||
|
||||
void xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly )
|
||||
WindowPtr pWin; /* GJA */
|
||||
unsigned long int color ;
|
||||
const int alu ;
|
||||
unsigned long int planes ;
|
||||
register int x0 ;
|
||||
register const int y0 ;
|
||||
register int lx ;
|
||||
register const int ly ; /* MUST BE > 0 !! */
|
||||
{
|
||||
int dx, dy;
|
||||
|
||||
if ( ( lx == 0 ) || ( ly == 0 ) )
|
||||
return;
|
||||
|
||||
for ( dy = 0 ; dy < ly ; dy++ ) {
|
||||
for ( dx = 0 ; dx < lx ; dx++ ) {
|
||||
DO_ROP(color,SAVEDSCREEN(pWin, x0+dx,y0+dy),alu,planes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* For file vgaStipple.c */
|
||||
|
||||
/* GJA -- modified this to take both Width and Height, and to
|
||||
* reduce x and y to Width and Height by taking remainders.
|
||||
*/
|
||||
static unsigned char
|
||||
xygetbits
|
||||
(
|
||||
register int x,
|
||||
register int y,
|
||||
register const unsigned int Width,
|
||||
register const unsigned int paddedByteWidth,
|
||||
register const unsigned int Height,
|
||||
register const unsigned char * const data
|
||||
)
|
||||
{
|
||||
register unsigned char bits ;
|
||||
unsigned const char *lineptr, *cptr ;
|
||||
register int shift ;
|
||||
register int wrap ;
|
||||
|
||||
x = x % Width;
|
||||
y = y % Height;
|
||||
|
||||
lineptr = data + (y * paddedByteWidth);
|
||||
cptr = lineptr + (x >> 3) ;
|
||||
bits = *cptr ;
|
||||
if ((shift = x & 7))
|
||||
bits = SCRLEFT8( bits, shift ) |
|
||||
SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
|
||||
if ( ( wrap = x + 8 - Width ) > 0 ) {
|
||||
bits &= SCRLEFT8( 0xFF, wrap ) ;
|
||||
bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
|
||||
}
|
||||
|
||||
return bits ;
|
||||
}
|
||||
|
||||
static void
|
||||
DoMono
|
||||
(
|
||||
WindowPtr pWin, /* GJA */
|
||||
int w,
|
||||
int x,
|
||||
int y,
|
||||
register const unsigned char *mastersrc,
|
||||
int h,
|
||||
unsigned int width,
|
||||
register unsigned int paddedByteWidth,
|
||||
unsigned int height,
|
||||
int xshift,
|
||||
int yshift,
|
||||
int alu,
|
||||
int planes,
|
||||
int fg
|
||||
)
|
||||
{
|
||||
int dy, dx, i;
|
||||
int byte;
|
||||
|
||||
for ( dy = 0 ; dy < h ; dy++ ) {
|
||||
for ( dx = 0; dx <= w - 8 ; dx += 8 ) {
|
||||
/* get next byte */
|
||||
byte = xygetbits(dx+xshift,dy+yshift,width,
|
||||
paddedByteWidth, height, mastersrc);
|
||||
for ( i = 0 ; i < 8 ; i++ ) {
|
||||
if ( byte & (128 >> i) ) {
|
||||
DO_ROP(fg,SAVEDSCREEN(pWin,x+dx+i,y+dy),
|
||||
alu,planes);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* get last bits */
|
||||
byte = xygetbits(dx+xshift,dy+yshift,width,
|
||||
paddedByteWidth, height, mastersrc);
|
||||
for ( i = 0 ; i < (w - dx) ; i++ ) {
|
||||
if ( byte & (128 >> i) ) {
|
||||
DO_ROP(fg,SAVEDSCREEN(pWin,x+dx+i,y+dy),
|
||||
alu,planes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc )
|
||||
WindowPtr pWin; /* GJA */
|
||||
register PixmapPtr const pStipple ;
|
||||
unsigned long int fg ;
|
||||
const int alu ;
|
||||
unsigned long int planes ;
|
||||
int x, y, w, h ;
|
||||
const int xSrc, ySrc ;
|
||||
{
|
||||
unsigned int width ;
|
||||
unsigned int height ;
|
||||
int xshift ;
|
||||
int yshift ;
|
||||
|
||||
if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
|
||||
return ;
|
||||
|
||||
/* Figure Bit Offsets & Source Address */
|
||||
width = pStipple->drawable.width ;
|
||||
if ( ( xshift = ( x - xSrc ) ) < 0 )
|
||||
xshift = width - ( ( - xshift ) % width ) ;
|
||||
else
|
||||
xshift %= width ;
|
||||
|
||||
height = pStipple->drawable.height ;
|
||||
if ( ( yshift = ( y - ySrc ) ) < 0 )
|
||||
yshift = height - ( ( - yshift ) % height ) ;
|
||||
else
|
||||
yshift %= height ;
|
||||
|
||||
DoMono( pWin, w, x, y,
|
||||
(const unsigned char *) pStipple->devPrivate.ptr,
|
||||
h,
|
||||
width,
|
||||
( ( width + 31 ) & (unsigned)(~31) ) >> 3,
|
||||
height,
|
||||
xshift, yshift,
|
||||
alu, (int)planes, (int)fg ) ;
|
||||
return ;
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* ppc solid area fill
|
||||
*
|
||||
* Tom Paquin 8/87
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "ppcGCstr.h"
|
||||
#include "ibmTrace.h"
|
||||
|
||||
void
|
||||
xf4bppFillArea( pWin, nboxes, pBox, pGC )
|
||||
register WindowPtr pWin ;
|
||||
register int nboxes ;
|
||||
register BoxPtr pBox ;
|
||||
GCPtr pGC ;
|
||||
{
|
||||
register int x, y, w, h ;
|
||||
int alu ;
|
||||
unsigned long int fg, bg, pm ;
|
||||
int xSrc, ySrc ;
|
||||
PixmapPtr pPixmap ;
|
||||
ppcPrivGC *pPrivGC = dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
|
||||
|
||||
TRACE( ( "xf4bppFillArea(0x%x,%d,0x%x,0x%x)\n", pWin, nboxes, pBox, pGC ) ) ;
|
||||
|
||||
if ( ( alu = pPrivGC->colorRrop.alu ) == GXnoop || !nboxes )
|
||||
return ;
|
||||
|
||||
xSrc = pGC->patOrg.x + pWin->drawable.x ;
|
||||
ySrc = pGC->patOrg.y + pWin->drawable.y ;
|
||||
|
||||
pm = pPrivGC->colorRrop.planemask ;
|
||||
fg = pPrivGC->colorRrop.fgPixel ;
|
||||
bg = pPrivGC->colorRrop.bgPixel ;
|
||||
|
||||
nboxes++ ;
|
||||
switch ( pPrivGC->colorRrop.fillStyle ) {
|
||||
case FillTiled:
|
||||
for ( pPixmap = pGC->tile.pixmap ; --nboxes ; pBox++ )
|
||||
if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
|
||||
&& ( h = pBox->y2 - ( y = pBox->y1 ) ) )
|
||||
xf4bppTileRect( pWin, pPixmap, alu, pm,
|
||||
x, y, w, h, xSrc, ySrc ) ;
|
||||
break ;
|
||||
case FillOpaqueStippled:
|
||||
for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ )
|
||||
if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
|
||||
&& ( h = pBox->y2 - ( y = pBox->y1 ) ) )
|
||||
xf4bppOpaqueStipple( pWin, pPixmap, fg, bg, alu, pm,
|
||||
x, y, w, h, xSrc, ySrc ) ;
|
||||
break ;
|
||||
case FillStippled:
|
||||
for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ )
|
||||
if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
|
||||
&& ( h = pBox->y2 - ( y = pBox->y1 ) ) )
|
||||
xf4bppFillStipple( pWin, pPixmap, fg, alu, pm,
|
||||
x, y, w, h, xSrc, ySrc ) ;
|
||||
break ;
|
||||
case FillSolid:
|
||||
for ( ; --nboxes ; pBox++ )
|
||||
if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
|
||||
&& ( h = pBox->y2 - ( y = pBox->y1 ) ) )
|
||||
xf4bppFillSolid( pWin, fg, alu, pm, x, y, w, h ) ;
|
||||
break ;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,237 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "ppcGCstr.h"
|
||||
|
||||
/* xf4bppGetReducedColorRrop( pGC, drawableDepth, returnLoc )
|
||||
* An attempt to do "strength reduction" on color raster-ops
|
||||
* P. Shupak 1/88
|
||||
*/
|
||||
|
||||
static void
|
||||
ppcReduceGeneral
|
||||
(
|
||||
register int alu,
|
||||
register unsigned long pm,
|
||||
register unsigned long fg,
|
||||
register unsigned long bg,
|
||||
register int fillStyle,
|
||||
int drawableDepth,
|
||||
ppcReducedRrop *returnLoc
|
||||
)
|
||||
{
|
||||
|
||||
if ( ( alu == GXnoop )
|
||||
|| !( pm &= ( ( 1 << drawableDepth ) - 1 ) ) ) {
|
||||
returnLoc->alu = GXnoop ;
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef DELETE_THIS
|
||||
switch ( fillStyle ) {
|
||||
case FillTiled:
|
||||
switch ( alu ) {
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
case GXinvert: /* 0xa NOT dst */
|
||||
case GXset: /* 0xf 1 */
|
||||
fillStyle = FillSolid ;
|
||||
default: /* We Can't Do Much Here */
|
||||
break ;
|
||||
}
|
||||
break ;
|
||||
case FillOpaqueStippled:
|
||||
if ( ( fg & pm ) != ( bg & pm ) ) { /* else FillSolid */
|
||||
switch ( alu ) {
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
case GXset: /* 0xf 1 */
|
||||
case GXinvert: /* 0xa NOT dst */
|
||||
fillStyle = FillSolid ;
|
||||
break ;
|
||||
case GXnor: /* 0x8 NOT src AND NOT dst */
|
||||
case GXnand: /* 0xe NOT src OR NOT dst */
|
||||
case GXcopy: /* 0x3 src */
|
||||
break ;
|
||||
case GXandReverse: /* 0x2 src AND NOT dst */
|
||||
fg = ~fg ;
|
||||
bg = ~bg ;
|
||||
alu = GXnor ;
|
||||
break ;
|
||||
case GXandInverted: /* 0x4 NOT src AND dst */
|
||||
fg = ~fg ;
|
||||
bg = ~bg ;
|
||||
alu = GXand ; /* Fall Through */
|
||||
case GXand: /* 0x1 src AND dst */
|
||||
pm &= ~( fg & bg ) ;
|
||||
if ( ( bg & pm ) == pm ) {
|
||||
fillStyle = FillStippled ;
|
||||
alu = GXclear ;
|
||||
}
|
||||
break ;
|
||||
case GXequiv: /* 0x9 NOT src XOR dst */
|
||||
fg = ~fg ;
|
||||
bg = ~bg ;
|
||||
alu = GXxor ; /* Fall Through */
|
||||
case GXxor: /* 0x6 src XOR dst */
|
||||
pm &= ( fg | bg ) ;
|
||||
if ( !( bg & pm ) ) {
|
||||
fillStyle = FillStippled ;
|
||||
alu = GXinvert ;
|
||||
}
|
||||
break ;
|
||||
case GXorReverse: /* 0xb src OR NOT dst */
|
||||
fg = ~fg ;
|
||||
bg = ~bg ;
|
||||
alu = GXnand ;
|
||||
break ;
|
||||
case GXcopyInverted: /* 0xc NOT src */
|
||||
fg = ~fg ;
|
||||
bg = ~bg ;
|
||||
alu = GXcopy ;
|
||||
break ;
|
||||
case GXorInverted: /* 0xd NOT src OR dst */
|
||||
fg = ~fg ;
|
||||
bg = ~bg ;
|
||||
alu = GXor ; /* Fall Through */
|
||||
case GXor: /* 0x7 src OR dst */
|
||||
pm &= ( fg | bg ) ;
|
||||
if ( !( bg & pm ) ) {
|
||||
fillStyle = FillStippled ;
|
||||
alu = GXset ;
|
||||
}
|
||||
break ;
|
||||
default:
|
||||
ErrorF(
|
||||
"xf4bppGetReducedColorRrop: Unknown Alu Raster-Op" ) ;
|
||||
break ;
|
||||
}
|
||||
break ; /* Don't Fall Through */
|
||||
}
|
||||
else
|
||||
fillStyle = FillSolid ;
|
||||
/* Fall Through */
|
||||
case FillStippled:
|
||||
case FillSolid:
|
||||
switch ( alu ) {
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
case GXset: /* 0xf 1 */
|
||||
case GXinvert: /* 0xa NOT dst */
|
||||
break ;
|
||||
case GXand: /* 0x1 src AND dst */
|
||||
pm &= ~fg ;
|
||||
alu = GXclear ;
|
||||
break ;
|
||||
case GXandReverse: /* 0x2 src AND NOT dst */
|
||||
fg = ~fg ;
|
||||
alu = GXnor ; /* Fall Through */
|
||||
case GXnor: /* 0x8 NOT src AND NOT dst */
|
||||
if ( !( fg & pm ) )
|
||||
alu = GXclear ;
|
||||
else if ( ( fg & pm ) == pm )
|
||||
alu = GXinvert ;
|
||||
break ;
|
||||
case GXandInverted: /* 0x4 NOT src AND dst */
|
||||
pm &= fg ;
|
||||
alu = GXclear ;
|
||||
break ;
|
||||
case GXxor: /* 0x6 src XOR dst */
|
||||
pm &= fg ;
|
||||
alu = GXinvert ;
|
||||
break ;
|
||||
case GXor: /* 0x7 src OR dst */
|
||||
pm &= fg ;
|
||||
alu = GXset ;
|
||||
break ;
|
||||
case GXequiv: /* 0x9 NOT src XOR dst */
|
||||
pm &= ~fg ;
|
||||
alu = GXinvert ;
|
||||
break ;
|
||||
case GXorReverse: /* 0xb src OR NOT dst */
|
||||
fg = ~fg ;
|
||||
alu = GXnand ; /* Fall Through */
|
||||
case GXnand: /* 0xe NOT src OR NOT dst */
|
||||
if ( !( fg & pm ) )
|
||||
alu = GXset ;
|
||||
else if ( ( fg & pm ) == pm )
|
||||
alu = GXinvert ;
|
||||
break ;
|
||||
case GXcopyInverted: /* 0xc NOT src */
|
||||
fg = ~fg ;
|
||||
alu = GXcopy ; /* Fall Through */
|
||||
case GXcopy: /* 0x3 src */
|
||||
if ( !( fg & pm ) )
|
||||
alu = GXclear ;
|
||||
else if ( ( fg & pm ) == pm )
|
||||
alu = GXset ;
|
||||
break ;
|
||||
case GXorInverted: /* 0xd NOT src OR dst */
|
||||
pm &= ~fg ;
|
||||
alu = GXset ;
|
||||
break ;
|
||||
default:
|
||||
ErrorF(
|
||||
"xf4bppGetReducedColorRrop: Unknown Alu Raster-Op" ) ;
|
||||
break ;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ErrorF("xf4bppGetReducedColorRrop: Bad Fillstyle\n");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Final Test On Restricted Plane Mask */
|
||||
if ( !pm )
|
||||
alu = GXnoop ;
|
||||
|
||||
/* Set Actual Returned Values */
|
||||
returnLoc->planemask = pm ;
|
||||
returnLoc->fgPixel = fg ;
|
||||
returnLoc->bgPixel = bg ;
|
||||
returnLoc->alu = alu ;
|
||||
returnLoc->fillStyle = fillStyle ;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppGetReducedColorRrop( pGC, drawableDepth, returnLoc )
|
||||
GC *pGC ;
|
||||
int drawableDepth ;
|
||||
ppcReducedRrop *returnLoc ;
|
||||
{
|
||||
|
||||
ppcReduceGeneral( pGC->alu,
|
||||
pGC->planemask,
|
||||
pGC->fgPixel,
|
||||
pGC->bgPixel,
|
||||
pGC->fillStyle,
|
||||
drawableDepth,
|
||||
returnLoc ) ;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
Copyright IBM Corporation 1987,1988,1989
|
||||
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 IBM not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
IBM 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.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
void
|
||||
xf4bppDestroyClip(pGC)
|
||||
GCPtr pGC;
|
||||
{
|
||||
if(pGC->clientClipType == CT_NONE)
|
||||
return;
|
||||
else if (pGC->clientClipType == CT_PIXMAP)
|
||||
{
|
||||
mfbDestroyPixmap((PixmapPtr)(pGC->clientClip));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we know we'll never have a list of rectangles, since
|
||||
ChangeClip immediately turns them into a region
|
||||
*/
|
||||
REGION_DESTROY(pGC->pScreen, pGC->clientClip);
|
||||
}
|
||||
pGC->clientClip = NULL;
|
||||
pGC->clientClipType = CT_NONE;
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppChangeClip(pGC, type, pvalue, nrects)
|
||||
GCPtr pGC;
|
||||
int type;
|
||||
pointer pvalue;
|
||||
int nrects;
|
||||
{
|
||||
xf4bppDestroyClip(pGC);
|
||||
if(type == CT_PIXMAP)
|
||||
{
|
||||
/* convert the pixmap to a region */
|
||||
pGC->clientClip = (pointer) (*pGC->pScreen->BitmapToRegion)((PixmapPtr)pvalue);
|
||||
/* you wouldn't do this if you were leaving the pixmap in
|
||||
rather than converting it.
|
||||
*/
|
||||
(*pGC->pScreen->DestroyPixmap)(pvalue);
|
||||
}
|
||||
else if (type == CT_REGION)
|
||||
{
|
||||
/* stuff the region in the GC */
|
||||
pGC->clientClip = pvalue;
|
||||
}
|
||||
else if (type != CT_NONE)
|
||||
{
|
||||
pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nrects,
|
||||
(xRectangle *)pvalue,
|
||||
type);
|
||||
xfree(pvalue);
|
||||
}
|
||||
pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION :
|
||||
CT_NONE;
|
||||
pGC->stateChanges |= GCClipMask;
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppCopyClip (pgcDst, pgcSrc)
|
||||
GCPtr pgcDst, pgcSrc;
|
||||
{
|
||||
RegionPtr prgnNew;
|
||||
|
||||
switch(pgcSrc->clientClipType)
|
||||
{
|
||||
case CT_PIXMAP:
|
||||
((PixmapPtr) pgcSrc->clientClip)->refcnt++;
|
||||
/* Fall through !! */
|
||||
case CT_NONE:
|
||||
xf4bppChangeClip(pgcDst, pgcSrc->clientClipType, pgcSrc->clientClip, 0);
|
||||
break;
|
||||
case CT_REGION:
|
||||
prgnNew = REGION_CREATE(pgcSrc->pScreen, NULL, 1);
|
||||
REGION_COPY(pgcSrc->pScreen, prgnNew, (RegionPtr)(pgcSrc->clientClip));
|
||||
xf4bppChangeClip(pgcDst, CT_REGION, (pointer)prgnNew, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,470 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/***********************************************************
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "mfbmap.h"
|
||||
#define PSZ 8
|
||||
#include "mfb.h"
|
||||
#include "mergerop.h"
|
||||
#include "mi.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
/*
|
||||
* Graft in the DoBitblt from cfb. It does everything correctly.
|
||||
*/
|
||||
static void
|
||||
vga16DoBitblt
|
||||
(
|
||||
DrawablePtr pSrc,
|
||||
DrawablePtr pDst,
|
||||
int alu,
|
||||
RegionPtr prgnDst,
|
||||
DDXPointPtr pptSrc,
|
||||
unsigned long planemask
|
||||
)
|
||||
{
|
||||
int widthSrc, widthDst; /* add to get to same position in next line */
|
||||
BoxPtr pbox;
|
||||
int nbox;
|
||||
BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
|
||||
/* temporaries for shuffling rectangles */
|
||||
DDXPointPtr pptTmp, pptNew1, pptNew2;
|
||||
/* shuffling boxes entails shuffling the
|
||||
source points too */
|
||||
int w, h;
|
||||
int careful;
|
||||
|
||||
widthSrc = mfbGetPixelWidth(pSrc);
|
||||
widthDst = mfbGetPixelWidth(pDst);
|
||||
|
||||
/* XXX we have to err on the side of safety when both are windows,
|
||||
* because we don't know if IncludeInferiors is being used.
|
||||
*/
|
||||
careful = ((pSrc == pDst) ||
|
||||
((pSrc->type == DRAWABLE_WINDOW) &&
|
||||
(pDst->type == DRAWABLE_WINDOW)));
|
||||
|
||||
pbox = REGION_RECTS(prgnDst);
|
||||
nbox = REGION_NUM_RECTS(prgnDst);
|
||||
|
||||
pboxNew1 = NULL;
|
||||
pptNew1 = NULL;
|
||||
pboxNew2 = NULL;
|
||||
pptNew2 = NULL;
|
||||
if (careful && (pptSrc->y < pbox->y1))
|
||||
{
|
||||
/* walk source botttom to top */
|
||||
widthSrc = -widthSrc;
|
||||
widthDst = -widthDst;
|
||||
|
||||
if (nbox > 1)
|
||||
{
|
||||
/* keep ordering in each band, reverse order of bands */
|
||||
pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
|
||||
if(!pboxNew1)
|
||||
return;
|
||||
pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
|
||||
if(!pptNew1)
|
||||
{
|
||||
xfree(pboxNew1);
|
||||
return;
|
||||
}
|
||||
pboxBase = pboxNext = pbox+nbox-1;
|
||||
while (pboxBase >= pbox)
|
||||
{
|
||||
while ((pboxNext >= pbox) &&
|
||||
(pboxBase->y1 == pboxNext->y1))
|
||||
pboxNext--;
|
||||
pboxTmp = pboxNext+1;
|
||||
pptTmp = pptSrc + (pboxTmp - pbox);
|
||||
while (pboxTmp <= pboxBase)
|
||||
{
|
||||
*pboxNew1++ = *pboxTmp++;
|
||||
*pptNew1++ = *pptTmp++;
|
||||
}
|
||||
pboxBase = pboxNext;
|
||||
}
|
||||
pboxNew1 -= nbox;
|
||||
pbox = pboxNew1;
|
||||
pptNew1 -= nbox;
|
||||
pptSrc = pptNew1;
|
||||
}
|
||||
}
|
||||
|
||||
if (careful && (pptSrc->x < pbox->x1))
|
||||
{
|
||||
if (nbox > 1)
|
||||
{
|
||||
/* reverse order of rects in each band */
|
||||
pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
|
||||
pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
|
||||
if(!pboxNew2 || !pptNew2)
|
||||
{
|
||||
if (pptNew2) xfree(pptNew2);
|
||||
if (pboxNew2) xfree(pboxNew2);
|
||||
if (pboxNew1)
|
||||
{
|
||||
xfree(pptNew1);
|
||||
xfree(pboxNew1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
pboxBase = pboxNext = pbox;
|
||||
while (pboxBase < pbox+nbox)
|
||||
{
|
||||
while ((pboxNext < pbox+nbox) &&
|
||||
(pboxNext->y1 == pboxBase->y1))
|
||||
pboxNext++;
|
||||
pboxTmp = pboxNext;
|
||||
pptTmp = pptSrc + (pboxTmp - pbox);
|
||||
while (pboxTmp != pboxBase)
|
||||
{
|
||||
*pboxNew2++ = *--pboxTmp;
|
||||
*pptNew2++ = *--pptTmp;
|
||||
}
|
||||
pboxBase = pboxNext;
|
||||
}
|
||||
pboxNew2 -= nbox;
|
||||
pbox = pboxNew2;
|
||||
pptNew2 -= nbox;
|
||||
pptSrc = pptNew2;
|
||||
}
|
||||
}
|
||||
|
||||
while(nbox--)
|
||||
{
|
||||
w = pbox->x2 - pbox->x1;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
if( pSrc->type == DRAWABLE_WINDOW )
|
||||
xf4bppBitBlt( (WindowPtr)pDst, alu, planemask,
|
||||
pptSrc->x, /* x0 */
|
||||
pptSrc->y, /* y0 */
|
||||
pbox->x1, /* x1 */
|
||||
pbox->y1, /* y1 */
|
||||
w, h ); /* w, h */
|
||||
else /* DRAWABLE_PIXMAP */
|
||||
xf4bppDrawColorImage( (WindowPtr)pDst,
|
||||
pbox->x1, pbox->y1,
|
||||
w,
|
||||
h,
|
||||
((unsigned char *)((PixmapPtr)pSrc)->devPrivate.ptr
|
||||
+ pptSrc->x + (pptSrc->y*((PixmapPtr)pSrc)->devKind)),
|
||||
((PixmapPtr)pSrc)->devKind,
|
||||
alu, planemask ) ;
|
||||
pbox++;
|
||||
pptSrc++;
|
||||
}
|
||||
if (pboxNew2)
|
||||
{
|
||||
xfree(pptNew2);
|
||||
xfree(pboxNew2);
|
||||
}
|
||||
if (pboxNew1)
|
||||
{
|
||||
xfree(pptNew1);
|
||||
xfree(pboxNew1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Graft in the CopyArea from mfb/cfb. It does everything correctly.
|
||||
*/
|
||||
|
||||
RegionPtr
|
||||
xf4bppCopyArea(pSrcDrawable, pDstDrawable,
|
||||
pGC, srcx, srcy, width, height, dstx, dsty)
|
||||
register DrawablePtr pSrcDrawable;
|
||||
register DrawablePtr pDstDrawable;
|
||||
register GC *pGC;
|
||||
int srcx, srcy;
|
||||
int width, height;
|
||||
int dstx, dsty;
|
||||
{
|
||||
RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
|
||||
Bool freeSrcClip = FALSE;
|
||||
|
||||
RegionPtr prgnExposed;
|
||||
RegionRec rgnDst;
|
||||
DDXPointPtr pptSrc;
|
||||
register DDXPointPtr ppt;
|
||||
register BoxPtr pbox;
|
||||
int i;
|
||||
register int dx;
|
||||
register int dy;
|
||||
xRectangle origSource;
|
||||
DDXPointRec origDest;
|
||||
int numRects;
|
||||
BoxRec fastBox;
|
||||
int fastClip = 0; /* for fast clipping with pixmap source */
|
||||
int fastExpose = 0; /* for fast exposures with pixmap source */
|
||||
|
||||
if ( pDstDrawable->type != DRAWABLE_WINDOW )
|
||||
return miCopyArea( pSrcDrawable, pDstDrawable, pGC,
|
||||
srcx, srcy, width, height, dstx, dsty ) ;
|
||||
|
||||
/* Begin code from mfb/cfbCopyArea */
|
||||
|
||||
origSource.x = srcx;
|
||||
origSource.y = srcy;
|
||||
origSource.width = width;
|
||||
origSource.height = height;
|
||||
origDest.x = dstx;
|
||||
origDest.y = dsty;
|
||||
|
||||
if ((pSrcDrawable != pDstDrawable) &&
|
||||
pSrcDrawable->pScreen->SourceValidate)
|
||||
{
|
||||
(*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height);
|
||||
}
|
||||
|
||||
srcx += pSrcDrawable->x;
|
||||
srcy += pSrcDrawable->y;
|
||||
|
||||
/* clip the source */
|
||||
|
||||
if (pSrcDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
if ((pSrcDrawable == pDstDrawable) &&
|
||||
(pGC->clientClipType == CT_NONE))
|
||||
{
|
||||
prgnSrcClip = pGC->pCompositeClip;
|
||||
}
|
||||
else
|
||||
{
|
||||
fastClip = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pGC->subWindowMode == IncludeInferiors)
|
||||
{
|
||||
if (!((WindowPtr) pSrcDrawable)->parent)
|
||||
{
|
||||
/*
|
||||
* special case bitblt from root window in
|
||||
* IncludeInferiors mode; just like from a pixmap
|
||||
*/
|
||||
fastClip = 1;
|
||||
}
|
||||
else if ((pSrcDrawable == pDstDrawable) &&
|
||||
(pGC->clientClipType == CT_NONE))
|
||||
{
|
||||
prgnSrcClip = pGC->pCompositeClip;
|
||||
}
|
||||
else
|
||||
{
|
||||
prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
|
||||
freeSrcClip = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
|
||||
}
|
||||
}
|
||||
|
||||
fastBox.x1 = srcx;
|
||||
fastBox.y1 = srcy;
|
||||
fastBox.x2 = srcx + width;
|
||||
fastBox.y2 = srcy + height;
|
||||
|
||||
/* Don't create a source region if we are doing a fast clip */
|
||||
if (fastClip)
|
||||
{
|
||||
fastExpose = 1;
|
||||
/*
|
||||
* clip the source; if regions extend beyond the source size,
|
||||
* make sure exposure events get sent
|
||||
*/
|
||||
if (fastBox.x1 < pSrcDrawable->x)
|
||||
{
|
||||
fastBox.x1 = pSrcDrawable->x;
|
||||
fastExpose = 0;
|
||||
}
|
||||
if (fastBox.y1 < pSrcDrawable->y)
|
||||
{
|
||||
fastBox.y1 = pSrcDrawable->y;
|
||||
fastExpose = 0;
|
||||
}
|
||||
if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
|
||||
{
|
||||
fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
|
||||
fastExpose = 0;
|
||||
}
|
||||
if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
|
||||
{
|
||||
fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
|
||||
fastExpose = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
|
||||
REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
|
||||
}
|
||||
|
||||
dstx += pDstDrawable->x;
|
||||
dsty += pDstDrawable->y;
|
||||
|
||||
if (pDstDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
if (!((WindowPtr)pDstDrawable)->realized)
|
||||
{
|
||||
if (!fastClip)
|
||||
REGION_UNINIT(pGC->pScreen, &rgnDst);
|
||||
if (freeSrcClip)
|
||||
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
dx = srcx - dstx;
|
||||
dy = srcy - dsty;
|
||||
|
||||
/* Translate and clip the dst to the destination composite clip */
|
||||
if (fastClip)
|
||||
{
|
||||
RegionPtr cclip;
|
||||
|
||||
/* Translate the region directly */
|
||||
fastBox.x1 -= dx;
|
||||
fastBox.x2 -= dx;
|
||||
fastBox.y1 -= dy;
|
||||
fastBox.y2 -= dy;
|
||||
|
||||
/* If the destination composite clip is one rectangle we can
|
||||
do the clip directly. Otherwise we have to create a full
|
||||
blown region and call intersect */
|
||||
cclip = pGC->pCompositeClip;
|
||||
if (REGION_NUM_RECTS(cclip) == 1)
|
||||
{
|
||||
BoxPtr pBox = REGION_RECTS(cclip);
|
||||
|
||||
if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
|
||||
if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
|
||||
if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
|
||||
if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
|
||||
|
||||
/* Check to see if the region is empty */
|
||||
if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2)
|
||||
{
|
||||
REGION_NULL(pGC->pScreen, &rgnDst);
|
||||
}
|
||||
else
|
||||
{
|
||||
REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We must turn off fastClip now, since we must create
|
||||
a full blown region. It is intersected with the
|
||||
composite clip below. */
|
||||
fastClip = 0;
|
||||
REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
|
||||
}
|
||||
|
||||
if (!fastClip)
|
||||
{
|
||||
REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip);
|
||||
}
|
||||
|
||||
/* Do bit blitting */
|
||||
numRects = REGION_NUM_RECTS(&rgnDst);
|
||||
if (numRects && width && height)
|
||||
{
|
||||
if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
|
||||
sizeof(DDXPointRec))))
|
||||
{
|
||||
REGION_UNINIT(pGC->pScreen, &rgnDst);
|
||||
if (freeSrcClip)
|
||||
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
|
||||
return NULL;
|
||||
}
|
||||
pbox = REGION_RECTS(&rgnDst);
|
||||
ppt = pptSrc;
|
||||
for (i = numRects; --i >= 0; pbox++, ppt++)
|
||||
{
|
||||
ppt->x = pbox->x1 + dx;
|
||||
ppt->y = pbox->y1 + dy;
|
||||
}
|
||||
|
||||
vga16DoBitblt(pSrcDrawable, pDstDrawable, pGC->alu,
|
||||
&rgnDst, pptSrc, pGC->planemask );
|
||||
xfree(pptSrc);
|
||||
}
|
||||
|
||||
prgnExposed = NULL;
|
||||
if (pGC->fExpose)
|
||||
{
|
||||
/* Pixmap sources generate a NoExposed (we return NULL to do this) */
|
||||
if (!fastExpose)
|
||||
prgnExposed =
|
||||
miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
|
||||
origSource.x, origSource.y,
|
||||
(int)origSource.width,
|
||||
(int)origSource.height,
|
||||
origDest.x, origDest.y, (unsigned long)0);
|
||||
}
|
||||
REGION_UNINIT(pGC->pScreen, &rgnDst);
|
||||
if (freeSrcClip)
|
||||
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
|
||||
return prgnExposed;
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Check to see if the alleged depth is acceptable for the Screen
|
||||
*
|
||||
* T. Paquin 9/87
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
Bool
|
||||
xf4bppDepthOK(pDraw,depth)
|
||||
register DrawablePtr pDraw;
|
||||
register int depth;
|
||||
{
|
||||
register ScreenPtr pScreen= pDraw->pScreen;
|
||||
register int i = pScreen->numDepths;
|
||||
|
||||
if ( ( pDraw->type == DRAWABLE_PIXMAP ) && ( depth == 1 ) )
|
||||
return TRUE ;
|
||||
|
||||
while ( i-- )
|
||||
if ( depth == pScreen->allowedDepths[i].depth )
|
||||
return TRUE ;
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
|
@ -1,215 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE
|
||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#define MODEQ(a, b) ((a) %= (b))
|
||||
|
||||
/*
|
||||
filled rectangles.
|
||||
translate the rectangles, clip them, and call the
|
||||
helper function in the GC.
|
||||
*/
|
||||
|
||||
#define NUM_STACK_RECTS 1024
|
||||
|
||||
void
|
||||
xf4bppPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int nrectFill; /* number of rectangles to fill */
|
||||
xRectangle *prectInit; /* Pointer to first rectangle to fill */
|
||||
{
|
||||
xRectangle *prect;
|
||||
RegionPtr prgnClip;
|
||||
register BoxPtr pbox;
|
||||
register BoxPtr pboxClipped;
|
||||
BoxPtr pboxClippedBase;
|
||||
BoxPtr pextent;
|
||||
BoxRec stackRects[NUM_STACK_RECTS];
|
||||
int numRects;
|
||||
int n;
|
||||
int xorg, yorg;
|
||||
|
||||
if (!(pGC->planemask & 0x0F)) /* GJA */
|
||||
return;
|
||||
|
||||
prgnClip = pGC->pCompositeClip;
|
||||
|
||||
prect = prectInit;
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
if (xorg || yorg)
|
||||
{
|
||||
prect = prectInit;
|
||||
n = nrectFill;
|
||||
Duff (n, prect->x += xorg; prect->y += yorg; prect++);
|
||||
}
|
||||
|
||||
|
||||
prect = prectInit;
|
||||
|
||||
numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
|
||||
if (numRects > NUM_STACK_RECTS)
|
||||
{
|
||||
pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
|
||||
if (!pboxClippedBase)
|
||||
return;
|
||||
}
|
||||
else
|
||||
pboxClippedBase = stackRects;
|
||||
|
||||
pboxClipped = pboxClippedBase;
|
||||
|
||||
if (REGION_NUM_RECTS(prgnClip) == 1)
|
||||
{
|
||||
int x1, y1, x2, y2, bx2, by2;
|
||||
|
||||
pextent = REGION_RECTS(prgnClip);
|
||||
x1 = pextent->x1;
|
||||
y1 = pextent->y1;
|
||||
x2 = pextent->x2;
|
||||
y2 = pextent->y2;
|
||||
while (nrectFill--)
|
||||
{
|
||||
if ((pboxClipped->x1 = prect->x) < x1)
|
||||
pboxClipped->x1 = x1;
|
||||
|
||||
if ((pboxClipped->y1 = prect->y) < y1)
|
||||
pboxClipped->y1 = y1;
|
||||
|
||||
bx2 = (int) prect->x + (int) prect->width;
|
||||
if (bx2 > x2)
|
||||
bx2 = x2;
|
||||
pboxClipped->x2 = bx2;
|
||||
|
||||
by2 = (int) prect->y + (int) prect->height;
|
||||
if (by2 > y2)
|
||||
by2 = y2;
|
||||
pboxClipped->y2 = by2;
|
||||
|
||||
prect++;
|
||||
if ((pboxClipped->x1 < pboxClipped->x2) &&
|
||||
(pboxClipped->y1 < pboxClipped->y2))
|
||||
{
|
||||
pboxClipped++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int x1, y1, x2, y2, bx2, by2;
|
||||
|
||||
pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
|
||||
x1 = pextent->x1;
|
||||
y1 = pextent->y1;
|
||||
x2 = pextent->x2;
|
||||
y2 = pextent->y2;
|
||||
while (nrectFill--)
|
||||
{
|
||||
BoxRec box;
|
||||
|
||||
if ((box.x1 = prect->x) < x1)
|
||||
box.x1 = x1;
|
||||
|
||||
if ((box.y1 = prect->y) < y1)
|
||||
box.y1 = y1;
|
||||
|
||||
bx2 = (int) prect->x + (int) prect->width;
|
||||
if (bx2 > x2)
|
||||
bx2 = x2;
|
||||
box.x2 = bx2;
|
||||
|
||||
by2 = (int) prect->y + (int) prect->height;
|
||||
if (by2 > y2)
|
||||
by2 = y2;
|
||||
box.y2 = by2;
|
||||
|
||||
prect++;
|
||||
|
||||
if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
|
||||
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--)
|
||||
{
|
||||
pboxClipped->x1 = max(box.x1, pbox->x1);
|
||||
pboxClipped->y1 = max(box.y1, pbox->y1);
|
||||
pboxClipped->x2 = min(box.x2, pbox->x2);
|
||||
pboxClipped->y2 = min(box.y2, pbox->y2);
|
||||
pbox++;
|
||||
|
||||
/* see if clipping left anything */
|
||||
if(pboxClipped->x1 < pboxClipped->x2 &&
|
||||
pboxClipped->y1 < pboxClipped->y2)
|
||||
{
|
||||
pboxClipped++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pboxClipped != pboxClippedBase)
|
||||
xf4bppFillArea((WindowPtr)pDrawable, pboxClipped-pboxClippedBase,
|
||||
pboxClippedBase, pGC);
|
||||
if (pboxClippedBase != stackRects)
|
||||
xfree(pboxClippedBase);
|
||||
}
|
||||
|
|
@ -1,446 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
Copyright IBM Corporation 1987,1988,1989
|
||||
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 IBM not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
IBM 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.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "mi.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "ppcGCstr.h"
|
||||
#include "vgaVideo.h"
|
||||
#include "ibmTrace.h"
|
||||
|
||||
#define ppcGCInterestValidateMask \
|
||||
( GCLineStyle | GCLineWidth | GCJoinStyle | GCBackground | GCForeground \
|
||||
| GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT \
|
||||
| GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode )
|
||||
|
||||
static void xf4bppValidateGC(GCPtr, unsigned long, DrawablePtr);
|
||||
static void xf4bppDestroyGC(GC *);
|
||||
|
||||
static GCFuncs vgaGCFuncs = {
|
||||
xf4bppValidateGC,
|
||||
(void (*)(GCPtr, unsigned long))NoopDDA,
|
||||
(void (*)(GCPtr, unsigned long, GCPtr))NoopDDA,
|
||||
xf4bppDestroyGC,
|
||||
xf4bppChangeClip,
|
||||
xf4bppDestroyClip,
|
||||
xf4bppCopyClip,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
static ppcPrivGC vgaPrototypeGCPriv = {
|
||||
GXcopy, /* unsigned char rop */
|
||||
0, /* unsigned char ropOpStip */
|
||||
0, /* unsigned char ropFillArea */
|
||||
{0, }, /* unsigned char unused[sizeof(long) - 3] */
|
||||
NULL, /* mfbFillAreaProcPtr FillArea */
|
||||
{
|
||||
VGA_ALLPLANES, /* unsigned long planemask */
|
||||
1, /* unsigned long fgPixel */
|
||||
0, /* unsigned long bgPixel */
|
||||
GXcopy, /* int alu */
|
||||
FillSolid, /* int fillStyle */
|
||||
}, /* ppcReducedRrop colorRrop */
|
||||
-1, /* short lastDrawableType */
|
||||
-1, /* short lastDrawableDepth */
|
||||
0 /* pointer devPriv */
|
||||
} ;
|
||||
|
||||
static GCOps vgaGCOps = {
|
||||
xf4bppSolidWindowFS, /* void (* FillSpans)() */
|
||||
xf4bppSetSpans, /* void (* SetSpans)() */
|
||||
miPutImage, /* void (* PutImage)() */
|
||||
xf4bppCopyArea, /* RegionPtr (* CopyArea)() */
|
||||
miCopyPlane, /* void (* CopyPlane)() */
|
||||
xf4bppPolyPoint, /* void (* PolyPoint)() */
|
||||
miZeroLine, /* void (* Polylines)() */
|
||||
miPolySegment, /* void (* PolySegment)() */
|
||||
miPolyRectangle, /* void (* PolyRectangle)() */
|
||||
xf4bppZeroPolyArc, /* void (* PolyArc)() */
|
||||
miFillPolygon, /* void (* FillPolygon)() */
|
||||
miPolyFillRect, /* void (* PolyFillRect)() */
|
||||
xf4bppPolyFillArc, /* void (* PolyFillArc)() */
|
||||
miPolyText8, /* int (* PolyText8)() */
|
||||
miPolyText16, /* int (* PolyText16)() */
|
||||
miImageText8, /* void (* ImageText8)() */
|
||||
miImageText16, /* void (* ImageText16)() */
|
||||
xf4bppImageGlyphBlt, /* GJA -- void (* ImageGlyphBlt)() */
|
||||
miPolyGlyphBlt, /* GJA -- void (* PolyGlyphBlt)() */
|
||||
miPushPixels, /* void (* PushPixels)() */
|
||||
{NULL} /* devPrivate */
|
||||
};
|
||||
|
||||
Bool
|
||||
xf4bppCreateGC( pGC )
|
||||
register GCPtr pGC ;
|
||||
{
|
||||
ppcPrivGC *pPriv ;
|
||||
GCOps *pOps ;
|
||||
|
||||
if ( pGC->depth == 1 )
|
||||
{
|
||||
return (mfbCreateGC(pGC));
|
||||
}
|
||||
|
||||
if ( !( pPriv = xalloc( sizeof( ppcPrivGC ) ) ) )
|
||||
return FALSE ;
|
||||
|
||||
if ( !( pOps = xalloc( sizeof( GCOps ) ) ) ) {
|
||||
xfree(pPriv);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Now we initialize the GC fields */
|
||||
pGC->miTranslate = 1;
|
||||
pGC->unused = 0;
|
||||
pGC->planemask = VGA_ALLPLANES;
|
||||
pGC->fgPixel = VGA_BLACK_PIXEL;
|
||||
pGC->bgPixel = VGA_WHITE_PIXEL;
|
||||
pGC->funcs = &vgaGCFuncs;
|
||||
/* ops, -- see below */
|
||||
|
||||
pGC->fExpose = TRUE;
|
||||
pGC->freeCompClip = FALSE;
|
||||
|
||||
/* GJA: I don't like this code:
|
||||
* they allocated a mfbPrivGC, ignore the allocated data and place
|
||||
* a pointer to a ppcPrivGC in its slot.
|
||||
*/
|
||||
*pPriv = vgaPrototypeGCPriv;
|
||||
dixSetPrivate(&pGC->devPrivates, mfbGetGCPrivateKey(), pPriv);
|
||||
|
||||
/* Set the vgaGCOps */
|
||||
*pOps = vgaGCOps;
|
||||
pOps->devPrivate.val = 1;
|
||||
pGC->ops = pOps;
|
||||
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
static void
|
||||
xf4bppDestroyGC( pGC )
|
||||
register GC *pGC ;
|
||||
|
||||
{
|
||||
TRACE( ( "xf4bppDestroyGC(pGC=0x%x)\n", pGC ) ) ;
|
||||
|
||||
if ( pGC->freeCompClip && pGC->pCompositeClip )
|
||||
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
|
||||
if(pGC->ops->devPrivate.val) xfree( pGC->ops );
|
||||
xfree(dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()));
|
||||
return ;
|
||||
}
|
||||
|
||||
static Mask
|
||||
ppcChangePixmapGC
|
||||
(
|
||||
register GC *pGC,
|
||||
register Mask changes
|
||||
)
|
||||
{
|
||||
register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
|
||||
register unsigned long int idx ; /* used for stepping through bitfields */
|
||||
|
||||
#define LOWBIT( x ) ( x & - x ) /* Two's complement */
|
||||
while ((idx = LOWBIT(changes))) {
|
||||
switch ( idx ) {
|
||||
|
||||
case GCLineStyle:
|
||||
case GCLineWidth:
|
||||
pGC->ops->Polylines = ( ! pGC->lineWidth )
|
||||
? miZeroLine
|
||||
: ( ( pGC->lineStyle == LineSolid )
|
||||
? miWideLine : miWideDash ) ;
|
||||
changes &= ~( GCLineStyle | GCLineWidth ) ;
|
||||
break ;
|
||||
|
||||
case GCJoinStyle:
|
||||
changes &= ~ idx ; /* i.e. changes &= ~ GCJoinStyle */
|
||||
break ;
|
||||
|
||||
case GCBackground:
|
||||
if ( pGC->fillStyle != FillOpaqueStippled ) {
|
||||
changes &= ~ idx ; /* i.e. changes &= ~GCBackground */
|
||||
break ;
|
||||
} /* else Fall Through */
|
||||
case GCForeground:
|
||||
if ( pGC->fillStyle == FillTiled ) {
|
||||
changes &= ~ idx ; /* i.e. changes &= ~GCForeground */
|
||||
break ;
|
||||
} /* else Fall Through */
|
||||
case GCFunction:
|
||||
case GCPlaneMask:
|
||||
case GCFillStyle:
|
||||
{ /* new_fill */
|
||||
int fillStyle = devPriv->colorRrop.fillStyle ;
|
||||
/* install a suitable fillspans */
|
||||
if ( fillStyle == FillSolid )
|
||||
pGC->ops->FillSpans = xf4bppSolidPixmapFS ;
|
||||
else if ( fillStyle == FillStippled )
|
||||
pGC->ops->FillSpans = xf4bppStipplePixmapFS ;
|
||||
else if ( fillStyle == FillOpaqueStippled )
|
||||
pGC->ops->FillSpans = xf4bppOpStipplePixmapFS ;
|
||||
else /* fillStyle == FillTiled */
|
||||
pGC->ops->FillSpans = xf4bppTilePixmapFS ;
|
||||
changes &= ~( GCBackground | GCForeground
|
||||
| GCFunction | GCPlaneMask | GCFillStyle ) ;
|
||||
break ;
|
||||
} /* end of new_fill */
|
||||
|
||||
default:
|
||||
ErrorF( "ppcChangePixmapGC: Unexpected GC Change\n" ) ;
|
||||
changes &= ~ idx ; /* Remove it anyway */
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
/* Clipping conventions
|
||||
if the drawable is a window
|
||||
CT_REGION ==> pCompositeClip really is the composite
|
||||
CT_other ==> pCompositeClip is the window clip region
|
||||
if the drawable is a pixmap
|
||||
CT_REGION ==> pCompositeClip is the translated client region
|
||||
clipped to the pixmap boundary
|
||||
CT_other ==> pCompositeClip is the pixmap bounding box
|
||||
*/
|
||||
|
||||
static void
|
||||
xf4bppValidateGC( pGC, changes, pDrawable )
|
||||
GCPtr pGC;
|
||||
unsigned long changes;
|
||||
DrawablePtr pDrawable;
|
||||
{
|
||||
register ppcPrivGCPtr devPriv ;
|
||||
WindowPtr pWin ;
|
||||
|
||||
devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
|
||||
mfbGetGCPrivateKey());
|
||||
if ( pDrawable->type != devPriv->lastDrawableType ) {
|
||||
devPriv->lastDrawableType = pDrawable->type ;
|
||||
xf4bppChangeGCtype( pGC, devPriv ) ;
|
||||
changes = (unsigned)~0 ;
|
||||
}
|
||||
|
||||
if ( pDrawable->depth == 1 ) {
|
||||
/* ibmAbort(); */
|
||||
xf4bppNeverCalled();
|
||||
}
|
||||
|
||||
if ( pDrawable->type == DRAWABLE_WINDOW ) {
|
||||
pWin = (WindowPtr) pDrawable ;
|
||||
pGC->lastWinOrg.x = pWin->drawable.x ;
|
||||
pGC->lastWinOrg.y = pWin->drawable.y ;
|
||||
}
|
||||
else {
|
||||
pWin = (WindowPtr) NULL ;
|
||||
pGC->lastWinOrg.x = 0 ;
|
||||
pGC->lastWinOrg.y = 0 ;
|
||||
}
|
||||
|
||||
changes &= ppcGCInterestValidateMask ;
|
||||
/* If Nothing REALLY Changed, Just Return */
|
||||
if ( pDrawable->serialNumber == (pGC->serialNumber & DRAWABLE_SERIAL_BITS) )
|
||||
if ( !( changes &= ~ GC_CALL_VALIDATE_BIT ) )
|
||||
return ;
|
||||
|
||||
/* GJA -- start of cfb code */
|
||||
/*
|
||||
* if the client clip is different or moved OR the subwindowMode has
|
||||
* changed OR the window's clip has changed since the last validation
|
||||
* we need to recompute the composite clip
|
||||
*/
|
||||
|
||||
if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
|
||||
(pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
|
||||
)
|
||||
{
|
||||
if (pWin) {
|
||||
RegionPtr pregWin;
|
||||
Bool freeTmpClip, freeCompClip;
|
||||
|
||||
if (pGC->subWindowMode == IncludeInferiors) {
|
||||
pregWin = NotClippedByChildren(pWin);
|
||||
freeTmpClip = TRUE;
|
||||
}
|
||||
else {
|
||||
pregWin = &pWin->clipList;
|
||||
freeTmpClip = FALSE;
|
||||
}
|
||||
freeCompClip = pGC->freeCompClip;
|
||||
|
||||
/*
|
||||
* if there is no client clip, we can get by with just keeping
|
||||
* the pointer we got, and remembering whether or not should
|
||||
* destroy (or maybe re-use) it later. this way, we avoid
|
||||
* unnecessary copying of regions. (this wins especially if
|
||||
* many clients clip by children and have no client clip.)
|
||||
*/
|
||||
if (pGC->clientClipType == CT_NONE) {
|
||||
if (freeCompClip)
|
||||
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
|
||||
pGC->pCompositeClip = pregWin;
|
||||
pGC->freeCompClip = freeTmpClip;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* we need one 'real' region to put into the composite
|
||||
* clip. if pregWin the current composite clip are real,
|
||||
* we can get rid of one. if pregWin is real and the
|
||||
* current composite clip isn't, use pregWin for the
|
||||
* composite clip. if the current composite clip is real
|
||||
* and pregWin isn't, use the current composite clip. if
|
||||
* neither is real, create a new region.
|
||||
*/
|
||||
|
||||
REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
|
||||
pDrawable->x + pGC->clipOrg.x,
|
||||
pDrawable->y + pGC->clipOrg.y);
|
||||
|
||||
if (freeCompClip)
|
||||
{
|
||||
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
|
||||
pregWin, pGC->clientClip);
|
||||
if (freeTmpClip)
|
||||
REGION_DESTROY(pGC->pScreen, pregWin);
|
||||
}
|
||||
else if (freeTmpClip)
|
||||
{
|
||||
REGION_INTERSECT(pGC->pScreen, pregWin, pregWin,
|
||||
pGC->clientClip);
|
||||
pGC->pCompositeClip = pregWin;
|
||||
}
|
||||
else
|
||||
{
|
||||
pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
|
||||
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
|
||||
pregWin, pGC->clientClip);
|
||||
}
|
||||
pGC->freeCompClip = TRUE;
|
||||
REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
|
||||
-(pDrawable->x + pGC->clipOrg.x),
|
||||
-(pDrawable->y + pGC->clipOrg.y));
|
||||
|
||||
}
|
||||
} /* end of composite clip for a window */
|
||||
else {
|
||||
BoxRec pixbounds;
|
||||
|
||||
/* XXX should we translate by drawable.x/y here ? */
|
||||
pixbounds.x1 = 0;
|
||||
pixbounds.y1 = 0;
|
||||
pixbounds.x2 = pDrawable->width;
|
||||
pixbounds.y2 = pDrawable->height;
|
||||
|
||||
if (pGC->freeCompClip) {
|
||||
REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
|
||||
} else {
|
||||
pGC->freeCompClip = TRUE;
|
||||
pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
|
||||
}
|
||||
|
||||
if (pGC->clientClipType == CT_REGION)
|
||||
{
|
||||
REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
|
||||
-pGC->clipOrg.x, -pGC->clipOrg.y);
|
||||
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
|
||||
pGC->pCompositeClip, pGC->clientClip);
|
||||
REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
|
||||
pGC->clipOrg.x, pGC->clipOrg.y);
|
||||
}
|
||||
} /* end of composute clip for pixmap */
|
||||
}
|
||||
/* GJA -- End of cfb code */
|
||||
|
||||
changes &= ~ ( GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode
|
||||
| GC_CALL_VALIDATE_BIT ) ;
|
||||
|
||||
/* If needed, Calculate the Color Reduced Raster-Op */
|
||||
if ( changes & ( GCFillStyle | GCBackground | GCForeground
|
||||
| GCPlaneMask | GCFunction ) )
|
||||
xf4bppGetReducedColorRrop( pGC, pDrawable->depth,
|
||||
&devPriv->colorRrop ) ;
|
||||
|
||||
(* ( ( pDrawable->type == DRAWABLE_WINDOW )
|
||||
? xf4bppChangeWindowGC
|
||||
: ppcChangePixmapGC ) )( pGC, changes ) ;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "gc.h"
|
||||
#include "mfb.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned long planemask ;
|
||||
unsigned long fgPixel ;
|
||||
unsigned long bgPixel ;
|
||||
int alu ;
|
||||
int fillStyle ;
|
||||
} ppcReducedRrop ;
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
/* private field of GC */
|
||||
typedef struct {
|
||||
/* The next five (5) fields MUST CORRESPOND to
|
||||
* the fields of a "mfbPrivGC" struct
|
||||
* ----- BEGINNING OF "DO-NOT-CHANGE" REGION -----
|
||||
*/
|
||||
unsigned char rop ; /* reduction of rasterop to 1 of 3 */
|
||||
unsigned char ropOpStip ; /* rop for opaque stipple */
|
||||
unsigned char ropFillArea ; /* == alu, rop, or ropOpStip */
|
||||
unsigned char unused[sizeof(long) - 3];
|
||||
mfbFillAreaProcPtr FillArea; /* fills regions; look at the code */
|
||||
/* ----- END OF "DO-NOT-CHANGE" REGION ----- */
|
||||
ppcReducedRrop colorRrop ;
|
||||
short lastDrawableType ; /* was last drawable a window or a pixmap? */
|
||||
short lastDrawableDepth ; /* was last drawable 1 or 8 planes? */
|
||||
pointer devPriv ; /* Private area for device specific stuff */
|
||||
} ppcPrivGC ;
|
||||
typedef ppcPrivGC *ppcPrivGCPtr ;
|
||||
|
||||
/* ppcCReduce.c */
|
||||
void xf4bppGetReducedColorRrop(
|
||||
GCPtr,
|
||||
int,
|
||||
ppcReducedRrop *
|
||||
);
|
||||
|
||||
/* vgaGC.c */
|
||||
void xf4bppChangeGCtype(
|
||||
GCPtr,
|
||||
ppcPrivGCPtr
|
||||
);
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE
|
||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "servermd.h"
|
||||
#include "ibmTrace.h"
|
||||
|
||||
/* GetSpans -- for each span, gets bits from drawable starting at ppt[i]
|
||||
* and continuing for pwidth[i] bits
|
||||
* Each scanline returned will be server scanline padded, i.e., it will come
|
||||
* out to an integral number of words.
|
||||
*/
|
||||
void
|
||||
xf4bppGetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart )
|
||||
DrawablePtr pDrawable ; /* drawable from which to get bits */
|
||||
int wMax ; /* largest value of all *pwidths */
|
||||
DDXPointPtr ppt ; /* points to start copying from */
|
||||
int *pwidth ; /* list of number of bits to copy */
|
||||
int nspans ; /* number of scanlines to copy */
|
||||
char *pdstStart ;
|
||||
{
|
||||
register int j ;
|
||||
register unsigned char *pdst ; /* where to put the bits */
|
||||
register unsigned char *psrc ; /* where to get the bits */
|
||||
register int pixmapStride ;
|
||||
|
||||
|
||||
TRACE( ( "xf4bppGetSpans(pDrawable=0x%x,wMax=%d,ppt=0x%x,pwidth=0x%x,nspans=%d)\n",
|
||||
pDrawable, wMax, ppt, pwidth, nspans ) ) ;
|
||||
|
||||
if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) )
|
||||
{
|
||||
mfbGetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart ) ;
|
||||
return;
|
||||
}
|
||||
|
||||
pixmapStride = PixmapBytePad( wMax, pDrawable->depth ) ;
|
||||
pdst = (unsigned char *) /* GJA */ pdstStart ;
|
||||
|
||||
if ( pDrawable->type == DRAWABLE_WINDOW ) {
|
||||
for ( ; nspans-- ; ppt++, pwidth++ ) {
|
||||
xf4bppReadColorImage( (WindowPtr)pDrawable,
|
||||
ppt->x, ppt->y, j = *pwidth, 1, pdst, pixmapStride ) ;
|
||||
pdst += j ; /* width is in 32 bit words */
|
||||
j = ( -j ) & 3 ;
|
||||
while ( j-- ) /* Pad out to 32-bit boundary */
|
||||
*pdst++ = 0 ;
|
||||
}
|
||||
}
|
||||
else { /* OK, if we are here, we had better be a DRAWABLE PIXMAP */
|
||||
register int widthSrc = /* width of pixmap in bytes */
|
||||
(int) ( (PixmapPtr) pDrawable )->devKind ;
|
||||
|
||||
psrc = (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ;
|
||||
for ( ; nspans-- ; ppt++, pwidth++ ) {
|
||||
MOVE( psrc + ( ppt->y * widthSrc ) + ppt->x,
|
||||
pdst, j = *pwidth ) ;
|
||||
pdst += j ;
|
||||
j = ( -j ) & 3 ;
|
||||
while ( j-- ) /* Pad out to 32-bit boundary */
|
||||
*pdst++ = 0 ;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
|
@ -1,233 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 1990 X Consortium
|
||||
|
||||
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 THE X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
Copyright IBM Corporation 1987,1988,1989
|
||||
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 IBM not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
IBM 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "mi.h"
|
||||
#include "micmap.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "vgaVideo.h"
|
||||
|
||||
#if 0
|
||||
/* XXX This remains to remind of the PC98 difference */
|
||||
static VisualRec vgaVisuals[] = {
|
||||
/* StaticColor needs to be first so is can be used as the default */
|
||||
/* vid class bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */
|
||||
#ifdef PC98
|
||||
{ 0, StaticColor, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, StaticGray, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, GrayScale, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, PseudoColor, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
|
||||
#else
|
||||
{ 0, StaticColor, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, StaticGray, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, GrayScale, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, PseudoColor, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
|
||||
#endif
|
||||
} ;
|
||||
#endif
|
||||
|
||||
void
|
||||
xf4bppNeverCalled()
|
||||
{
|
||||
FatalError("xf4bppNeverCalled was nevertheless called\n");
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static Bool
|
||||
vgaScreenClose
|
||||
(
|
||||
int idx,
|
||||
ScreenPtr pScreen
|
||||
)
|
||||
{
|
||||
pScreen->defColormap = 0 ;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static GCPtr sampleGCperDepth[MAXFORMATS+1] = { 0 };
|
||||
static PixmapPtr samplePixmapPerDepth[1] = { 0 };
|
||||
|
||||
/* GJA -- Took this from miscrinit.c.
|
||||
* We want that devKind contains the distance in bytes between two scanlines.
|
||||
* The computation that mi does is not appropriate for planar VGA.
|
||||
* Therefore we provide here our own routine.
|
||||
*/
|
||||
|
||||
/* GJA -- WARNING: this is an internal structure declaration, taken from
|
||||
* miscrinit.c
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
pointer pbits; /* pointer to framebuffer */
|
||||
int width; /* delta to add to a framebuffer addr to move one row down */
|
||||
} miScreenInitParmsRec, *miScreenInitParmsPtr;
|
||||
|
||||
/* With the introduction of pixmap privates, the "screen pixmap" can no
|
||||
* longer be created in miScreenInit, since all the modules that could
|
||||
* possibly ask for pixmap private space have not been initialized at
|
||||
* that time. pScreen->CreateScreenResources is called after all
|
||||
* possible private-requesting modules have been inited; we create the
|
||||
* screen pixmap here.
|
||||
*/
|
||||
static Bool
|
||||
v16CreateScreenResources
|
||||
(
|
||||
ScreenPtr pScreen
|
||||
)
|
||||
{
|
||||
miScreenInitParmsPtr pScrInitParms;
|
||||
pointer value;
|
||||
|
||||
pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
|
||||
|
||||
/* if width is non-zero, pScreen->devPrivate will be a pixmap
|
||||
* else it will just take the value pbits
|
||||
*/
|
||||
if (pScrInitParms->width)
|
||||
{
|
||||
PixmapPtr pPixmap;
|
||||
|
||||
/* create a pixmap with no data, then redirect it to point to
|
||||
* the screen
|
||||
*/
|
||||
pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0);
|
||||
if (!pPixmap)
|
||||
return FALSE;
|
||||
|
||||
if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width,
|
||||
pScreen->height, pScreen->rootDepth, 8 /* bits per pixel */,
|
||||
/* GJA: was PixmapBytePad(pScrInitParms->width, pScreen->rootDepth), */
|
||||
#define BITS_PER_BYTE_SHIFT 3
|
||||
pScrInitParms->width >> BITS_PER_BYTE_SHIFT,
|
||||
pScrInitParms->pbits))
|
||||
return FALSE;
|
||||
value = (pointer)pPixmap;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = pScrInitParms->pbits;
|
||||
}
|
||||
xfree(pScreen->devPrivate); /* freeing miScreenInitParmsRec */
|
||||
pScreen->devPrivate = value; /* pPixmap or pbits */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
xf4bppScreenInit( pScreen, pbits, virtx, virty, dpix, dpiy, width )
|
||||
ScreenPtr pScreen;
|
||||
pointer pbits;
|
||||
int virtx, virty;
|
||||
int dpix, dpiy;
|
||||
int width;
|
||||
{
|
||||
Bool ret;
|
||||
VisualPtr visuals;
|
||||
DepthPtr depths;
|
||||
int nvisuals;
|
||||
int ndepths;
|
||||
int rootdepth;
|
||||
VisualID defaultVisual;
|
||||
|
||||
rootdepth = 0;
|
||||
ret = miInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
|
||||
&defaultVisual, (unsigned long)1 << 8, 6, -1);
|
||||
if (!ret)
|
||||
return FALSE;
|
||||
|
||||
pScreen-> id = 0;
|
||||
pScreen->defColormap = FakeClientID(0);
|
||||
pScreen-> whitePixel = VGA_WHITE_PIXEL;
|
||||
pScreen-> blackPixel = VGA_BLACK_PIXEL;
|
||||
pScreen-> rgf = 0;
|
||||
*(pScreen-> GCperDepth) = *(sampleGCperDepth);
|
||||
*(pScreen-> PixmapPerDepth) = *(samplePixmapPerDepth);
|
||||
pScreen-> CloseScreen = vgaScreenClose;
|
||||
pScreen-> QueryBestSize = xf4bppQueryBestSize;
|
||||
pScreen-> GetImage = xf4bppGetImage;
|
||||
pScreen-> GetSpans = xf4bppGetSpans;
|
||||
pScreen-> CreateWindow = xf4bppCreateWindowForXYhardware;
|
||||
pScreen-> DestroyWindow = xf4bppDestroyWindow;
|
||||
pScreen-> PositionWindow = xf4bppPositionWindow;
|
||||
pScreen-> CopyWindow = xf4bppCopyWindow;
|
||||
pScreen-> CreatePixmap = xf4bppCreatePixmap;
|
||||
pScreen-> CreateGC = xf4bppCreateGC;
|
||||
pScreen-> CreateColormap = xf4bppInitializeColormap;
|
||||
pScreen-> DestroyColormap = (DestroyColormapProcPtr)NoopDDA;
|
||||
pScreen-> InstallColormap = miInstallColormap;
|
||||
pScreen-> UninstallColormap = miUninstallColormap;
|
||||
pScreen-> ListInstalledColormaps = miListInstalledColormaps;
|
||||
pScreen-> StoreColors = (StoreColorsProcPtr)NoopDDA;
|
||||
pScreen-> ResolveColor = xf4bppResolveColor;
|
||||
mfbFillInScreen(pScreen);
|
||||
|
||||
if (!mfbAllocatePrivates(pScreen, NULL))
|
||||
return FALSE;
|
||||
|
||||
if (!miScreenInit(pScreen, pbits, virtx, virty, dpix, dpiy, width,
|
||||
rootdepth, ndepths, depths, defaultVisual /* See above */,
|
||||
nvisuals, visuals))
|
||||
return FALSE;
|
||||
|
||||
/* GJA -- Now we override the supplied default: */
|
||||
pScreen -> CreateScreenResources = v16CreateScreenResources;
|
||||
|
||||
mfbRegisterCopyPlaneProc(pScreen,miCopyPlane); /* GJA -- R4->R5 */
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "mi.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "servermd.h"
|
||||
|
||||
/* Was 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 and bcopy it to the destination
|
||||
* buffer, except that if the planemask is not all ones, we create a
|
||||
* temporary pixmap and do a SetSpans into it ( 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
|
||||
* completely ugly and slow but works, but the interfaces just aren't
|
||||
* designed for this case. Life is hard.
|
||||
* XY format:
|
||||
* get the single plane specified in planemask
|
||||
*/
|
||||
void
|
||||
xf4bppGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine )
|
||||
DrawablePtr pDraw ;
|
||||
int sx, sy, w, h ;
|
||||
unsigned int format ;
|
||||
unsigned long planeMask ;
|
||||
char * pdstLine ;
|
||||
{
|
||||
#if 1
|
||||
int depth, i, linelength, width ;
|
||||
DDXPointRec pt ;
|
||||
char *pbits ;
|
||||
XID gcv[2] ;
|
||||
PixmapPtr pPixmap = (PixmapPtr) NULL ;
|
||||
GCPtr pGC ;
|
||||
char *pDst = pdstLine ;
|
||||
|
||||
depth = pDraw->depth ;
|
||||
if ( format == ZPixmap ) {
|
||||
linelength = PixmapBytePad( w, depth ) ;
|
||||
/* if ( pDraw->type == DRAWABLE_WINDOW ) { */
|
||||
sx += pDraw->x ;
|
||||
sy += pDraw->y ;
|
||||
/* } */
|
||||
if ( ( ( ( 1 << pDraw->depth ) - 1 ) & planeMask )
|
||||
!= (unsigned)( 1 << pDraw->depth ) - 1 ) {
|
||||
pGC = GetScratchGC( depth, pDraw->pScreen ) ;
|
||||
pPixmap = (PixmapPtr)
|
||||
(* pDraw->pScreen->CreatePixmap)( pDraw->pScreen, w, h, depth,
|
||||
CREATE_PIXMAP_USAGE_SCRATCH) ;
|
||||
gcv[0] = GXcopy ;
|
||||
gcv[1] = planeMask ;
|
||||
DoChangeGC( pGC, GCPlaneMask | GCFunction, gcv, 0 ) ;
|
||||
ValidateGC( (DrawablePtr)pPixmap, pGC ) ;
|
||||
|
||||
pbits = (char *)xalloc(w);
|
||||
|
||||
for ( i = 0 ; i < h ; i++ ) {
|
||||
pt.x = sx ;
|
||||
pt.y = sy + i ;
|
||||
width = w ;
|
||||
(* pDraw->pScreen->GetSpans)( pDraw, w, &pt, &width, 1, pbits ) ;
|
||||
pt.x = 0 ;
|
||||
pt.y = i ;
|
||||
width = w ;
|
||||
if ( planeMask & ((1 << depth) - 1) ) /* GJA -- mfb bug */
|
||||
(* pGC->ops->SetSpans)( (DrawablePtr)pPixmap, pGC, pbits, &pt, &width, 1, TRUE ) ;
|
||||
(* pDraw->pScreen->GetSpans)( (DrawablePtr)pPixmap, w, &pt, &width, 1, pDst ) ;
|
||||
pDst += linelength ;
|
||||
}
|
||||
|
||||
xfree(pbits) ;
|
||||
(* pGC->pScreen->DestroyPixmap)( pPixmap ) ;
|
||||
FreeScratchGC( pGC ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
for ( i = 0 ; i < h ; i++ ) {
|
||||
pt.x = sx ;
|
||||
pt.y = sy + i ;
|
||||
width = w ;
|
||||
(* pDraw->pScreen->GetSpans)( pDraw, w, &pt, &width, 1, pDst ) ;
|
||||
pDst += linelength ;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
miGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine ) ;
|
||||
}
|
||||
|
|
@ -1,502 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************************
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "mi.h"
|
||||
#include "mispans.h"
|
||||
#include "ppcGCstr.h"
|
||||
#include "ppcSpMcro.h"
|
||||
#include "vgaVideo.h"
|
||||
#include "ibmTrace.h"
|
||||
|
||||
#define LeftMostBitInScreenLongWord SCRLEFT( 0xFFFFFFFF, 31 )
|
||||
|
||||
/* GJA -- copied this from VGA */
|
||||
#define SCRLEFT8(lw, n) ( (unsigned char) (((unsigned char) lw) << (n)) )
|
||||
#define SCRRIGHT8(lw, n) ( (unsigned char) (((unsigned char)lw) >> (n)) )
|
||||
/*
|
||||
********** ********** ********** ********** ********** ********** **********
|
||||
these routines all clip. they assume that anything that has called
|
||||
them has already translated the points (i.e. pGC->miTranslate is
|
||||
non-zero, which is howit gets set in mfbCreateGC().)
|
||||
|
||||
the number of new scnalines created by clipping ==
|
||||
MaxRectsPerBand * nSpans.
|
||||
********** ********** ********** ********** ********** ********** **********
|
||||
*/
|
||||
/* A mod definition that goes smoothly into the negative.
|
||||
*/
|
||||
static int
|
||||
modulo
|
||||
(
|
||||
int n1,
|
||||
int n2
|
||||
)
|
||||
{
|
||||
int tmp;
|
||||
if ( n1 < 0 ) {
|
||||
tmp = (-n1) % n2;
|
||||
if ( tmp == 0 ) {
|
||||
return 0;
|
||||
} else {
|
||||
return n2 - tmp;
|
||||
}
|
||||
} else {
|
||||
return n1 % n2;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
|
||||
DrawablePtr pDrawable ;
|
||||
GCPtr pGC ;
|
||||
int nInit ; /* number of spans to fill */
|
||||
DDXPointPtr pptInit ; /* pointer to list of start points */
|
||||
int *pwidthInit ; /* pointer to list of n widths */
|
||||
int fSorted ;
|
||||
{
|
||||
register unsigned long int pm, npm ;
|
||||
register unsigned long int fg ;
|
||||
register int alu ;
|
||||
/* next three parameters are post-clip */
|
||||
int n ; /* number of spans to fill */
|
||||
register DDXPointPtr ppt ; /* pointer to list of start points */
|
||||
register int *pwidth ; /* pointer to list of n widths */
|
||||
register unsigned char *addrl ; /* pointer to current longword in bitmap */
|
||||
int i ;
|
||||
int *pwidthFree ; /* copies of the pointers to free */
|
||||
DDXPointPtr pptFree ;
|
||||
|
||||
TRACE(("xf4bppSolidPixmapFS(pDrawable=0x%x, pGC=0x%x, nInit=%d, pptInit=0x%x, pwidthInit=0x%x, fSorted=%d)\n", pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ;
|
||||
|
||||
if ( pDrawable->type != DRAWABLE_PIXMAP ) {
|
||||
ErrorF("xf4bppSolidPixmapFS: drawable is not a pixmap\n") ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()))->colorRrop.alu ) == GXnoop )
|
||||
return ;
|
||||
|
||||
n = nInit * miFindMaxBand(pGC->pCompositeClip) ;
|
||||
if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) )
|
||||
return ;
|
||||
pwidth = pwidthFree ;
|
||||
|
||||
if ( !( pptFree = (DDXPointRec *)
|
||||
xalloc( n * sizeof( DDXPointRec ) ) ) ) {
|
||||
xfree( pwidth ) ;
|
||||
return ;
|
||||
}
|
||||
ppt = pptFree ;
|
||||
|
||||
n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit,
|
||||
ppt, pwidth, fSorted ) ;
|
||||
|
||||
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
|
||||
fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
|
||||
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
|
||||
|
||||
for ( ; n-- ; ppt++, pwidth++ ) {
|
||||
addrl = ( (unsigned char *) ( ( (PixmapPtr) pDrawable )->devPrivate.ptr ) )
|
||||
+ ( ppt->y * ( (int) ( ( (PixmapPtr) pDrawable )->devKind ) ) )
|
||||
+ ppt->x ;
|
||||
for ( i = *pwidth ; i-- ; addrl++ )
|
||||
{
|
||||
unsigned _p;
|
||||
DoRop( _p, alu, fg, *addrl );
|
||||
*addrl = ( *addrl & npm ) | ( pm & _p ) ;
|
||||
}
|
||||
#ifdef notdef /* PURDUE */
|
||||
*addrl = ( *addrl & npm ) | ( pm & DoRop( alu, fg, *addrl ) ) ;
|
||||
#endif /* PURDUE */
|
||||
}
|
||||
xfree( pptFree ) ;
|
||||
xfree( pwidthFree ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
/* GJA -- copied from vgaStipple.c */
|
||||
static unsigned char
|
||||
vgagetbits
|
||||
(
|
||||
register const int x,
|
||||
register const unsigned int patternWidth,
|
||||
register const unsigned char * const lineptr
|
||||
)
|
||||
{
|
||||
register unsigned char bits ;
|
||||
register const unsigned char *cptr ;
|
||||
register int shift ;
|
||||
register int wrap ;
|
||||
|
||||
cptr = lineptr + ( x >> 3 ) ;
|
||||
bits = *cptr ;
|
||||
if ((shift = x & 7))
|
||||
bits = SCRLEFT8( bits, shift ) | SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
|
||||
if ( ( wrap = x + 8 - patternWidth ) > 0 ) {
|
||||
bits &= SCRLEFT8( 0xFF, wrap ) ;
|
||||
bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
|
||||
}
|
||||
|
||||
/* GJA -- Handle extraction of 8 bits from < 8 bits wide stipple.
|
||||
* I duplicated case 4,5,6,7 to give the compiler a chance to optimize.
|
||||
*/
|
||||
switch (patternWidth) {
|
||||
case 1: /* Not really useful. */
|
||||
bits &= ~SCRRIGHT8(0xFF,1);
|
||||
bits |= SCRRIGHT8(bits,1);
|
||||
bits |= SCRRIGHT8(bits,2);
|
||||
bits |= SCRRIGHT8(bits,4);
|
||||
break;
|
||||
case 2:
|
||||
bits &= ~SCRRIGHT8(0xFF,2);
|
||||
bits |= SCRRIGHT8(bits,2); bits |= SCRRIGHT8(bits,4); break;
|
||||
case 3:
|
||||
bits &= ~SCRRIGHT8(0xFF,3);
|
||||
bits |= (SCRRIGHT8(bits,3) | SCRRIGHT8(bits,6)); break;
|
||||
case 4:
|
||||
bits = (bits & ~SCRRIGHT8(0xFF,4)) | SCRRIGHT8(bits,4); break;
|
||||
case 5:
|
||||
bits = (bits & ~SCRRIGHT8(0xFF,5)) | SCRRIGHT8(bits,5); break;
|
||||
case 6:
|
||||
bits = (bits & ~SCRRIGHT8(0xFF,6)) | SCRRIGHT8(bits,6); break;
|
||||
case 7:
|
||||
bits = (bits & ~SCRRIGHT8(0xFF,7)) | SCRRIGHT8(bits,7); break;
|
||||
default:
|
||||
;
|
||||
/* Do nothing, of course */
|
||||
}
|
||||
|
||||
return bits ;
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppStipplePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
|
||||
register DrawablePtr pDrawable ;
|
||||
GC *pGC ;
|
||||
int nInit ; /* number of spans to fill */
|
||||
DDXPointPtr pptInit ; /* pointer to list of start points */
|
||||
int *pwidthInit ; /* pointer to list of n widths */
|
||||
int fSorted ;
|
||||
{
|
||||
register unsigned char *pdst ; /* pointer to current word in bitmap */
|
||||
register unsigned long int pm, npm ;
|
||||
register unsigned long int fg ;
|
||||
register int alu ;
|
||||
/* next three parameters are post-clip */
|
||||
int n ; /* number of spans to fill */
|
||||
register DDXPointPtr ppt ; /* pointer to list of start points */
|
||||
register int *pwidth ; /* pointer to list of n widths */
|
||||
PixmapPtr pTile ; /* pointer to tile we want to fill with */
|
||||
int width, x, xSrc, ySrc ;
|
||||
int tlwidth, tileWidth ;
|
||||
unsigned char *psrcT ;
|
||||
int *pwidthFree ; /* copies of the pointers to free */
|
||||
DDXPointPtr pptFree ;
|
||||
int xoff, count, stip, i ;
|
||||
|
||||
TRACE(("xf4bppStipplePixmapFS(pDrawable=0x%x, pGC=0x%x, nInit=%d, pptInit=0x%x, pwidthInit=0x%x, fSorted=%d)\n",
|
||||
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ;
|
||||
|
||||
if ( pDrawable->type != DRAWABLE_PIXMAP ) {
|
||||
ErrorF( "xf4bppStippleWindowFS: drawable is not a pixmap\n") ;
|
||||
return ;
|
||||
}
|
||||
if ( pGC->stipple->drawable.depth != 1 ) {
|
||||
ErrorF( "ppcStippleFS: bad depth\ntype = %d, depth = %d\n",
|
||||
pDrawable->type, pGC->stipple->drawable.depth ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
|
||||
return ;
|
||||
|
||||
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
|
||||
pptFree, pwidth, ppt, fSorted ) ;
|
||||
|
||||
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
|
||||
fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
|
||||
|
||||
pTile = pGC->stipple ;
|
||||
tlwidth = pTile->devKind ;
|
||||
|
||||
tileWidth = pTile->drawable.width ;
|
||||
|
||||
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
|
||||
|
||||
/* this replaces rotating the stipple. Instead, we just adjust the offset
|
||||
* at which we start grabbing bits from the stipple */
|
||||
xSrc = pGC->patOrg.x + pDrawable->x;
|
||||
ySrc = pGC->patOrg.y + pDrawable->y;
|
||||
|
||||
while ( n-- ) {
|
||||
pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr )
|
||||
+ ( ppt->y * ( (int) ( ( (PixmapPtr) pDrawable )->devKind ) ) )
|
||||
+ ppt->x ;
|
||||
psrcT = (unsigned char *)pTile->devPrivate.ptr
|
||||
+ ( modulo( ppt->y - ySrc, pTile->drawable.height ) * tlwidth ) ;
|
||||
x = ppt->x ;
|
||||
|
||||
xoff = modulo( x - xSrc, tileWidth) ;
|
||||
for ( width = *pwidth ; width ; width -= count, xoff+=count ) {
|
||||
|
||||
if ( xoff >= tileWidth ) xoff -= tileWidth;
|
||||
|
||||
if ( width < 8 )
|
||||
count = width;
|
||||
else
|
||||
count = 8;
|
||||
|
||||
stip = vgagetbits( xoff, tileWidth, psrcT ) ;
|
||||
|
||||
for ( i = count ; i-- ; ) {
|
||||
if ( stip & 128 )
|
||||
{
|
||||
unsigned _p;
|
||||
DoRop( _p, alu, fg, *pdst ) ;
|
||||
*pdst = ( *pdst & npm ) | ( pm & _p ) ;
|
||||
}
|
||||
#ifdef notdef /* PURDUE */
|
||||
*pdst = ( *pdst & npm ) | ( pm & DoRop( alu, fg, *pdst ) ) ;
|
||||
#endif /* PURDUE */
|
||||
pdst++ ;
|
||||
stip = SCRLEFT( stip, 1 ) ;
|
||||
}
|
||||
}
|
||||
ppt++ ;
|
||||
pwidth++ ;
|
||||
}
|
||||
xfree( pptFree ) ;
|
||||
xfree( pwidthFree ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppOpStipplePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
|
||||
DrawablePtr pDrawable ;
|
||||
GC *pGC ;
|
||||
int nInit ; /* number of spans to fill */
|
||||
DDXPointPtr pptInit ; /* pointer to list of start points */
|
||||
int *pwidthInit ; /* pointer to list of n widths */
|
||||
int fSorted ;
|
||||
{
|
||||
register unsigned char *pdst ; /* pointer to current word in bitmap */
|
||||
register unsigned long int pm, npm ;
|
||||
register unsigned long int fg, bg ;
|
||||
register int alu ;
|
||||
/* next three parameters are post-clip */
|
||||
int n ; /* number of spans to fill */
|
||||
register DDXPointPtr ppt ; /* pointer to list of start points */
|
||||
register int *pwidth ; /* pointer to list of n widths */
|
||||
PixmapPtr pTile ; /* pointer to tile we want to fill with */
|
||||
int width ;
|
||||
int xSrc, ySrc ;
|
||||
int tlwidth, tileWidth ;
|
||||
unsigned char *psrcT ;
|
||||
int *pwidthFree ; /* copies of the pointers to free */
|
||||
DDXPointPtr pptFree ;
|
||||
int xoff, count, stip, i ;
|
||||
|
||||
TRACE( ( "xf4bppOpStipplePixmapFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
|
||||
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
|
||||
|
||||
if ( pGC->stipple->drawable.depth != 1 ) {
|
||||
ErrorF( "xf4bppOpStipplePixmapFS: bad depth\ntype = %d, depth = %d\n",
|
||||
pDrawable->type, pGC->stipple->drawable.depth ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
|
||||
return ;
|
||||
|
||||
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
|
||||
pptFree, pwidth, ppt, fSorted ) ;
|
||||
|
||||
fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
|
||||
bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ;
|
||||
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
|
||||
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
|
||||
|
||||
pTile = pGC->stipple ;
|
||||
tlwidth = pTile->devKind ;
|
||||
tileWidth = pTile->drawable.width ;
|
||||
|
||||
xSrc = pGC->patOrg.x + pDrawable->x;
|
||||
ySrc = pGC->patOrg.y + pDrawable->y;
|
||||
|
||||
/* this replaces rotating the stipple. Instead, we just adjust the offset
|
||||
* at which we start grabbing bits from the stipple */
|
||||
for ( ; n-- ; ppt++, pwidth++ ) {
|
||||
pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr )
|
||||
+ ( ppt->y * ( (int) ( (PixmapPtr) pDrawable )->devKind ) )
|
||||
+ ppt->x ;
|
||||
psrcT = (unsigned char *)pTile->devPrivate.ptr
|
||||
+ ( modulo( ppt->y - ySrc, pTile->drawable.height ) * tlwidth ) ;
|
||||
|
||||
xoff = modulo( ppt->x - xSrc, tileWidth) ;
|
||||
|
||||
for ( width = *pwidth ; width ; width -= count, xoff+=count ) {
|
||||
|
||||
if ( xoff >= tileWidth ) xoff -= tileWidth;
|
||||
|
||||
if ( width < 8 )
|
||||
count = width;
|
||||
else
|
||||
count = 8;
|
||||
|
||||
stip = vgagetbits( xoff, tileWidth, psrcT ) ;
|
||||
for ( i = count ; i-- ; pdst++, stip = SCRLEFT( stip, 1 ) )
|
||||
if ( stip & 128 )
|
||||
{
|
||||
unsigned _p;
|
||||
DoRop( _p, alu, fg, *pdst ) ;
|
||||
*pdst = ( *pdst & npm ) | ( pm & _p ) ;
|
||||
}
|
||||
#ifdef notdef /* PURDUE */
|
||||
*pdst = ( *pdst & npm ) | ( pm & DoRop( alu, fg, *pdst ) ) ;
|
||||
#endif /* PURDUE */
|
||||
else
|
||||
{
|
||||
unsigned _p;
|
||||
DoRop( _p, alu, bg, *pdst ) ;
|
||||
*pdst = ( *pdst & npm ) | ( pm & _p ) ;
|
||||
}
|
||||
#ifdef notdef /* PURDUE */
|
||||
*pdst = ( *pdst & npm ) | ( pm & DoRop( alu, bg, *pdst ) ) ;
|
||||
#endif /* PURDUE */
|
||||
}
|
||||
}
|
||||
xfree( pptFree ) ;
|
||||
xfree( pwidthFree ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppTilePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
|
||||
register DrawablePtr pDrawable ;
|
||||
GC *pGC ;
|
||||
int nInit ; /* number of spans to fill */
|
||||
DDXPointPtr pptInit ; /* pointer to list of start points */
|
||||
int *pwidthInit ; /* pointer to list of n widths */
|
||||
int fSorted ;
|
||||
{
|
||||
register DDXPointPtr ppt ; /* pointer to list of start points */
|
||||
register int *pwidth ; /* pointer to list of n widths */
|
||||
register unsigned char *pdst ; /* pointer to current word in bitmap */
|
||||
register unsigned char *psrc ; /* pointer to current word in tile */
|
||||
register PixmapPtr pTile ; /* pointer to tile we want to fill with */
|
||||
int i ;
|
||||
int alu ;
|
||||
unsigned char pm, npm ;
|
||||
/* next three parameters are post-clip */
|
||||
int n ; /* number of spans to fill */
|
||||
int tileWidth ;
|
||||
int xSrc, ySrc;
|
||||
unsigned char *psrcT ;
|
||||
int *pwidthFree ; /* copies of the pointers to free */
|
||||
DDXPointPtr pptFree ;
|
||||
|
||||
TRACE( ( "ppcTileFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
|
||||
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
|
||||
|
||||
if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) ) {
|
||||
mfbTileFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ;
|
||||
return ;
|
||||
}
|
||||
if ( !xf4bppDepthOK( pDrawable, pGC->tile.pixmap->drawable.depth ) ) {
|
||||
ErrorF( "ppcTileFS: bad depth\ntype = %d, depth = %d\n",
|
||||
pDrawable->type, pDrawable->depth) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
|
||||
return ;
|
||||
|
||||
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
|
||||
pptFree, pwidth, ppt, fSorted ) ;
|
||||
|
||||
/* the following code is for 8 bits per pixel addressable memory only */
|
||||
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
|
||||
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
|
||||
pTile = pGC->tile.pixmap ;
|
||||
tileWidth = pTile->drawable.width ;
|
||||
|
||||
xSrc = pGC->patOrg.x + pDrawable->x;
|
||||
ySrc = pGC->patOrg.y + pDrawable->y;
|
||||
/* this replaces rotating the tile. Instead we just adjust the offset
|
||||
* at which we start grabbing bits from the tile */
|
||||
for ( ; n-- ; ppt++, pwidth++ ) {
|
||||
pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr )
|
||||
+ ( ppt->y * ( (int) ( (PixmapPtr) pDrawable )->devKind ) )
|
||||
+ ppt->x ;
|
||||
psrcT = (unsigned char *) pTile->devPrivate.ptr
|
||||
+ ( modulo( ppt->y - ySrc, pTile->drawable.height) * pTile->devKind ) ;
|
||||
|
||||
psrc = psrcT + modulo( ppt->x - xSrc, tileWidth ) ;
|
||||
for ( i = *pwidth ; i-- ; pdst++, psrc++ ) {
|
||||
if ( psrc >= ( psrcT + tileWidth ) )
|
||||
psrc = psrcT ;
|
||||
{
|
||||
unsigned _p;
|
||||
DoRop( _p, alu, *psrc, *pdst ) ;
|
||||
*pdst = ( *pdst & npm ) | ( pm & _p ) ;
|
||||
}
|
||||
#ifdef notdef /* PURDUE */
|
||||
*pdst = ( *pdst & npm ) | ( pm & DoRop( alu, *psrc, *pdst ) ) ;
|
||||
#endif /* PURDUE */
|
||||
}
|
||||
}
|
||||
xfree( pptFree ) ;
|
||||
xfree( pwidthFree ) ;
|
||||
return ;
|
||||
}
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE
|
||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "servermd.h"
|
||||
#include "OScompiler.h"
|
||||
#include "ibmTrace.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
PixmapPtr
|
||||
xf4bppCreatePixmap( pScreen, width, height, depth, usage_hint )
|
||||
ScreenPtr pScreen ;
|
||||
int width ;
|
||||
int height ;
|
||||
int depth ;
|
||||
unsigned usage_hint ;
|
||||
{
|
||||
register PixmapPtr pPixmap = (PixmapPtr)NULL;
|
||||
size_t size ;
|
||||
|
||||
TRACE(("xf4bppCreatePixmap(pScreen=0x%x, width=%d, height=%d, depth=%d, usage_hint=%d)\n", pScreen, width, height, depth, usage_hint)) ;
|
||||
|
||||
if ( depth > 8 )
|
||||
return (PixmapPtr) NULL ;
|
||||
|
||||
size = PixmapBytePad(width, depth);
|
||||
|
||||
if (size / 4 > 32767 || height > 32767)
|
||||
return (PixmapPtr) NULL ;
|
||||
|
||||
pPixmap = AllocatePixmap (pScreen, (height * size));
|
||||
|
||||
if ( !pPixmap )
|
||||
return (PixmapPtr) NULL ;
|
||||
pPixmap->drawable.type = DRAWABLE_PIXMAP ;
|
||||
pPixmap->drawable.class = 0 ;
|
||||
pPixmap->drawable.pScreen = pScreen ;
|
||||
pPixmap->drawable.depth = depth ;
|
||||
pPixmap->drawable.id = 0 ;
|
||||
pPixmap->drawable.bitsPerPixel = ( depth == 1 ) ? 1 : 8 ;
|
||||
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER ;
|
||||
pPixmap->drawable.x = 0 ;
|
||||
pPixmap->drawable.y = 0 ;
|
||||
pPixmap->drawable.width = width ;
|
||||
pPixmap->drawable.height = height ;
|
||||
pPixmap->devKind = size;
|
||||
pPixmap->refcnt = 1 ;
|
||||
size = height * pPixmap->devKind ;
|
||||
pPixmap->devPrivate.ptr = (pointer) (((CARD8*)pPixmap)
|
||||
+ pScreen->totalPixmapSize);
|
||||
bzero( (char *) pPixmap->devPrivate.ptr, size ) ;
|
||||
pPixmap->usage_hint = usage_hint;
|
||||
return pPixmap ;
|
||||
}
|
||||
|
||||
PixmapPtr
|
||||
xf4bppCopyPixmap(pSrc)
|
||||
register PixmapPtr pSrc;
|
||||
{
|
||||
register PixmapPtr pDst;
|
||||
int size;
|
||||
|
||||
TRACE(("xf4bppCopyPixmap(pSrc=0x%x)\n", pSrc)) ;
|
||||
size = pSrc->drawable.height * pSrc->devKind;
|
||||
pDst = xalloc(sizeof(PixmapRec) + size);
|
||||
if (!pDst)
|
||||
return NullPixmap;
|
||||
pDst->devPrivates = NULL;
|
||||
pDst->drawable = pSrc->drawable;
|
||||
pDst->drawable.id = 0;
|
||||
pDst->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
pDst->devKind = pSrc->devKind;
|
||||
pDst->refcnt = 1;
|
||||
pDst->devPrivate.ptr = (pointer)(pDst + 1);
|
||||
MOVE( (char *)pSrc->devPrivate.ptr, (char *)pDst->devPrivate.ptr, size ) ;
|
||||
return pDst;
|
||||
}
|
||||
|
|
@ -1,143 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
Copyright IBM Corporation 1987,1988,1989
|
||||
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 IBM not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
IBM 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.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "mi.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "ppcGCstr.h"
|
||||
#include "ibmTrace.h"
|
||||
|
||||
void
|
||||
xf4bppPolyPoint( pDrawable, pGC, mode, npt, pptInit )
|
||||
DrawablePtr pDrawable ;
|
||||
GCPtr pGC ;
|
||||
int mode ; /* Origin or Previous */
|
||||
int npt ;
|
||||
xPoint *pptInit ;
|
||||
{
|
||||
register xPoint *ppt ;
|
||||
ppcPrivGC *devPriv ;
|
||||
int alu ;
|
||||
int nptTmp ;
|
||||
|
||||
TRACE( ("xf4bppPolyPoint(0x%x,0x%x,%d,%d,0x%x)\n",
|
||||
pDrawable, pGC, mode, npt, pptInit ) ) ;
|
||||
|
||||
if ( pDrawable->type == DRAWABLE_PIXMAP ) {
|
||||
if ( pGC->alu != GXnoop )
|
||||
miPolyPoint( pDrawable, pGC, mode, npt, pptInit ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
devPriv = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
|
||||
if ( ( alu = devPriv->colorRrop.alu ) == GXnoop )
|
||||
return ;
|
||||
|
||||
/* make pointlist origin relative */
|
||||
if ( mode == CoordModePrevious )
|
||||
for ( ppt = pptInit, nptTmp = npt ; --nptTmp ; ) {
|
||||
ppt++ ;
|
||||
ppt->x += (ppt-1)->x ;
|
||||
ppt->y += (ppt-1)->y ;
|
||||
}
|
||||
|
||||
if ( pGC->miTranslate ) {
|
||||
register int xorg = pDrawable->x ;
|
||||
register int yorg = pDrawable->y ;
|
||||
for ( ppt = pptInit, nptTmp = npt ; nptTmp-- ; ppt++ ) {
|
||||
ppt->x += xorg ;
|
||||
ppt->y += yorg ;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
register RegionPtr pRegion = pGC->pCompositeClip ;
|
||||
register unsigned long int fg = devPriv->colorRrop.fgPixel ;
|
||||
register unsigned long int pm = devPriv->colorRrop.planemask ;
|
||||
BoxRec box ; /* Scratch Space */
|
||||
|
||||
if ( ! REGION_NUM_RECTS(pRegion))
|
||||
return ;
|
||||
|
||||
for ( ppt = pptInit ; npt-- ; ppt++ )
|
||||
if (POINT_IN_REGION(pDrawable->pScreen, pRegion,
|
||||
ppt->x, ppt->y, &box))
|
||||
xf4bppFillSolid( (WindowPtr)pDrawable,
|
||||
fg, alu, pm, ppt->x, ppt->y, 1, 1 ) ;
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
|
||||
void
|
||||
xf4bppQueryBestSize
|
||||
(
|
||||
register int class,
|
||||
register unsigned short *pwidth,
|
||||
register unsigned short *pheight,
|
||||
ScreenPtr pScreen
|
||||
)
|
||||
{
|
||||
if ( class == CursorShape )
|
||||
*pwidth = *pheight = 32 ; /* ppc's cursor max out at 32 by 32 */
|
||||
else /* either TileShape or StippleShape */
|
||||
/* Round Up To Nearest Multiple Of 8 -- We don't care what height they use */
|
||||
*pwidth = ( *pwidth + 0x7 ) & ~ 0x7 ;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
/************************************************************
|
||||
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
|
||||
|
||||
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 no-
|
||||
tice appear in all copies and that both that copyright no-
|
||||
tice and this permission notice appear in supporting docu-
|
||||
mentation, and that the names of Sun or X Consortium
|
||||
not be used in advertising or publicity pertaining to
|
||||
distribution of the software without specific prior
|
||||
written permission. Sun and X Consortium make no
|
||||
representations about the suitability of this software for
|
||||
any purpose. It is provided "as is" without any express or
|
||||
implied warranty.
|
||||
|
||||
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
|
||||
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
|
||||
ABLE 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Generic Color Resolution Scheme
|
||||
* P. Shupak 12/31/87
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
/*
|
||||
* New colormap routines that can support multiple Visual types.
|
||||
*/
|
||||
|
||||
static unsigned short defstaticpalette[16][3] = {
|
||||
/* R G B */
|
||||
{ 0x0000, 0x0000, 0x0000 }, /* black */
|
||||
{ 0xFFFF, 0xFFFF, 0xFFFF }, /* white */
|
||||
{ 0xAAAA, 0xAAAA, 0xAAAA }, /* grey */
|
||||
{ 0x0000, 0x0000, 0xAAAA }, /* dark blue */
|
||||
{ 0x0000, 0x0000, 0xFFFF }, /* medium blue */
|
||||
{ 0x0000, 0xAAAA, 0xFFFF }, /* light blue */
|
||||
{ 0x0000, 0xFFFF, 0xFFFF }, /* cyan */
|
||||
{ 0x0000, 0xAAAA, 0x0000 }, /* dark green */
|
||||
{ 0x0000, 0xFFFF, 0x0000 }, /* green */
|
||||
{ 0xAAAA, 0xFFFF, 0x5555 }, /* pale green */
|
||||
{ 0xAAAA, 0x5555, 0x0000 }, /* brown */
|
||||
{ 0xFFFF, 0xAAAA, 0x0000 }, /* light brown */
|
||||
{ 0xFFFF, 0xFFFF, 0x0000 }, /* yellow */
|
||||
{ 0xAAAA, 0x0000, 0xAAAA }, /* purple */
|
||||
{ 0xFFFF, 0x0000, 0xFFFF }, /* magenta */
|
||||
{ 0xFFFF, 0x0000, 0x0000 }, /* red */
|
||||
};
|
||||
|
||||
Bool
|
||||
xf4bppInitializeColormap(pmap)
|
||||
register ColormapPtr pmap;
|
||||
{
|
||||
register unsigned i;
|
||||
register VisualPtr pVisual;
|
||||
unsigned lim, maxent, shift;
|
||||
|
||||
pVisual = pmap->pVisual;
|
||||
lim = (1 << pVisual->bitsPerRGBValue) - 1;
|
||||
shift = 16 - pVisual->bitsPerRGBValue;
|
||||
maxent = pVisual->ColormapEntries - 1;
|
||||
|
||||
switch( pVisual->class )
|
||||
{
|
||||
case StaticGray:
|
||||
for ( i = 0 ; i < maxent ; i++ ) {
|
||||
pmap->red[i].co.local.red =
|
||||
pmap->red[i].co.local.green =
|
||||
pmap->red[i].co.local.blue =
|
||||
((((i * 65535) / maxent) >> shift) * 65535) / lim;
|
||||
}
|
||||
break;
|
||||
case StaticColor:
|
||||
for ( i = 0 ; i < 16 ; i++ ) {
|
||||
pmap->red[i].co.local.red = (defstaticpalette[i][0]);
|
||||
pmap->red[i].co.local.green = (defstaticpalette[i][1]);
|
||||
pmap->red[i].co.local.blue = (defstaticpalette[i][2]);
|
||||
}
|
||||
break;
|
||||
case GrayScale:
|
||||
case PseudoColor:
|
||||
for(i=0;i<=maxent;i++) {
|
||||
int a,b,c;
|
||||
a = i << 10;
|
||||
b = i << 12;
|
||||
c = i << 14;
|
||||
pmap->red[i].co.local.red = a;
|
||||
pmap->red[i].co.local.green = b;
|
||||
pmap->red[i].co.local.blue = c;
|
||||
}
|
||||
break;
|
||||
case TrueColor:
|
||||
case DirectColor:
|
||||
default:
|
||||
ErrorF( "Unsupported Visual class %d\b", pVisual->class );
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppResolveColor( pred, pgreen, pblue, pVisual )
|
||||
register unsigned short* pred ;
|
||||
register unsigned short* pgreen ;
|
||||
register unsigned short* pblue ;
|
||||
register VisualPtr pVisual ;
|
||||
{
|
||||
unsigned lim, maxent, shift;
|
||||
|
||||
lim = (1 << pVisual->bitsPerRGBValue) - 1;
|
||||
shift = 16 - pVisual->bitsPerRGBValue;
|
||||
maxent = pVisual->ColormapEntries - 1;
|
||||
|
||||
switch( pVisual->class )
|
||||
{
|
||||
case StaticGray:
|
||||
*pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
|
||||
*pred = (((*pred * (maxent + 1)) >> 16) * 65535) / maxent;
|
||||
*pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
|
||||
break;
|
||||
case StaticColor:
|
||||
break;
|
||||
case GrayScale:
|
||||
*pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
|
||||
*pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
|
||||
break;
|
||||
case PseudoColor:
|
||||
/* rescale to rgb bits */
|
||||
*pred = ((*pred >> shift) * 65535) / lim;
|
||||
*pgreen = ((*pgreen >> shift) * 65535) / lim;
|
||||
*pblue = ((*pblue >> shift) * 65535) / lim;
|
||||
break;
|
||||
case TrueColor:
|
||||
case DirectColor:
|
||||
default:
|
||||
ErrorF( "Unsupported Visual class %d\b", pVisual->class );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,319 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/***********************************************************
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE
|
||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "servermd.h"
|
||||
|
||||
/* SetScanline -- copies the bits from psrc to the drawable starting at
|
||||
* (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc
|
||||
* starts on the scanline. (I.e., if this scanline passes through multiple
|
||||
* boxes, we may not want to start grabbing bits at psrc but at some offset
|
||||
* further on.)
|
||||
*/
|
||||
static void
|
||||
ppcSetScanline
|
||||
(
|
||||
register int pixCount, /* width of scanline in bits */
|
||||
register char *psrc,
|
||||
register unsigned char *pdst, /* where to put the bits */
|
||||
register int pm, /* plane mask */
|
||||
const int alu /* raster op */
|
||||
)
|
||||
{
|
||||
register int npm = ~pm ; /* inverted plane mask */
|
||||
register char tmpx ;
|
||||
|
||||
pm &= 0x0F; npm &= 0x0F; /* GJA */
|
||||
|
||||
switch ( alu ) {
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
while ( pixCount-- )
|
||||
*pdst++ &= npm ;
|
||||
break ;
|
||||
case GXand: /* 0x1 src AND dst */
|
||||
while ( pixCount-- )
|
||||
*pdst++ &= *psrc++ | npm ;
|
||||
break ;
|
||||
case GXandReverse: /* 0x2 src AND NOT dst */
|
||||
for ( ; pixCount-- ; pdst++, psrc++ ) {
|
||||
tmpx = *pdst;
|
||||
*pdst = ( tmpx & npm ) | ( pm & *psrc & ~tmpx ) ;
|
||||
}
|
||||
break ;
|
||||
case GXcopy: /* 0x3 src */
|
||||
for ( ; pixCount-- ; pdst++, psrc++ )
|
||||
*pdst = ( *pdst & npm ) | ( pm & *psrc ) ;
|
||||
break ;
|
||||
case GXandInverted: /* 0x4 NOT src AND dst */
|
||||
while ( pixCount-- )
|
||||
*pdst++ &= npm | ~*psrc++ ;
|
||||
break ;
|
||||
case GXnoop: /* 0x5 dst */
|
||||
break ;
|
||||
case GXxor: /* 0x6 src XOR dst */
|
||||
while ( pixCount-- )
|
||||
*pdst++ ^= pm & *psrc++ ;
|
||||
break ;
|
||||
case GXor: /* 0x7 src OR dst */
|
||||
while ( pixCount-- )
|
||||
*pdst++ |= *psrc++ & pm ;
|
||||
break ;
|
||||
case GXnor: /* 0x8 NOT src AND NOT dst */
|
||||
for ( ; pixCount-- ; pdst++, psrc++ ) {
|
||||
tmpx = *pdst;
|
||||
*pdst = ( tmpx & npm ) | ( pm & ~( tmpx | *psrc ) ) ;
|
||||
}
|
||||
break ;
|
||||
case GXequiv: /* 0x9 NOT src XOR dst */
|
||||
while ( pixCount-- )
|
||||
*pdst++ ^= pm & ~ *psrc++ ;
|
||||
break ;
|
||||
case GXorReverse: /* 0xb src OR NOT dst */
|
||||
for ( ; pixCount-- ; pdst++, psrc++ ) {
|
||||
tmpx = *pdst;
|
||||
*pdst = ( tmpx & npm ) | ( pm & ( *psrc | ~tmpx ) ) ;
|
||||
}
|
||||
break ;
|
||||
case GXinvert: /* 0xa NOT dst */
|
||||
while ( pixCount-- )
|
||||
*pdst++ ^= pm ;
|
||||
break ;
|
||||
case GXcopyInverted: /* 0xc NOT src */
|
||||
for ( ; pixCount-- ; pdst++, psrc++ )
|
||||
*pdst = ( *pdst & npm ) | ( pm & ~ *psrc ) ;
|
||||
break ;
|
||||
case GXorInverted: /* 0xd NOT src OR dst */
|
||||
while ( pixCount-- )
|
||||
*pdst++ |= pm & ~ *psrc++ ;
|
||||
break ;
|
||||
case GXnand: /* 0xe NOT src OR NOT dst */
|
||||
for ( ; pixCount-- ; pdst++, psrc++ ) {
|
||||
tmpx = *pdst;
|
||||
*pdst = ( tmpx & npm ) | ( pm & ~( tmpx & *psrc ) ) ;
|
||||
}
|
||||
break ;
|
||||
case GXset: /* 0xf 1 */
|
||||
while ( pixCount-- )
|
||||
*pdst++ |= pm ;
|
||||
break ;
|
||||
default:
|
||||
ErrorF( "ppcSetScanLine: bad alu value == 0x%02X\n", alu ) ;
|
||||
break ;
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at
|
||||
* ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines
|
||||
* are in increasing Y order.
|
||||
* Source bit lines are server scanline padded so that they always begin
|
||||
* on a word boundary.
|
||||
*/
|
||||
void
|
||||
xf4bppSetSpans( pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted )
|
||||
register DrawablePtr pDrawable ;
|
||||
GCPtr pGC ;
|
||||
char *psrc ;
|
||||
register DDXPointPtr ppt ;
|
||||
int *pwidth ;
|
||||
int nspans ;
|
||||
int fSorted ;
|
||||
{
|
||||
unsigned char *pdstBase = NULL; /* start of dst bitmap */
|
||||
int widthDst = 0; /* width of bitmap in words */
|
||||
register BoxPtr pbox, pboxLast, pboxTest ;
|
||||
register DDXPointPtr pptLast ;
|
||||
RegionPtr prgnDst ;
|
||||
register int width ;
|
||||
int xStart, xEnd ;
|
||||
int yMax ;
|
||||
int alu ;
|
||||
int pm ;
|
||||
|
||||
/* allow for 1-deep windows on nfb machines (eg apa8, aed) */
|
||||
if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) ) {
|
||||
mfbSetSpans( pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if ( !( pm = pGC->planemask & ~( (~0) << pDrawable->depth ) )
|
||||
|| ( ( alu = pGC->alu ) == GXnoop ) )
|
||||
return ;
|
||||
|
||||
prgnDst = pGC->pCompositeClip ;
|
||||
|
||||
if ( ! REGION_NUM_RECTS(prgnDst))
|
||||
return ;
|
||||
|
||||
pboxLast = ( pbox = REGION_RECTS(prgnDst) ) + REGION_NUM_RECTS(prgnDst);
|
||||
pptLast = ppt + nspans ;
|
||||
|
||||
if ( pDrawable->type == DRAWABLE_WINDOW ) {
|
||||
yMax = (int) pDrawable->height + pDrawable->y ;
|
||||
}
|
||||
else {
|
||||
pdstBase = (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ;
|
||||
widthDst = (int) ( (PixmapPtr) pDrawable )->devKind ;
|
||||
yMax = pDrawable->height ;
|
||||
}
|
||||
|
||||
if ( fSorted ) {
|
||||
/* scan lines sorted in ascending order. Because they are sorted, we
|
||||
* don't have to check each scanline against each clip box. We can be
|
||||
* sure that this scanline only has to be clipped to boxes at or after the
|
||||
* beginning of this y-band
|
||||
*/
|
||||
for ( pboxTest = pbox ;
|
||||
( ppt < pptLast ) && ( ppt->y < yMax ) ;
|
||||
ppt++, pwidth++,
|
||||
psrc += PixmapBytePad( width, pDrawable->depth ) ) {
|
||||
width = *pwidth ;
|
||||
for ( pbox = pboxTest ;
|
||||
pbox < pboxLast ;
|
||||
pbox++ ) {
|
||||
if ( pbox->y2 <= ppt->y ) {
|
||||
/* clip box is before scanline */
|
||||
pboxTest = pbox + 1 ;
|
||||
}
|
||||
else if ( ( pbox->y1 > ppt->y )
|
||||
|| ( pbox->x1 > ppt->x + width ) )
|
||||
break ; /* scanline before clip box or left of clip box */
|
||||
else if ( pbox->x2 > ppt->x ) {
|
||||
/* some of the scanline is in the current clip box */
|
||||
xStart = MAX( pbox->x1, ppt->x ) ;
|
||||
xEnd = MIN( ppt->x + width, pbox->x2 ) ;
|
||||
if ( pDrawable->type == DRAWABLE_PIXMAP )
|
||||
ppcSetScanline( xEnd - xStart,
|
||||
psrc + ( xStart - ppt->x ),
|
||||
pdstBase + xStart
|
||||
+ ( ppt->y * widthDst ),
|
||||
pm, alu ) ;
|
||||
else
|
||||
xf4bppDrawColorImage( (WindowPtr)pDrawable,
|
||||
xStart, ppt->y, xEnd - xStart, 1,
|
||||
(unsigned char *)psrc + ( xStart - ppt->x ),
|
||||
xEnd - xStart, alu, pm ) ;
|
||||
if ( ppt->x + width <= pbox->x2 )
|
||||
break ; /* End of the line, as it were */
|
||||
}
|
||||
}
|
||||
/* We've tried this line against every box ; it must be outside them
|
||||
* all. move on to the next point */
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* scan lines not sorted. We must clip each line against all the boxes */
|
||||
for ( ;
|
||||
ppt < pptLast ;
|
||||
ppt++, pwidth++,
|
||||
psrc += PixmapBytePad( width, pDrawable->depth ) ) {
|
||||
width = *pwidth ;
|
||||
if ( ppt->y >= 0 && ppt->y < yMax ) {
|
||||
for ( pbox = REGION_RECTS(prgnDst) ; pbox < pboxLast ; pbox++ ) {
|
||||
if ( pbox->y1 > ppt->y )
|
||||
break ; /* rest of clip region is above this scanline */
|
||||
else if ( ( pbox->y2 > ppt->y )
|
||||
&& ( pbox->x1 <= ppt->x + width )
|
||||
&& ( pbox->x2 > ppt->x ) ) {
|
||||
xStart = MAX( pbox->x1, ppt->x ) ;
|
||||
xEnd = MIN( pbox->x2, ppt->x + width ) ;
|
||||
if ( pDrawable->type == DRAWABLE_PIXMAP )
|
||||
ppcSetScanline( xEnd - xStart,
|
||||
psrc + ( xStart - ppt->x ),
|
||||
/* ^ GJA */
|
||||
( ( pdstBase
|
||||
+ ( ppt->y * widthDst ) )
|
||||
+ xStart ),
|
||||
pm, alu ) ;
|
||||
else /* pDrawable->type == DRAWABLE_WINDOW */
|
||||
xf4bppDrawColorImage( (WindowPtr)pDrawable,
|
||||
xStart, ppt->y, xEnd - xStart, 1,
|
||||
(unsigned char *)psrc + ( xStart - ppt->x ),
|
||||
/* GJA ^ */
|
||||
xEnd - xStart, alu, pm ) ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* This screwy macro is used in all the spans routines and you find
|
||||
it all over the place, so it is a macro just to tidy things up.
|
||||
*/
|
||||
|
||||
#define SETSPANPTRS(IN,N,IPW,PW,IPPT,PPT,FPW,FPPT,FSORT) \
|
||||
{ \
|
||||
N = IN * miFindMaxBand(pGC->pCompositeClip); \
|
||||
if(!(PW = (int *)xalloc(N * sizeof(int)))) \
|
||||
return; \
|
||||
if(!(PPT = (DDXPointRec *)xalloc(N * sizeof(DDXPointRec)))) \
|
||||
{ \
|
||||
free(PW); \
|
||||
return; \
|
||||
} \
|
||||
FPW = PW; \
|
||||
FPPT = PPT; \
|
||||
N = miClipSpans(pGC->pCompositeClip, IPPT, IPW, IN, \
|
||||
PPT, PW, FSORT); \
|
||||
}
|
||||
|
||||
|
|
@ -1,280 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************************
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "mi.h"
|
||||
#include "mispans.h"
|
||||
#include "ppcGCstr.h"
|
||||
#include "ppcSpMcro.h"
|
||||
#include "ibmTrace.h"
|
||||
|
||||
#define LeftMostBitInScreenLongWord SCRLEFT( 0xFFFFFFFF, 31 )
|
||||
/*
|
||||
********** ********** ********** ********** ********** ********** **********
|
||||
these routines all clip. they assume that anything that has called
|
||||
them has already translated the points (i.e. pGC->miTranslate is
|
||||
non-zero, which is howit gets set in mfbCreateGC().)
|
||||
|
||||
the number of new scanlines created by clipping ==
|
||||
MaxRectsPerBand * nSpans.
|
||||
********** ********** ********** ********** ********** ********** **********
|
||||
*/
|
||||
|
||||
void
|
||||
xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
|
||||
DrawablePtr pDrawable ;
|
||||
GCPtr pGC ;
|
||||
int nInit ; /* number of spans to fill */
|
||||
DDXPointPtr pptInit ; /* pointer to list of start points */
|
||||
int *pwidthInit ; /* pointer to list of n widths */
|
||||
int fSorted ;
|
||||
{
|
||||
register unsigned long int pm ;
|
||||
register unsigned long int fg ;
|
||||
register int alu ;
|
||||
/* next three parameters are post-clip */
|
||||
int n ; /* number of spans to fill */
|
||||
register DDXPointPtr ppt ; /* pointer to list of start points */
|
||||
register int *pwidth ; /* pointer to list of n widths */
|
||||
int *pwidthFree ; /* copies of the pointers to free */
|
||||
DDXPointPtr pptFree ;
|
||||
|
||||
TRACE( ( "xf4bppSolidWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
|
||||
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
|
||||
|
||||
if ( pDrawable->type != DRAWABLE_WINDOW ) {
|
||||
ErrorF( "xf4bppSolidWindowFS: drawable is not a window\n") ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
|
||||
return ;
|
||||
|
||||
n = nInit * miFindMaxBand( pGC->pCompositeClip ) ;
|
||||
if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) )
|
||||
return ;
|
||||
pwidth = pwidthFree ;
|
||||
|
||||
if ( !( pptFree = (DDXPointRec *)
|
||||
xalloc( n * sizeof( DDXPointRec ) ) ) ) {
|
||||
xfree( pwidth ) ;
|
||||
return ;
|
||||
}
|
||||
ppt = pptFree ;
|
||||
|
||||
n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit,
|
||||
ppt, pwidth, fSorted ) ;
|
||||
|
||||
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
|
||||
fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
|
||||
|
||||
for ( ; n-- ; ppt++, pwidth++ )
|
||||
if ( *pwidth )
|
||||
xf4bppFillSolid( (WindowPtr)pDrawable,
|
||||
fg, alu, pm, ppt->x, ppt->y, *pwidth, 1 ) ;
|
||||
|
||||
xfree( pptFree ) ;
|
||||
xfree( pwidthFree ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppStippleWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
|
||||
DrawablePtr pDrawable ;
|
||||
register GC *pGC ;
|
||||
int nInit ; /* number of spans to fill */
|
||||
DDXPointPtr pptInit ; /* pointer to list of start points */
|
||||
int *pwidthInit ; /* pointer to list of n widths */
|
||||
int fSorted ;
|
||||
{
|
||||
register unsigned long int pm ;
|
||||
register unsigned long int fg ;
|
||||
register int alu ;
|
||||
/* next three parameters are post-clip */
|
||||
int n ; /* number of spans to fill */
|
||||
register DDXPointPtr ppt ; /* pointer to list of start points */
|
||||
register int *pwidth ; /* pointer to list of n widths */
|
||||
PixmapPtr pTile ; /* pointer to tile we want to fill with */
|
||||
int xSrc ;
|
||||
int ySrc ;
|
||||
int *pwidthFree ; /* copies of the pointers to free */
|
||||
DDXPointPtr pptFree ;
|
||||
|
||||
TRACE( ( "xf4bppStippleWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
|
||||
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
|
||||
|
||||
if ( pDrawable->type != DRAWABLE_WINDOW ) {
|
||||
ErrorF( "xf4bppStippleWindowFS: drawable is not a window\n" ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if ( pGC->stipple->drawable.depth != 1 ) {
|
||||
ErrorF("ppcStippleFS: bad depth\ntype = %d, depth = %d\n",
|
||||
pDrawable->type, pGC->stipple->drawable.depth ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
|
||||
return ;
|
||||
|
||||
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
|
||||
pptFree, pwidth, ppt, fSorted ) ;
|
||||
|
||||
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
|
||||
fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
|
||||
|
||||
xSrc = pGC->patOrg.x + pDrawable->x ;
|
||||
ySrc = pGC->patOrg.y + pDrawable->y ;
|
||||
pTile = pGC->stipple ;
|
||||
|
||||
for ( ; n-- ; ppt++, pwidth++ )
|
||||
xf4bppFillStipple( (WindowPtr)pDrawable, pTile, fg, alu, pm,
|
||||
ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
|
||||
|
||||
xfree( pptFree ) ;
|
||||
xfree( pwidthFree ) ;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppOpStippleWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
|
||||
DrawablePtr pDrawable ;
|
||||
register GC *pGC ;
|
||||
int nInit ; /* number of spans to fill */
|
||||
DDXPointPtr pptInit ; /* pointer to list of start points */
|
||||
int *pwidthInit ; /* pointer to list of n widths */
|
||||
int fSorted ;
|
||||
{
|
||||
register DDXPointPtr ppt ; /* pointer to list of start points */
|
||||
register int *pwidth ; /* pointer to list of n widths */
|
||||
int n ; /* number of spans to fill */
|
||||
int xSrc ;
|
||||
int ySrc ;
|
||||
unsigned long int pm ;
|
||||
unsigned long int fg, bg ;
|
||||
int alu ;
|
||||
int *pwidthFree ; /* copies of the pointers to free */
|
||||
DDXPointPtr pptFree ;
|
||||
|
||||
TRACE( ( "xf4bppOpStippleWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
|
||||
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
|
||||
|
||||
if ( pGC->stipple->drawable.depth != 1 ) {
|
||||
ErrorF( "xf4bppOpStippleWindowFS: bad depth\ntype = %d, depth = %d\n",
|
||||
pDrawable->type, pGC->stipple->drawable.depth ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
|
||||
return ;
|
||||
|
||||
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
|
||||
pptFree, pwidth, ppt, fSorted ) ;
|
||||
|
||||
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
|
||||
fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
|
||||
bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ;
|
||||
|
||||
xSrc = pGC->patOrg.x + pDrawable->x ;
|
||||
ySrc = pGC->patOrg.y + pDrawable->y ;
|
||||
|
||||
for ( ; n-- ; ppt++, pwidth++ )
|
||||
xf4bppOpaqueStipple( (WindowPtr)pDrawable, pGC->stipple, fg, bg, alu, pm,
|
||||
ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
|
||||
|
||||
xfree( pptFree ) ;
|
||||
xfree( pwidthFree ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppTileWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
|
||||
DrawablePtr pDrawable ;
|
||||
register GC *pGC ;
|
||||
int nInit ; /* number of spans to fill */
|
||||
DDXPointPtr pptInit ; /* pointer to list of start points */
|
||||
int *pwidthInit ; /* pointer to list of n widths */
|
||||
int fSorted ;
|
||||
{
|
||||
/* next three parameters are post-clip */
|
||||
register DDXPointPtr ppt ; /* pointer to list of start points */
|
||||
register int *pwidth ; /* pointer to list of n widths */
|
||||
int n ; /* number of spans to fill */
|
||||
unsigned char pm ;
|
||||
int alu ;
|
||||
int xSrc ;
|
||||
int ySrc ;
|
||||
int *pwidthFree ; /* copies of the pointers to free */
|
||||
DDXPointPtr pptFree ;
|
||||
|
||||
TRACE( ( "xf4bppTileWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
|
||||
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
|
||||
|
||||
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
|
||||
return ;
|
||||
|
||||
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
|
||||
pptFree, pwidth, ppt, fSorted ) ;
|
||||
|
||||
xSrc = pGC->patOrg.x + pDrawable->x ;
|
||||
ySrc = pGC->patOrg.y + pDrawable->y ;
|
||||
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
|
||||
|
||||
for ( ; n-- ; ppt++, pwidth++ )
|
||||
xf4bppTileRect( (WindowPtr)pDrawable, pGC->tile.pixmap, alu, pm,
|
||||
ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
|
||||
|
||||
xfree( pptFree ) ;
|
||||
xfree( pwidthFree ) ;
|
||||
return ;
|
||||
}
|
||||
|
|
@ -1,220 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
Copyright IBM Corporation 1987,1988,1989
|
||||
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 IBM not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
IBM 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.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "ibmTrace.h"
|
||||
|
||||
/*
|
||||
xf4bppCopyWindow copies only the parts of the destination that are
|
||||
visible in the source.
|
||||
*/
|
||||
|
||||
void
|
||||
xf4bppCopyWindow(pWin, ptOldOrg, prgnSrc)
|
||||
register WindowPtr pWin ;
|
||||
DDXPointRec ptOldOrg ;
|
||||
RegionPtr prgnSrc ;
|
||||
{
|
||||
RegionPtr prgnDst ;
|
||||
register BoxPtr pbox ;
|
||||
register int dx, dy ;
|
||||
register int nbox ;
|
||||
register int pm ;
|
||||
|
||||
BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew ;
|
||||
/* temporaries for shuffling rectangles */
|
||||
|
||||
TRACE(("xf4bppCopyWindow(pWin= 0x%x, ptOldOrg= 0x%x, prgnSrc= 0x%x)\n", pWin, ptOldOrg, prgnSrc)) ;
|
||||
|
||||
|
||||
dx = ptOldOrg.x - pWin->drawable.x ;
|
||||
dy = ptOldOrg.y - pWin->drawable.y ;
|
||||
REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
|
||||
|
||||
prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
|
||||
REGION_INTERSECT(pWin->drawable.pScreen, prgnDst,
|
||||
&pWin->borderClip, prgnSrc);
|
||||
|
||||
if ( !( nbox = REGION_NUM_RECTS(prgnDst) ) )
|
||||
return;
|
||||
|
||||
pbox = REGION_RECTS(prgnDst);
|
||||
|
||||
pboxNew = 0 ;
|
||||
if ( nbox > 1 ) {
|
||||
if ( dy < 0 ) {
|
||||
if ( dx > 0 ) {
|
||||
/* walk source bottom to top */
|
||||
/* keep ordering in each band, reverse order of bands */
|
||||
if ( !( pboxNew =
|
||||
(BoxPtr) xalloc( sizeof( BoxRec ) * nbox ) ) )
|
||||
return ;
|
||||
pboxBase = pboxNext = pbox+nbox - 1 ;
|
||||
while ( pboxBase >= pbox ) {
|
||||
while ( ( pboxNext >= pbox )
|
||||
&& ( pboxBase->y1 == pboxNext->y1 ) )
|
||||
pboxNext-- ;
|
||||
pboxTmp = pboxNext + 1 ;
|
||||
while ( pboxTmp <= pboxBase )
|
||||
*pboxNew++ = *pboxTmp++ ;
|
||||
pboxBase = pboxNext ;
|
||||
}
|
||||
pboxNew -= nbox ;
|
||||
pbox = pboxNew ;
|
||||
}
|
||||
else { /* dx <= 0 */
|
||||
/* we can just reverse the entire list in place */
|
||||
/* Do three-position swaps */
|
||||
BoxRec tmpBox ;
|
||||
|
||||
pboxBase = pbox ;
|
||||
pboxNext = pbox + nbox - 1 ;
|
||||
while ( pboxBase < pboxNext ) {
|
||||
/* ****** Warning Structure Assignment !! ****** */
|
||||
tmpBox = *pboxBase ;
|
||||
*pboxBase = *pboxNext ;
|
||||
*pboxNext = tmpBox ;
|
||||
pboxBase++ ;
|
||||
pboxNext-- ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( dx < 0 ) {
|
||||
/* walk source right to left */
|
||||
/* reverse order of rects in each band */
|
||||
if ( !( pboxNew = (BoxPtr)xalloc(sizeof(BoxRec) * nbox) ) )
|
||||
return ;
|
||||
pboxBase = pboxNext = pbox ;
|
||||
while (pboxBase < pbox+nbox)
|
||||
{
|
||||
while ((pboxNext < pbox+nbox) &&
|
||||
(pboxNext->y1 == pboxBase->y1))
|
||||
pboxNext++ ;
|
||||
pboxTmp = pboxNext ;
|
||||
while (pboxTmp != pboxBase)
|
||||
*pboxNew++ = *--pboxTmp ;
|
||||
pboxBase = pboxNext ;
|
||||
}
|
||||
pboxNew -= nbox ;
|
||||
pbox = pboxNew ;
|
||||
}
|
||||
} /* END if nbox > 1 */
|
||||
|
||||
/*
|
||||
* call blit several times, the parms are:
|
||||
* blit( alu,rplanes, wplanes, srcx, srcy, destx, desty, width, height ) ;
|
||||
*/
|
||||
|
||||
pm = ( 1 << pWin->drawable.depth ) - 1 ;
|
||||
for ( ; nbox-- ; pbox++ )
|
||||
xf4bppBitBlt( pWin, GXcopy, pm,
|
||||
pbox->x1 + dx, pbox->y1 + dy,
|
||||
pbox->x1, pbox->y1,
|
||||
pbox->x2 - pbox->x1, pbox->y2 - pbox->y1) ;
|
||||
|
||||
/* free up stuff */
|
||||
if ( pboxNew )
|
||||
xfree( pboxNew ) ;
|
||||
|
||||
REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
|
||||
}
|
||||
|
||||
Bool xf4bppPositionWindow(pWin, x, y)
|
||||
register WindowPtr pWin ;
|
||||
register int x, y ;
|
||||
{
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
Bool
|
||||
xf4bppDestroyWindow(pWin)
|
||||
register WindowPtr pWin ;
|
||||
{
|
||||
return pWin ? TRUE : FALSE ;
|
||||
}
|
||||
|
||||
/* As The Name Says -- Used For ega, vga and apa8c */
|
||||
Bool
|
||||
xf4bppCreateWindowForXYhardware(pWin)
|
||||
register WindowPtr pWin ;
|
||||
{
|
||||
TRACE(("xf4bppCreateWindowForXYhardware (pWin= 0x%x)\n", pWin));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -1,749 +0,0 @@
|
|||
/* GJA -- span move routines */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "vgaReg.h"
|
||||
#include "vgaVideo.h"
|
||||
|
||||
#include "xf86str.h" /* for pScrn->vtSema */
|
||||
extern ScrnInfoPtr *xf86Screens;
|
||||
|
||||
#ifndef PC98_EGC /* not PC98_EGC */
|
||||
/* NOTE: It seems that there is no way to program the VGA to copy just
|
||||
* a part of a byte in the smarter modes. Therefore we copy the boundaries
|
||||
* plane by plane.
|
||||
*/
|
||||
#define WORDSZ 8
|
||||
/* The fast blit code requires WORDSZ = 8 for its read-modify write cycle.
|
||||
* Therefore, we do not fully implement the other options.
|
||||
*/
|
||||
#define HIGHPLANEMASK 0x08
|
||||
#define HIGHPLANEINDEX 3
|
||||
|
||||
/* Of course, we want the following anyway:
|
||||
* (Yes, they're identical now.)
|
||||
*/
|
||||
#define SMEM(x,y) ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + (x) )
|
||||
#define DMEM(x,y) ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + (x) )
|
||||
|
||||
#define WORD8 unsigned char
|
||||
#define LW8 BYTES_PER_LINE(pWin) /* Line width */
|
||||
#define WSHIFT8 0x3
|
||||
#define WMASK8 0x07
|
||||
/* NOTE: lmask[8] matters. It must be different from lmask[0] */
|
||||
static unsigned char lmasktab[] = {
|
||||
0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF
|
||||
} ;
|
||||
static unsigned char rmasktab[] = {
|
||||
0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01, 0x00
|
||||
} ;
|
||||
|
||||
#define LMASK8(n) lmasktab[n]
|
||||
#define RMASK8(n) rmasktab[n]
|
||||
#define SWAPB8(x) (x)
|
||||
|
||||
#if (WORDSZ == 8)
|
||||
|
||||
#define WORD WORD8
|
||||
#define LW LW8
|
||||
#define WSHIFT WSHIFT8
|
||||
#define WMASK WMASK8
|
||||
|
||||
#define LMASK(n) LMASK8(n)
|
||||
#define RMASK(n) RMASK8(n)
|
||||
#define SWAPB(x) SWAPB8(x)
|
||||
|
||||
#endif /* WORDSZ == 8 */
|
||||
|
||||
#define DO_ALU(dst,src,mask,alu) {\
|
||||
int _ndst, _odst; _odst = dst; \
|
||||
switch ( alu ) { \
|
||||
case GXclear: \
|
||||
_ndst = 0; break; \
|
||||
case GXand: \
|
||||
_ndst = src & _odst; break; \
|
||||
case GXandReverse: \
|
||||
_ndst = src & ~ _odst; break; \
|
||||
case GXcopy: \
|
||||
_ndst = src; break; \
|
||||
case GXandInverted: \
|
||||
_ndst = ~ src & _odst; break; \
|
||||
default: \
|
||||
case GXnoop: \
|
||||
_ndst = _odst; break; \
|
||||
case GXxor: \
|
||||
_ndst = src ^ _odst; break; \
|
||||
case GXor: \
|
||||
_ndst = src | _odst; break; \
|
||||
case GXnor: \
|
||||
_ndst = ~ src & ~ _odst; break; \
|
||||
case GXequiv: \
|
||||
_ndst = ~ src ^ _odst; break; \
|
||||
case GXinvert: \
|
||||
_ndst = ~ _odst; break; \
|
||||
case GXorReverse: \
|
||||
_ndst = src | ~ _odst; break; \
|
||||
case GXcopyInverted: \
|
||||
_ndst = ~ src; break; \
|
||||
case GXorInverted: \
|
||||
_ndst = ~ src | _odst; break; \
|
||||
case GXnand: \
|
||||
_ndst = ~ src | ~ _odst; break; \
|
||||
case GXset: \
|
||||
_ndst = ~0; break; \
|
||||
} \
|
||||
dst = (_odst & ~(mask)) | (_ndst & (mask)); \
|
||||
}
|
||||
|
||||
static void aligned_blit(
|
||||
WindowPtr, int, int, int, int, int, int, int, int
|
||||
);
|
||||
|
||||
static void aligned_blit_center(
|
||||
WindowPtr, int, int, int, int, int, int
|
||||
);
|
||||
|
||||
static void shift(
|
||||
WindowPtr, int, int, int, int, int, int, int
|
||||
);
|
||||
|
||||
static void shift_thin_rect(
|
||||
WindowPtr, int, int, int, int, int, int, int
|
||||
);
|
||||
|
||||
static void shift_center(
|
||||
WindowPtr, int, int, int, int, int, int, int
|
||||
);
|
||||
|
||||
void xf4bppBitBlt(pWin,alu,writeplanes,x0,y0,x1,y1,w,h)
|
||||
WindowPtr pWin; /* GJA */
|
||||
int alu;
|
||||
int writeplanes; /* planes */
|
||||
int x0, y0, x1, y1, w, h;
|
||||
{
|
||||
IOADDRESS REGBASE;
|
||||
int plane, bit;
|
||||
|
||||
if ( !w || !h ) return;
|
||||
|
||||
if ( ! xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
|
||||
xf4bppOffBitBlt(pWin,alu,writeplanes,x0,y0,x1,y1,w,h);
|
||||
return;
|
||||
}
|
||||
|
||||
REGBASE =
|
||||
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
|
||||
|
||||
/* 0x7, not WMASK: it is hardware dependant */
|
||||
if ( ((x0 - x1) & 0x7) || (alu != GXcopy) ) {
|
||||
/* Use slow copy */
|
||||
SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
|
||||
SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
|
||||
SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
|
||||
SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
|
||||
|
||||
for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX ;
|
||||
plane ; plane >>= 1, bit-- )
|
||||
{
|
||||
|
||||
if ( writeplanes & plane) {
|
||||
SetVideoGraphics(Read_Map_SelectIndex, bit);
|
||||
SetVideoSequencer(Mask_MapIndex, plane);
|
||||
|
||||
shift(pWin,x0,x1,y0,y1,w,h,alu);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
aligned_blit(pWin,x0,x1,y0,y1,w,h,alu,writeplanes);
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy a span a number of places to the right.
|
||||
*/
|
||||
static void
|
||||
shift(pWin,x0,x1,y0,y1,w,h,alu)
|
||||
WindowPtr pWin; /* GJA */
|
||||
int x0; /* left edge of source */
|
||||
int x1; /* left edge of target */
|
||||
int y0;
|
||||
int y1;
|
||||
int w; /* length of source, and of target */
|
||||
int h;
|
||||
int alu;
|
||||
{
|
||||
if ( ((x1 & WMASK) + w) <= WORDSZ ) {
|
||||
shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu);
|
||||
} else if ( x1 > x0 ) { /* Shift right: start right */
|
||||
int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
|
||||
|
||||
if ( r1 ) /* right edge */
|
||||
shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
|
||||
shift_center(pWin,x0,x1,y0,y1,w,h,alu);
|
||||
if ( l1 ) /* left edge */
|
||||
shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
|
||||
} else {
|
||||
int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
|
||||
|
||||
if ( l1 ) /* left edge */
|
||||
shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
|
||||
shift_center(pWin,x0,x1,y0,y1,w,h,alu);
|
||||
if ( r1 ) /* right edge */
|
||||
shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
|
||||
}
|
||||
}
|
||||
|
||||
/* The whole rectangle is so thin that it fits in one byte written */
|
||||
static void
|
||||
shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu)
|
||||
WindowPtr pWin; /* GJA */
|
||||
int x0; /* left edge of source */
|
||||
int x1; /* left edge of target */
|
||||
int y0;
|
||||
int y1;
|
||||
int w; /* length of source, and of target */
|
||||
int h;
|
||||
int alu;
|
||||
{
|
||||
int l0 = x0 & WMASK; /* Left edge of source, as bit */
|
||||
int l1 = x1 & WMASK; /* Left edge of target, as bit */
|
||||
int L0 = x0 >> WSHIFT; /* Left edge of source, as byte */
|
||||
int L1 = x1 >> WSHIFT; /* Left edge of target, as byte */
|
||||
int pad;
|
||||
int htmp;
|
||||
int mask;
|
||||
int tmp;
|
||||
int bs;
|
||||
|
||||
volatile unsigned char *sp, *dp;
|
||||
|
||||
mask = RMASK(l1) & LMASK(l1+w);
|
||||
bs = (x1 - x0) & WMASK;
|
||||
|
||||
if ( y1 > y0 ) { /* Move down, start at the bottom */
|
||||
pad = - BYTES_PER_LINE(pWin);
|
||||
sp = SMEM(L0,y0+h-1);
|
||||
dp = DMEM(L1,y1+h-1);
|
||||
} else { /* Move up, start at the top */
|
||||
pad = BYTES_PER_LINE(pWin);
|
||||
sp = SMEM(L0,y0);
|
||||
dp = DMEM(L1,y1);
|
||||
}
|
||||
|
||||
if ( l0+w > WORDSZ ) {
|
||||
/* Need two bytes */
|
||||
for ( htmp = h ; htmp ; htmp-- ) {
|
||||
tmp = (sp[0] << (WORDSZ - bs));
|
||||
sp++;
|
||||
tmp |= (sp[0] >> bs);
|
||||
sp--;
|
||||
DO_ALU(dp[0],tmp,mask,alu);
|
||||
dp += pad;
|
||||
sp += pad;
|
||||
}
|
||||
} else if ( l0 <= l1 ) {
|
||||
/* Need one byte, shifted right */
|
||||
for ( htmp = h ; htmp ; htmp-- ) {
|
||||
tmp = (sp[0] >> bs);
|
||||
DO_ALU(dp[0],tmp,mask,alu);
|
||||
dp += pad;
|
||||
sp += pad;
|
||||
}
|
||||
} else {
|
||||
/* Need one byte, shifted left */
|
||||
for ( htmp = h ; htmp ; htmp-- ) {
|
||||
tmp = (sp[0] << (WORDSZ - bs));
|
||||
DO_ALU(dp[0],tmp,mask,alu);
|
||||
dp += pad;
|
||||
sp += pad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
shift_center(pWin,x0,x1,y0,y1,w,h,alu)
|
||||
WindowPtr pWin; /* GJA */
|
||||
int x0; /* left edge of source */
|
||||
int x1; /* left edge of target */
|
||||
int y0;
|
||||
int y1;
|
||||
int w; /* length of source, and of target */
|
||||
int h;
|
||||
int alu;
|
||||
{
|
||||
int l1 = x1 & WMASK; /* Left edge of target, as bit */
|
||||
int r1 = (x1 + w) & WMASK; /* Right edge of target, as bit */
|
||||
int pad;
|
||||
int htmp, wtmp; /* Temporaries for indices over height and width */
|
||||
volatile unsigned char tmp; /* Temporary result of the shifts */
|
||||
int bs;
|
||||
int rem; /* Remaining bits; temporary in loop */
|
||||
int bytecnt;
|
||||
|
||||
volatile unsigned char *sp, *dp;
|
||||
|
||||
bs = (x1 - x0) & WMASK;
|
||||
|
||||
if ( l1 ) {
|
||||
bytecnt = (w - (WORDSZ - l1) - r1) >> WSHIFT;
|
||||
sp = SMEM( ((x0 + (WORDSZ - l1)) >> WSHIFT), y0);
|
||||
dp = DMEM( ((x1 + (WORDSZ - l1)) >> WSHIFT), y1);
|
||||
} else {
|
||||
bytecnt = (w - r1) >> WSHIFT;
|
||||
sp = SMEM( (x0 >> WSHIFT), y0);
|
||||
dp = DMEM( (x1 >> WSHIFT), y1);
|
||||
}
|
||||
|
||||
if ( y1 > y0 ) { /* Move down, start at the bottom */
|
||||
if ( x1 > x0 ) { /* Move right, start right */
|
||||
pad = - BYTES_PER_LINE(pWin) + bytecnt;
|
||||
sp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
|
||||
dp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
|
||||
} else { /* Move left, start left */
|
||||
pad = - BYTES_PER_LINE(pWin) - bytecnt;
|
||||
sp += BYTES_PER_LINE(pWin) * (h - 1);
|
||||
dp += BYTES_PER_LINE(pWin) * (h - 1);
|
||||
}
|
||||
} else { /* Move up, start at the top */
|
||||
if ( x1 > x0 ) { /* Move right, start right */
|
||||
pad = BYTES_PER_LINE(pWin) + bytecnt;
|
||||
sp += bytecnt - 1;
|
||||
dp += bytecnt - 1;
|
||||
} else { /* Move left, start left */
|
||||
pad = BYTES_PER_LINE(pWin) - bytecnt;
|
||||
sp += 0;
|
||||
dp += 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( x1 > x0 ) { /* Move right, start right */
|
||||
if ( bs == 0 ) { /* No shift. Need one byte only */
|
||||
for ( htmp = h ; htmp ; htmp-- ) {
|
||||
for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
|
||||
tmp = sp[0];
|
||||
DO_ALU(dp[0],tmp,~0,alu);
|
||||
dp--;
|
||||
sp--;
|
||||
}
|
||||
dp += pad;
|
||||
sp += pad;
|
||||
}
|
||||
} else {
|
||||
for ( htmp = h ; htmp ; htmp-- ) {
|
||||
if ( bytecnt ) {
|
||||
sp++;
|
||||
rem = sp[0];
|
||||
sp--;
|
||||
for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
|
||||
tmp = (rem >> bs);
|
||||
rem = sp[0];
|
||||
tmp |= (rem << (WORDSZ - bs)) ;
|
||||
DO_ALU(dp[0],tmp,~0,alu);
|
||||
dp--;
|
||||
sp--;
|
||||
}
|
||||
}
|
||||
dp += pad;
|
||||
sp += pad;
|
||||
}
|
||||
}
|
||||
} else { /* x1 <= x0 */ /* Move left, start left */
|
||||
if ( bs == 0 ) { /* No shift. Need one byte only */
|
||||
for ( htmp = h ; htmp ; htmp-- ) {
|
||||
for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
|
||||
tmp = sp[0];
|
||||
DO_ALU(dp[0],tmp,~0,alu);
|
||||
dp++;
|
||||
sp++;
|
||||
}
|
||||
dp += pad;
|
||||
sp += pad;
|
||||
}
|
||||
} else {
|
||||
for ( htmp = h ; htmp ; htmp-- ) {
|
||||
if ( bytecnt ) {
|
||||
rem = sp[0];
|
||||
for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
|
||||
tmp = (rem << (WORDSZ - bs));
|
||||
sp++;
|
||||
rem = sp[0];
|
||||
sp--;
|
||||
tmp |= (rem >> bs);
|
||||
DO_ALU(dp[0],tmp,~0,alu);
|
||||
dp++;
|
||||
sp++;
|
||||
}
|
||||
}
|
||||
dp += pad;
|
||||
sp += pad;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy a rectangle.
|
||||
*/
|
||||
static void
|
||||
aligned_blit(pWin,x0,x1,y0,y1,w,h,alu,planes)
|
||||
WindowPtr pWin; /* GJA */
|
||||
int x0; /* left edge of source */
|
||||
int x1; /* left edge of target */
|
||||
int y0;
|
||||
int y1;
|
||||
int w; /* length of source, and of target */
|
||||
int h;
|
||||
int alu;
|
||||
int planes;
|
||||
{
|
||||
IOADDRESS REGBASE =
|
||||
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
|
||||
int plane, bit;
|
||||
|
||||
if ( ((x1 & WMASK) + w) <= WORDSZ ) {
|
||||
SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
|
||||
SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
|
||||
SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
|
||||
SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
|
||||
|
||||
for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
|
||||
plane ; plane >>= 1, bit-- )
|
||||
{
|
||||
if ( planes & plane) {
|
||||
SetVideoGraphics(Read_Map_SelectIndex, bit);
|
||||
SetVideoSequencer(Mask_MapIndex, plane);
|
||||
|
||||
shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu);
|
||||
}
|
||||
}
|
||||
} else if ( x1 > x0 ) { /* Shift right: start right */
|
||||
int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
|
||||
|
||||
if ( r1 ) { /* right edge */
|
||||
SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
|
||||
SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
|
||||
SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
|
||||
SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
|
||||
|
||||
for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
|
||||
plane ; plane >>= 1, bit-- )
|
||||
{
|
||||
if ( planes & plane) {
|
||||
SetVideoGraphics(Read_Map_SelectIndex, bit);
|
||||
SetVideoSequencer(Mask_MapIndex, plane);
|
||||
|
||||
shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Center */
|
||||
SetVideoGraphics(Graphics_ModeIndex, 1); /* Write mode 1 */
|
||||
SetVideoSequencer(Mask_MapIndex, planes);
|
||||
|
||||
aligned_blit_center(pWin,x0,x1,y0,y1,w,h);
|
||||
|
||||
if ( l1 ) { /* left edge */
|
||||
SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
|
||||
SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
|
||||
SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
|
||||
SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
|
||||
|
||||
for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
|
||||
plane ; plane >>= 1, bit-- )
|
||||
{
|
||||
if ( planes & plane) {
|
||||
SetVideoGraphics(Read_Map_SelectIndex, bit);
|
||||
SetVideoSequencer(Mask_MapIndex, plane);
|
||||
|
||||
shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
|
||||
|
||||
if ( l1 ) { /* left edge */
|
||||
SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
|
||||
SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
|
||||
SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
|
||||
SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
|
||||
|
||||
for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
|
||||
plane ; plane >>= 1, bit-- )
|
||||
{
|
||||
if ( planes & plane) {
|
||||
SetVideoGraphics(Read_Map_SelectIndex, bit);
|
||||
SetVideoSequencer(Mask_MapIndex, plane);
|
||||
|
||||
shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Center */
|
||||
SetVideoGraphics(Graphics_ModeIndex, 1); /* Write mode 1 */
|
||||
SetVideoSequencer(Mask_MapIndex, planes);
|
||||
|
||||
aligned_blit_center(pWin,x0,x1,y0,y1,w,h);
|
||||
|
||||
if ( r1 ) { /* right edge */
|
||||
SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
|
||||
SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
|
||||
SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
|
||||
SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
|
||||
|
||||
for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX ;
|
||||
plane ; plane >>= 1, bit-- )
|
||||
{
|
||||
if ( planes & plane) {
|
||||
SetVideoGraphics(Read_Map_SelectIndex, bit);
|
||||
SetVideoSequencer(Mask_MapIndex, plane);
|
||||
|
||||
shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
aligned_blit_center(pWin,x0,x1,y0,y1,w,h)
|
||||
WindowPtr pWin; /* GJA */
|
||||
int x0; /* left edge of source */
|
||||
int x1; /* left edge of target */
|
||||
int y0;
|
||||
int y1;
|
||||
int w; /* length of source, and of target */
|
||||
int h;
|
||||
{
|
||||
int l1 = x1 & WMASK; /* Left edge of target, as bit */
|
||||
int r1 = (x1 + w) & WMASK; /* Right edge of target, as bit */
|
||||
int pad;
|
||||
int htmp, wtmp; /* Temporaries for indices over height and width */
|
||||
volatile unsigned char tmp; /* Temporary result of the shifts */
|
||||
int bytecnt;
|
||||
|
||||
volatile unsigned char *sp, *dp;
|
||||
|
||||
if ( l1 ) {
|
||||
bytecnt = (w - (WORDSZ - l1) - r1) >> WSHIFT;
|
||||
sp = SMEM( ((x0 + (WORDSZ - l1)) >> WSHIFT), y0);
|
||||
dp = DMEM( ((x1 + (WORDSZ - l1)) >> WSHIFT), y1);
|
||||
} else {
|
||||
bytecnt = (w - r1) >> WSHIFT;
|
||||
sp = SMEM( (x0 >> WSHIFT), y0);
|
||||
dp = DMEM( (x1 >> WSHIFT), y1);
|
||||
}
|
||||
|
||||
if ( y1 > y0 ) { /* Move down, start at the bottom */
|
||||
if ( x1 > x0 ) { /* Move right, start right */
|
||||
pad = - BYTES_PER_LINE(pWin) + bytecnt;
|
||||
sp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
|
||||
dp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
|
||||
} else { /* Move left, start left */
|
||||
pad = - BYTES_PER_LINE(pWin) - bytecnt;
|
||||
sp += BYTES_PER_LINE(pWin) * (h - 1);
|
||||
dp += BYTES_PER_LINE(pWin) * (h - 1);
|
||||
}
|
||||
} else { /* Move up, start at the top */
|
||||
if ( x1 > x0 ) { /* Move right, start right */
|
||||
pad = BYTES_PER_LINE(pWin) + bytecnt;
|
||||
sp += bytecnt - 1;
|
||||
dp += bytecnt - 1;
|
||||
} else { /* Move left, start left */
|
||||
pad = BYTES_PER_LINE(pWin) - bytecnt;
|
||||
sp += 0;
|
||||
dp += 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( x1 > x0 ) { /* Move right, start right */
|
||||
for ( htmp = h ; htmp ; htmp-- ) {
|
||||
for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
|
||||
tmp = sp[0];
|
||||
dp[0] = tmp;
|
||||
dp--;
|
||||
sp--;
|
||||
}
|
||||
dp += pad;
|
||||
sp += pad;
|
||||
}
|
||||
} else { /* x1 <= x0 */ /* Move left, start left */
|
||||
for ( htmp = h ; htmp ; htmp-- ) {
|
||||
for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
|
||||
tmp = sp[0];
|
||||
dp[0] = tmp;
|
||||
dp++;
|
||||
sp++;
|
||||
}
|
||||
dp += pad;
|
||||
sp += pad;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else /* PC98_EGC */
|
||||
|
||||
static void
|
||||
egc_fast_blt (pWin, alu, writeplanes, x0, y0, x1, y1, w, h)
|
||||
WindowPtr pWin;
|
||||
const int alu, writeplanes ;
|
||||
register int x0, x1 ;
|
||||
int y0, y1 ;
|
||||
register int w, h ;
|
||||
{
|
||||
register volatile unsigned char *src ;
|
||||
register volatile unsigned char *dst ;
|
||||
unsigned short *src_x ;
|
||||
unsigned short *dst_x ;
|
||||
int x_direction, y_interval ;
|
||||
int src_off, dst_off ;
|
||||
register int k, i ;
|
||||
unsigned short ROP_value;
|
||||
|
||||
src = (unsigned char *)SCREENADDRESS( pWin, 0, y0);
|
||||
dst = (unsigned char *)SCREENADDRESS( pWin, 0, y1);
|
||||
|
||||
/* Set Map Mask */
|
||||
outw(EGC_PLANE, ~(writeplanes & VGA_ALLPLANES));
|
||||
switch(alu) {
|
||||
case GXnor: /* ~(S|D) */
|
||||
ROP_value = 0x2903;
|
||||
break;
|
||||
case GXandInverted: /* ~S&D */
|
||||
ROP_value = 0x290c;
|
||||
break;
|
||||
case GXand: /* S&D */
|
||||
ROP_value = 0x29c0;
|
||||
break;
|
||||
case GXequiv: /* ~S ^ D */
|
||||
ROP_value = 0x29c3;
|
||||
break;
|
||||
case GXxor: /* S^D */
|
||||
ROP_value = 0x293c;
|
||||
break;
|
||||
case GXandReverse: /* S&~D */
|
||||
ROP_value = 0x2930;
|
||||
break;
|
||||
case GXorReverse: /* S|~D */
|
||||
ROP_value = 0x29f3;
|
||||
break;
|
||||
case GXnand: /* ~(S&D) */
|
||||
ROP_value = 0x293f;
|
||||
break;
|
||||
case GXorInverted: /* ~S|D */
|
||||
ROP_value = 0x29cf;
|
||||
break;
|
||||
case GXor: /* S|D */
|
||||
ROP_value = 0x29fa;
|
||||
break;
|
||||
case GXcopyInverted: /* ~S */
|
||||
ROP_value = 0x290f;
|
||||
break;
|
||||
case GXcopy: /* S */
|
||||
default:
|
||||
ROP_value = 0x29f0;
|
||||
}
|
||||
outw(EGC_MODE, ROP_value);
|
||||
if ( y1 > y0 ) {
|
||||
y_interval = - BYTES_PER_LINE(pWin) * 8 ;
|
||||
src += BYTES_PER_LINE(pWin) * ( h - 1 ) ;
|
||||
dst += BYTES_PER_LINE(pWin) * ( h - 1 ) ;
|
||||
}
|
||||
else {
|
||||
y_interval = BYTES_PER_LINE(pWin) * 8 ;
|
||||
}
|
||||
|
||||
src = (unsigned char *)((int)src << 3) ;
|
||||
dst = (unsigned char *)((int)dst << 3) ;
|
||||
|
||||
if ( y1 > y0) {
|
||||
x_direction = 0x1000 ;
|
||||
src += x0 + w - 1 ;
|
||||
dst += x1 + w - 1 ;
|
||||
} else if ( y1 < y0 ) {
|
||||
x_direction = 0 ;
|
||||
src += x0 ;
|
||||
dst += x1 ;
|
||||
} else {
|
||||
if ( x1 < x0 ) {
|
||||
x_direction = 0 ;
|
||||
src += x0 ;
|
||||
dst += x1 ;
|
||||
} else {
|
||||
x_direction = 0x1000 ;
|
||||
src += x0 + w - 1 ;
|
||||
dst += x1 + w - 1 ;
|
||||
}
|
||||
}
|
||||
outw ( EGC_LENGTH , w - 1 ) ;
|
||||
|
||||
for ( ; h-- ; ) {
|
||||
if ( x_direction ) {
|
||||
src_off = 15 - (int)src & 0xf ;
|
||||
dst_off = 15 - (int)dst & 0xf ;
|
||||
} else {
|
||||
src_off = (int)src & 0xf ;
|
||||
dst_off = (int)dst & 0xf ;
|
||||
}
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
src_x = (unsigned short *)(((unsigned int)src >> 4 ) << 1) ;
|
||||
dst_x = (unsigned short *)(((unsigned int)dst >> 4 ) << 1) ;
|
||||
#else
|
||||
src_x = (unsigned short *)(((int)src >> 4 ) << 1) ;
|
||||
dst_x = (unsigned short *)(((int)dst >> 4 ) << 1) ;
|
||||
#endif
|
||||
k = ( src_off + w + 15 ) >> 4 ;
|
||||
if ( src_off < dst_off ) {
|
||||
if ( ((src_off + w - 1 ) >> 4) < ((dst_off + w - 1) >> 4)) k++ ;
|
||||
}
|
||||
if ( src_off > dst_off ) {
|
||||
if ( ((src_off + w - 1) >> 4 ) == ((dst_off + w - 1) >> 4) ) k++ ;
|
||||
if ( x_direction ) dst_x ++ ;
|
||||
else dst_x -- ;
|
||||
}
|
||||
outw ( EGC_ADD , x_direction | src_off | dst_off << 4 );
|
||||
if ( x_direction ) {
|
||||
wcopyl ( src_x, dst_x, k, VIDBASE(pWin) ) ;
|
||||
} else {
|
||||
wcopyr ( src_x, dst_x, k, VIDBASE(pWin) ) ;
|
||||
}
|
||||
src += y_interval ;
|
||||
dst += y_interval ;
|
||||
}
|
||||
outw ( EGC_ADD, 0 ) ;
|
||||
outw ( EGC_LENGTH , 0xf );
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppBitBlt( pWin,alu, writeplanes, x0, y0, x1, y1, w, h )
|
||||
WindowPtr pWin; /* GJA */
|
||||
int alu;
|
||||
int writeplanes; /* planes */
|
||||
int x0, y0, x1, y1, w, h;
|
||||
{
|
||||
if ( ! xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
|
||||
xf4bppOffBitBlt( pWin, alu, writeplanes,
|
||||
x0, y0, x1, y1, w, h );
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( alu ) {
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
case GXinvert: /* 0xa NOT dst */
|
||||
case GXset: /* 0xf 1 */
|
||||
xf4bppFillSolid( pWin, VGA_ALLPLANES, alu, writeplanes, x1, y1, w, h ) ;
|
||||
/* x1, y1, GJA */
|
||||
case GXnoop: /* 0x5 dst */
|
||||
return ;
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
|
||||
egc_fast_blt ( pWin, alu, writeplanes, x0, y0, x1, y1, w, h);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,213 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 1987 X Consortium
|
||||
|
||||
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 THE X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
|
||||
Copyright IBM Corporation 1987,1988,1989
|
||||
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 IBM not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
IBM 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.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "mfbmap.h"
|
||||
#include "mfb.h"
|
||||
#include "mi.h"
|
||||
#include "ppcGCstr.h"
|
||||
|
||||
void
|
||||
xf4bppChangeGCtype( pGC, devPriv )
|
||||
register GC *pGC ;
|
||||
register ppcPrivGCPtr devPriv ;
|
||||
{
|
||||
if ( devPriv->lastDrawableType == DRAWABLE_PIXMAP ) {
|
||||
pGC->ops->CopyArea = miCopyArea ;
|
||||
pGC->ops->PolyFillRect = miPolyFillRect ;
|
||||
pGC->ops->PushPixels = miPushPixels ;
|
||||
pGC->ops->PolyArc = miPolyArc ;
|
||||
pGC->ops->PolyFillArc = miPolyFillArc ;
|
||||
pGC->ops->PolySegment = miPolySegment ;
|
||||
}
|
||||
else {
|
||||
pGC->ops->CopyArea = xf4bppCopyArea ;
|
||||
pGC->ops->PolyFillRect = xf4bppPolyFillRect ;
|
||||
pGC->ops->PushPixels = miPushPixels ; /* GJA */
|
||||
pGC->ops->PolyArc = xf4bppZeroPolyArc ;
|
||||
pGC->ops->PolyFillArc = xf4bppPolyFillArc ;
|
||||
pGC->ops->PolySegment = xf4bppSegmentSS ;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Mask
|
||||
xf4bppChangeWindowGC( pGC, changes )
|
||||
register GC *pGC ;
|
||||
register Mask changes ;
|
||||
{
|
||||
register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
|
||||
register unsigned long int idx ; /* used for stepping through bitfields */
|
||||
|
||||
#define LOWBIT( x ) ( x & - x ) /* Two's complement */
|
||||
while ((idx = LOWBIT(changes))) {
|
||||
switch ( idx ) {
|
||||
|
||||
case GCLineStyle:
|
||||
case GCLineWidth:
|
||||
pGC->ops->PolyArc = ( ( pGC->lineStyle == LineSolid )
|
||||
? ( ( pGC->lineWidth == 0 ) ? xf4bppZeroPolyArc
|
||||
: miPolyArc )
|
||||
: miPolyArc ) ;
|
||||
pGC->ops->PolySegment = ( ( pGC->lineStyle == LineSolid )
|
||||
? ( ( pGC->lineWidth == 0 )
|
||||
? ( ( pGC->fillStyle == FillSolid ) ?
|
||||
xf4bppSegmentSS : miPolySegment )
|
||||
: miPolySegment )
|
||||
: ( ( pGC->lineWidth == 0 )
|
||||
? ( ( pGC->fillStyle == FillSolid ) ?
|
||||
xf4bppSegmentSD : miPolySegment )
|
||||
: miPolySegment ) ) ;
|
||||
pGC->ops->Polylines = ( ( pGC->lineStyle == LineSolid )
|
||||
? ( ( pGC->lineWidth == 0 )
|
||||
? ( (pGC->fillStyle == FillSolid ) ?
|
||||
xf4bppLineSS : miZeroLine )
|
||||
: miWideLine )
|
||||
: ( ( pGC->lineWidth == 0 )
|
||||
? ( (pGC->fillStyle == FillSolid ) ?
|
||||
xf4bppLineSD : miWideDash )
|
||||
: miWideDash ) ) ;
|
||||
/*
|
||||
* If these are just square boxes with no funny business
|
||||
* going on we can call the fast routine that draws
|
||||
* rectangles without floating point.
|
||||
*/
|
||||
/* too buggy */
|
||||
#if 0
|
||||
if ( ( pGC->lineStyle == LineSolid )
|
||||
&& ( pGC->joinStyle == JoinMiter )
|
||||
&& ( pGC->lineWidth != 0 ) )
|
||||
pGC->ops->PolyRectangle = xf4bppPolyRectangle;
|
||||
else
|
||||
#endif
|
||||
pGC->ops->PolyRectangle = miPolyRectangle;
|
||||
|
||||
changes &= ~( GCLineStyle | GCLineWidth ) ;
|
||||
break ;
|
||||
case GCJoinStyle:
|
||||
/*
|
||||
* If these are just square boxes with no funny business
|
||||
* going on we can call the fast routine that draws
|
||||
* rectangles without floating point.
|
||||
*/
|
||||
/* too buggy */
|
||||
#if 0
|
||||
if ( ( pGC->lineStyle == LineSolid )
|
||||
&& ( pGC->joinStyle == JoinMiter )
|
||||
&& ( pGC->lineWidth != 0 ) )
|
||||
pGC->ops->PolyRectangle = xf4bppPolyRectangle;
|
||||
else
|
||||
#endif
|
||||
pGC->ops->PolyRectangle = miPolyRectangle;
|
||||
changes &= ~ idx ; /* i.e. changes &= ~ GCJoinStyle */
|
||||
break ;
|
||||
|
||||
case GCBackground:
|
||||
if ( pGC->fillStyle != FillOpaqueStippled ) {
|
||||
changes &= ~ idx ; /* i.e. changes &= ~GCBackground */
|
||||
break ;
|
||||
} /* else Fall Through */
|
||||
case GCForeground:
|
||||
if ( pGC->fillStyle == FillTiled ) {
|
||||
changes &= ~ idx ; /* i.e. changes &= ~GCForeground */
|
||||
break ;
|
||||
} /* else Fall Through */
|
||||
case GCFunction:
|
||||
case GCPlaneMask:
|
||||
case GCFillStyle:
|
||||
{ /* new_fill */
|
||||
int fillStyle = devPriv->colorRrop.fillStyle ;
|
||||
/* install a suitable fillspans */
|
||||
if ( fillStyle == FillSolid )
|
||||
pGC->ops->FillSpans = xf4bppSolidWindowFS ;
|
||||
else if ( fillStyle == FillStippled )
|
||||
pGC->ops->FillSpans = xf4bppStippleWindowFS ;
|
||||
else if ( fillStyle == FillOpaqueStippled )
|
||||
pGC->ops->FillSpans = xf4bppOpStippleWindowFS ;
|
||||
else /* fillStyle == FillTiled */
|
||||
pGC->ops->FillSpans = xf4bppTileWindowFS ;
|
||||
} /* end of new_fill */
|
||||
changes &= ~( GCBackground | GCForeground
|
||||
| GCFunction
|
||||
| GCPlaneMask | GCFillStyle ) ;
|
||||
break ;
|
||||
|
||||
default:
|
||||
ErrorF("xf4bppChangeWindowGC: Unexpected GC Change\n") ;
|
||||
changes &= ~ idx ; /* Remove it anyway */
|
||||
break ;
|
||||
}
|
||||
}
|
||||
return changes;
|
||||
}
|
||||
|
|
@ -1,460 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "vgaReg.h"
|
||||
#include "vgaVideo.h"
|
||||
|
||||
#include "xf86str.h" /* for pScrn->vtSema */
|
||||
extern ScrnInfoPtr *xf86Screens;
|
||||
|
||||
#undef TRUE
|
||||
#undef FALSE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
void
|
||||
xf4bppDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes )
|
||||
WindowPtr pWin; /* GJA */
|
||||
int x, y ;
|
||||
register int w, h ;
|
||||
unsigned char *data ;
|
||||
register int RowIncrement ;
|
||||
const int alu ;
|
||||
const unsigned long int planes ;
|
||||
{
|
||||
IOADDRESS REGBASE;
|
||||
register unsigned long int tmp ;
|
||||
register const unsigned char *src ;
|
||||
register volatile unsigned char *dst ;
|
||||
register int Pixel_Count ;
|
||||
register unsigned int currMask ;
|
||||
register unsigned int InitialMask ;
|
||||
register volatile unsigned char *StartByte ;
|
||||
unsigned int invert_source_data = FALSE ;
|
||||
#ifdef PC98_EGC /* new EGC test */
|
||||
register unsigned char tmp1;
|
||||
#endif
|
||||
|
||||
{ /* Start GJA */
|
||||
if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
|
||||
xf4bppOffDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes );
|
||||
return;
|
||||
}
|
||||
} /* End GJA */
|
||||
|
||||
{
|
||||
unsigned int invert_existing_data = FALSE ;
|
||||
unsigned int data_rotate_value = VGA_COPY_MODE ;
|
||||
#ifdef PC98_EGC
|
||||
unsigned short ROP_value;
|
||||
#endif
|
||||
|
||||
REGBASE = 0x300 +
|
||||
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase;
|
||||
|
||||
switch ( alu ) {
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
case GXinvert: /* 0xa NOT dst */
|
||||
case GXset: /* 0xf 1 */
|
||||
xf4bppFillSolid( pWin, VGA_ALLPLANES, alu, planes, x, y, w, h ) ;
|
||||
case GXnoop: /* 0x5 dst */
|
||||
return ;
|
||||
case GXnor: /* 0x8 NOT src AND NOT dst */
|
||||
invert_existing_data = TRUE ;
|
||||
case GXandInverted: /* 0x4 NOT src AND dst */
|
||||
invert_source_data = TRUE ;
|
||||
case GXand: /* 0x1 src AND dst */
|
||||
data_rotate_value = VGA_AND_MODE ;
|
||||
break ;
|
||||
case GXequiv: /* 0x9 NOT src XOR dst */
|
||||
invert_source_data = TRUE ;
|
||||
case GXxor: /* 0x6 src XOR dst */
|
||||
data_rotate_value = VGA_XOR_MODE ;
|
||||
break ;
|
||||
case GXandReverse: /* 0x2 src AND NOT dst */
|
||||
invert_existing_data = TRUE ;
|
||||
data_rotate_value = VGA_AND_MODE ;
|
||||
break ;
|
||||
case GXnand: /* 0xe NOT src OR NOT dst */
|
||||
invert_source_data = TRUE ;
|
||||
case GXorReverse: /* 0xb src OR NOT dst */
|
||||
invert_existing_data = TRUE ;
|
||||
/* GJA -- moved this here */
|
||||
data_rotate_value = VGA_OR_MODE ;
|
||||
break ;
|
||||
case GXorInverted: /* 0xd NOT src OR dst */
|
||||
invert_source_data = TRUE ;
|
||||
case GXor: /* 0x7 src OR dst */
|
||||
data_rotate_value = VGA_OR_MODE ;
|
||||
break ;
|
||||
case GXcopyInverted: /* 0xc NOT src */
|
||||
invert_source_data = TRUE ;
|
||||
case GXcopy: /* 0x3 src */
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
|
||||
#ifdef PC98_EGC
|
||||
/* Setup EGC Registers */
|
||||
switch(data_rotate_value) {
|
||||
/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
|
||||
case VGA_AND_MODE:
|
||||
if (invert_existing_data)
|
||||
ROP_value = EGC_AND_INV_MODE;
|
||||
else
|
||||
ROP_value = EGC_AND_MODE;
|
||||
break;
|
||||
case VGA_OR_MODE:
|
||||
if (invert_existing_data)
|
||||
ROP_value = EGC_OR_INV_MODE;
|
||||
else
|
||||
ROP_value = EGC_OR_MODE;
|
||||
break;
|
||||
case VGA_XOR_MODE:
|
||||
if (invert_existing_data)
|
||||
ROP_value = EGC_XOR_INV_MODE;
|
||||
else
|
||||
ROP_value = EGC_XOR_MODE;
|
||||
break;
|
||||
case VGA_COPY_MODE:
|
||||
default:
|
||||
ROP_value = EGC_COPY_MODE;
|
||||
break;
|
||||
}
|
||||
outw(EGC_PLANE, ~(planes & VGA_ALLPLANES));
|
||||
outw(EGC_MODE, ROP_value);
|
||||
outw(EGC_FGC, 0x0000);
|
||||
tmp1 = 0;
|
||||
#else
|
||||
if ( invert_existing_data )
|
||||
xf4bppFillSolid( pWin, VGA_ALLPLANES, GXinvert, planes, x, y, w, h ) ;
|
||||
/* Setup VGA Registers */
|
||||
SetVideoSequencer( Mask_MapIndex, planes & VGA_ALLPLANES ) ;
|
||||
/* Set Raster Op */
|
||||
SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
|
||||
SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_2 ) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
StartByte = SCREENADDRESS(pWin, x, y);
|
||||
InitialMask = SCRRIGHT8( LeftmostBit, BIT_OFFSET( x ) ) ;
|
||||
if ( invert_source_data )
|
||||
#ifdef PC98_EGC
|
||||
#if 0 /* New EGC version */
|
||||
egc_image_invert ( StartByte, data, InitialMask, w, h,
|
||||
RowIncrement ) ;
|
||||
#else /* new EGC c version */
|
||||
for ( ;
|
||||
h-- ;
|
||||
data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
|
||||
dst = StartByte;
|
||||
for ( src = data,
|
||||
Pixel_Count = w, currMask = InitialMask ;
|
||||
Pixel_Count-- ;
|
||||
src++ ) {
|
||||
if (tmp1 != (~*src & VGA_ALLPLANES)) {
|
||||
tmp1 = ~*src & VGA_ALLPLANES;
|
||||
/* set FGC */
|
||||
outw(EGC_FGC, ~*src & VGA_ALLPLANES);
|
||||
}
|
||||
*((VgaMemoryPtr) dst) = currMask;
|
||||
if ( currMask & RightmostBit ) {
|
||||
currMask = LeftmostBit ;
|
||||
dst++;
|
||||
}
|
||||
else
|
||||
currMask = SCRRIGHT8( currMask, 1 ) ;
|
||||
}
|
||||
}
|
||||
#endif /* new EGC */
|
||||
#else /* original */
|
||||
for ( ;
|
||||
h-- ;
|
||||
data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
|
||||
dst = StartByte;
|
||||
for ( src = data,
|
||||
Pixel_Count = w, currMask = InitialMask ;
|
||||
Pixel_Count-- ;
|
||||
src++ ) {
|
||||
/* Set The Bit Mask Reg */
|
||||
SetVideoGraphics( Bit_MaskIndex, currMask ) ;
|
||||
/* Read To Load vga Data Latches */
|
||||
tmp = *( (VgaMemoryPtr) dst ) ;
|
||||
(void) tmp;
|
||||
*( (VgaMemoryPtr) dst ) = ~ *src ;
|
||||
if ( currMask & RightmostBit ) {
|
||||
currMask = LeftmostBit ;
|
||||
dst++;
|
||||
}
|
||||
else
|
||||
currMask = SCRRIGHT8( currMask, 1 ) ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else /* invert_source_data == FALSE */
|
||||
#ifdef PC98_EGC
|
||||
#if 0 /* new EGC version */
|
||||
egc_image ( StartByte, data, InitialMask, w, h,
|
||||
RowIncrement );
|
||||
#else /* new EGC c version */
|
||||
for ( ;
|
||||
h-- ;
|
||||
data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
|
||||
dst = StartByte;
|
||||
for ( src = data,
|
||||
Pixel_Count = w, currMask = InitialMask ;
|
||||
Pixel_Count-- ;
|
||||
src++ ) {
|
||||
if (tmp1 != *src & VGA_ALLPLANES) {
|
||||
tmp1 = *src & VGA_ALLPLANES;
|
||||
outw(EGC_FGC, tmp1); /* set FGC */
|
||||
}
|
||||
*((VgaMemoryPtr) dst) = currMask; /* write with mask */
|
||||
if ( currMask & RightmostBit ) {
|
||||
currMask = LeftmostBit ;
|
||||
dst++;
|
||||
}
|
||||
else
|
||||
currMask = SCRRIGHT8( currMask, 1 ) ;
|
||||
}
|
||||
}
|
||||
#endif /* new EGC version */
|
||||
#else /* original */
|
||||
for ( ;
|
||||
h-- ;
|
||||
data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
|
||||
dst = StartByte;
|
||||
for ( src = data,
|
||||
Pixel_Count = w, currMask = InitialMask ;
|
||||
Pixel_Count-- ;
|
||||
src++ ) {
|
||||
/* Set The Bit Mask Reg */
|
||||
SetVideoGraphics( Bit_MaskIndex, currMask ) ; /* GJA */
|
||||
/* Read To Load vga Data Latches */
|
||||
tmp = *( (VgaMemoryPtr) dst ) ;
|
||||
(void) tmp;
|
||||
*( (VgaMemoryPtr) dst ) = *src ;
|
||||
if ( currMask & RightmostBit ) {
|
||||
currMask = LeftmostBit ;
|
||||
dst++;
|
||||
}
|
||||
else
|
||||
currMask = SCRRIGHT8( currMask, 1 ) ;
|
||||
}
|
||||
}
|
||||
#endif /* original */
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifndef PC98_EGC
|
||||
static unsigned long int
|
||||
read8Z
|
||||
(
|
||||
IOADDRESS REGBASE,
|
||||
register volatile unsigned char *screen_ptr
|
||||
)
|
||||
{
|
||||
register unsigned long int i ;
|
||||
register unsigned long int j ;
|
||||
|
||||
/* Read One Byte At A Time to get
|
||||
* i == [ Plane 3 ] [ Plane 2 ] [ Plane 1 ] [ Plane 0 ]
|
||||
* into a single register
|
||||
*/
|
||||
SetVideoGraphicsData( 3 ) ;
|
||||
i = *( (VgaMemoryPtr) screen_ptr ) << 8 ;
|
||||
SetVideoGraphicsData( 2 ) ;
|
||||
i |= *( (VgaMemoryPtr) screen_ptr ) ;
|
||||
i <<= 8 ;
|
||||
SetVideoGraphicsData( 1 ) ;
|
||||
i |= *( (VgaMemoryPtr) screen_ptr ) ;
|
||||
i <<= 8 ;
|
||||
SetVideoGraphicsData( 0 ) ;
|
||||
i |= *( (VgaMemoryPtr) screen_ptr ) ;
|
||||
|
||||
/* Push Bits To Get
|
||||
* j == [Pixel 7][Pixel 6][Pixel 5][Pixel 4][Pixel 3][Pixel 2][Pixel 1][Pixel 0]
|
||||
* into one register
|
||||
*/
|
||||
|
||||
j = ( i & 0x1 ) << 4 ;
|
||||
j |= ( i >>= 1 ) & 0x1 ;
|
||||
j <<= 4 ;
|
||||
j |= ( i >>= 1 ) & 0x1 ;
|
||||
j <<= 4 ;
|
||||
j |= ( i >>= 1 ) & 0x1 ;
|
||||
j <<= 4 ;
|
||||
j |= ( i >>= 1 ) & 0x1 ;
|
||||
j <<= 4 ;
|
||||
j |= ( i >>= 1 ) & 0x1 ;
|
||||
j <<= 4 ;
|
||||
j |= ( i >>= 1 ) & 0x1 ;
|
||||
j <<= 4 ;
|
||||
j |= ( i >>= 1 ) & 0x1 ;
|
||||
|
||||
j |= ( i & 0x2 ) << 28 ;
|
||||
j |= ( ( i >>= 1 ) & 0x2 ) << 24 ;
|
||||
j |= ( ( i >>= 1 ) & 0x2 ) << 20 ;
|
||||
j |= ( ( i >>= 1 ) & 0x2 ) << 16 ;
|
||||
j |= ( ( i >>= 1 ) & 0x2 ) << 12 ;
|
||||
j |= ( ( i >>= 1 ) & 0x2 ) << 8 ;
|
||||
j |= ( ( i >>= 1 ) & 0x2 ) << 4 ;
|
||||
j |= ( i >>= 1 ) & 0x2 ;
|
||||
|
||||
j |= ( i & 0x4 ) << 28 ;
|
||||
j |= ( ( i >>= 1 ) & 0x4 ) << 24 ;
|
||||
j |= ( ( i >>= 1 ) & 0x4 ) << 20 ;
|
||||
j |= ( ( i >>= 1 ) & 0x4 ) << 16 ;
|
||||
j |= ( ( i >>= 1 ) & 0x4 ) << 12 ;
|
||||
j |= ( ( i >>= 1 ) & 0x4 ) << 8 ;
|
||||
j |= ( ( i >>= 1 ) & 0x4 ) << 4 ;
|
||||
j |= ( i >>= 1 ) & 0x4 ;
|
||||
|
||||
j |= ( i & 0x8 ) << 28 ;
|
||||
j |= ( ( i >>= 1 ) & 0x8 ) << 24 ;
|
||||
j |= ( ( i >>= 1 ) & 0x8 ) << 20 ;
|
||||
j |= ( ( i >>= 1 ) & 0x8 ) << 16 ;
|
||||
j |= ( ( i >>= 1 ) & 0x8 ) << 12 ;
|
||||
j |= ( ( i >>= 1 ) & 0x8 ) << 8 ;
|
||||
j |= ( ( i >>= 1 ) & 0x8 ) << 4 ;
|
||||
j |= ( i >>= 1 ) & 0x8 ;
|
||||
|
||||
return j ;
|
||||
}
|
||||
#endif /* not PC98_EGC */
|
||||
|
||||
void
|
||||
xf4bppReadColorImage( pWin, x, y, lx, ly, data, RowIncrement )
|
||||
WindowPtr pWin; /* GJA */
|
||||
int x, y ;
|
||||
int lx, ly ;
|
||||
register unsigned char *data ;
|
||||
int RowIncrement ;
|
||||
{
|
||||
IOADDRESS REGBASE;
|
||||
register unsigned long int tmp ;
|
||||
register volatile unsigned char *src ;
|
||||
volatile unsigned char *masterSrc ;
|
||||
int savCenterWidth ;
|
||||
int dx ;
|
||||
int skip ;
|
||||
int center_width ;
|
||||
int ignore ;
|
||||
int pad ;
|
||||
unsigned char tmpc;
|
||||
|
||||
{ /* Start GJA */
|
||||
if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
|
||||
xf4bppOffReadColorImage( pWin, x, y, lx, ly, data, RowIncrement );
|
||||
return;
|
||||
}
|
||||
} /* End GJA */
|
||||
|
||||
if ( ( lx <= 0 ) || ( ly <= 0 ) )
|
||||
return ;
|
||||
|
||||
REGBASE = 0x300 +
|
||||
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase;
|
||||
|
||||
/* Setup VGA Registers */
|
||||
#ifndef PC98_EGC
|
||||
SetVideoGraphicsIndex( Graphics_ModeIndex ) ;
|
||||
tmpc = inb( GraphicsDataRegister );
|
||||
SetVideoGraphicsData( tmpc & ~0x8 ) ; /* Clear the bit */
|
||||
SetVideoGraphicsIndex( Read_Map_SelectIndex ) ;
|
||||
#else
|
||||
outw(EGC_MODE, 0x0800);
|
||||
#endif
|
||||
|
||||
skip = BIT_OFFSET( x ) ;
|
||||
pad = RowIncrement - lx ;
|
||||
ignore = BIT_OFFSET( x + lx ) ;
|
||||
masterSrc = SCREENADDRESS( pWin, x, y ) ;
|
||||
center_width = ROW_OFFSET( x + lx ) - ROW_OFFSET( ( x + 0x7 ) & ~0x7 ) ;
|
||||
|
||||
#define SINGLE_STEP *data++ = tmp & VGA_ALLPLANES ; tmp >>= 4
|
||||
|
||||
|
||||
if ( center_width < 0 ) {
|
||||
src = masterSrc;
|
||||
for ( ; ly-- ; ) {
|
||||
tmp = read8Z( REGBASE, src ) >> ( skip << 2 ) ;
|
||||
for ( dx = lx + 1 ; --dx ; ) {
|
||||
SINGLE_STEP ;
|
||||
}
|
||||
data += pad ;
|
||||
src += BYTES_PER_LINE(pWin);
|
||||
}
|
||||
} else
|
||||
for ( savCenterWidth = center_width ;
|
||||
ly-- ;
|
||||
center_width = savCenterWidth,
|
||||
masterSrc += BYTES_PER_LINE(pWin) ) {
|
||||
src = masterSrc ;
|
||||
tmp = read8Z( REGBASE, src ) ; src++;
|
||||
if ((dx = skip))
|
||||
tmp >>= ( dx << 2 ) ;
|
||||
else
|
||||
if ( lx < 8 ) { /* kludge -- GJA */
|
||||
--center_width ; /* kludge -- GJA */
|
||||
dx = 8 - lx ; /* kludge -- GJA */
|
||||
} else /* kludge -- GJA */
|
||||
--center_width ;
|
||||
BranchPoint:
|
||||
switch ( dx ) {
|
||||
LoopTop:
|
||||
case 0x0: SINGLE_STEP ;
|
||||
case 0x1: SINGLE_STEP ;
|
||||
case 0x2: SINGLE_STEP ;
|
||||
case 0x3: SINGLE_STEP ;
|
||||
case 0x4: SINGLE_STEP ;
|
||||
case 0x5: SINGLE_STEP ;
|
||||
case 0x6: SINGLE_STEP ;
|
||||
case 0x7: *data++ = tmp & VGA_ALLPLANES ;
|
||||
|
||||
/* Fall Through To End Of Inner Loop */
|
||||
if ( center_width > 0 ) {
|
||||
tmp = read8Z( REGBASE, src ) ; src++;
|
||||
center_width-- ;
|
||||
goto LoopTop ;
|
||||
}
|
||||
else if ( ( center_width == 0 )
|
||||
&& ( dx = ( - ignore ) & 07 ) ) {
|
||||
tmp = read8Z( REGBASE, src ) ; src++;
|
||||
center_width-- ;
|
||||
goto BranchPoint ; /* Do Mod 8 edge */
|
||||
}
|
||||
else /* End of this line */
|
||||
data += pad ;
|
||||
}
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SET_BYTE_REGISTER( ioport, value ) outb( ioport, value )
|
||||
#define SET_INDEX_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value )
|
||||
#define SET_DATA_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value )
|
||||
/* GJA -- deleted RTIO and ATRIO case here, so that a PCIO #define became
|
||||
* superfluous.
|
||||
*/
|
||||
#define SET_INDEXED_REGISTER(RegGroup, Index, Value) \
|
||||
(SET_BYTE_REGISTER(RegGroup, Index), \
|
||||
SET_BYTE_REGISTER((RegGroup) + 1, Value))
|
||||
|
||||
/* There is a jumper on the ega to change this to 0x200 instead !! */
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#if 0 /* This is now a stack variable, as needed */
|
||||
#define REGBASE 0x300
|
||||
#endif
|
||||
|
||||
#define AttributeIndexRegister REGBASE + 0xC0
|
||||
#define AttributeDataWriteRegister REGBASE + 0xC0
|
||||
#define AttributeDataReadRegister REGBASE + 0xC1
|
||||
#define AttributeRegister AttributeIndexRegister
|
||||
#define AttributeModeIndex 0x30
|
||||
#define OverScanColorIndex 0x31
|
||||
#define ColorPlaneEnableIndex 0x32
|
||||
#define HorizPelPanIndex 0x33
|
||||
#define ColorSelectIndex 0x34
|
||||
#ifndef PC98_EGC
|
||||
#define SetVideoAttributeIndex( index ) \
|
||||
SET_INDEX_REGISTER( AttributeIndexRegister, index )
|
||||
#define SetVideoAttribute( index, value ) \
|
||||
SetVideoAttributeIndex( index ) ; \
|
||||
SET_BYTE_REGISTER( AttributeDataWriteRegister, value )
|
||||
#endif
|
||||
|
||||
/* Graphics Registers 03CE & 03CF */
|
||||
#define GraphicsIndexRegister REGBASE + 0xCE
|
||||
#define GraphicsDataRegister REGBASE + 0xCF
|
||||
#define GraphicsRegister GraphicsIndexRegister
|
||||
#define Set_ResetIndex 0x00
|
||||
#define Enb_Set_ResetIndex 0x01
|
||||
#define Color_CompareIndex 0x02
|
||||
#define Data_RotateIndex 0x03
|
||||
#define Read_Map_SelectIndex 0x04
|
||||
#define Graphics_ModeIndex 0x05
|
||||
#define MiscellaneousIndex 0x06
|
||||
#define Color_Dont_CareIndex 0x07
|
||||
#define Bit_MaskIndex 0x08
|
||||
#ifndef PC98_EGC
|
||||
#define SetVideoGraphicsIndex( index ) \
|
||||
SET_INDEX_REGISTER( GraphicsIndexRegister, index )
|
||||
#define SetVideoGraphicsData( value ) \
|
||||
SET_INDEX_REGISTER( GraphicsDataRegister, value )
|
||||
#define SetVideoGraphics( index, value ) \
|
||||
SET_INDEXED_REGISTER( GraphicsRegister, index, value )
|
||||
#endif
|
||||
|
||||
/* Sequencer Registers 03C4 & 03C5 */
|
||||
#define SequencerIndexRegister REGBASE + 0xC4
|
||||
#define SequencerDataRegister REGBASE + 0xC5
|
||||
#define SequencerRegister SequencerIndexRegister
|
||||
#define Seq_ResetIndex 00
|
||||
#define Clock_ModeIndex 01
|
||||
#define Mask_MapIndex 02
|
||||
#define Char_Map_SelectIndex 03
|
||||
#define Memory_ModeIndex 04
|
||||
#ifndef PC98_EGC
|
||||
#define SetVideoSequencerIndex( index ) \
|
||||
SET_INDEX_REGISTER( SequencerIndexRegister, index )
|
||||
#define SetVideoSequencer( index, value ) \
|
||||
SET_INDEXED_REGISTER( SequencerRegister, index, value )
|
||||
#endif
|
||||
|
||||
/* BIT CONSTANTS FOR THE VGA/EGA HARDWARE */
|
||||
/* for the Graphics' Data_Rotate Register */
|
||||
#define VGA_ROTATE_FUNC_SHIFT 3
|
||||
#define VGA_COPY_MODE ( 0 << VGA_ROTATE_FUNC_SHIFT ) /* 0x00 */
|
||||
#define VGA_AND_MODE ( 1 << VGA_ROTATE_FUNC_SHIFT ) /* 0x08 */
|
||||
#define VGA_OR_MODE ( 2 << VGA_ROTATE_FUNC_SHIFT ) /* 0x10 */
|
||||
#define VGA_XOR_MODE ( 3 << VGA_ROTATE_FUNC_SHIFT ) /* 0x18 */
|
||||
/* for the Graphics' Graphics_Mode Register */
|
||||
#define VGA_READ_MODE_SHIFT 3
|
||||
#define VGA_WRITE_MODE_0 0
|
||||
#define VGA_WRITE_MODE_1 1
|
||||
#define VGA_WRITE_MODE_2 2
|
||||
#define VGA_WRITE_MODE_3 3
|
||||
#define VGA_READ_MODE_0 ( 0 << VGA_READ_MODE_SHIFT )
|
||||
#define VGA_READ_MODE_1 ( 1 << VGA_READ_MODE_SHIFT )
|
||||
|
||||
#ifdef PC98_EGC
|
||||
/* I/O port address define for extended EGC */
|
||||
#define EGC_PLANE 0x4a0 /* EGC active plane select */
|
||||
#define EGC_READ 0x4a2 /* EGC FGC,EGC,Read Plane */
|
||||
#define EGC_MODE 0x4a4 /* EGC Mode register & ROP */
|
||||
#define EGC_FGC 0x4a6 /* EGC Forground color */
|
||||
#define EGC_MASK 0x4a8 /* EGC Mask register */
|
||||
#define EGC_BGC 0x4aa /* EGC Background color */
|
||||
#define EGC_ADD 0x4ac /* EGC Dest/Source address */
|
||||
#define EGC_LENGTH 0x4ae /* EGC Bit length */
|
||||
|
||||
#define PALETTE_ADD 0xa8 /* Palette address */
|
||||
#define PALETTE_GRE 0xaa /* Palette Green */
|
||||
#define PALETTE_RED 0xac /* Palette Red */
|
||||
#define PALETTE_BLU 0xae /* Palette Blue */
|
||||
|
||||
#define EGC_AND_MODE 0x2c8c /* (S&P&D)|(~S&D) */
|
||||
#define EGC_AND_INV_MODE 0x2c2c /* (S&P&~D)|(~S&D) */
|
||||
#define EGC_OR_MODE 0x2cec /* S&(P|D)|(~S&D) */
|
||||
#define EGC_OR_INV_MODE 0x2cbc /* S&(P|~D)|(~S&D) */
|
||||
#define EGC_XOR_MODE 0x2c6c /* (S&(P&~D|~P&D))|(~S&D) */
|
||||
#define EGC_XOR_INV_MODE 0x2c9c /* (S&(P&D)|(~P&~D))|(~S&D) */
|
||||
#define EGC_COPY_MODE 0x2cac /* (S&P)|(~S&D) */
|
||||
#endif
|
||||
|
|
@ -1,574 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "vgaReg.h"
|
||||
#include "vgaVideo.h"
|
||||
|
||||
#include "xf86str.h" /* for pScrn->vtSema */
|
||||
extern ScrnInfoPtr *xf86Screens;
|
||||
|
||||
#undef TRUE
|
||||
#undef FALSE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#ifndef PC98_EGC
|
||||
#ifdef USE_ASM
|
||||
extern void fastFill();
|
||||
extern void fastFillRMW();
|
||||
#else
|
||||
|
||||
static void fastFill
|
||||
(
|
||||
register volatile unsigned char *destination,
|
||||
register const unsigned int bytes_per_line,
|
||||
register const unsigned int bytewidth, /* MUST BE > 0 !! */
|
||||
register unsigned int height /* MUST BE > 0 !! */
|
||||
)
|
||||
{
|
||||
int stop_count = bytewidth ;
|
||||
register int row_jump = bytes_per_line - bytewidth ;
|
||||
#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__)
|
||||
register const unsigned int notZero = ((unsigned char)(~0x0));
|
||||
#else
|
||||
#define notZero ((unsigned char)(~0))
|
||||
#endif
|
||||
|
||||
#define SINGLE_STORE \
|
||||
( *( (VgaMemoryPtr) destination ) = notZero ); \
|
||||
destination++; stop_count--;
|
||||
|
||||
/* TOP OF FIRST LOOP */
|
||||
BranchPoint:
|
||||
|
||||
switch ( bytewidth & 0xF ) { /* Jump into loop at mod 16 remainder */
|
||||
LoopTop :
|
||||
case 0x0 : SINGLE_STORE ;
|
||||
case 0xF : SINGLE_STORE ;
|
||||
case 0xE : SINGLE_STORE ;
|
||||
case 0xD : SINGLE_STORE ;
|
||||
case 0xC : SINGLE_STORE ;
|
||||
case 0xB : SINGLE_STORE ;
|
||||
case 0xA : SINGLE_STORE ;
|
||||
case 0x9 : SINGLE_STORE ;
|
||||
case 0x8 : SINGLE_STORE ;
|
||||
case 0x7 : SINGLE_STORE ;
|
||||
case 0x6 : SINGLE_STORE ;
|
||||
case 0x5 : SINGLE_STORE ;
|
||||
case 0x4 : SINGLE_STORE ;
|
||||
case 0x3 : SINGLE_STORE ;
|
||||
case 0x2 : SINGLE_STORE ;
|
||||
case 0x1 : SINGLE_STORE ;
|
||||
/* FIRST LOOP */
|
||||
if ( stop_count )
|
||||
goto LoopTop ;
|
||||
/* SECOND LOOP */
|
||||
if ( --height ) {
|
||||
destination += row_jump ;
|
||||
stop_count = bytewidth ;
|
||||
goto BranchPoint ;
|
||||
}
|
||||
else
|
||||
return ;
|
||||
#undef SINGLE_STORE
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
/* For Read-Modify-Write Case */
|
||||
static void fastFillRMW
|
||||
(
|
||||
register volatile unsigned char *destination,
|
||||
register const unsigned int bytes_per_line,
|
||||
register const unsigned int bytewidth, /* MUST BE > 0 !! */
|
||||
register unsigned int height /* MUST BE > 0 !! */
|
||||
)
|
||||
{
|
||||
int stop_count = bytewidth ;
|
||||
register int row_jump = bytes_per_line - bytewidth ;
|
||||
#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__)
|
||||
register const unsigned int notZero = ((unsigned char)(~0x0));
|
||||
#endif
|
||||
register int tmp ;
|
||||
|
||||
#define SINGLE_STORE \
|
||||
tmp = *( (VgaMemoryPtr) destination ) ; (void)tmp; \
|
||||
( *( (VgaMemoryPtr) destination ) = notZero ) ; \
|
||||
destination++; stop_count-- ;
|
||||
|
||||
/* TOP OF FIRST LOOP */
|
||||
BranchPoint:
|
||||
|
||||
switch ( bytewidth & 0xF ) { /* Jump into loop at mod 16 remainder */
|
||||
LoopTop :
|
||||
case 0x0 : SINGLE_STORE ;
|
||||
case 0xF : SINGLE_STORE ;
|
||||
case 0xE : SINGLE_STORE ;
|
||||
case 0xD : SINGLE_STORE ;
|
||||
case 0xC : SINGLE_STORE ;
|
||||
case 0xB : SINGLE_STORE ;
|
||||
case 0xA : SINGLE_STORE ;
|
||||
case 0x9 : SINGLE_STORE ;
|
||||
case 0x8 : SINGLE_STORE ;
|
||||
case 0x7 : SINGLE_STORE ;
|
||||
case 0x6 : SINGLE_STORE ;
|
||||
case 0x5 : SINGLE_STORE ;
|
||||
case 0x4 : SINGLE_STORE ;
|
||||
case 0x3 : SINGLE_STORE ;
|
||||
case 0x2 : SINGLE_STORE ;
|
||||
case 0x1 : SINGLE_STORE ;
|
||||
/* FIRST LOOP */
|
||||
if ( stop_count )
|
||||
goto LoopTop ;
|
||||
/* SECOND LOOP */
|
||||
if ( --height ) {
|
||||
destination += row_jump ;
|
||||
stop_count = bytewidth ;
|
||||
goto BranchPoint ;
|
||||
}
|
||||
else
|
||||
return ;
|
||||
}
|
||||
#undef SINGLE_STORE
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void xf4bppFillSolid( pWin, color, alu, planes, x0, y0, lx, ly )
|
||||
WindowPtr pWin; /* GJA */
|
||||
unsigned long int color ;
|
||||
const int alu ;
|
||||
unsigned long int planes ;
|
||||
register int x0 ;
|
||||
register const int y0 ;
|
||||
register int lx ;
|
||||
register const int ly ; /* MUST BE > 0 !! */
|
||||
{
|
||||
IOADDRESS REGBASE;
|
||||
register volatile unsigned char *dst ;
|
||||
register int tmp ;
|
||||
register int tmp2 ;
|
||||
register int tmp3 ;
|
||||
unsigned int data_rotate_value = VGA_COPY_MODE ;
|
||||
unsigned int read_write_modify = FALSE ;
|
||||
unsigned int invert_existing_data = FALSE ;
|
||||
|
||||
{ /* Start GJA */
|
||||
if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
|
||||
xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly );
|
||||
return;
|
||||
}
|
||||
} /* End GJA */
|
||||
|
||||
if ( ( lx == 0 ) || ( ly == 0 ) )
|
||||
return;
|
||||
|
||||
switch ( alu ) {
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
color = 0 ;
|
||||
break ;
|
||||
case GXnor: /* 0x8 NOT src AND NOT dst */
|
||||
invert_existing_data = TRUE ;
|
||||
case GXandInverted: /* 0x4 NOT src AND dst */
|
||||
color = ~color ;
|
||||
case GXand: /* 0x1 src AND dst */
|
||||
data_rotate_value = VGA_AND_MODE ;
|
||||
read_write_modify = TRUE ;
|
||||
case GXcopy: /* 0x3 src */
|
||||
break ;
|
||||
case GXnoop: /* 0x5 dst */
|
||||
return ;
|
||||
case GXequiv: /* 0x9 NOT src XOR dst */
|
||||
color = ~color ;
|
||||
case GXxor: /* 0x6 src XOR dst */
|
||||
data_rotate_value = VGA_XOR_MODE ;
|
||||
read_write_modify = TRUE ;
|
||||
planes &= color ;
|
||||
break ;
|
||||
case GXandReverse: /* 0x2 src AND NOT dst */
|
||||
invert_existing_data = TRUE ;
|
||||
data_rotate_value = VGA_AND_MODE ;
|
||||
read_write_modify = TRUE ;
|
||||
break ;
|
||||
case GXorReverse: /* 0xb src OR NOT dst */
|
||||
invert_existing_data = TRUE ;
|
||||
data_rotate_value = VGA_OR_MODE ;
|
||||
read_write_modify = TRUE ;
|
||||
break ;
|
||||
case GXnand: /* 0xe NOT src OR NOT dst */
|
||||
invert_existing_data = TRUE ;
|
||||
case GXorInverted: /* 0xd NOT src OR dst */
|
||||
color = ~color ;
|
||||
case GXor: /* 0x7 src OR dst */
|
||||
data_rotate_value = VGA_OR_MODE ;
|
||||
read_write_modify = TRUE ;
|
||||
break ;
|
||||
case GXcopyInverted: /* 0xc NOT src */
|
||||
color = ~color ;
|
||||
break ;
|
||||
case GXinvert: /* 0xa NOT dst */
|
||||
data_rotate_value = VGA_XOR_MODE ;
|
||||
read_write_modify = TRUE ;
|
||||
case GXset: /* 0xf 1 */
|
||||
color = VGA_ALLPLANES ;
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
|
||||
if ( !( planes &= VGA_ALLPLANES ) )
|
||||
return ;
|
||||
|
||||
REGBASE =
|
||||
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
|
||||
|
||||
/*
|
||||
* Set The Plane-Enable
|
||||
*/
|
||||
SetVideoSequencer( Mask_MapIndex, planes ) ;
|
||||
SetVideoGraphics( Enb_Set_ResetIndex, planes ) ;
|
||||
/*
|
||||
* Put Display Into SET/RESET Write Mode
|
||||
*/
|
||||
SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_3 ) ;
|
||||
/*
|
||||
* Set The Color in The Set/Reset Register
|
||||
*/
|
||||
SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
|
||||
/*
|
||||
* Set The Function-Select In The Data Rotate Register
|
||||
*/
|
||||
SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
|
||||
|
||||
/* Do Left Edge */
|
||||
if ((tmp = x0 & 07)) {
|
||||
tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp ) ;
|
||||
/* Catch The Cases Where The Entire Region Is Within One Byte */
|
||||
if ( ( lx -= 8 - tmp ) < 0 ) {
|
||||
tmp2 &= SCRLEFT8( 0xFF, -lx ) ;
|
||||
lx = 0 ;
|
||||
}
|
||||
/* Set The Bit Mask Reg */
|
||||
SetVideoGraphics(Bit_MaskIndex, tmp2 ) ;
|
||||
if ( invert_existing_data == TRUE ) {
|
||||
SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ;
|
||||
SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ;
|
||||
dst = SCREENADDRESS( pWin, x0, y0 );
|
||||
for ( tmp = ly;
|
||||
tmp-- ; ) {
|
||||
tmp3 = *( (VgaMemoryPtr) dst ) ;
|
||||
(void)tmp3;
|
||||
*( (VgaMemoryPtr) dst ) = tmp2 ;
|
||||
dst += BYTES_PER_LINE(pWin);
|
||||
}
|
||||
SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
|
||||
SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
|
||||
/* Un-Set XOR */
|
||||
}
|
||||
dst = SCREENADDRESS( pWin, x0, y0 );
|
||||
for ( tmp = ly;
|
||||
tmp-- ; ) {
|
||||
tmp3 = *( (VgaMemoryPtr) dst ) ;
|
||||
(void)tmp3;
|
||||
*( (VgaMemoryPtr) dst ) = tmp2 ;
|
||||
dst += BYTES_PER_LINE(pWin);
|
||||
}
|
||||
if ( !lx ) { /* All Handled In This Byte */
|
||||
return ;
|
||||
}
|
||||
x0 = ( x0 + 8 ) & ~07 ;
|
||||
}
|
||||
|
||||
/* Fill The Center Of The Box */
|
||||
if ( ROW_OFFSET( lx ) ) {
|
||||
SetVideoGraphics(Bit_MaskIndex, 0xFF ) ;
|
||||
if ( invert_existing_data == TRUE ) {
|
||||
SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ;
|
||||
SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ;
|
||||
fastFillRMW( SCREENADDRESS( pWin, x0, y0 ),
|
||||
BYTES_PER_LINE(pWin),
|
||||
ROW_OFFSET( lx ), ly ) ;
|
||||
SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
|
||||
SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
|
||||
/* Un-Set XOR */
|
||||
/* Point At The Bit Mask Reg */
|
||||
}
|
||||
(* ( ( read_write_modify == FALSE ) ? fastFill : fastFillRMW ) )
|
||||
( SCREENADDRESS( pWin, x0, y0 ), BYTES_PER_LINE(pWin),
|
||||
ROW_OFFSET( lx ), ly ) ;
|
||||
}
|
||||
|
||||
/* Do Right Edge */
|
||||
if ((tmp = BIT_OFFSET(lx))) { /* x0 Now Is Byte Aligned */
|
||||
/* Set The Bit Mask */
|
||||
SetVideoGraphics( Bit_MaskIndex,
|
||||
(tmp2 = SCRLEFT8( 0xFF, ( 8 - tmp ) ) ) ) ;
|
||||
if ( invert_existing_data == TRUE ) {
|
||||
SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ;
|
||||
SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ;
|
||||
dst = SCREENADDRESS( pWin, ( x0 + lx ), y0 );
|
||||
for ( tmp = ly;
|
||||
tmp-- ; ) {
|
||||
tmp3 = *( (VgaMemoryPtr) dst ) ;
|
||||
(void)tmp3;
|
||||
*( (VgaMemoryPtr) dst ) = tmp2 ;
|
||||
dst += BYTES_PER_LINE(pWin);
|
||||
}
|
||||
SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
|
||||
SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
|
||||
/* Un-Set XOR */
|
||||
}
|
||||
dst = SCREENADDRESS( pWin, ( x0 + lx ), y0 );
|
||||
for ( tmp = ly;
|
||||
tmp-- ; ) {
|
||||
tmp3 = *( (VgaMemoryPtr) dst ) ;
|
||||
(void)tmp3;
|
||||
*( (VgaMemoryPtr) dst ) = tmp2 ;
|
||||
dst += BYTES_PER_LINE(pWin) ;
|
||||
}
|
||||
}
|
||||
/* Disable Set/Reset Register */
|
||||
SetVideoGraphics( Enb_Set_ResetIndex, 0 ) ;
|
||||
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
#else /* for PC98 EGC */
|
||||
static void WordfastFill( destination, bytes_per_line, wordwidth, height )
|
||||
register volatile unsigned char *destination ;
|
||||
register const unsigned int bytes_per_line ;
|
||||
register const unsigned int wordwidth ; /* MUST BE > 0 !! */
|
||||
register unsigned int height ; /* MUST BE > 0 !! */
|
||||
{
|
||||
int stop_count = wordwidth ;
|
||||
register int row_jump = bytes_per_line - wordwidth*2 ;
|
||||
#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__) && 0
|
||||
register const int notZero = ~0x0 ;
|
||||
#else
|
||||
#define notZero ( ~0 )
|
||||
#endif
|
||||
|
||||
#define SINGLE_STORE \
|
||||
( *( (unsigned short *) destination++ ) = notZero ); \
|
||||
destination++; stop_count--;
|
||||
|
||||
/* TOP OF FIRST LOOP */
|
||||
BranchPoint:
|
||||
|
||||
switch ( wordwidth & 0xF ) { /* Jump into loop at mod 16 remainder */
|
||||
LoopTop :
|
||||
case 0x0 : SINGLE_STORE ;
|
||||
case 0xF : SINGLE_STORE ;
|
||||
case 0xE : SINGLE_STORE ;
|
||||
case 0xD : SINGLE_STORE ;
|
||||
case 0xC : SINGLE_STORE ;
|
||||
case 0xB : SINGLE_STORE ;
|
||||
case 0xA : SINGLE_STORE ;
|
||||
case 0x9 : SINGLE_STORE ;
|
||||
case 0x8 : SINGLE_STORE ;
|
||||
case 0x7 : SINGLE_STORE ;
|
||||
case 0x6 : SINGLE_STORE ;
|
||||
case 0x5 : SINGLE_STORE ;
|
||||
case 0x4 : SINGLE_STORE ;
|
||||
case 0x3 : SINGLE_STORE ;
|
||||
case 0x2 : SINGLE_STORE ;
|
||||
case 0x1 : SINGLE_STORE ;
|
||||
/* FIRST LOOP */
|
||||
if ( stop_count )
|
||||
goto LoopTop ;
|
||||
/* SECOND LOOP */
|
||||
if ( --height ) {
|
||||
destination += row_jump ;
|
||||
stop_count = wordwidth ;
|
||||
goto BranchPoint ;
|
||||
}
|
||||
else
|
||||
return ;
|
||||
#undef SINGLE_STORE
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
void xf4bppFillSolid( pWin, color, alu, planes, x0, y0, lx, ly )
|
||||
WindowPtr pWin; /* GJA */
|
||||
unsigned long int color ;
|
||||
const int alu ;
|
||||
unsigned long int planes ;
|
||||
register int x0 ;
|
||||
register const int y0 ;
|
||||
register int lx ;
|
||||
register const int ly ; /* MUST BE > 0 !! */
|
||||
{
|
||||
register volatile unsigned char *dst ;
|
||||
register tmp ;
|
||||
register tmp2 ;
|
||||
register unsigned short tmp3 ;
|
||||
unsigned short ROP_value;
|
||||
unsigned int data_rotate_value = VGA_COPY_MODE ;
|
||||
unsigned int read_write_modify = FALSE ;
|
||||
unsigned int invert_existing_data = FALSE ;
|
||||
|
||||
{ /* Start GJA */
|
||||
if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
|
||||
xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly );
|
||||
return;
|
||||
}
|
||||
} /* End GJA */
|
||||
|
||||
if ( ( lx == 0 ) || ( ly == 0 ) )
|
||||
return;
|
||||
|
||||
switch ( alu ) {
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
color = 0 ;
|
||||
break ;
|
||||
case GXnor: /* 0x8 NOT src AND NOT dst */
|
||||
invert_existing_data = TRUE ;
|
||||
case GXandInverted: /* 0x4 NOT src AND dst */
|
||||
color = ~color ;
|
||||
case GXand: /* 0x1 src AND dst */
|
||||
data_rotate_value = VGA_AND_MODE ;
|
||||
read_write_modify = TRUE ;
|
||||
case GXcopy: /* 0x3 src */
|
||||
break ;
|
||||
case GXnoop: /* 0x5 dst */
|
||||
return ;
|
||||
case GXequiv: /* 0x9 NOT src XOR dst */
|
||||
color = ~color ;
|
||||
case GXxor: /* 0x6 src XOR dst */
|
||||
data_rotate_value = VGA_XOR_MODE ;
|
||||
read_write_modify = TRUE ;
|
||||
planes &= color ;
|
||||
break ;
|
||||
case GXandReverse: /* 0x2 src AND NOT dst */
|
||||
invert_existing_data = TRUE ;
|
||||
data_rotate_value = VGA_AND_MODE ;
|
||||
read_write_modify = TRUE ;
|
||||
break ;
|
||||
case GXorReverse: /* 0xb src OR NOT dst */
|
||||
invert_existing_data = TRUE ;
|
||||
data_rotate_value = VGA_OR_MODE ;
|
||||
read_write_modify = TRUE ;
|
||||
break ;
|
||||
case GXnand: /* 0xe NOT src OR NOT dst */
|
||||
invert_existing_data = TRUE ;
|
||||
case GXorInverted: /* 0xd NOT src OR dst */
|
||||
color = ~color ;
|
||||
case GXor: /* 0x7 src OR dst */
|
||||
data_rotate_value = VGA_OR_MODE ;
|
||||
read_write_modify = TRUE ;
|
||||
break ;
|
||||
case GXcopyInverted: /* 0xc NOT src */
|
||||
color = ~color ;
|
||||
break ;
|
||||
case GXinvert: /* 0xa NOT dst */
|
||||
data_rotate_value = VGA_XOR_MODE ;
|
||||
read_write_modify = TRUE ;
|
||||
case GXset: /* 0xf 1 */
|
||||
color = VGA_ALLPLANES ;
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
|
||||
if ( !( planes &= VGA_ALLPLANES ) )
|
||||
return ;
|
||||
|
||||
/* Set Access Planes */
|
||||
outw(EGC_PLANE, ~planes);
|
||||
switch(data_rotate_value) {
|
||||
/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
|
||||
case VGA_AND_MODE:
|
||||
if (invert_existing_data)
|
||||
ROP_value = EGC_AND_INV_MODE;
|
||||
else
|
||||
ROP_value = EGC_AND_MODE;
|
||||
break;
|
||||
case VGA_OR_MODE:
|
||||
if (invert_existing_data)
|
||||
ROP_value = EGC_OR_INV_MODE;
|
||||
else
|
||||
ROP_value = EGC_OR_MODE;
|
||||
break;
|
||||
case VGA_XOR_MODE:
|
||||
if (invert_existing_data)
|
||||
ROP_value = EGC_XOR_INV_MODE;
|
||||
else
|
||||
ROP_value = EGC_XOR_MODE;
|
||||
break;
|
||||
case VGA_COPY_MODE:
|
||||
default:
|
||||
ROP_value = EGC_COPY_MODE;
|
||||
break;
|
||||
}
|
||||
outw(EGC_MODE, ROP_value);
|
||||
outw(EGC_FGC, color & VGA_ALLPLANES);
|
||||
/* Do Left Edge */
|
||||
if ( tmp = x0 & 0x0f ) {
|
||||
dst = (unsigned char *)((int)(SCREENADDRESS(pWin,x0,y0)) & ~0x01);
|
||||
tmp3 = (unsigned)0xffff >>tmp;
|
||||
/* Catch The Cases Where The Entire Region Is Within One Word */
|
||||
if ( ( lx -= 16 - tmp ) < 0 ) {
|
||||
tmp3 &= (unsigned)0xffff << -lx;
|
||||
lx = 0 ;
|
||||
}
|
||||
tmp3 = (unsigned short)(tmp3 >> 8 | tmp3 << 8);
|
||||
for ( tmp = ly;
|
||||
tmp-- ; ) {
|
||||
*((unsigned short *) dst ) = tmp3 ;
|
||||
dst += BYTES_PER_LINE(pWin);
|
||||
}
|
||||
if ( !lx ) { /* All Handled In This Word */
|
||||
return ;
|
||||
}
|
||||
x0 = ( x0 + 0x0f ) & ~0x0f ;
|
||||
}
|
||||
|
||||
/* Fill The Center Of The Box */
|
||||
if (lx >> 4) {
|
||||
WordfastFill( SCREENADDRESS( pWin, x0, y0 ), BYTES_PER_LINE(pWin),
|
||||
(lx >> 4), ly ) ;
|
||||
}
|
||||
|
||||
/* Do Right Edge */
|
||||
if ( tmp = lx & 0x0f ) { /* x0 Now Is Word Aligned */
|
||||
/* Set The Bit Mask */
|
||||
tmp3 = (unsigned)0xffff << ( 16 - tmp );
|
||||
dst = (unsigned char*)((int)SCREENADDRESS(pWin,(x0+lx),y0) & ~0x01);
|
||||
tmp3 = (unsigned short)(tmp3 >> 8 | tmp3 << 8);
|
||||
for ( tmp = ly;
|
||||
tmp-- ; ) {
|
||||
*( (unsigned short *) dst ) = tmp3 ;
|
||||
dst += BYTES_PER_LINE(pWin);
|
||||
}
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,720 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "vgaReg.h"
|
||||
#include "vgaVideo.h"
|
||||
|
||||
#include "xf86str.h" /* for pScrn->vtSema */
|
||||
extern ScrnInfoPtr *xf86Screens;
|
||||
|
||||
#ifndef PC98_EGC
|
||||
static unsigned char
|
||||
getbits
|
||||
(
|
||||
register const int x,
|
||||
register const unsigned int patternWidth,
|
||||
register const unsigned char * const lineptr
|
||||
)
|
||||
{
|
||||
register unsigned char bits ;
|
||||
register const unsigned char *cptr ;
|
||||
register int shift ;
|
||||
register int wrap ;
|
||||
|
||||
cptr = lineptr + ( x >> 3 ) ;
|
||||
bits = *cptr ;
|
||||
if ((shift = x & 7))
|
||||
bits = SCRLEFT8( bits, shift ) | SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
|
||||
if ( ( wrap = x + 8 - patternWidth ) > 0 ) {
|
||||
bits &= SCRLEFT8( 0xFF, wrap ) ;
|
||||
bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
|
||||
}
|
||||
|
||||
/* GJA -- Handle extraction of 8 bits from < 8 bits wide stipple.
|
||||
* I duplicated case 4,5,6,7 to give the compiler a chance to optimize.
|
||||
*/
|
||||
switch (patternWidth) {
|
||||
case 1: /* Not really useful. */
|
||||
bits &= ~SCRRIGHT8(0xFF,1);
|
||||
bits |= SCRRIGHT8(bits,1);
|
||||
bits |= SCRRIGHT8(bits,2);
|
||||
bits |= SCRRIGHT8(bits,4);
|
||||
break;
|
||||
case 2:
|
||||
bits &= ~SCRRIGHT8(0xFF,2);
|
||||
bits |= SCRRIGHT8(bits,2); bits |= SCRRIGHT8(bits,4); break;
|
||||
case 3:
|
||||
bits &= ~SCRRIGHT8(0xFF,3);
|
||||
bits |= (SCRRIGHT8(bits,3) | SCRRIGHT8(bits,6)); break;
|
||||
case 4:
|
||||
bits = (bits & ~SCRRIGHT8(0xFF,4)) | SCRRIGHT8(bits,4); break;
|
||||
case 5:
|
||||
bits = (bits & ~SCRRIGHT8(0xFF,5)) | SCRRIGHT8(bits,5); break;
|
||||
case 6:
|
||||
bits = (bits & ~SCRRIGHT8(0xFF,6)) | SCRRIGHT8(bits,6); break;
|
||||
case 7:
|
||||
bits = (bits & ~SCRRIGHT8(0xFF,7)) | SCRRIGHT8(bits,7); break;
|
||||
default:
|
||||
;
|
||||
/* Do nothing, of course */
|
||||
}
|
||||
return bits ;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* GJA --
|
||||
* Basically, in the code below, we will draw a stipple in the usual
|
||||
* three parts: left edge, center and right edge.
|
||||
* For efficiency reasons, the center will be drawn byte aligned, so that
|
||||
* we will have to shuffle the bits in the left and right edges.
|
||||
* The hard cases will be stipples with width < 8: In order to get 8
|
||||
* bits from those, we will need a loop. One single 'if' will never do.
|
||||
* This is taken care of above.
|
||||
*/
|
||||
static void
|
||||
DoMonoSingle
|
||||
(
|
||||
WindowPtr pWin, /* GJA */
|
||||
int w,
|
||||
int x,
|
||||
int y,
|
||||
register const unsigned char *mastersrc,
|
||||
int h,
|
||||
register unsigned int width,
|
||||
register unsigned int paddedByteWidth,
|
||||
unsigned int height,
|
||||
int xshift,
|
||||
int yshift
|
||||
)
|
||||
{
|
||||
IOADDRESS REGBASE =
|
||||
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
|
||||
register volatile unsigned char *xDst ;
|
||||
register VideoAdapterObject tmp2 ;
|
||||
register int NeedValX ;
|
||||
register int counter ;
|
||||
register int tmp1 ;
|
||||
unsigned int rowCounter ;
|
||||
int byte_cnt ;
|
||||
#ifdef PC98_EGC
|
||||
unsigned char bitmask;
|
||||
#endif
|
||||
|
||||
/* Do Left Edge */
|
||||
if ((tmp1 = x & 07)) {
|
||||
tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp1 ) ;
|
||||
/* Catch The Cases Where The Entire Region Is Within One Byte */
|
||||
if ( ( w -= 8 - tmp1 ) < 0 ) {
|
||||
tmp2 &= SCRLEFT8( (unsigned) 0xFF, -w ) ;
|
||||
w = 0 ;
|
||||
}
|
||||
#ifndef PC98_EGC
|
||||
SetVideoGraphics( Bit_MaskIndex, tmp2 ) ; /* Set The Bit Mask */
|
||||
#else
|
||||
bitmask = tmp2; /* Set The Bit Mask */
|
||||
#endif
|
||||
/*
|
||||
* For Each Line In The Source Pixmap
|
||||
*/
|
||||
xDst = SCREENADDRESS( pWin, x, y );
|
||||
for ( tmp1 = yshift, rowCounter = h;
|
||||
rowCounter ;
|
||||
rowCounter-- , tmp1++ ) {
|
||||
|
||||
if ( tmp1 >= (int)height )
|
||||
tmp1 -= height ;
|
||||
#ifndef PC98_EGC
|
||||
/* Read To Save */
|
||||
tmp2 = *( (VgaMemoryPtr) xDst) ;
|
||||
#endif
|
||||
/* Write Pattern */
|
||||
*( (VgaMemoryPtr) xDst ) =
|
||||
#ifndef PC98_EGC
|
||||
getbits( xshift /* GJA */, width,
|
||||
mastersrc
|
||||
+ ( tmp1 * paddedByteWidth ) ) >> (x & 07) ;
|
||||
#else
|
||||
#if 0
|
||||
(getbits( xshift /* GJA */, width,
|
||||
mastersrc
|
||||
+ ( tmp1 * paddedByteWidth ) ) >> (x & 07)
|
||||
& bitmask);
|
||||
#else
|
||||
(getbits_x( xshift /* GJA */, width,
|
||||
mastersrc
|
||||
+ ( tmp1 * paddedByteWidth ), (x & 07))
|
||||
& bitmask);
|
||||
#endif
|
||||
#endif
|
||||
xDst += BYTES_PER_LINE(pWin);
|
||||
}
|
||||
NeedValX = (xshift + 8 - (x & 07)) % width;
|
||||
x = ( x + 7 ) & ~07 ;
|
||||
}
|
||||
else {
|
||||
NeedValX = xshift ;
|
||||
}
|
||||
|
||||
if ((byte_cnt = ROW_OFFSET(w))) { /* Fill The Center Of The Box */
|
||||
int SavNeedX = NeedValX ;
|
||||
|
||||
#ifndef PC98_EGC
|
||||
SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* Set The Bit Mask */
|
||||
#endif
|
||||
/*
|
||||
* For Each Line In The Source Pixmap
|
||||
*/
|
||||
xDst = SCREENADDRESS( pWin, x, y );
|
||||
for ( tmp1 = yshift, rowCounter = h;
|
||||
rowCounter ;
|
||||
rowCounter-- , tmp1++ ) {
|
||||
register const unsigned char *l_ptr ;
|
||||
if ( tmp1 >= (int)height )
|
||||
tmp1 -= height ;
|
||||
l_ptr = mastersrc + ( tmp1 * paddedByteWidth ) ;
|
||||
/*
|
||||
* For Each Byte Across The Pattern In X
|
||||
*/
|
||||
for ( counter = byte_cnt, NeedValX = SavNeedX ;
|
||||
counter-- ; ) {
|
||||
#ifndef PC98_EGC
|
||||
/* Read To Save */
|
||||
tmp2 = *( (VgaMemoryPtr) xDst) ;
|
||||
#endif
|
||||
/* Write Pattern */
|
||||
*( (VgaMemoryPtr) xDst ) =
|
||||
#ifndef PC98_EGC
|
||||
getbits( NeedValX, width, l_ptr ) ;
|
||||
#else
|
||||
#if 0
|
||||
getbits( NeedValX, width, l_ptr ) ;
|
||||
#else
|
||||
getbits_x ( NeedValX, width, l_ptr, 0 ) ;
|
||||
#endif
|
||||
#endif
|
||||
/* GJA -- The '%' is there since width could be < 8 */
|
||||
NeedValX = (NeedValX + 8) % width;
|
||||
xDst++;
|
||||
}
|
||||
xDst += BYTES_PER_LINE(pWin) - byte_cnt;
|
||||
}
|
||||
}
|
||||
|
||||
/* Do Right Edge */
|
||||
if ((tmp1 = BIT_OFFSET(w))) { /* x Now Is Byte Aligned */
|
||||
/* Set The Bit Mask */
|
||||
#ifndef PC98_EGC
|
||||
SetVideoGraphics( Bit_MaskIndex, SCRLEFT8( 0xFF, ( 8 - tmp1 ) ) ) ;
|
||||
#else
|
||||
bitmask = SCRLEFT8( 0xFF, ( 8 - tmp1 ));
|
||||
#endif
|
||||
/*
|
||||
* For Each Line In The Source Pixmap
|
||||
*/
|
||||
xDst = SCREENADDRESS( pWin, ( x + w ), y );
|
||||
for ( tmp1 = yshift, rowCounter = h;
|
||||
rowCounter ;
|
||||
rowCounter-- , tmp1++ ) {
|
||||
if ( tmp1 >= (int)height )
|
||||
tmp1 -= height ;
|
||||
#ifndef PC98_EGC
|
||||
/* Read To Save */
|
||||
tmp2 = *( (VgaMemoryPtr) xDst) ;
|
||||
#endif
|
||||
/* Write Pattern */
|
||||
*( (VgaMemoryPtr) xDst ) =
|
||||
#ifndef PC98_EGC
|
||||
getbits( NeedValX, width,
|
||||
mastersrc
|
||||
+ ( tmp1 * paddedByteWidth ) ) ;
|
||||
#else
|
||||
#if 0
|
||||
(getbits( NeedValX, width,
|
||||
mastersrc
|
||||
+ ( tmp1 * paddedByteWidth ) ) & bitmask);
|
||||
#else
|
||||
(getbits_x( NeedValX, width,
|
||||
mastersrc
|
||||
+ ( tmp1 * paddedByteWidth ), 0 ) & bitmask);
|
||||
#endif
|
||||
#endif
|
||||
xDst += BYTES_PER_LINE(pWin) ;
|
||||
}
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
static void
|
||||
DoMonoMany
|
||||
(
|
||||
WindowPtr pWin, /* GJA */
|
||||
int w,
|
||||
int x,
|
||||
int y,
|
||||
register const unsigned char *mastersrc,
|
||||
int h,
|
||||
register unsigned int width,
|
||||
register unsigned int paddedByteWidth,
|
||||
unsigned int height,
|
||||
int xshift,
|
||||
int yshift
|
||||
)
|
||||
{
|
||||
IOADDRESS REGBASE =
|
||||
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
|
||||
register volatile unsigned char *xDst ;
|
||||
register VideoAdapterObject tmp2 ;
|
||||
register int NeedValX ;
|
||||
register int byte_cnt ;
|
||||
register int tmp1 ;
|
||||
unsigned DestinationRow ;
|
||||
unsigned int SourceRow ;
|
||||
volatile unsigned char *dst ;
|
||||
int scr_incr = ( height * BYTES_PER_LINE(pWin) ) ;
|
||||
#ifdef PC98_EGC
|
||||
unsigned char bitmask;
|
||||
#endif
|
||||
|
||||
/* Do Left Edge */
|
||||
if ((tmp1 = x & 07)) {
|
||||
tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp1 ) ;
|
||||
/* Catch The Cases Where The Entire Region Is Within One Byte */
|
||||
if ( ( w -= 8 - tmp1 ) < 0 ) {
|
||||
tmp2 &= SCRLEFT8( (unsigned) 0xFF, -w ) ;
|
||||
w = 0 ;
|
||||
}
|
||||
#ifndef PC98_EGC
|
||||
SetVideoGraphics( Bit_MaskIndex, tmp2 ) ; /* Set The Bit Mask */
|
||||
#else
|
||||
bitmask = tmp2; /* Set The Bit Mask */
|
||||
#endif
|
||||
/*
|
||||
* For Each Line In The Source Pixmap
|
||||
*/
|
||||
for ( tmp1 = yshift, SourceRow = 0, dst = SCREENADDRESS( pWin, x, y ) ;
|
||||
SourceRow < height ;
|
||||
tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) ) {
|
||||
register unsigned bitPattern ;
|
||||
|
||||
if ( tmp1 >= (int)height )
|
||||
tmp1 -= height ;
|
||||
/*
|
||||
* For Each Time Pattern Repeats In The Y Dimension
|
||||
*/
|
||||
xDst = dst;
|
||||
for ( DestinationRow = SourceRow,
|
||||
#ifndef PC98_EGC
|
||||
bitPattern = getbits( xshift, width,
|
||||
mastersrc
|
||||
+ ( tmp1 * paddedByteWidth ) ) ;
|
||||
#else
|
||||
#if 0
|
||||
bitPattern = getbits( xshift, width,
|
||||
mastersrc
|
||||
+ ( tmp1 * paddedByteWidth ) ) ;
|
||||
#else
|
||||
bitPattern = getbits_x( xshift, width,
|
||||
mastersrc
|
||||
+ ( tmp1 * paddedByteWidth ), 0 ) ;
|
||||
#endif
|
||||
#endif
|
||||
(int)DestinationRow < h ;
|
||||
DestinationRow += height ) {
|
||||
#ifndef PC98_EGC
|
||||
/* Read To Save */
|
||||
tmp2 = *( (VgaMemoryPtr) xDst ) ;
|
||||
#endif
|
||||
/* Write Pattern */
|
||||
#ifndef PC98_EGC
|
||||
*( (VgaMemoryPtr) xDst ) = bitPattern >> (x & 07);
|
||||
#else
|
||||
*( (VgaMemoryPtr) xDst ) = (bitPattern >> (x & 07)) & bitmask;
|
||||
#endif
|
||||
xDst += scr_incr;
|
||||
}
|
||||
}
|
||||
NeedValX = (xshift + 8 - (x & 07)) % width;
|
||||
x = ( x + 7 ) & ~07 ;
|
||||
}
|
||||
else {
|
||||
NeedValX = xshift ;
|
||||
}
|
||||
|
||||
if ((byte_cnt = ROW_OFFSET(w))) { /* Fill The Center Of The Box */
|
||||
int SavNeedX = NeedValX ;
|
||||
|
||||
#ifndef PC98_EGC
|
||||
SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* Set The Bit Mask */
|
||||
#endif
|
||||
/*
|
||||
* For Each Line In The Source Pixmap
|
||||
*/
|
||||
for ( tmp1 = yshift, SourceRow = 0, dst = SCREENADDRESS( pWin, x, y ) ;
|
||||
SourceRow < height ;
|
||||
tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) - byte_cnt ) {
|
||||
register const unsigned char *l_ptr ;
|
||||
if ( tmp1 >= (int)height )
|
||||
tmp1 -= height ;
|
||||
l_ptr = mastersrc + ( tmp1 * paddedByteWidth ) ;
|
||||
/*
|
||||
* For Each Byte Across The Pattern In X
|
||||
*/
|
||||
for ( tmp2 = byte_cnt, NeedValX = SavNeedX ;
|
||||
tmp2-- ;
|
||||
dst++ ) {
|
||||
register unsigned bitPattern ;
|
||||
#ifndef PC98_EGC
|
||||
register VideoAdapterObject tmp3 ;
|
||||
#endif
|
||||
/*
|
||||
* For Each Time Pattern Repeats In Y
|
||||
*/
|
||||
xDst = dst;
|
||||
for ( DestinationRow = SourceRow,
|
||||
#ifndef PC98_EGC
|
||||
bitPattern = getbits( NeedValX, width, l_ptr ) ;
|
||||
#else
|
||||
#if 0
|
||||
bitPattern = getbits( NeedValX, width, l_ptr ) ;
|
||||
#else
|
||||
bitPattern = getbits_x( NeedValX, width, l_ptr, 0 ) ;
|
||||
#endif
|
||||
#endif
|
||||
(int)DestinationRow < h ;
|
||||
DestinationRow += height ) {
|
||||
#ifndef PC98_EGC
|
||||
/* Read To Save */
|
||||
tmp3 = *( (VgaMemoryPtr) xDst) ;
|
||||
(void)tmp3;
|
||||
#endif
|
||||
/* Write Pattern */
|
||||
*( (VgaMemoryPtr) xDst ) = bitPattern ;
|
||||
xDst += scr_incr;
|
||||
}
|
||||
NeedValX = (NeedValX + 8) % width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Do Right Edge */
|
||||
if ((tmp1 = BIT_OFFSET(w))) { /* x Now Is Byte Aligned */
|
||||
/* Set The Bit Mask */
|
||||
#ifndef PC98_EGC
|
||||
SetVideoGraphics( Bit_MaskIndex, SCRLEFT8( 0xFF, ( 8 - tmp1 ) ) ) ;
|
||||
#else
|
||||
bitmask = SCRLEFT8( 0xFF, ( 8 - tmp1 ) );
|
||||
#endif
|
||||
/*
|
||||
* For Each Line In The Source Pixmap
|
||||
*/
|
||||
for ( tmp1 = yshift, SourceRow = 0,
|
||||
dst = SCREENADDRESS( pWin, ( x + w ), y ) ;
|
||||
SourceRow < height ;
|
||||
tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) ) {
|
||||
register unsigned bitPattern ;
|
||||
if ( tmp1 >= (int)height )
|
||||
tmp1 -= height ;
|
||||
/*
|
||||
* For Each Time Pattern Repeats In The Y Dimension
|
||||
*/
|
||||
xDst = dst;
|
||||
for ( DestinationRow = SourceRow,
|
||||
#ifndef PC98_EGC
|
||||
bitPattern = getbits( NeedValX, width,
|
||||
mastersrc
|
||||
+ ( tmp1 * paddedByteWidth ) ) ;
|
||||
#else
|
||||
#if 0
|
||||
bitPattern = getbits( NeedValX, width,
|
||||
mastersrc
|
||||
+ ( tmp1 * paddedByteWidth ) ) ;
|
||||
#else
|
||||
bitPattern = getbits_x( NeedValX, width,
|
||||
mastersrc
|
||||
+ ( tmp1 * paddedByteWidth ), 0 ) ;
|
||||
#endif
|
||||
#endif
|
||||
(int)DestinationRow < h ;
|
||||
DestinationRow += height ) {
|
||||
#ifndef PC98_EGC
|
||||
/* Read To Save */
|
||||
tmp2 = *( (VgaMemoryPtr) xDst) ;
|
||||
#endif
|
||||
/* Write Pattern */
|
||||
#ifndef PC98_EGC
|
||||
*( (VgaMemoryPtr) xDst ) = bitPattern ;
|
||||
#else
|
||||
*( (VgaMemoryPtr) xDst ) = bitPattern & bitmask;
|
||||
#endif
|
||||
xDst += scr_incr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
#define DO_RECURSE 0x10000
|
||||
|
||||
static void
|
||||
vgaSetMonoRegisters
|
||||
(
|
||||
DrawablePtr pDrawable,
|
||||
register unsigned long int plane_mask,
|
||||
register unsigned long int desiredState
|
||||
)
|
||||
{
|
||||
IOADDRESS REGBASE =
|
||||
xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300;
|
||||
#ifndef PC98_EGC
|
||||
/* Setup VGA Registers */
|
||||
/*
|
||||
* Set The Plane-Enable
|
||||
*/
|
||||
SetVideoSequencer( Mask_MapIndex, plane_mask ) ;
|
||||
SetVideoGraphics( Enb_Set_ResetIndex, plane_mask ) ;
|
||||
/*
|
||||
* Put Display Into SET-AND (i.e. Write Mode 3 )
|
||||
*/
|
||||
SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_3 ) ;
|
||||
/*
|
||||
* Set The Color in The Set/Reset Register
|
||||
*/
|
||||
SetVideoGraphics( Set_ResetIndex, desiredState & VGA_ALLPLANES ) ;
|
||||
/*
|
||||
* Set The Vga's Alu Function
|
||||
*/
|
||||
SetVideoGraphics( Data_RotateIndex, desiredState >> 8 ) ;
|
||||
#else /* PC98_EGC */
|
||||
unsigned short ROP_value;
|
||||
/* Setup VGA Registers */
|
||||
/*
|
||||
* Set The Plane-Enable
|
||||
*/
|
||||
outw(EGC_PLANE, ~plane_mask);
|
||||
switch((desiredState >> 8)&0x18) {
|
||||
/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
|
||||
case VGA_AND_MODE:
|
||||
if (desiredState & DO_RECURSE)
|
||||
ROP_value = EGC_AND_INV_MODE;
|
||||
else
|
||||
ROP_value = EGC_AND_MODE;
|
||||
break;
|
||||
case VGA_OR_MODE:
|
||||
if (desiredState & DO_RECURSE)
|
||||
ROP_value = EGC_OR_INV_MODE;
|
||||
else
|
||||
ROP_value = EGC_OR_MODE;
|
||||
break;
|
||||
case VGA_XOR_MODE:
|
||||
if (desiredState & DO_RECURSE)
|
||||
ROP_value = EGC_XOR_INV_MODE;
|
||||
else
|
||||
ROP_value = EGC_XOR_MODE;
|
||||
break;
|
||||
case VGA_COPY_MODE:
|
||||
default:
|
||||
ROP_value = EGC_COPY_MODE;
|
||||
break;
|
||||
}
|
||||
outw(EGC_MODE, ROP_value);
|
||||
outw(EGC_FGC, desiredState & VGA_ALLPLANES);
|
||||
#endif
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
vgaCalcMonoMode
|
||||
(
|
||||
int rasterOp,
|
||||
register unsigned long int color
|
||||
)
|
||||
{
|
||||
register unsigned int data_rotate_value = VGA_COPY_MODE << 8 ;
|
||||
register unsigned int invert_existing_data = 0 ;
|
||||
|
||||
/* Test The Raster-Op */
|
||||
switch ( rasterOp ) {
|
||||
case GXclear: /* 0x0 Zero 0 */
|
||||
color = 0 ;
|
||||
break ;
|
||||
case GXinvert: /* 0xa NOT dst */
|
||||
data_rotate_value = VGA_XOR_MODE << 8 ;
|
||||
case GXset: /* 0xf 1 */
|
||||
color = VGA_ALLPLANES ;
|
||||
break ;
|
||||
case GXnor: /* 0x8 NOT src AND NOT dst */
|
||||
invert_existing_data = DO_RECURSE ;
|
||||
case GXandInverted: /* 0x4 NOT src AND dst */
|
||||
color = ~color ;
|
||||
case GXand: /* 0x1 src AND dst */
|
||||
data_rotate_value = VGA_AND_MODE << 8 ;
|
||||
case GXcopy: /* 0x3 src */
|
||||
break ;
|
||||
case GXequiv: /* 0x9 NOT src XOR dst */
|
||||
color = ~color ;
|
||||
case GXxor: /* 0x6 src XOR dst */
|
||||
data_rotate_value = VGA_XOR_MODE << 8 ;
|
||||
break ;
|
||||
case GXandReverse: /* 0x2 src AND NOT dst */
|
||||
invert_existing_data = DO_RECURSE ;
|
||||
data_rotate_value = VGA_AND_MODE << 8 ;
|
||||
break ;
|
||||
case GXorReverse: /* 0xb src OR NOT dst */
|
||||
invert_existing_data = DO_RECURSE ;
|
||||
data_rotate_value = VGA_OR_MODE << 8 ;
|
||||
break ;
|
||||
case GXnand: /* 0xe NOT src OR NOT dst */
|
||||
invert_existing_data = DO_RECURSE ;
|
||||
case GXorInverted: /* 0xd NOT src OR dst */
|
||||
color = ~color ;
|
||||
case GXor: /* 0x7 src OR dst */
|
||||
data_rotate_value = VGA_OR_MODE << 8 ;
|
||||
break ;
|
||||
case GXcopyInverted: /* 0xc NOT src */
|
||||
color = ~color ;
|
||||
break ;
|
||||
case GXnoop: /* 0x5 dst */
|
||||
; /* Shouldn't Get Here !! */
|
||||
}
|
||||
|
||||
return ( color & VGA_ALLPLANES ) | data_rotate_value | invert_existing_data ;
|
||||
}
|
||||
|
||||
static void
|
||||
vgaDrawMonoImage
|
||||
(
|
||||
WindowPtr pWin, /* GJA */
|
||||
unsigned char *data,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h,
|
||||
unsigned long int fg,
|
||||
int alu,
|
||||
unsigned long int planes
|
||||
)
|
||||
{
|
||||
unsigned long regState ;
|
||||
|
||||
if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
|
||||
xf4bppOffDrawMonoImage( pWin, data, x, y, w, h, fg, alu, planes );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
|
||||
return ;
|
||||
|
||||
#ifndef PC98_EGC
|
||||
if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) {
|
||||
vgaDrawMonoImage( pWin, data, x, y, w, h,
|
||||
VGA_ALLPLANES, GXinvert, planes ) ;
|
||||
regState &= ~DO_RECURSE ;
|
||||
}
|
||||
#else
|
||||
regState = vgaCalcMonoMode(alu, (char)fg);
|
||||
#endif
|
||||
|
||||
|
||||
vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ;
|
||||
|
||||
DoMonoSingle( pWin, w, x, y, (const unsigned char *) data, h,
|
||||
w, ( ( w + 31 ) & ~31 ) >> 3, h, 0, 0 ) ;
|
||||
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void
|
||||
xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc )
|
||||
WindowPtr pWin; /* GJA */
|
||||
register PixmapPtr const pStipple ;
|
||||
unsigned long int fg ;
|
||||
const int alu ;
|
||||
unsigned long int planes ;
|
||||
int x, y, w, h ;
|
||||
const int xSrc, ySrc ;
|
||||
{
|
||||
unsigned int width ;
|
||||
unsigned int height ;
|
||||
int xshift ;
|
||||
int yshift ;
|
||||
unsigned long regState ;
|
||||
|
||||
if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
|
||||
xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes,
|
||||
x, y, w, h, xSrc, ySrc );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
|
||||
return ;
|
||||
|
||||
#if 1
|
||||
if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) {
|
||||
xf4bppFillStipple( pWin, pStipple, VGA_ALLPLANES, GXinvert, planes,
|
||||
x, y, w, h, xSrc, ySrc ) ;
|
||||
regState &= ~DO_RECURSE ;
|
||||
}
|
||||
#else
|
||||
regState = vgaCalcMonoMode(alu, (char)fg);
|
||||
#endif
|
||||
|
||||
|
||||
vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ;
|
||||
|
||||
/* Figure Bit Offsets & Source Address */
|
||||
width = pStipple->drawable.width ;
|
||||
if ( ( xshift = ( x - xSrc ) ) < 0 )
|
||||
xshift = width - ( ( - xshift ) % width ) ;
|
||||
else
|
||||
xshift %= width ;
|
||||
if ( xshift == (int)width ) xshift = 0;
|
||||
|
||||
height = pStipple->drawable.height ;
|
||||
if ( ( yshift = ( y - ySrc ) ) < 0 )
|
||||
yshift = height - ( ( - yshift ) % height ) ;
|
||||
else
|
||||
yshift %= height ;
|
||||
if ( yshift == (int)height ) yshift = 0;
|
||||
|
||||
(* ( (h > (int)height) ? DoMonoMany : DoMonoSingle ) ) (
|
||||
pWin, w, x, y,
|
||||
(const unsigned char *) pStipple->devPrivate.ptr,
|
||||
h,
|
||||
width,
|
||||
( ( width + 31 ) & ((unsigned)(~31)) ) >> 3,
|
||||
height,
|
||||
xshift, yshift
|
||||
) ;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* Copyright IBM Corporation 1987,1988,1989
|
||||
*
|
||||
* 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 IBM not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
* IBM 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "misc.h" /* GJA -- for pointer data type */
|
||||
#ifdef lint
|
||||
#if defined(volatile)
|
||||
#undef volatile
|
||||
#endif
|
||||
#define volatile /**/
|
||||
#if defined(const)
|
||||
#undef const
|
||||
#endif
|
||||
#define const /**/
|
||||
#if defined(signed)
|
||||
#undef signed
|
||||
#endif
|
||||
#define signed /**/
|
||||
#endif
|
||||
|
||||
/*
|
||||
* References to all pc ( i.e. '286 ) memory in the
|
||||
* regions used by the [ev]ga server ( the 128K windows )
|
||||
* MUST be long-word ( i.e. 32-bit ) reads or writes.
|
||||
* This definition will change for other memory architectures
|
||||
* ( e.g. AIX-Rt )
|
||||
*/
|
||||
typedef unsigned char VideoAdapterObject ;
|
||||
typedef volatile VideoAdapterObject *VideoMemoryPtr ;
|
||||
typedef volatile VideoAdapterObject *VgaMemoryPtr ;
|
||||
#if !defined(BITMAP_BIT_ORDER)
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#endif
|
||||
|
||||
#if !defined(IMAGE_BYTE_ORDER)
|
||||
#define IMAGE_BYTE_ORDER LSBFirst
|
||||
#endif
|
||||
|
||||
/* Bit Ordering Macros */
|
||||
#if !defined(SCRLEFT8)
|
||||
#define SCRLEFT8(lw, n) ( (unsigned char) (((unsigned char) lw) << (n)) )
|
||||
#endif
|
||||
#if !defined(SCRRIGHT8)
|
||||
#define SCRRIGHT8(lw, n) ( (unsigned char) (((unsigned char)lw) >> (n)) )
|
||||
#endif
|
||||
/* These work ONLY on 8-bit wide Quantities !! */
|
||||
#define LeftmostBit ( SCRLEFT8( 0xFF, 7 ) & 0xFF )
|
||||
#define RightmostBit ( SCRRIGHT8( 0xFF, 7 ) & 0xFF )
|
||||
|
||||
/*
|
||||
* [ev]ga video screen defines & macros
|
||||
*/
|
||||
#define VGA_BLACK_PIXEL 0
|
||||
#define VGA_WHITE_PIXEL 1
|
||||
|
||||
#define VGA_MAXPLANES 4
|
||||
#define VGA_ALLPLANES 0xFL
|
||||
|
||||
#define VIDBASE(pDraw) ((volatile unsigned char *) \
|
||||
(((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))-> \
|
||||
devPrivate.ptr))
|
||||
#define BYTES_PER_LINE(pDraw) \
|
||||
((int)((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))->devKind)
|
||||
|
||||
#define ROW_OFFSET( x ) ( ( x ) >> 3 )
|
||||
#define BIT_OFFSET( x ) ( ( x ) & 0x7 )
|
||||
#define SCREENADDRESS( pWin, x, y ) \
|
||||
( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + ROW_OFFSET(x) )
|
||||
|
||||
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 THE
|
||||
* XFREE86 PROJECT 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 XFree86 Project 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
|
||||
* XFree86 Project.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf86Module.h"
|
||||
|
||||
static MODULESETUPPROTO(xf4bppSetup);
|
||||
|
||||
static XF86ModuleVersionInfo VersRec =
|
||||
{
|
||||
"xf4bpp",
|
||||
MODULEVENDORSTRING,
|
||||
MODINFOSTRING1,
|
||||
MODINFOSTRING2,
|
||||
XORG_VERSION_CURRENT,
|
||||
1, 0, 0,
|
||||
ABI_CLASS_ANSIC, /* Only need ansic layer */
|
||||
ABI_ANSIC_VERSION,
|
||||
MOD_CLASS_NONE,
|
||||
{0,0,0,0} /* signature, to be patched into the file by a tool */
|
||||
};
|
||||
|
||||
_X_EXPORT XF86ModuleData xf4bppModuleData = { &VersRec, xf4bppSetup, NULL };
|
||||
|
||||
static pointer
|
||||
xf4bppSetup(pointer module, pointer opts, int *errmaj, int *errmin)
|
||||
{
|
||||
/* This module requires xf1bpp for bitmap support */
|
||||
return LoadSubModule(module, "xf1bpp", NULL, NULL, NULL, NULL,
|
||||
errmaj, errmin);
|
||||
}
|
||||
|
|
@ -1,203 +0,0 @@
|
|||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf4bpp.h"
|
||||
#include "OScompiler.h"
|
||||
#include "wm3.h"
|
||||
#include "vgaVideo.h"
|
||||
#include "xf86.h"
|
||||
|
||||
/* Ferraro is wrong. GJA */
|
||||
#define COPY (0 << 3)
|
||||
#define AND (1 << 3)
|
||||
#define OR (2 << 3)
|
||||
#define XOR (3 << 3)
|
||||
|
||||
int
|
||||
wm3_set_regs(pGC)
|
||||
GC *pGC;
|
||||
{
|
||||
#ifndef PC98_EGC
|
||||
IOADDRESS REGBASE = xf86Screens[pGC->pScreen->myNum]->domainIOBase + 0x300;
|
||||
int post_invert = 0;
|
||||
int ALU;
|
||||
|
||||
switch(pGC->alu) {
|
||||
case GXclear: /* rop0 = RROP_BLACK; rop1 = RROP_BLACK; */
|
||||
pGC->fgPixel = 0;
|
||||
pGC->bgPixel = 0;
|
||||
ALU = COPY;
|
||||
break;
|
||||
case GXand: /* rop0 = RROP_BLACK; rop1 = RROP_NOP; */
|
||||
ALU = AND;
|
||||
break;
|
||||
case GXandReverse: /* rop0 = RROP_BLACK; rop1 = RROP_INVERT; -- TRICKY */
|
||||
pGC->fgPixel = ~pGC->fgPixel;
|
||||
pGC->bgPixel = ~pGC->bgPixel;
|
||||
ALU = OR;
|
||||
post_invert = 1;
|
||||
break;
|
||||
case GXcopy: /* rop0 = RROP_BLACK; rop1 = RROP_WHITE; */
|
||||
ALU = COPY;
|
||||
break;
|
||||
case GXandInverted: /* rop0 = RROP_NOP; rop1 = RROP_BLACK; */
|
||||
pGC->fgPixel = ~pGC->fgPixel;
|
||||
pGC->bgPixel = ~pGC->bgPixel;
|
||||
ALU = AND;
|
||||
break;
|
||||
default:
|
||||
case GXnoop: /* rop0 = RROP_NOP; rop1 = RROP_NOP; */
|
||||
return 0;
|
||||
case GXxor: /* rop0 = RROP_NOP; rop1 = RROP_INVERT; */
|
||||
ALU = XOR;
|
||||
break;
|
||||
case GXor: /* rop0 = RROP_NOP; rop1 = RROP_WHITE; */
|
||||
ALU = OR;
|
||||
break;
|
||||
case GXnor: /* rop0 = RROP_INVERT; rop1 = RROP_BLACK; -- TRICKY*/
|
||||
ALU = OR;
|
||||
post_invert = 1;
|
||||
break;
|
||||
case GXequiv: /* rop0 = RROP_INVERT; rop1 = RROP_NOP; */
|
||||
pGC->fgPixel = ~pGC->fgPixel;
|
||||
pGC->bgPixel = ~pGC->bgPixel;
|
||||
ALU = XOR;
|
||||
break;
|
||||
case GXinvert: /* rop0 = RROP_INVERT; rop1 = RROP_INVERT; */
|
||||
pGC->fgPixel = 0x0F;
|
||||
pGC->bgPixel = 0x0F;
|
||||
ALU = XOR;
|
||||
break;
|
||||
case GXorReverse: /* rop0 = RROP_INVERT; rop1 = RROP_WHITE; -- TRICKY */
|
||||
pGC->fgPixel = ~pGC->fgPixel;
|
||||
pGC->bgPixel = ~pGC->bgPixel;
|
||||
ALU = AND;
|
||||
post_invert = 1;
|
||||
break;
|
||||
case GXcopyInverted: /* rop0 = RROP_WHITE; rop1 = RROP_BLACK; */
|
||||
pGC->fgPixel = ~pGC->fgPixel;
|
||||
pGC->bgPixel = ~pGC->bgPixel;
|
||||
ALU = COPY;
|
||||
break;
|
||||
case GXorInverted: /* rop0 = RROP_WHITE; rop1 = RROP_NOP; */
|
||||
pGC->fgPixel = ~pGC->fgPixel;
|
||||
pGC->bgPixel = ~pGC->bgPixel;
|
||||
ALU = OR;
|
||||
break;
|
||||
case GXnand: /* rop0 = RROP_WHITE; rop1 = RROP_INVERT; -- TRICKY */
|
||||
ALU = AND;
|
||||
post_invert = 1;
|
||||
break;
|
||||
case GXset: /* rop0 = RROP_WHITE; rop1 = RROP_WHITE; */
|
||||
pGC->fgPixel = 0x0F;
|
||||
pGC->bgPixel = 0x0F;
|
||||
ALU = COPY;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
SetVideoSequencer(Mask_MapIndex, (pGC->planemask & VGA_ALLPLANES));
|
||||
SetVideoGraphics(Enb_Set_ResetIndex, VGA_ALLPLANES);
|
||||
SetVideoGraphics(Set_ResetIndex, pGC->fgPixel);
|
||||
SetVideoGraphics(Bit_MaskIndex, 0xFF);
|
||||
SetVideoGraphics(Graphics_ModeIndex, 3); /* Write Mode 3 */
|
||||
SetVideoGraphics(Data_RotateIndex, ALU);
|
||||
|
||||
return post_invert;
|
||||
#else
|
||||
int ALU;
|
||||
|
||||
switch(pGC->alu) {
|
||||
case GXclear: /* rop0 = RROP_BLACK; rop1 = RROP_BLACK; */
|
||||
pGC->fgPixel = 0;
|
||||
pGC->bgPixel = 0;
|
||||
ALU = EGC_COPY_MODE;
|
||||
break;
|
||||
case GXand: /* rop0 = RROP_BLACK; rop1 = RROP_NOP; */
|
||||
ALU = EGC_AND_MODE;
|
||||
break;
|
||||
case GXandReverse: /* rop0 = RROP_BLACK; rop1 = RROP_INVERT; -- TRICKY */
|
||||
pGC->fgPixel = ~pGC->fgPixel;
|
||||
pGC->bgPixel = ~pGC->bgPixel;
|
||||
ALU = EGC_OR_INV_MODE;
|
||||
break;
|
||||
case GXcopy: /* rop0 = RROP_BLACK; rop1 = RROP_WHITE; */
|
||||
ALU = EGC_COPY_MODE;
|
||||
break;
|
||||
case GXandInverted: /* rop0 = RROP_NOP; rop1 = RROP_BLACK; */
|
||||
pGC->fgPixel = ~pGC->fgPixel;
|
||||
pGC->bgPixel = ~pGC->bgPixel;
|
||||
ALU = EGC_AND_MODE;
|
||||
break;
|
||||
case GXnoop: /* rop0 = RROP_NOP; rop1 = RROP_NOP; */
|
||||
return 0;
|
||||
case GXxor: /* rop0 = RROP_NOP; rop1 = RROP_INVERT; */
|
||||
ALU = EGC_XOR_MODE;
|
||||
break;
|
||||
case GXor: /* rop0 = RROP_NOP; rop1 = RROP_WHITE; */
|
||||
ALU = EGC_OR_MODE;
|
||||
break;
|
||||
case GXnor: /* rop0 = RROP_INVERT; rop1 = RROP_BLACK; -- TRICKY*/
|
||||
ALU = EGC_OR_INV_MODE;
|
||||
break;
|
||||
case GXequiv: /* rop0 = RROP_INVERT; rop1 = RROP_NOP; */
|
||||
pGC->fgPixel = ~pGC->fgPixel;
|
||||
pGC->bgPixel = ~pGC->bgPixel;
|
||||
ALU = EGC_XOR_MODE;
|
||||
break;
|
||||
case GXinvert: /* rop0 = RROP_INVERT; rop1 = RROP_INVERT; */
|
||||
pGC->fgPixel = 0x0F;
|
||||
pGC->bgPixel = 0x0F;
|
||||
ALU = EGC_XOR_MODE;
|
||||
break;
|
||||
case GXorReverse: /* rop0 = RROP_INVERT; rop1 = RROP_WHITE; -- TRICKY */
|
||||
pGC->fgPixel = ~pGC->fgPixel;
|
||||
pGC->bgPixel = ~pGC->bgPixel;
|
||||
ALU = EGC_AND_INV_MODE;
|
||||
break;
|
||||
case GXcopyInverted: /* rop0 = RROP_WHITE; rop1 = RROP_BLACK; */
|
||||
pGC->fgPixel = ~pGC->fgPixel;
|
||||
pGC->bgPixel = ~pGC->bgPixel;
|
||||
ALU = EGC_COPY_MODE;
|
||||
break;
|
||||
case GXorInverted: /* rop0 = RROP_WHITE; rop1 = RROP_NOP; */
|
||||
pGC->fgPixel = ~pGC->fgPixel;
|
||||
pGC->bgPixel = ~pGC->bgPixel;
|
||||
ALU = EGC_OR_MODE;
|
||||
break;
|
||||
case GXnand: /* rop0 = RROP_WHITE; rop1 = RROP_INVERT; -- TRICKY */
|
||||
ALU = EGC_OR_INV_MODE;
|
||||
break;
|
||||
case GXset: /* rop0 = RROP_WHITE; rop1 = RROP_WHITE; */
|
||||
pGC->fgPixel = 0x0F;
|
||||
pGC->bgPixel = 0x0F;
|
||||
ALU = EGC_COPY_MODE;
|
||||
break;
|
||||
}
|
||||
|
||||
outw(EGC_PLANE, ~(pGC->planemask & VGA_ALLPLANES));
|
||||
outw(EGC_MODE, ALU);
|
||||
outw(EGC_FGC, pGC->fgPixel & VGA_ALLPLANES); /* set FGC */
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
Now we will have to set the alu.
|
||||
Problematic is: How do we handle IsDoubleDash, which draws with both fg
|
||||
and bg colour?
|
||||
The answer is: We take care to store the ink colour in one register only.
|
||||
Then we need set only this register to change the ink.
|
||||
*/
|
||||
|
||||
/* -- MORE NOTES:
|
||||
We might try to 'wrap' the mfb functions in a 16-colour wrapper that does
|
||||
all operations once. However, this does not work:
|
||||
Some operations (esp) CopyArea may for example cause expositions.
|
||||
Such expositions will cause data to be copied in from backing store,
|
||||
and this copying in may damage the contents of the VGA registers.
|
||||
So we must take care to set the VGA registers at each place where they could
|
||||
be modified.
|
||||
*/
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "vgaReg.h"
|
||||
|
||||
#ifdef PC98_EGC
|
||||
#define VGA_ALLPLANES 0xFL
|
||||
#endif
|
||||
|
||||
/* Do call in Write Mode 3.
|
||||
* We take care of the possibility that two passes are needed.
|
||||
*/
|
||||
#ifndef PC98_EGC
|
||||
#define DO_WM3(pgc,call) \
|
||||
{ int _tp, _fg, _bg, _alu; \
|
||||
_fg = pgc->fgPixel; _bg = pgc->bgPixel; \
|
||||
_tp = wm3_set_regs(pgc); \
|
||||
(call); \
|
||||
if ( _tp ) { \
|
||||
_alu = pgc->alu; \
|
||||
pgc->alu = GXinvert; \
|
||||
_tp = wm3_set_regs(pgc); \
|
||||
(call); \
|
||||
pgc->alu = _alu; \
|
||||
} \
|
||||
pgc->fgPixel = _fg; pgc->bgPixel = _bg; \
|
||||
}
|
||||
#else
|
||||
#define DO_WM3(pgc,call) \
|
||||
{ int _tp, _fg, _bg; \
|
||||
_fg = pgc->fgPixel; _bg = pgc->bgPixel; \
|
||||
_tp = wm3_set_regs(pgc); \
|
||||
(call); \
|
||||
pgc->fgPixel = _fg; pgc->bgPixel = _bg; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PC98_EGC
|
||||
#define WM3_SET_INK(ink) \
|
||||
SetVideoGraphics(Set_ResetIndex, ink)
|
||||
#else
|
||||
#define WM3_SET_INK(ink) \
|
||||
outw(EGC_FGC, ink)
|
||||
#endif
|
||||
|
||||
/* GJA -- Move a long word to screen memory.
|
||||
* The reads into 'dummy' are here to load the VGA latches.
|
||||
* This is a RMW operation except for trivial cases.
|
||||
* Notice that we ignore the operation.
|
||||
*/
|
||||
#ifdef PC98_EGC
|
||||
#define UPDRW(destp,src) \
|
||||
{ volatile unsigned short *_dtmp = \
|
||||
(volatile unsigned short *)(destp); \
|
||||
unsigned int _stmp = (src); \
|
||||
*_dtmp = _stmp; _dtmp++; _stmp >>= 16; \
|
||||
*_dtmp = _stmp; }
|
||||
#else
|
||||
#define UPDRW(destp,src) \
|
||||
{ volatile char *_dtmp = (volatile char *)(destp); \
|
||||
unsigned int _stmp = (src); \
|
||||
volatile int dummy; /* Bit bucket. */ \
|
||||
_stmp = ldl_u(&_stmp); \
|
||||
dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \
|
||||
dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \
|
||||
dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \
|
||||
dummy = *_dtmp; *_dtmp = _stmp; }
|
||||
#endif
|
||||
|
||||
#define UPDRWB(destp,src) \
|
||||
{ volatile int dummy; /* Bit bucket. */ \
|
||||
dummy = *(destp); *(destp) = (src); }
|
||||
|
|
@ -1,622 +0,0 @@
|
|||
|
||||
#ifndef __XF4BPP_H__
|
||||
#define __XF4BPP_H__
|
||||
|
||||
|
||||
#include "windowstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "colormapst.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#ifndef PixelType
|
||||
#define PixelType CARD32
|
||||
#endif
|
||||
|
||||
/* ppcArea.c */
|
||||
void xf4bppFillArea(
|
||||
WindowPtr,
|
||||
int,
|
||||
BoxPtr,
|
||||
GCPtr
|
||||
);
|
||||
|
||||
/* ppcClip.c */
|
||||
void xf4bppDestroyClip(
|
||||
GCPtr
|
||||
);
|
||||
void xf4bppChangeClip(
|
||||
GCPtr,
|
||||
int,
|
||||
pointer,
|
||||
int
|
||||
);
|
||||
void xf4bppCopyClip(
|
||||
GCPtr,
|
||||
GCPtr
|
||||
);
|
||||
|
||||
/* ppcCpArea.c */
|
||||
RegionPtr xf4bppCopyArea(
|
||||
DrawablePtr,
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int
|
||||
);
|
||||
|
||||
/* ppcDepth.c */
|
||||
Bool xf4bppDepthOK(
|
||||
DrawablePtr,
|
||||
int
|
||||
);
|
||||
|
||||
/* ppcFillRct.c */
|
||||
void xf4bppPolyFillRect(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
xRectangle *
|
||||
);
|
||||
|
||||
/* ppcWindowFS.c */
|
||||
void xf4bppSolidWindowFS(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
DDXPointPtr,
|
||||
int *,
|
||||
int
|
||||
);
|
||||
void xf4bppStippleWindowFS(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
DDXPointPtr,
|
||||
int *,
|
||||
int
|
||||
);
|
||||
void xf4bppOpStippleWindowFS(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
DDXPointPtr,
|
||||
int *,
|
||||
int
|
||||
);
|
||||
void xf4bppTileWindowFS(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
DDXPointPtr,
|
||||
int *,
|
||||
int
|
||||
);
|
||||
|
||||
/* xf4bppPixmapFS.c */
|
||||
void xf4bppSolidPixmapFS(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
DDXPointPtr,
|
||||
int *,
|
||||
int
|
||||
);
|
||||
void xf4bppStipplePixmapFS(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
DDXPointPtr,
|
||||
int *,
|
||||
int
|
||||
);
|
||||
void xf4bppOpStipplePixmapFS(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
DDXPointPtr,
|
||||
int *,
|
||||
int
|
||||
);
|
||||
void xf4bppTilePixmapFS(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
DDXPointPtr,
|
||||
int *,
|
||||
int
|
||||
);
|
||||
|
||||
/* ppcGC.c */
|
||||
Bool xf4bppCreateGC(
|
||||
GCPtr
|
||||
);
|
||||
|
||||
/* ppcGetSp.c */
|
||||
void xf4bppGetSpans(
|
||||
DrawablePtr,
|
||||
int,
|
||||
DDXPointPtr,
|
||||
int *,
|
||||
int,
|
||||
char *
|
||||
);
|
||||
|
||||
/* ppcImg.c */
|
||||
void xf4bppGetImage(
|
||||
DrawablePtr,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
unsigned int,
|
||||
unsigned long,
|
||||
char *
|
||||
);
|
||||
|
||||
/* ppcLine.c */
|
||||
void xf4bppScrnZeroLine(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
int,
|
||||
DDXPointPtr
|
||||
);
|
||||
void xf4bppScrnZeroDash(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
int,
|
||||
DDXPointPtr
|
||||
);
|
||||
void xf4bppScrnZeroSegs(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
xSegment *
|
||||
);
|
||||
|
||||
/* ppcPixmap.c */
|
||||
PixmapPtr xf4bppCreatePixmap(
|
||||
ScreenPtr,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
unsigned
|
||||
);
|
||||
PixmapPtr xf4bppCopyPixmap(
|
||||
PixmapPtr
|
||||
);
|
||||
|
||||
/* ppcPolyPnt.c */
|
||||
void xf4bppPolyPoint(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
int,
|
||||
xPoint *
|
||||
);
|
||||
|
||||
/* ppcPolyRec.c */
|
||||
void xf4bppPolyRectangle(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
xRectangle *
|
||||
);
|
||||
|
||||
/* ppcQuery.c */
|
||||
void xf4bppQueryBestSize(
|
||||
int,
|
||||
unsigned short *,
|
||||
unsigned short *,
|
||||
ScreenPtr
|
||||
);
|
||||
|
||||
/* ppcRslvC.c */
|
||||
void xf4bppResolveColor(
|
||||
unsigned short *,
|
||||
unsigned short *,
|
||||
unsigned short *,
|
||||
VisualPtr
|
||||
);
|
||||
Bool xf4bppInitializeColormap(
|
||||
ColormapPtr
|
||||
);
|
||||
|
||||
/* ppcSetSp.c */
|
||||
void xf4bppSetSpans(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
char *,
|
||||
DDXPointPtr,
|
||||
int *,
|
||||
int,
|
||||
int
|
||||
);
|
||||
|
||||
/* ppcWindow.c */
|
||||
void xf4bppCopyWindow(
|
||||
WindowPtr,
|
||||
DDXPointRec,
|
||||
RegionPtr
|
||||
);
|
||||
Bool xf4bppPositionWindow(
|
||||
WindowPtr,
|
||||
int,
|
||||
int
|
||||
);
|
||||
Bool xf4bppUnrealizeWindow(
|
||||
WindowPtr,
|
||||
int,
|
||||
int
|
||||
);
|
||||
Bool xf4bppDestroyWindow(
|
||||
WindowPtr
|
||||
);
|
||||
Bool xf4bppCreateWindowForXYhardware(
|
||||
WindowPtr
|
||||
);
|
||||
|
||||
/* emulOpStip.c */
|
||||
void xf4bppOpaqueStipple(
|
||||
WindowPtr,
|
||||
PixmapPtr,
|
||||
unsigned long int,
|
||||
unsigned long int,
|
||||
int,
|
||||
unsigned long int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int
|
||||
);
|
||||
|
||||
/* emulRepAre.c */
|
||||
void xf4bppReplicateArea(
|
||||
WindowPtr,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int
|
||||
);
|
||||
|
||||
/* emulTile.c */
|
||||
void xf4bppTileRect(
|
||||
WindowPtr,
|
||||
PixmapPtr,
|
||||
const int,
|
||||
const unsigned long int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int
|
||||
);
|
||||
|
||||
/* vgaGC.c */
|
||||
Mask xf4bppChangeWindowGC(
|
||||
GCPtr,
|
||||
Mask
|
||||
);
|
||||
|
||||
/* vgaBitBlt.c */
|
||||
void xf4bppBitBlt(
|
||||
WindowPtr,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int
|
||||
);
|
||||
|
||||
/* vgaImages.c */
|
||||
void xf4bppDrawColorImage(
|
||||
WindowPtr,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
unsigned char *,
|
||||
int,
|
||||
const int,
|
||||
const unsigned long int
|
||||
);
|
||||
void xf4bppReadColorImage(
|
||||
WindowPtr,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
unsigned char *,
|
||||
int
|
||||
);
|
||||
|
||||
/* vgaLine.c */
|
||||
void xf4bppHorzLine(
|
||||
WindowPtr,
|
||||
unsigned long int,
|
||||
int,
|
||||
unsigned long int,
|
||||
int,
|
||||
int,
|
||||
int
|
||||
);
|
||||
void xf4bppVertLine(
|
||||
WindowPtr,
|
||||
unsigned long int,
|
||||
int,
|
||||
unsigned long int,
|
||||
int,
|
||||
int,
|
||||
int
|
||||
);
|
||||
void xf4bppBresLine(
|
||||
WindowPtr,
|
||||
unsigned long int,
|
||||
int,
|
||||
unsigned long int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
unsigned long int
|
||||
);
|
||||
|
||||
/* vgaStipple.c */
|
||||
void xf4bppFillStipple(
|
||||
WindowPtr,
|
||||
const PixmapPtr,
|
||||
unsigned long int,
|
||||
const int,
|
||||
unsigned long int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
const int,
|
||||
const int
|
||||
);
|
||||
|
||||
/* vgaSolid.c */
|
||||
void xf4bppFillSolid(
|
||||
WindowPtr,
|
||||
unsigned long int,
|
||||
const int,
|
||||
unsigned long int,
|
||||
int,
|
||||
const int,
|
||||
int,
|
||||
const int
|
||||
);
|
||||
|
||||
/* offscreen.c */
|
||||
void xf4bppOffBitBlt(
|
||||
WindowPtr,
|
||||
const int,
|
||||
const int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int
|
||||
);
|
||||
void xf4bppOffDrawColorImage(
|
||||
WindowPtr,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
unsigned char *,
|
||||
int,
|
||||
const int,
|
||||
const unsigned long int
|
||||
);
|
||||
void xf4bppOffReadColorImage(
|
||||
WindowPtr,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
unsigned char *,
|
||||
int
|
||||
);
|
||||
void xf4bppOffFillSolid(
|
||||
WindowPtr,
|
||||
unsigned long int,
|
||||
const int,
|
||||
unsigned long int,
|
||||
int,
|
||||
const int,
|
||||
int,
|
||||
const int
|
||||
);
|
||||
void xf4bppOffDrawMonoImage(
|
||||
WindowPtr,
|
||||
unsigned char *,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
unsigned long int,
|
||||
int,
|
||||
unsigned long int
|
||||
);
|
||||
void xf4bppOffFillStipple(
|
||||
WindowPtr,
|
||||
const PixmapPtr,
|
||||
unsigned long int,
|
||||
const int,
|
||||
unsigned long int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
const int,
|
||||
const int
|
||||
);
|
||||
|
||||
/* mfbimggblt.c */
|
||||
void xf4bppImageGlyphBlt(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
int,
|
||||
unsigned int,
|
||||
CharInfoPtr *,
|
||||
pointer
|
||||
);
|
||||
|
||||
/* wm3.c */
|
||||
int wm3_set_regs(
|
||||
GC *
|
||||
);
|
||||
|
||||
/* ppcIO.c */
|
||||
void xf4bppNeverCalled(
|
||||
void
|
||||
);
|
||||
Bool xf4bppScreenInit(
|
||||
ScreenPtr,
|
||||
pointer,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int
|
||||
);
|
||||
|
||||
/* mfbfillarc.c */
|
||||
void xf4bppPolyFillArc(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
xArc *
|
||||
);
|
||||
|
||||
/* mfbzerarc.c */
|
||||
void xf4bppZeroPolyArc(
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
xArc *
|
||||
);
|
||||
|
||||
/* mfbline.c */
|
||||
void xf4bppSegmentSS (
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
xSegment *
|
||||
);
|
||||
void xf4bppLineSS (
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
int,
|
||||
DDXPointPtr
|
||||
);
|
||||
void xf4bppSegmentSD (
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
xSegment *
|
||||
);
|
||||
void xf4bppLineSD (
|
||||
DrawablePtr,
|
||||
GCPtr,
|
||||
int,
|
||||
int,
|
||||
DDXPointPtr
|
||||
);
|
||||
|
||||
/* mfbbres.c */
|
||||
void xf4bppBresS(
|
||||
PixelType *,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int
|
||||
);
|
||||
|
||||
/* mfbbresd.c */
|
||||
void xf4bppBresD(
|
||||
DrawablePtr,
|
||||
int, int,
|
||||
int *,
|
||||
unsigned char *,
|
||||
int,
|
||||
int *,
|
||||
int,
|
||||
PixelType *,
|
||||
int, int, int, int, int, int,
|
||||
int, int,
|
||||
int, int
|
||||
);
|
||||
|
||||
/* mfbhrzvert.c */
|
||||
void xf4bppHorzS(
|
||||
PixelType *,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int
|
||||
);
|
||||
void xf4bppVertS(
|
||||
PixelType *,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int
|
||||
);
|
||||
|
||||
#ifdef PC98_EGC
|
||||
|
||||
/* egc_asm.s */
|
||||
unsigned char getbits_x(
|
||||
int,
|
||||
unsigned int,
|
||||
pointer,
|
||||
unsigned int
|
||||
);
|
||||
void wcopyr(
|
||||
pointer,
|
||||
pointer,
|
||||
int,
|
||||
pointer
|
||||
);
|
||||
void wcopyl(
|
||||
pointer,
|
||||
pointer,
|
||||
int,
|
||||
pointer
|
||||
);
|
||||
unsigned long int read8Z(
|
||||
pointer
|
||||
);
|
||||
|
||||
#endif /* PC98_EGC */
|
||||
|
||||
#endif /* __XF4BPP_H__ */
|
||||
|
|
@ -46,7 +46,6 @@ SRCS_NATIVEGDI = \
|
|||
winnativegdi.c \
|
||||
winpixmap.c \
|
||||
winpolyline.c \
|
||||
winpushpxl.c \
|
||||
winrop.c \
|
||||
winsetsp.c
|
||||
DEFS_NATIVEGDI = -DXWIN_NATIVEGDI
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ const GCOps winGCOps = {
|
|||
miImageGlyphBlt,
|
||||
miPolyGlyphBlt,
|
||||
#endif
|
||||
winPushPixels
|
||||
miPushPixels,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,225 +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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_XWIN_CONFIG_H
|
||||
#include <xwin-config.h>
|
||||
#endif
|
||||
#include <X11/X.h>
|
||||
#include "gcstruct.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "miscstruct.h"
|
||||
#include "../mfb/maskbits.h"
|
||||
#include "mi.h"
|
||||
|
||||
#define NPT 128
|
||||
|
||||
/* winPushPixels -- squeegees the fill style of pGC through pBitMap
|
||||
* into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may
|
||||
* be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit
|
||||
* is set in the bitmap, the fill style is put onto the drawable using
|
||||
* the GC's logical function. The drawable is not changed where the bitmap
|
||||
* has a zero bit or outside the area covered by the stencil.
|
||||
|
||||
WARNING:
|
||||
this code works if the 1-bit deep pixmap format returned by GetSpans
|
||||
is the same as the format defined by the mfb code (i.e. 32-bit padding
|
||||
per scanline, scanline unit = 32 bits; later, this might mean
|
||||
bitsizeof(int) padding and sacnline unit == bitsizeof(int).)
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* in order to have both (MSB_FIRST and LSB_FIRST) versions of this
|
||||
* in the server, we need to rename one of them
|
||||
*/
|
||||
void
|
||||
winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
|
||||
int dx, int dy, int xOrg, int yOrg)
|
||||
{
|
||||
int h, dxDivPPW, ibEnd;
|
||||
MiBits *pwLineStart;
|
||||
register MiBits *pw, *pwEnd;
|
||||
register MiBits msk;
|
||||
register int ib, w;
|
||||
register int ipt; /* index into above arrays */
|
||||
Bool fInBox;
|
||||
DDXPointRec pt[NPT], ptThisLine;
|
||||
int width[NPT];
|
||||
PixelType startmask;
|
||||
|
||||
|
||||
startmask = (MiBits)(-1) ^
|
||||
LONG2CHARSDIFFORDER((MiBits)(-1) >> 1);
|
||||
|
||||
pwLineStart = (MiBits *)xalloc(BitmapBytePad(dx));
|
||||
if (!pwLineStart)
|
||||
return;
|
||||
ipt = 0;
|
||||
dxDivPPW = dx/PPW;
|
||||
|
||||
for(h = 0, ptThisLine.x = 0, ptThisLine.y = 0;
|
||||
h < dy;
|
||||
h++, ptThisLine.y++)
|
||||
{
|
||||
|
||||
(*pBitMap->drawable.pScreen->GetSpans)((DrawablePtr)pBitMap, dx,
|
||||
&ptThisLine, &dx, 1, (char *)pwLineStart);
|
||||
|
||||
pw = pwLineStart;
|
||||
/* Process all words which are fully in the pixmap */
|
||||
|
||||
fInBox = FALSE;
|
||||
pwEnd = pwLineStart + dxDivPPW;
|
||||
while(pw < pwEnd)
|
||||
{
|
||||
w = *pw;
|
||||
#ifdef XFree86Server
|
||||
msk = startmask;
|
||||
#else
|
||||
msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1);
|
||||
#endif
|
||||
for(ib = 0; ib < PPW; ib++)
|
||||
{
|
||||
if(w & msk)
|
||||
{
|
||||
if(!fInBox)
|
||||
{
|
||||
pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
|
||||
pt[ipt].y = h + yOrg;
|
||||
/* start new box */
|
||||
fInBox = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fInBox)
|
||||
{
|
||||
width[ipt] = ((pw - pwLineStart) << PWSH) +
|
||||
ib + xOrg - pt[ipt].x;
|
||||
if (++ipt >= NPT)
|
||||
{
|
||||
(*pGC->ops->FillSpans)(pDrawable, pGC,
|
||||
NPT, pt, width, TRUE);
|
||||
ipt = 0;
|
||||
}
|
||||
/* end box */
|
||||
fInBox = FALSE;
|
||||
}
|
||||
}
|
||||
#ifdef XFree86Server
|
||||
/* This is not quite right, but it'll do for now */
|
||||
msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
|
||||
#else
|
||||
msk = SCRRIGHT(msk, 1);
|
||||
#endif
|
||||
}
|
||||
pw++;
|
||||
}
|
||||
ibEnd = dx & PIM;
|
||||
if(ibEnd)
|
||||
{
|
||||
/* Process final partial word on line */
|
||||
w = *pw;
|
||||
#ifdef XFree86Server
|
||||
msk = startmask;
|
||||
#else
|
||||
msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1);
|
||||
#endif
|
||||
for(ib = 0; ib < ibEnd; ib++)
|
||||
{
|
||||
if(w & msk)
|
||||
{
|
||||
if(!fInBox)
|
||||
{
|
||||
/* start new box */
|
||||
pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
|
||||
pt[ipt].y = h + yOrg;
|
||||
fInBox = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fInBox)
|
||||
{
|
||||
/* end box */
|
||||
width[ipt] = ((pw - pwLineStart) << PWSH) +
|
||||
ib + xOrg - pt[ipt].x;
|
||||
if (++ipt >= NPT)
|
||||
{
|
||||
(*pGC->ops->FillSpans)(pDrawable,
|
||||
pGC, NPT, pt, width, TRUE);
|
||||
ipt = 0;
|
||||
}
|
||||
fInBox = FALSE;
|
||||
}
|
||||
}
|
||||
#ifdef XFree86Server
|
||||
/* This is not quite right, but it'll do for now */
|
||||
msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
|
||||
#else
|
||||
msk = SCRRIGHT(msk, 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/* If scanline ended with last bit set, end the box */
|
||||
if(fInBox)
|
||||
{
|
||||
width[ipt] = dx + xOrg - pt[ipt].x;
|
||||
if (++ipt >= NPT)
|
||||
{
|
||||
(*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE);
|
||||
ipt = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
xfree(pwLineStart);
|
||||
/* Flush any remaining spans */
|
||||
if (ipt)
|
||||
{
|
||||
(*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE);
|
||||
}
|
||||
}
|
||||
|
|
@ -48,6 +48,11 @@ SOFTWARE.
|
|||
#ifndef SERVERMD_H
|
||||
#define SERVERMD_H 1
|
||||
|
||||
/*
|
||||
* Note: much of this is vestigial from mfb/cfb times. This should
|
||||
* really be simplified even further.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine dependent values:
|
||||
* GLYPHPADBYTES should be chosen with consideration for the space-time
|
||||
|
|
@ -61,63 +66,6 @@ SOFTWARE.
|
|||
* compiler what kind of padding you want because its defines are
|
||||
* kept separate from this. See server/include/font.h for how
|
||||
* GLYPHPADBYTES is used.
|
||||
*
|
||||
* Along with this, you should choose an appropriate value for
|
||||
* GETLEFTBITS_ALIGNMENT, which is used in ddx/mfb/maskbits.h. This
|
||||
* constant choses what kind of memory references are guarenteed during
|
||||
* font access; either 1, 2 or 4, for byte, word or longword access,
|
||||
* respectively. For instance, if you have decided to to have
|
||||
* GLYPHPADBYTES == 4, then it is pointless for you to have a
|
||||
* GETLEFTBITS_ALIGNMENT > 1, because the padding of the fonts has already
|
||||
* guarenteed you that your fonts are longword aligned. On the other
|
||||
* hand, even if you have chosen GLYPHPADBYTES == 1 to save space, you may
|
||||
* also decide that the computing involved in aligning the pointer is more
|
||||
* costly than an odd-address access; you choose GETLEFTBITS_ALIGNMENT == 1.
|
||||
*
|
||||
* Next, choose the tuning parameters which are appropriate for your
|
||||
* hardware; these modify the behaviour of the raw frame buffer code
|
||||
* in ddx/mfb and ddx/cfb. Defining these incorrectly will not cause
|
||||
* the server to run incorrectly, but defining these correctly will
|
||||
* cause some noticeable speed improvements:
|
||||
*
|
||||
* AVOID_MEMORY_READ - (8-bit cfb only)
|
||||
* When stippling pixels on the screen (polytext and pushpixels),
|
||||
* don't read long words from the display and mask in the
|
||||
* appropriate values. Rather, perform multiple byte/short/long
|
||||
* writes as appropriate. This option uses many more instructions
|
||||
* but runs much faster when the destination is much slower than
|
||||
* the CPU and at least 1 level of write buffer is availible (2
|
||||
* is much better). Defined currently for SPARC and MIPS.
|
||||
*
|
||||
* FAST_CONSTANT_OFFSET_MODE - (cfb and mfb)
|
||||
* This define is used on machines which have no auto-increment
|
||||
* addressing mode, but do have an effectively free constant-offset
|
||||
* addressing mode. Currently defined for MIPS and SPARC, even though
|
||||
* I remember the cg6 as performing better without it (cg3 definitely
|
||||
* performs better with it).
|
||||
*
|
||||
* LARGE_INSTRUCTION_CACHE -
|
||||
* This define increases the number of times some loops are
|
||||
* unrolled. On 68020 machines (with 256 bytes of i-cache),
|
||||
* this define will slow execution down as instructions miss
|
||||
* the cache frequently. On machines with real i-caches, this
|
||||
* reduces loop overhead, causing a slight performance improvement.
|
||||
* Currently defined for MIPS and SPARC
|
||||
*
|
||||
* FAST_UNALIGNED_READS -
|
||||
* For machines with more memory bandwidth than CPU, this
|
||||
* define uses unaligned reads for 8-bit BitBLT instead of doing
|
||||
* aligned reads and combining the results with shifts and
|
||||
* logical-ors. Currently defined for 68020 and vax.
|
||||
* PLENTIFUL_REGISTERS -
|
||||
* For machines with > 20 registers. Currently used for
|
||||
* unrolling the text painting code a bit more. Currently
|
||||
* defined for MIPS.
|
||||
* SHARED_IDCACHE -
|
||||
* For non-Harvard RISC machines, those which share the same
|
||||
* CPU memory bus for instructions and data. This unrolls some
|
||||
* solid fill loops which are otherwise best left rolled up.
|
||||
* Currently defined for SPARC.
|
||||
*/
|
||||
|
||||
#ifdef vax
|
||||
|
|
@ -125,8 +73,6 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER LSBFirst /* Values for the VAX only */
|
||||
#define BITMAP_BIT_ORDER LSBFirst
|
||||
#define GLYPHPADBYTES 1
|
||||
#define GETLEFTBITS_ALIGNMENT 4
|
||||
#define FAST_UNALIGNED_READS
|
||||
|
||||
#endif /* vax */
|
||||
|
||||
|
|
@ -135,8 +81,6 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER MSBFirst
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
#define AVOID_MEMORY_READ
|
||||
|
||||
#endif /* __avr32__ */
|
||||
|
||||
|
|
@ -155,9 +99,6 @@ SOFTWARE.
|
|||
# endif
|
||||
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
#define LARGE_INSTRUCTION_CACHE
|
||||
#define AVOID_MEMORY_READ
|
||||
|
||||
#endif /* __arm32__ */
|
||||
|
||||
|
|
@ -166,13 +107,7 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER MSBFirst
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 4 /* to make fb work */
|
||||
#define GETLEFTBITS_ALIGNMENT 1 /* PA forces longs to 4 */
|
||||
/* byte boundries */
|
||||
#define AVOID_MEMORY_READ
|
||||
#define FAST_CONSTANT_OFFSET_MODE
|
||||
#define LARGE_INSTRUCTION_CACHE
|
||||
#define PLENTIFUL_REGISTERS
|
||||
|
||||
#endif /* hpux || __hppa__ */
|
||||
|
||||
#if defined(__powerpc__) || defined(__ppc__)
|
||||
|
|
@ -180,20 +115,12 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER MSBFirst
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
|
||||
/* XXX Should this be for Lynx only? */
|
||||
#ifdef Lynx
|
||||
#define BITMAP_SCANLINE_UNIT 8
|
||||
#endif
|
||||
|
||||
#define LARGE_INSTRUCTION_CACHE
|
||||
#define FAST_CONSTANT_OFFSET_MODE
|
||||
#define PLENTIFUL_REGISTERS
|
||||
#define AVOID_MEMORY_READ
|
||||
|
||||
#define FAST_MEMCPY
|
||||
|
||||
#endif /* PowerPC */
|
||||
|
||||
#if defined(__sh__)
|
||||
|
|
@ -202,19 +129,12 @@ SOFTWARE.
|
|||
# define IMAGE_BYTE_ORDER MSBFirst
|
||||
# define BITMAP_BIT_ORDER MSBFirst
|
||||
# define GLYPHPADBYTES 4
|
||||
# define GETLEFTBITS_ALIGNMENT 1
|
||||
#else
|
||||
# define IMAGE_BYTE_ORDER LSBFirst
|
||||
# define BITMAP_BIT_ORDER LSBFirst
|
||||
# define GLYPHPADBYTES 4
|
||||
# define GETLEFTBITS_ALIGNMENT 1
|
||||
#endif
|
||||
|
||||
#define AVOID_MEMORY_READ
|
||||
#define FAST_CONSTANT_OFFSET_MODE
|
||||
#define LARGE_INSTRUCTION_CACHE
|
||||
#define PLENTIFUL_REGISTERS
|
||||
|
||||
#endif /* SuperH */
|
||||
|
||||
#if defined(__m32r__)
|
||||
|
|
@ -223,19 +143,12 @@ SOFTWARE.
|
|||
# define IMAGE_BYTE_ORDER MSBFirst
|
||||
# define BITMAP_BIT_ORDER MSBFirst
|
||||
# define GLYPHPADBYTES 4
|
||||
# define GETLEFTBITS_ALIGNMENT 1
|
||||
#else
|
||||
# define IMAGE_BYTE_ORDER LSBFirst
|
||||
# define BITMAP_BIT_ORDER LSBFirst
|
||||
# define GLYPHPADBYTES 4
|
||||
# define GETLEFTBITS_ALIGNMENT 1
|
||||
#endif
|
||||
|
||||
#define AVOID_MEMORY_READ
|
||||
#define FAST_CONSTANT_OFFSET_MODE
|
||||
#define LARGE_INSTRUCTION_CACHE
|
||||
#define PLENTIFUL_REGISTERS
|
||||
|
||||
#endif /* __m32r__ */
|
||||
|
||||
#if (defined(sun) && (defined(__sparc) || defined(sparc))) || \
|
||||
|
|
@ -256,37 +169,15 @@ SOFTWARE.
|
|||
# define BITMAP_BIT_ORDER MSBFirst
|
||||
#endif
|
||||
|
||||
#ifdef sparc
|
||||
# define AVOID_MEMORY_READ
|
||||
# define LARGE_INSTRUCTION_CACHE
|
||||
# define FAST_CONSTANT_OFFSET_MODE
|
||||
# define SHARED_IDCACHE
|
||||
#endif
|
||||
|
||||
#ifdef mc68020
|
||||
#define FAST_UNALIGNED_READS
|
||||
#endif
|
||||
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
|
||||
#endif /* sun && !(i386 && SVR4) */
|
||||
|
||||
|
||||
#if defined(AIXV3)
|
||||
|
||||
#define IMAGE_BYTE_ORDER MSBFirst /* Values for the RISC/6000 */
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
|
||||
#define LARGE_INSTRUCTION_CACHE
|
||||
#define FAST_CONSTANT_OFFSET_MODE
|
||||
#define PLENTIFUL_REGISTERS
|
||||
#define AVOID_MEMORY_READ
|
||||
|
||||
#define FAST_MEMCPY
|
||||
#endif /* AIXV3 */
|
||||
|
||||
#if defined(ibm032) || defined (ibm)
|
||||
|
||||
|
|
@ -297,7 +188,6 @@ SOFTWARE.
|
|||
#endif
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 1
|
||||
#define GETLEFTBITS_ALIGNMENT 4
|
||||
/* ibm pcc doesn't understand pragmas. */
|
||||
|
||||
#ifdef __i386__
|
||||
|
|
@ -311,9 +201,6 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER MSBFirst /* Values for Pegasus only */
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
|
||||
#define FAST_UNALIGNED_READS
|
||||
|
||||
#endif /* tektronix */
|
||||
|
||||
|
|
@ -322,9 +209,6 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER MSBFirst /* Values for the MacII only */
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
|
||||
/* might want FAST_UNALIGNED_READS for frame buffers with < 1us latency */
|
||||
|
||||
#endif /* macII */
|
||||
|
||||
|
|
@ -334,19 +218,12 @@ SOFTWARE.
|
|||
# define IMAGE_BYTE_ORDER LSBFirst /* Values for the PMAX only */
|
||||
# define BITMAP_BIT_ORDER LSBFirst
|
||||
# define GLYPHPADBYTES 4
|
||||
# define GETLEFTBITS_ALIGNMENT 1
|
||||
#else
|
||||
# define IMAGE_BYTE_ORDER MSBFirst /* Values for the MIPS only */
|
||||
# define BITMAP_BIT_ORDER MSBFirst
|
||||
# define GLYPHPADBYTES 4
|
||||
# define GETLEFTBITS_ALIGNMENT 1
|
||||
#endif
|
||||
|
||||
#define AVOID_MEMORY_READ
|
||||
#define FAST_CONSTANT_OFFSET_MODE
|
||||
#define LARGE_INSTRUCTION_CACHE
|
||||
#define PLENTIFUL_REGISTERS
|
||||
|
||||
#endif /* mips */
|
||||
|
||||
#if defined(__alpha) || defined(__alpha__) || defined(__alphaCross)
|
||||
|
|
@ -363,10 +240,6 @@ SOFTWARE.
|
|||
# endif
|
||||
|
||||
# define GLYPHPADBYTES 4
|
||||
# define GETLEFTBITS_ALIGNMENT 1
|
||||
# define FAST_CONSTANT_OFFSET_MODE
|
||||
# define LARGE_INSTRUCTION_CACHE
|
||||
# define PLENTIFUL_REGISTERS
|
||||
|
||||
#endif /* alpha */
|
||||
|
||||
|
|
@ -375,15 +248,10 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER MSBFirst
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
|
||||
#define BITMAP_SCANLINE_UNIT 8
|
||||
#define LARGE_INSTRUCTION_CACHE
|
||||
#define FAST_CONSTANT_OFFSET_MODE
|
||||
#define FAST_UNALIGNED_READ
|
||||
|
||||
#define FAST_MEMCPY
|
||||
|
||||
#endif /* linux/s390 */
|
||||
|
||||
#if defined (linux) && defined (__s390x__)
|
||||
|
|
@ -391,14 +259,10 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER MSBFirst
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
|
||||
#define BITMAP_SCANLINE_UNIT 8
|
||||
#define LARGE_INSTRUCTION_CACHE
|
||||
#define FAST_CONSTANT_OFFSET_MODE
|
||||
#define FAST_UNALIGNED_READ
|
||||
|
||||
#define FAST_MEMCPY
|
||||
#endif /* linux/s390x */
|
||||
|
||||
|
||||
|
|
@ -416,10 +280,6 @@ SOFTWARE.
|
|||
# endif
|
||||
|
||||
# define GLYPHPADBYTES 4
|
||||
# define GETLEFTBITS_ALIGNMENT 1
|
||||
# define FAST_CONSTANT_OFFSET_MODE
|
||||
# define LARGE_INSTRUCTION_CACHE
|
||||
# define PLENTIFUL_REGISTERS
|
||||
|
||||
#endif /* ia64 */
|
||||
|
||||
|
|
@ -437,11 +297,7 @@ SOFTWARE.
|
|||
# endif
|
||||
|
||||
# define GLYPHPADBYTES 4
|
||||
# define GETLEFTBITS_ALIGNMENT 1
|
||||
# define LARGE_INSTRUCTION_CACHE
|
||||
# define FAST_CONSTANT_OFFSET_MODE
|
||||
/* ???? */
|
||||
# define FAST_UNALIGNED_READS
|
||||
#endif /* AMD64 */
|
||||
|
||||
#ifdef stellar
|
||||
|
|
@ -449,7 +305,6 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER MSBFirst /* Values for the stellar only*/
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 4
|
||||
#define IMAGE_BUFSIZE (64*1024)
|
||||
/*
|
||||
* Use SysV random number generator.
|
||||
|
|
@ -463,14 +318,6 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER MSBFirst /* Values for the OMRON only*/
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
|
||||
#ifndef mc68000
|
||||
#define FAST_CONSTANT_OFFSET_MODE
|
||||
#define AVOID_MEMORY_READ
|
||||
#define LARGE_INSTRUCTION_CACHE
|
||||
#define PLENTIFUL_REGISTERS
|
||||
#endif
|
||||
|
||||
#endif /* luna */
|
||||
|
||||
|
|
@ -501,12 +348,8 @@ SOFTWARE.
|
|||
#define GLYPHPADBYTES 4
|
||||
#endif
|
||||
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
#define AVOID_MEMORY_READ
|
||||
#ifdef XSVGA
|
||||
#define AVOID_GLYPHBLT
|
||||
#define FAST_CONSTANT_OFFSET_MODE
|
||||
#define FAST_MEMCPY
|
||||
#define NO_ONE_RECT
|
||||
#endif
|
||||
|
||||
|
|
@ -516,9 +359,7 @@ SOFTWARE.
|
|||
|
||||
#define IMAGE_BYTE_ORDER MSBFirst
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define FAST_UNALIGNED_READS
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
|
||||
#endif /* linux/m68k */
|
||||
|
||||
|
|
@ -527,11 +368,6 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER MSBFirst
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
#define AVOID_MEMORY_READ
|
||||
#define FAST_CONSTANT_OFFSET_MODE
|
||||
#define LARGE_INSTRUCTION_CACHE
|
||||
#define PLENTIFUL_REGISTERS
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -540,7 +376,6 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER LSBFirst
|
||||
#define BITMAP_BIT_ORDER LSBFirst
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
#endif
|
||||
|
||||
/* linux on IBM S/390 */
|
||||
|
|
@ -548,7 +383,6 @@ SOFTWARE.
|
|||
#define IMAGE_BYTE_ORDER MSBFirst
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#define GLYPHPADBYTES 4
|
||||
#define GETLEFTBITS_ALIGNMENT 1
|
||||
#endif /* linux/s390 */
|
||||
|
||||
/* size of buffer to use with GetImage, measured in bytes. There's obviously
|
||||
|
|
|
|||
133
mfb/Makefile.am
133
mfb/Makefile.am
|
|
@ -1,133 +0,0 @@
|
|||
noinst_LTLIBRARIES = libmfb.la
|
||||
|
||||
AM_CFLAGS = $(DIX_CFLAGS)
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/hw/xfree86/os-support
|
||||
|
||||
libmfb_gen_sources = mfbseg.c mfbpgbwht.c mfbpgbblak.c mfbpgbinv.c mfbigbwht.c \
|
||||
mfbigbblak.c mfbpawhite.c mfbpablack.c mfbpainv.c mfbtewhite.c \
|
||||
mfbteblack.c mfbbltC.c mfbbltX.c mfbbltCI.c mfbbltO.c mfbbltG.c \
|
||||
mfbtileC.c mfbtileG.c mfbplywhite.c mfbplyblack.c mfbplyinv.c
|
||||
|
||||
DISTCLEANFILES = $(libmfb_gen_sources)
|
||||
|
||||
libmfb_la_SOURCES = mfbgc.c mfbwindow.c mfbfont.c \
|
||||
mfbfillrct.c maskbits.c mfbpixmap.c \
|
||||
mfbimage.c mfbline.c mfbbres.c mfbhrzvert.c mfbbresd.c \
|
||||
mfbpushpxl.c mfbzerarc.c mfbfillarc.c \
|
||||
mfbfillsp.c mfbsetsp.c mfbscrinit.c mfbscrclse.c mfbclip.c \
|
||||
mfbbitblt.c mfbgetsp.c mfbpolypnt.c \
|
||||
mfbcmap.c mfbmisc.c $(libmfb_gen_sources)
|
||||
|
||||
EXTRA_DIST = maskbits.h mergerop.h fastblt.h mfbline.c mfbblt.c mfbtile.c \
|
||||
mfbplygblt.c mfbimggblt.c mfbpntarea.c mfbtegblt.c mfbply1rct.c
|
||||
|
||||
sdk_HEADERS = mfb.h
|
||||
|
||||
mfbseg.c:
|
||||
echo "#define POLYSEGMENT" > $@
|
||||
echo "#include \"$(srcdir)/mfbline.c\"" >> $@
|
||||
|
||||
mfbbltC.c:
|
||||
echo "#define MROP Mcopy" > $@
|
||||
echo "#include \"$(srcdir)/mfbblt.c\"" >> $@
|
||||
|
||||
mfbbltX.c:
|
||||
echo "#define MROP Mxor" > $@
|
||||
echo "#include \"$(srcdir)/mfbblt.c\"" >> $@
|
||||
|
||||
mfbbltCI.c:
|
||||
echo "#define MROP McopyInverted" > $@
|
||||
echo "#include \"$(srcdir)/mfbblt.c\"" >> $@
|
||||
|
||||
mfbbltO.c:
|
||||
echo "#define MROP Mor" > $@
|
||||
echo "#include \"$(srcdir)/mfbblt.c\"" >> $@
|
||||
|
||||
mfbbltG.c:
|
||||
echo "#define MROP 0" > $@
|
||||
echo "#include \"$(srcdir)/mfbblt.c\"" >> $@
|
||||
|
||||
mfbtileC.c:
|
||||
echo "#define MROP Mcopy" > $@
|
||||
echo "#include \"$(srcdir)/mfbtile.c\"" >> $@
|
||||
|
||||
mfbtileG.c:
|
||||
echo "#define MROP 0" > $@
|
||||
echo "#include \"$(srcdir)/mfbtile.c\"" >> $@
|
||||
|
||||
mfbpgbwht.c:
|
||||
echo "#define OPEQ MFB_OPEQ_WHITE" > $@
|
||||
echo "#define MFBPOLYGLYPHBLT mfbPolyGlyphBltWhite" >> $@
|
||||
echo "#include \"$(srcdir)/mfbplygblt.c\"" >> $@
|
||||
|
||||
mfbpgbblak.c:
|
||||
echo "#define OPEQ MFB_OPEQ_BLACK" > $@
|
||||
echo "#define MFBPOLYGLYPHBLT mfbPolyGlyphBltBlack" >> $@
|
||||
echo "#include \"$(srcdir)/mfbplygblt.c\"" >> $@
|
||||
|
||||
mfbpgbinv.c:
|
||||
echo "#define OPEQ MFB_OPEQ_INVERT" > $@
|
||||
echo "#define MFBPOLYGLYPHBLT mfbPolyGlyphBltInvert" >> $@
|
||||
echo "#include \"$(srcdir)/mfbplygblt.c\"" >> $@
|
||||
|
||||
mfbigbwht.c:
|
||||
echo "#define OPEQ MFB_OPEQ_WHITE" > $@
|
||||
echo "#define MFBIMAGEGLYPHBLT mfbImageGlyphBltWhite" >> $@
|
||||
echo "#include \"$(srcdir)/mfbimggblt.c\"" >> $@
|
||||
|
||||
mfbigbblak.c:
|
||||
echo "#define OPEQ MFB_OPEQ_BLACK" > $@
|
||||
echo "#define MFBIMAGEGLYPHBLT mfbImageGlyphBltBlack" >> $@
|
||||
echo "#include \"$(srcdir)/mfbimggblt.c\"" >> $@
|
||||
|
||||
mfbpawhite.c:
|
||||
echo "#define OPEQ MFB_OPEQ_WHITE" > $@
|
||||
echo "#define MFBSOLIDFILLAREA mfbSolidWhiteArea" >> $@
|
||||
echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_WHITE" >> $@
|
||||
echo "#define MFBSTIPPLEFILLAREA mfbStippleWhiteArea" >> $@
|
||||
echo "#include \"$(srcdir)/mfbpntarea.c\"" >> $@
|
||||
|
||||
mfbpablack.c:
|
||||
echo "#define OPEQ MFB_OPEQ_BLACK" > $@
|
||||
echo "#define MFBSOLIDFILLAREA mfbSolidBlackArea" >> $@
|
||||
echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_BLACK" >> $@
|
||||
echo "#define MFBSTIPPLEFILLAREA mfbStippleBlackArea" >> $@
|
||||
echo "#include \"$(srcdir)/mfbpntarea.c\"" >> $@
|
||||
|
||||
mfbpainv.c:
|
||||
echo "#define OPEQ MFB_OPEQ_INVERT" > $@
|
||||
echo "#define MFBSOLIDFILLAREA mfbSolidInvertArea" >> $@
|
||||
echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_INVERT" >> $@
|
||||
echo "#define MFBSTIPPLEFILLAREA mfbStippleInvertArea" >> $@
|
||||
echo "#include \"$(srcdir)/mfbpntarea.c\"" >> $@
|
||||
|
||||
mfbtewhite.c:
|
||||
echo "#define OP MFB_OP_WHITE" > $@
|
||||
echo "#define MFBTEGLYPHBLT mfbTEGlyphBltWhite" >> $@
|
||||
echo "#define CLIPTETEXT mfbImageGlyphBltWhite" >> $@
|
||||
echo "#include \"$(srcdir)/mfbtegblt.c\"" >> $@
|
||||
|
||||
mfbteblack.c:
|
||||
echo "#define OP MFB_OP_BLACK" > $@
|
||||
echo "#define MFBTEGLYPHBLT mfbTEGlyphBltBlack" >> $@
|
||||
echo "#define CLIPTETEXT mfbImageGlyphBltBlack" >> $@
|
||||
echo "#include \"$(srcdir)/mfbtegblt.c\"" >> $@
|
||||
|
||||
mfbplywhite.c:
|
||||
echo "#define OPEQ MFB_OPEQ_WHITE" > $@
|
||||
echo "#define MFBFILLPOLY1RECT mfbFillPolyWhite" >> $@
|
||||
echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_WHITE" >> $@
|
||||
echo "#include \"$(srcdir)/mfbply1rct.c\"" >> $@
|
||||
|
||||
mfbplyblack.c:
|
||||
echo "#define OPEQ MFB_OPEQ_BLACK" > $@
|
||||
echo "#define MFBFILLPOLY1RECT mfbFillPolyBlack" >> $@
|
||||
echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_BLACK" >> $@
|
||||
echo "#include \"$(srcdir)/mfbply1rct.c\"" >> $@
|
||||
|
||||
mfbplyinv.c:
|
||||
echo "#define OPEQ MFB_OPEQ_INVERT" > $@
|
||||
echo "#define MFBFILLPOLY1RECT mfbFillPolyInvert" >> $@
|
||||
echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_INVERT" >> $@
|
||||
echo "#include \"$(srcdir)/mfbply1rct.c\"" >> $@
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright 1989, 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.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* Fast bitblt macros for certain hardware. If your machine has an addressing
|
||||
* mode of small constant + register, you'll probably want this magic specific
|
||||
* code. It's 25% faster for the R2000. I haven't studied the Sparc
|
||||
* instruction set, but I suspect it also has this addressing mode. Also,
|
||||
* unrolling the loop by 32 is possibly excessive for mfb. The number of times
|
||||
* the loop is actually looped through is pretty small.
|
||||
*/
|
||||
|
||||
/*
|
||||
* WARNING: These macros make *a lot* of assumptions about
|
||||
* the environment they are invoked in. Plenty of implicit
|
||||
* arguments, lots of side effects. Don't use them casually.
|
||||
*/
|
||||
|
||||
#define SwitchOdd(n) case n: BodyOdd(n)
|
||||
#define SwitchEven(n) case n: BodyEven(n)
|
||||
|
||||
/* to allow mfb and cfb to share code... */
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef BitRight
|
||||
#define BitRight(a,b) SCRRIGHT(a,b)
|
||||
#define BitLeft(a,b) SCRLEFT(a,b)
|
||||
#endif
|
||||
|
||||
#ifdef LARGE_INSTRUCTION_CACHE
|
||||
#define UNROLL 8
|
||||
#define PackedLoop \
|
||||
switch (nl & (UNROLL-1)) { \
|
||||
SwitchOdd( 7) SwitchEven( 6) SwitchOdd( 5) SwitchEven( 4) \
|
||||
SwitchOdd( 3) SwitchEven( 2) SwitchOdd( 1) \
|
||||
} \
|
||||
while ((nl -= UNROLL) >= 0) { \
|
||||
LoopReset \
|
||||
BodyEven( 8) \
|
||||
BodyOdd( 7) BodyEven( 6) BodyOdd( 5) BodyEven( 4) \
|
||||
BodyOdd( 3) BodyEven( 2) BodyOdd( 1) \
|
||||
}
|
||||
#else
|
||||
#define UNROLL 4
|
||||
#define PackedLoop \
|
||||
switch (nl & (UNROLL-1)) { \
|
||||
SwitchOdd( 3) SwitchEven( 2) SwitchOdd( 1) \
|
||||
} \
|
||||
while ((nl -= UNROLL) >= 0) { \
|
||||
LoopReset \
|
||||
BodyEven( 4) \
|
||||
BodyOdd( 3) BodyEven( 2) BodyOdd( 1) \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define DuffL(counter,label,body) \
|
||||
switch (counter & 3) { \
|
||||
label: \
|
||||
body \
|
||||
case 3: \
|
||||
body \
|
||||
case 2: \
|
||||
body \
|
||||
case 1: \
|
||||
body \
|
||||
case 0: \
|
||||
if ((counter -= 4) >= 0) \
|
||||
goto label; \
|
||||
}
|
||||
1059
mfb/maskbits.c
1059
mfb/maskbits.c
File diff suppressed because it is too large
Load diff
689
mfb/maskbits.h
689
mfb/maskbits.h
|
|
@ -1,689 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.1, 1/24/89 */
|
||||
/***********************************************************
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include "servermd.h"
|
||||
|
||||
|
||||
/* the following notes use the following conventions:
|
||||
SCREEN LEFT SCREEN RIGHT
|
||||
in this file and maskbits.c, left and right refer to screen coordinates,
|
||||
NOT bit numbering in registers.
|
||||
|
||||
starttab[n]
|
||||
bits[0,n-1] = 0 bits[n,PLST] = 1
|
||||
endtab[n] =
|
||||
bits[0,n-1] = 1 bits[n,PLST] = 0
|
||||
|
||||
startpartial[], endpartial[]
|
||||
these are used as accelerators for doing putbits and masking out
|
||||
bits that are all contained between longword boudaries. the extra
|
||||
256 bytes of data seems a small price to pay -- code is smaller,
|
||||
and narrow things (e.g. window borders) go faster.
|
||||
|
||||
the names may seem misleading; they are derived not from which end
|
||||
of the word the bits are turned on, but at which end of a scanline
|
||||
the table tends to be used.
|
||||
|
||||
look at the tables and macros to understand boundary conditions.
|
||||
(careful readers will note that starttab[n] = ~endtab[n] for n != 0)
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
these two macros depend on the screen's bit ordering.
|
||||
in both of them x is a screen position. they are used to
|
||||
combine bits collected from multiple longwords into a
|
||||
single destination longword, and to unpack a single
|
||||
source longword into multiple destinations.
|
||||
|
||||
SCRLEFT(dst, x)
|
||||
takes dst[x, PPW] and moves them to dst[0, PPW-x]
|
||||
the contents of the rest of dst are 0.
|
||||
this is a right shift on LSBFirst (forward-thinking)
|
||||
machines like the VAX, and left shift on MSBFirst
|
||||
(backwards) machines like the 680x0 and pc/rt.
|
||||
|
||||
SCRRIGHT(dst, x)
|
||||
takes dst[0,x] and moves them to dst[PPW-x, PPW]
|
||||
the contents of the rest of dst are 0.
|
||||
this is a left shift on LSBFirst, right shift
|
||||
on MSBFirst.
|
||||
|
||||
|
||||
the remaining macros are cpu-independent; all bit order dependencies
|
||||
are built into the tables and the two macros above.
|
||||
|
||||
maskbits(x, w, startmask, endmask, nlw)
|
||||
for a span of width w starting at position x, returns
|
||||
a mask for ragged bits at start, mask for ragged bits at end,
|
||||
and the number of whole longwords between the ends.
|
||||
|
||||
maskpartialbits(x, w, mask)
|
||||
works like maskbits(), except all the bits are in the
|
||||
same longword (i.e. (x&PIM + w) <= PPW)
|
||||
|
||||
maskPPWbits(x, w, startmask, endmask, nlw)
|
||||
as maskbits, but does not calculate nlw. it is used by
|
||||
mfbGlyphBlt to put down glyphs <= PPW bits wide.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
NOTE
|
||||
any pointers passed to the following 4 macros are
|
||||
guranteed to be PPW-bit aligned.
|
||||
The only non-PPW-bit-aligned references ever made are
|
||||
to font glyphs, and those are made with getleftbits()
|
||||
and getshiftedleftbits (qq.v.)
|
||||
|
||||
For 64-bit server, it is assumed that we will never have font padding
|
||||
of more than 4 bytes. The code uses int's to access the fonts
|
||||
intead of longs.
|
||||
|
||||
getbits(psrc, x, w, dst)
|
||||
starting at position x in psrc (x < PPW), collect w
|
||||
bits and put them in the screen left portion of dst.
|
||||
psrc is a longword pointer. this may span longword boundaries.
|
||||
it special-cases fetching all w bits from one longword.
|
||||
|
||||
+--------+--------+ +--------+
|
||||
| | m |n| | ==> | m |n| |
|
||||
+--------+--------+ +--------+
|
||||
x x+w 0 w
|
||||
psrc psrc+1 dst
|
||||
m = PPW - x
|
||||
n = w - m
|
||||
|
||||
implementation:
|
||||
get m bits, move to screen-left of dst, zeroing rest of dst;
|
||||
get n bits from next word, move screen-right by m, zeroing
|
||||
lower m bits of word.
|
||||
OR the two things together.
|
||||
|
||||
putbits(src, x, w, pdst)
|
||||
starting at position x in pdst, put down the screen-leftmost
|
||||
w bits of src. pdst is a longword pointer. this may
|
||||
span longword boundaries.
|
||||
it special-cases putting all w bits into the same longword.
|
||||
|
||||
+--------+ +--------+--------+
|
||||
| m |n| | ==> | | m |n| |
|
||||
+--------+ +--------+--------+
|
||||
0 w x x+w
|
||||
dst pdst pdst+1
|
||||
m = PPW - x
|
||||
n = w - m
|
||||
|
||||
implementation:
|
||||
get m bits, shift screen-right by x, zero screen-leftmost x
|
||||
bits; zero rightmost m bits of *pdst and OR in stuff
|
||||
from before the semicolon.
|
||||
shift src screen-left by m, zero bits n-PPW;
|
||||
zero leftmost n bits of *(pdst+1) and OR in the
|
||||
stuff from before the semicolon.
|
||||
|
||||
putbitsrop(src, x, w, pdst, ROP)
|
||||
like putbits but calls DoRop with the rasterop ROP (see mfb.h for
|
||||
DoRop)
|
||||
|
||||
putbitsrrop(src, x, w, pdst, ROP)
|
||||
like putbits but calls DoRRop with the reduced rasterop ROP
|
||||
(see mfb.h for DoRRop)
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
The two macros below are used only for getting bits from glyphs
|
||||
in fonts, and glyphs in fonts are gotten only with the following two
|
||||
mcros.
|
||||
You should tune these macros toyour font format and cpu
|
||||
byte ordering.
|
||||
|
||||
NOTE
|
||||
getleftbits(psrc, w, dst)
|
||||
get the leftmost w (w<=32) bits from *psrc and put them
|
||||
in dst. this is used by the mfbGlyphBlt code for glyphs
|
||||
<=PPW bits wide.
|
||||
psrc is declared (unsigned char *)
|
||||
|
||||
psrc is NOT guaranteed to be PPW-bit aligned. on many
|
||||
machines this will cause problems, so there are several
|
||||
versions of this macro.
|
||||
|
||||
this macro is called ONLY for getting bits from font glyphs,
|
||||
and depends on the server-natural font padding.
|
||||
|
||||
for blazing text performance, you want this macro
|
||||
to touch memory as infrequently as possible (e.g.
|
||||
fetch longwords) and as efficiently as possible
|
||||
(e.g. don't fetch misaligned longwords)
|
||||
|
||||
getshiftedleftbits(psrc, offset, w, dst)
|
||||
used by the font code; like getleftbits, but shifts the
|
||||
bits SCRLEFT by offset.
|
||||
this is implemented portably, calling getleftbits()
|
||||
and SCRLEFT().
|
||||
psrc is declared (unsigned char *).
|
||||
*/
|
||||
|
||||
/* to match CFB and allow algorithm sharing ...
|
||||
* name mfb32 mfb64 explanation
|
||||
* ---- ------ ----- -----------
|
||||
* PGSZ 32 64 pixel group size (in bits; same as PPW for mfb)
|
||||
* PGSZB 4 8 pixel group size (in bytes)
|
||||
* PPW 32 64 pixels per word (pixels per pixel group)
|
||||
* PLST 31 63 index of last pixel in a word (should be PPW-1)
|
||||
* PIM 0x1f 0x3f pixel index mask (index within a pixel group)
|
||||
* PWSH 5 6 pixel-to-word shift (should be log2(PPW))
|
||||
*
|
||||
* The MFB_ versions are here so that cfb can include maskbits.h to get
|
||||
* the bitmap constants without conflicting with its own P* constants.
|
||||
*
|
||||
* Keith Packard (keithp@suse.com):
|
||||
* Note mfb64 is no longer supported; it requires DIX support
|
||||
* for realigning images which costs too much
|
||||
*/
|
||||
|
||||
/* warning: PixelType definition duplicated in mfb.h */
|
||||
#ifndef PixelType
|
||||
#define PixelType CARD32
|
||||
#endif /* PixelType */
|
||||
#ifndef MfbBits
|
||||
#define MfbBits CARD32
|
||||
#endif
|
||||
|
||||
#define MFB_PGSZB 4
|
||||
#define MFB_PPW (MFB_PGSZB<<3) /* assuming 8 bits per byte */
|
||||
#define MFB_PGSZ MFB_PPW
|
||||
#define MFB_PLST (MFB_PPW-1)
|
||||
#define MFB_PIM MFB_PLST
|
||||
|
||||
/* set PWSH = log2(PPW) using brute force */
|
||||
|
||||
#if MFB_PPW == 32
|
||||
#define MFB_PWSH 5
|
||||
#endif /* MFB_PPW == 32 */
|
||||
|
||||
/* XXX don't use these five */
|
||||
extern PixelType starttab[];
|
||||
extern PixelType endtab[];
|
||||
extern PixelType partmasks[MFB_PPW][MFB_PPW];
|
||||
extern PixelType rmask[];
|
||||
extern PixelType mask[];
|
||||
/* XXX use these five */
|
||||
extern PixelType mfbGetstarttab(int);
|
||||
extern PixelType mfbGetendtab(int);
|
||||
extern PixelType mfbGetpartmasks(int, int);
|
||||
extern PixelType mfbGetrmask(int);
|
||||
extern PixelType mfbGetmask(int);
|
||||
|
||||
#ifndef MFB_CONSTS_ONLY
|
||||
|
||||
#define PGSZB MFB_PGSZB
|
||||
#define PPW MFB_PPW
|
||||
#define PGSZ MFB_PGSZ
|
||||
#define PLST MFB_PLST
|
||||
#define PIM MFB_PIM
|
||||
#define PWSH MFB_PWSH
|
||||
|
||||
#define BitLeft(b,s) SCRLEFT(b,s)
|
||||
#define BitRight(b,s) SCRRIGHT(b,s)
|
||||
|
||||
#if 1
|
||||
#define LONG2CHARSSAMEORDER(x) ((MfbBits)(x))
|
||||
#define LONG2CHARSDIFFORDER( x ) ( ( ( ( x ) & (MfbBits)0x000000FF ) << 0x18 ) \
|
||||
| ( ( ( x ) & (MfbBits)0x0000FF00 ) << 0x08 ) \
|
||||
| ( ( ( x ) & (MfbBits)0x00FF0000 ) >> 0x08 ) \
|
||||
| ( ( ( x ) & (MfbBits)0xFF000000 ) >> 0x18 ) )
|
||||
#endif /* XFree86Server */
|
||||
|
||||
#if (BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER)
|
||||
#define LONG2CHARS(x) ((MfbBits)(x))
|
||||
#else
|
||||
/*
|
||||
* the unsigned case below is for compilers like
|
||||
* the Danbury C and i386cc
|
||||
*/
|
||||
#define LONG2CHARS( x ) ( ( ( ( x ) & (MfbBits)0x000000FF ) << 0x18 ) \
|
||||
| ( ( ( x ) & (MfbBits)0x0000FF00 ) << 0x08 ) \
|
||||
| ( ( ( x ) & (MfbBits)0x00FF0000 ) >> 0x08 ) \
|
||||
| ( ( ( x ) & (MfbBits)0xFF000000 ) >> 0x18 ) )
|
||||
#endif /* BITMAP_BIT_ORDER */
|
||||
|
||||
#ifdef STRICT_ANSI_SHIFT
|
||||
#define SHL(x,y) ((y) >= PPW ? 0 : LONG2CHARS(LONG2CHARS(x) << (y)))
|
||||
#define SHR(x,y) ((y) >= PPW ? 0 : LONG2CHARS(LONG2CHARS(x) >> (y)))
|
||||
#else
|
||||
#define SHL(x,y) LONG2CHARS(LONG2CHARS(x) << (y))
|
||||
#define SHR(x,y) LONG2CHARS(LONG2CHARS(x) >> (y))
|
||||
#endif
|
||||
|
||||
#if (BITMAP_BIT_ORDER == MSBFirst) /* pc/rt, 680x0 */
|
||||
#define SCRLEFT(lw, n) SHL((PixelType)(lw),(n))
|
||||
#define SCRRIGHT(lw, n) SHR((PixelType)(lw),(n))
|
||||
#else /* vax, intel */
|
||||
#define SCRLEFT(lw, n) SHR((PixelType)(lw),(n))
|
||||
#define SCRRIGHT(lw, n) SHL((PixelType)(lw),(n))
|
||||
#endif
|
||||
|
||||
#define DoRRop(alu, src, dst) \
|
||||
(((alu) == RROP_BLACK) ? ((dst) & ~(src)) : \
|
||||
((alu) == RROP_WHITE) ? ((dst) | (src)) : \
|
||||
((alu) == RROP_INVERT) ? ((dst) ^ (src)) : \
|
||||
(dst))
|
||||
|
||||
/* A generalized form of a x4 Duff's Device */
|
||||
#define Duff(counter, block) { \
|
||||
while (counter >= 4) {\
|
||||
{ block; } \
|
||||
{ block; } \
|
||||
{ block; } \
|
||||
{ block; } \
|
||||
counter -= 4; \
|
||||
} \
|
||||
switch (counter & 3) { \
|
||||
case 3: { block; } \
|
||||
case 2: { block; } \
|
||||
case 1: { block; } \
|
||||
case 0: \
|
||||
counter = 0; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define maskbits(x, w, startmask, endmask, nlw) \
|
||||
startmask = mfbGetstarttab((x) & PIM); \
|
||||
endmask = mfbGetendtab(((x)+(w)) & PIM); \
|
||||
if (startmask) \
|
||||
nlw = (((w) - (PPW - ((x) & PIM))) >> PWSH); \
|
||||
else \
|
||||
nlw = (w) >> PWSH;
|
||||
|
||||
#define maskpartialbits(x, w, mask) \
|
||||
mask = mfbGetpartmasks((x) & PIM, (w) & PIM);
|
||||
|
||||
#define maskPPWbits(x, w, startmask, endmask) \
|
||||
startmask = mfbGetstarttab((x) & PIM); \
|
||||
endmask = mfbGetendtab(((x)+(w)) & PIM);
|
||||
|
||||
#ifdef __GNUC__ /* XXX don't want for Alpha? */
|
||||
#ifdef vax
|
||||
#define FASTGETBITS(psrc,x,w,dst) \
|
||||
__asm ("extzv %1,%2,%3,%0" \
|
||||
: "=g" (dst) \
|
||||
: "g" (x), "g" (w), "m" (*(char *)(psrc)))
|
||||
#define getbits(psrc,x,w,dst) FASTGETBITS(psrc,x,w,dst)
|
||||
|
||||
#define FASTPUTBITS(src, x, w, pdst) \
|
||||
__asm ("insv %3,%1,%2,%0" \
|
||||
: "=m" (*(char *)(pdst)) \
|
||||
: "g" (x), "g" (w), "g" (src))
|
||||
#define putbits(src, x, w, pdst) FASTPUTBITS(src, x, w, pdst)
|
||||
#endif /* vax */
|
||||
#ifdef mc68020
|
||||
#define FASTGETBITS(psrc, x, w, dst) \
|
||||
__asm ("bfextu %3{%1:%2},%0" \
|
||||
: "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc)))
|
||||
|
||||
#define getbits(psrc,x,w,dst) \
|
||||
{ \
|
||||
FASTGETBITS(psrc, x, w, dst);\
|
||||
dst = SHL(dst,(32-(w))); \
|
||||
}
|
||||
|
||||
#define FASTPUTBITS(src, x, w, pdst) \
|
||||
__asm ("bfins %3,%0{%1:%2}" \
|
||||
: "=o" (*(char *)(pdst)) \
|
||||
: "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))
|
||||
|
||||
#define putbits(src, x, w, pdst) FASTPUTBITS(SHR((src),32-(w)), x, w, pdst)
|
||||
|
||||
#endif /* mc68020 */
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
/* The following flag is used to override a bugfix for sun 3/60+CG4 machines,
|
||||
*/
|
||||
|
||||
/* We don't need to be careful about this unless we're dealing with sun3's
|
||||
* We will default its usage for those who do not know anything, but will
|
||||
* override its effect if the machine doesn't look like a sun3
|
||||
*/
|
||||
#if !defined(mc68020) || !defined(sun)
|
||||
#define NO_3_60_CG4
|
||||
#endif
|
||||
|
||||
/* This is gross. We want to #define u_putbits as something which can be used
|
||||
* in the case of the 3/60+CG4, but if we use /bin/cc or are on another
|
||||
* machine type, we want nothing to do with u_putbits. What a hastle. Here
|
||||
* I used slo_putbits as something which either u_putbits or putbits could be
|
||||
* defined as.
|
||||
*
|
||||
* putbits gets it iff it is not already defined with FASTPUTBITS above.
|
||||
* u_putbits gets it if we have FASTPUTBITS (putbits) from above and have not
|
||||
* overridden the NO_3_60_CG4 flag.
|
||||
*/
|
||||
|
||||
#define slo_putbits(src, x, w, pdst) \
|
||||
{ \
|
||||
register int n = (x)+(w)-PPW; \
|
||||
\
|
||||
if (n <= 0) \
|
||||
{ \
|
||||
register PixelType tmpmask; \
|
||||
maskpartialbits((x), (w), tmpmask); \
|
||||
*(pdst) = (*(pdst) & ~tmpmask) | \
|
||||
(SCRRIGHT(src, x) & tmpmask); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
register int d = PPW-(x); \
|
||||
*(pdst) = (*(pdst) & mfbGetendtab(x)) | (SCRRIGHT((src), x)); \
|
||||
(pdst)[1] = ((pdst)[1] & mfbGetstarttab(n)) | \
|
||||
(SCRLEFT(src, d) & mfbGetendtab(n)); \
|
||||
} \
|
||||
}
|
||||
|
||||
#if defined(putbits) && !defined(NO_3_60_CG4)
|
||||
#define u_putbits(src, x, w, pdst) slo_putbits(src, x, w, pdst)
|
||||
#else
|
||||
#define u_putbits(src, x, w, pdst) putbits(src, x, w, pdst)
|
||||
#endif
|
||||
|
||||
#if !defined(putbits)
|
||||
#define putbits(src, x, w, pdst) slo_putbits(src, x, w, pdst)
|
||||
#endif
|
||||
|
||||
/* Now if we have not gotten any really good bitfield macros, try some
|
||||
* moderately fast macros. Alas, I don't know how to do asm instructions
|
||||
* without gcc.
|
||||
*/
|
||||
|
||||
#ifndef getbits
|
||||
#define getbits(psrc, x, w, dst) \
|
||||
{ \
|
||||
dst = SCRLEFT(*(psrc), (x)); \
|
||||
if ( ((x) + (w)) > PPW) \
|
||||
dst |= (SCRRIGHT(*((psrc)+1), PPW-(x))); \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We have to special-case putbitsrop because of 3/60+CG4 combos
|
||||
*/
|
||||
|
||||
#define u_putbitsrop(src, x, w, pdst, rop) \
|
||||
{\
|
||||
register PixelType t1, t2; \
|
||||
register int n = (x)+(w)-PPW; \
|
||||
\
|
||||
t1 = SCRRIGHT((src), (x)); \
|
||||
DoRop(t2, rop, t1, *(pdst)); \
|
||||
\
|
||||
if (n <= 0) \
|
||||
{ \
|
||||
register PixelType tmpmask; \
|
||||
\
|
||||
maskpartialbits((x), (w), tmpmask); \
|
||||
*(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
int m = PPW-(x); \
|
||||
*(pdst) = (*(pdst) & mfbGetendtab(x)) | (t2 & mfbGetstarttab(x)); \
|
||||
t1 = SCRLEFT((src), m); \
|
||||
DoRop(t2, rop, t1, (pdst)[1]); \
|
||||
(pdst)[1] = ((pdst)[1] & mfbGetstarttab(n)) | (t2 & mfbGetendtab(n)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* If our getbits and putbits are FAST enough,
|
||||
* do this brute force, it's faster
|
||||
*/
|
||||
|
||||
#if defined(FASTPUTBITS) && defined(FASTGETBITS) && defined(NO_3_60_CG4)
|
||||
#if (BITMAP_BIT_ORDER == MSBFirst)
|
||||
#define putbitsrop(src, x, w, pdst, rop) \
|
||||
{ \
|
||||
register PixelType _tmp, _tmp2; \
|
||||
FASTGETBITS(pdst, x, w, _tmp); \
|
||||
_tmp2 = SCRRIGHT(src, PPW-(w)); \
|
||||
DoRop(_tmp, rop, _tmp2, _tmp) \
|
||||
FASTPUTBITS(_tmp, x, w, pdst); \
|
||||
}
|
||||
#define putbitsrrop(src, x, w, pdst, rop) \
|
||||
{ \
|
||||
register PixelType _tmp, _tmp2; \
|
||||
\
|
||||
FASTGETBITS(pdst, x, w, _tmp); \
|
||||
_tmp2 = SCRRIGHT(src, PPW-(w)); \
|
||||
_tmp= DoRRop(rop, _tmp2, _tmp); \
|
||||
FASTPUTBITS(_tmp, x, w, pdst); \
|
||||
}
|
||||
#undef u_putbitsrop
|
||||
#else
|
||||
#define putbitsrop(src, x, w, pdst, rop) \
|
||||
{ \
|
||||
register PixelType _tmp; \
|
||||
FASTGETBITS(pdst, x, w, _tmp); \
|
||||
DoRop(_tmp, rop, src, _tmp) \
|
||||
FASTPUTBITS(_tmp, x, w, pdst); \
|
||||
}
|
||||
#define putbitsrrop(src, x, w, pdst, rop) \
|
||||
{ \
|
||||
register PixelType _tmp; \
|
||||
\
|
||||
FASTGETBITS(pdst, x, w, _tmp); \
|
||||
_tmp= DoRRop(rop, src, _tmp); \
|
||||
FASTPUTBITS(_tmp, x, w, pdst); \
|
||||
}
|
||||
#undef u_putbitsrop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef putbitsrop
|
||||
#define putbitsrop(src, x, w, pdst, rop) u_putbitsrop(src, x, w, pdst, rop)
|
||||
#endif
|
||||
|
||||
#ifndef putbitsrrop
|
||||
#define putbitsrrop(src, x, w, pdst, rop) \
|
||||
{\
|
||||
register PixelType t1, t2; \
|
||||
register int n = (x)+(w)-PPW; \
|
||||
\
|
||||
t1 = SCRRIGHT((src), (x)); \
|
||||
t2 = DoRRop(rop, t1, *(pdst)); \
|
||||
\
|
||||
if (n <= 0) \
|
||||
{ \
|
||||
register PixelType tmpmask; \
|
||||
\
|
||||
maskpartialbits((x), (w), tmpmask); \
|
||||
*(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
int m = PPW-(x); \
|
||||
*(pdst) = (*(pdst) & mfbGetendtab(x)) | (t2 & mfbGetstarttab(x)); \
|
||||
t1 = SCRLEFT((src), m); \
|
||||
t2 = DoRRop(rop, t1, (pdst)[1]); \
|
||||
(pdst)[1] = ((pdst)[1] & mfbGetstarttab(n)) | (t2 & mfbGetendtab(n)); \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GETLEFTBITS_ALIGNMENT == 1
|
||||
#define getleftbits(psrc, w, dst) dst = *((CARD32 *)(pointer) psrc)
|
||||
#endif /* GETLEFTBITS_ALIGNMENT == 1 */
|
||||
|
||||
#if GETLEFTBITS_ALIGNMENT == 2
|
||||
#define getleftbits(psrc, w, dst) \
|
||||
{ \
|
||||
if ( ((int)(psrc)) & 0x01 ) \
|
||||
getbits( ((CARD32 *)(((char *)(psrc))-1)), 8, (w), (dst) ); \
|
||||
else \
|
||||
getbits(psrc, 0, w, dst); \
|
||||
}
|
||||
#endif /* GETLEFTBITS_ALIGNMENT == 2 */
|
||||
|
||||
#if GETLEFTBITS_ALIGNMENT == 4
|
||||
#define getleftbits(psrc, w, dst) \
|
||||
{ \
|
||||
int off, off_b; \
|
||||
off_b = (off = ( ((int)(psrc)) & 0x03)) << 3; \
|
||||
getbits( \
|
||||
(CARD32 *)( ((char *)(psrc)) - off), \
|
||||
(off_b), (w), (dst) \
|
||||
); \
|
||||
}
|
||||
#endif /* GETLEFTBITS_ALIGNMENT == 4 */
|
||||
|
||||
|
||||
#define getshiftedleftbits(psrc, offset, w, dst) \
|
||||
getleftbits((psrc), (w), (dst)); \
|
||||
dst = SCRLEFT((dst), (offset));
|
||||
|
||||
/* FASTGETBITS and FASTPUTBITS are not necessarily correct implementations of
|
||||
* getbits and putbits, but they work if used together.
|
||||
*
|
||||
* On a MSBFirst machine, a cpu bitfield extract instruction (like bfextu)
|
||||
* could normally assign its result to a 32-bit word register in the screen
|
||||
* right position. This saves canceling register shifts by not fighting the
|
||||
* natural cpu byte order.
|
||||
*
|
||||
* Unfortunately, these fail on a 3/60+CG4 and cannot be used unmodified. Sigh.
|
||||
*/
|
||||
#if defined(FASTGETBITS) && defined(FASTPUTBITS)
|
||||
#ifdef NO_3_60_CG4
|
||||
#define u_FASTPUT(aa, bb, cc, dd) FASTPUTBITS(aa, bb, cc, dd)
|
||||
#else
|
||||
#define u_FASTPUT(aa, bb, cc, dd) u_putbits(SCRLEFT(aa, PPW-(cc)), bb, cc, dd)
|
||||
#endif
|
||||
|
||||
#define getandputbits(psrc, srcbit, dstbit, width, pdst) \
|
||||
{ \
|
||||
register PixelType _tmpbits; \
|
||||
FASTGETBITS(psrc, srcbit, width, _tmpbits); \
|
||||
u_FASTPUT(_tmpbits, dstbit, width, pdst); \
|
||||
}
|
||||
|
||||
#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
|
||||
{ \
|
||||
register PixelType _tmpsrc, _tmpdst; \
|
||||
FASTGETBITS(pdst, dstbit, width, _tmpdst); \
|
||||
FASTGETBITS(psrc, srcbit, width, _tmpsrc); \
|
||||
DoRop(_tmpdst, rop, _tmpsrc, _tmpdst); \
|
||||
u_FASTPUT(_tmpdst, dstbit, width, pdst); \
|
||||
}
|
||||
|
||||
#define getandputrrop(psrc, srcbit, dstbit, width, pdst, rop) \
|
||||
{ \
|
||||
register PixelType _tmpsrc, _tmpdst; \
|
||||
FASTGETBITS(pdst, dstbit, width, _tmpdst); \
|
||||
FASTGETBITS(psrc, srcbit, width, _tmpsrc); \
|
||||
_tmpdst = DoRRop(rop, _tmpsrc, _tmpdst); \
|
||||
u_FASTPUT(_tmpdst, dstbit, width, pdst); \
|
||||
}
|
||||
|
||||
#define getandputbits0(psrc, srcbit, width, pdst) \
|
||||
getandputbits(psrc, srcbit, 0, width, pdst)
|
||||
|
||||
#define getandputrop0(psrc, srcbit, width, pdst, rop) \
|
||||
getandputrop(psrc, srcbit, 0, width, pdst, rop)
|
||||
|
||||
#define getandputrrop0(psrc, srcbit, width, pdst, rop) \
|
||||
getandputrrop(psrc, srcbit, 0, width, pdst, rop)
|
||||
|
||||
|
||||
#else /* Slow poke */
|
||||
|
||||
/* pairs of getbits/putbits happen frequently. Some of the code can
|
||||
* be shared or avoided in a few specific instances. It gets us a
|
||||
* small advantage, so we do it. The getandput...0 macros are the only ones
|
||||
* which speed things here. The others are here for compatibility w/the above
|
||||
* FAST ones
|
||||
*/
|
||||
|
||||
#define getandputbits(psrc, srcbit, dstbit, width, pdst) \
|
||||
{ \
|
||||
register PixelType _tmpbits; \
|
||||
getbits(psrc, srcbit, width, _tmpbits); \
|
||||
putbits(_tmpbits, dstbit, width, pdst); \
|
||||
}
|
||||
|
||||
#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
|
||||
{ \
|
||||
register PixelType _tmpbits; \
|
||||
getbits(psrc, srcbit, width, _tmpbits) \
|
||||
putbitsrop(_tmpbits, dstbit, width, pdst, rop) \
|
||||
}
|
||||
|
||||
#define getandputrrop(psrc, srcbit, dstbit, width, pdst, rop) \
|
||||
{ \
|
||||
register PixelType _tmpbits; \
|
||||
getbits(psrc, srcbit, width, _tmpbits) \
|
||||
putbitsrrop(_tmpbits, dstbit, width, pdst, rop) \
|
||||
}
|
||||
|
||||
|
||||
#define getandputbits0(psrc, sbindex, width, pdst) \
|
||||
{ /* unroll the whole damn thing to see how it * behaves */ \
|
||||
register int _flag = PPW - (sbindex); \
|
||||
register PixelType _src; \
|
||||
\
|
||||
_src = SCRLEFT (*(psrc), (sbindex)); \
|
||||
if ((width) > _flag) \
|
||||
_src |= SCRRIGHT (*((psrc) + 1), _flag); \
|
||||
\
|
||||
*(pdst) = (*(pdst) & mfbGetstarttab((width))) | (_src & mfbGetendtab((width))); \
|
||||
}
|
||||
|
||||
|
||||
#define getandputrop0(psrc, sbindex, width, pdst, rop) \
|
||||
{ \
|
||||
register int _flag = PPW - (sbindex); \
|
||||
register PixelType _src; \
|
||||
\
|
||||
_src = SCRLEFT (*(psrc), (sbindex)); \
|
||||
if ((width) > _flag) \
|
||||
_src |= SCRRIGHT (*((psrc) + 1), _flag); \
|
||||
DoRop(_src, rop, _src, *(pdst)); \
|
||||
\
|
||||
*(pdst) = (*(pdst) & mfbGetstarttab((width))) | (_src & mfbGetendtab((width))); \
|
||||
}
|
||||
|
||||
#define getandputrrop0(psrc, sbindex, width, pdst, rop) \
|
||||
{ \
|
||||
int _flag = PPW - (sbindex); \
|
||||
register PixelType _src; \
|
||||
\
|
||||
_src = SCRLEFT (*(psrc), (sbindex)); \
|
||||
if ((width) > _flag) \
|
||||
_src |= SCRRIGHT (*((psrc) + 1), _flag); \
|
||||
_src = DoRRop(rop, _src, *(pdst)); \
|
||||
\
|
||||
*(pdst) = (*(pdst) & mfbGetstarttab((width))) | (_src & mfbGetendtab((width))); \
|
||||
}
|
||||
|
||||
#endif /* FASTGETBITS && FASTPUTBITS */
|
||||
|
||||
#endif /* MFB_CONSTS_ONLY */
|
||||
398
mfb/mergerop.h
398
mfb/mergerop.h
|
|
@ -1,398 +0,0 @@
|
|||
/*
|
||||
*
|
||||
Copyright 1989, 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.
|
||||
*
|
||||
* Author: Keith Packard, MIT X Consortium
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef _MERGEROP_H_
|
||||
#define _MERGEROP_H_
|
||||
|
||||
#ifndef GXcopy
|
||||
#include <X11/X.h>
|
||||
#endif
|
||||
|
||||
typedef struct _mergeRopBits {
|
||||
MfbBits ca1, cx1, ca2, cx2;
|
||||
} mergeRopRec, *mergeRopPtr;
|
||||
|
||||
extern mergeRopRec mergeRopBits[16];
|
||||
extern mergeRopPtr mergeGetRopBits(int i);
|
||||
|
||||
#if defined(PPW) && defined(PGSZ) && (PPW != PGSZ) /* cfb */
|
||||
#define DeclareMergeRop() MfbBits _ca1 = 0, _cx1 = 0, _ca2 = 0, _cx2 = 0;
|
||||
#define DeclarePrebuiltMergeRop() MfbBits _cca, _ccx;
|
||||
#if PSZ == 24 /* both for PGSZ == 32 and 64 */
|
||||
#define DeclareMergeRop24() \
|
||||
MfbBits _ca1u[4], _cx1u[4], _ca2u[4], _cx2u[4];
|
||||
/* int _unrollidx[3]={0,0,1,2};*/
|
||||
#define DeclarePrebuiltMergeRop24() MfbBits _ccau[4], _ccxu[4];
|
||||
#endif /* PSZ == 24 */
|
||||
#else /* mfb */
|
||||
#define DeclareMergeRop() MfbBits _ca1 = 0, _cx1 = 0, _ca2 = 0, _cx2 = 0;
|
||||
#define DeclarePrebuiltMergeRop() MfbBits _cca, _ccx;
|
||||
#endif
|
||||
|
||||
#if defined(PPW) && defined(PGSZ) && (PPW != PGSZ) /* cfb */
|
||||
#define InitializeMergeRop(alu,pm) {\
|
||||
MfbBits _pm; \
|
||||
mergeRopPtr _bits; \
|
||||
_pm = PFILL(pm); \
|
||||
_bits = mergeGetRopBits(alu); \
|
||||
_ca1 = _bits->ca1 & _pm; \
|
||||
_cx1 = _bits->cx1 | ~_pm; \
|
||||
_ca2 = _bits->ca2 & _pm; \
|
||||
_cx2 = _bits->cx2 & _pm; \
|
||||
}
|
||||
#if PSZ == 24
|
||||
#if (BITMAP_BIT_ORDER == MSBFirst)
|
||||
#define InitializeMergeRop24(alu,pm) {\
|
||||
register int i; \
|
||||
register MfbBits _pm = (pm) & 0xFFFFFF; \
|
||||
mergeRopPtr _bits = mergeGetRopBits(alu); \
|
||||
MfbBits _bits_ca1 = _bits->ca1; \
|
||||
MfbBits _bits_cx1 = _bits->cx1; \
|
||||
MfbBits _bits_ca2 = _bits->ca2; \
|
||||
MfbBits _bits_cx2 = _bits->cx2; \
|
||||
_pm = (_pm << 8) | (_pm >> 16); \
|
||||
for(i = 0; i < 4; i++){ \
|
||||
_ca1u[i] = _bits_ca1 & _pm; \
|
||||
_cx1u[i] = _bits_cx1 | ~_pm; \
|
||||
_ca2u[i] = _bits_ca2 & _pm; \
|
||||
_cx2u[i] = _bits_cx2 & _pm; \
|
||||
_pm = (_pm << 16)|(_pm >> 8); \
|
||||
} \
|
||||
}
|
||||
#else /*(BITMAP_BIT_ORDER == LSBFirst)*/
|
||||
#define InitializeMergeRop24(alu,pm) {\
|
||||
register int i; \
|
||||
register MfbBits _pm = (pm) & cfbmask[0]; \
|
||||
mergeRopPtr _bits = mergeGetRopBits(alu); \
|
||||
MfbBits _bits_ca1 = _bits->ca1 & cfbmask[0]; \
|
||||
MfbBits _bits_cx1 = _bits->cx1 & cfbmask[0]; \
|
||||
MfbBits _bits_ca2 = _bits->ca2 & cfbmask[0]; \
|
||||
MfbBits _bits_cx2 = _bits->cx2 & cfbmask[0]; \
|
||||
_pm |= (_pm << 24); \
|
||||
_bits_ca1 |= (_bits->ca1 << 24); \
|
||||
_bits_cx1 |= (_bits->cx1 << 24); \
|
||||
_bits_ca2 |= (_bits->ca2 << 24); \
|
||||
_bits_cx2 |= (_bits->cx2 << 24); \
|
||||
for(i = 0; i < 4; i++){ \
|
||||
_ca1u[i] = _bits_ca1 & _pm; \
|
||||
_cx1u[i] = _bits_cx1 | ~_pm; \
|
||||
_ca2u[i] = _bits_ca2 & _pm; \
|
||||
_cx2u[i] = _bits_cx2 & _pm; \
|
||||
_pm = (_pm << 16)|(_pm >> 8); \
|
||||
} \
|
||||
}
|
||||
#endif /*(BITMAP_BIT_ORDER == MSBFirst)*/
|
||||
#endif /* PSZ == 24 */
|
||||
#else /* mfb */
|
||||
#define InitializeMergeRop(alu,pm) {\
|
||||
mergeRopPtr _bits; \
|
||||
_bits = mergeGetRopBits(alu); \
|
||||
_ca1 = _bits->ca1; \
|
||||
_cx1 = _bits->cx1; \
|
||||
_ca2 = _bits->ca2; \
|
||||
_cx2 = _bits->cx2; \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* AND has higher precedence than XOR */
|
||||
|
||||
#define DoMergeRop(src, dst) \
|
||||
(((dst) & (((src) & _ca1) ^ _cx1)) ^ (((src) & _ca2) ^ _cx2))
|
||||
|
||||
#define DoMergeRop24u(src, dst, i) \
|
||||
(((dst) & (((src) & _ca1u[i]) ^ _cx1u[i])) ^ (((src) & _ca2u[i]) ^ _cx2u[i]))
|
||||
|
||||
#define DoMaskMergeRop24(src, dst, mask, index) {\
|
||||
register int idx = ((index) & 3)<< 1; \
|
||||
MfbBits _src0 = (src);\
|
||||
MfbBits _src1 = (_src0 & _ca1) ^ _cx1; \
|
||||
MfbBits _src2 = (_src0 & _ca2) ^ _cx2; \
|
||||
*(dst) = (((*(dst)) & cfbrmask[idx]) | (((*(dst)) & cfbmask[idx]) & \
|
||||
(((( _src1 |(~mask))<<cfb24Shift[idx])&cfbmask[idx]) ^ \
|
||||
((( _src2&(mask))<<cfb24Shift[idx])&cfbmask[idx])))); \
|
||||
idx++; \
|
||||
(dst)++; \
|
||||
*(dst) = (((*(dst)) & cfbrmask[idx]) | (((*(dst)) & cfbmask[idx]) & \
|
||||
((((_src1 |(~mask))>>cfb24Shift[idx])&cfbmask[idx]) ^ \
|
||||
(((_src2 &(mask))>>cfb24Shift[idx])&cfbmask[idx])))); \
|
||||
(dst)--; \
|
||||
}
|
||||
|
||||
#define DoMaskMergeRop(src, dst, mask) \
|
||||
(((dst) & ((((src) & _ca1) ^ _cx1) | ~(mask))) ^ ((((src) & _ca2) ^ _cx2) & (mask)))
|
||||
|
||||
#define DoMaskMergeRop24u(src, dst, mask, i) \
|
||||
(((dst) & ((((src) & _ca1u[(i)]) ^ _cx1u[(i)]) | ~(mask))) ^ ((((src) & _ca2u[(i)]) ^ _cx2u[(i)]) & (mask)))
|
||||
|
||||
#define DoMergeRop24(src,dst,index) {\
|
||||
register int idx = ((index) & 3)<< 1; \
|
||||
MfbBits _src0 = (src);\
|
||||
MfbBits _src1 = (_src0 & _ca1) ^ _cx1; \
|
||||
MfbBits _src2 = (_src0 & _ca2) ^ _cx2; \
|
||||
*(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) & \
|
||||
((_src1 << cfb24Shift[idx])&cfbmask[idx])) ^ \
|
||||
((_src2 << cfb24Shift[idx])&cfbmask[idx]))); \
|
||||
idx++; \
|
||||
(dst)++; \
|
||||
*(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) & \
|
||||
((_src1 >> cfb24Shift[idx])&cfbmask[idx])) ^ \
|
||||
((_src2 >> cfb24Shift[idx])&cfbmask[idx]))); \
|
||||
(dst)--; \
|
||||
}
|
||||
|
||||
#define DoPrebuiltMergeRop(dst) (((dst) & _cca) ^ _ccx)
|
||||
|
||||
#define DoPrebuiltMergeRop24(dst,index) { \
|
||||
register int idx = ((index) & 3)<< 1; \
|
||||
*(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) &\
|
||||
(( _cca <<cfb24Shift[idx])&cfbmask[idx])) ^ \
|
||||
(( _ccx <<cfb24Shift[idx])&cfbmask[idx]))); \
|
||||
idx++; \
|
||||
(dst)++; \
|
||||
*(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) &\
|
||||
(( _cca >>cfb24Shift[idx])&cfbmask[idx])) ^ \
|
||||
(( _ccx >>cfb24Shift[idx])&cfbmask[idx]))); \
|
||||
(dst)--; \
|
||||
}
|
||||
|
||||
#define DoMaskPrebuiltMergeRop(dst,mask) \
|
||||
(((dst) & (_cca | ~(mask))) ^ (_ccx & (mask)))
|
||||
|
||||
#define PrebuildMergeRop(src) ((_cca = ((src) & _ca1) ^ _cx1), \
|
||||
(_ccx = ((src) & _ca2) ^ _cx2))
|
||||
|
||||
#ifndef MROP
|
||||
#define MROP 0
|
||||
#endif
|
||||
|
||||
#define Mclear (1<<GXclear)
|
||||
#define Mand (1<<GXand)
|
||||
#define MandReverse (1<<GXandReverse)
|
||||
#define Mcopy (1<<GXcopy)
|
||||
#define MandInverted (1<<GXandInverted)
|
||||
#define Mnoop (1<<GXnoop)
|
||||
#define Mxor (1<<GXxor)
|
||||
#define Mor (1<<GXor)
|
||||
#define Mnor (1<<GXnor)
|
||||
#define Mequiv (1<<GXequiv)
|
||||
#define Minvert (1<<GXinvert)
|
||||
#define MorReverse (1<<GXorReverse)
|
||||
#define McopyInverted (1<<GXcopyInverted)
|
||||
#define MorInverted (1<<GXorInverted)
|
||||
#define Mnand (1<<GXnand)
|
||||
#define Mset (1<<GXset)
|
||||
|
||||
#define MROP_PIXEL24(pix, idx) \
|
||||
(((*(pix) & cfbmask[(idx)<<1]) >> cfb24Shift[(idx)<<1])| \
|
||||
((*((pix)+1) & cfbmask[((idx)<<1)+1]) << cfb24Shift[((idx)<<1)+1]))
|
||||
|
||||
#define MROP_SOLID24P(src,dst,sindex, index) \
|
||||
MROP_SOLID24(MROP_PIXEL24(src,sindex),dst,index)
|
||||
|
||||
#define MROP_MASK24P(src,dst,mask,sindex,index) \
|
||||
MROP_MASK24(MROP_PIXEL24(src,sindex),dst,mask,index)
|
||||
|
||||
#if (MROP) == Mcopy
|
||||
#define MROP_DECLARE()
|
||||
#define MROP_DECLARE_REG()
|
||||
#define MROP_INITIALIZE(alu,pm)
|
||||
#define MROP_SOLID(src,dst) (src)
|
||||
#define MROP_SOLID24(src,dst,index) {\
|
||||
register int idx = ((index) & 3)<< 1; \
|
||||
MfbBits _src = (src); \
|
||||
*(dst) = (*(dst) & cfbrmask[idx])|((_src<<cfb24Shift[idx])&cfbmask[idx]); \
|
||||
idx++; \
|
||||
*((dst)+1) = (*((dst)+1) & cfbrmask[idx])|((_src>>cfb24Shift[idx])&cfbmask[idx]); \
|
||||
}
|
||||
#define MROP_MASK(src,dst,mask) (((dst) & ~(mask)) | ((src) & (mask)))
|
||||
#define MROP_MASK24(src,dst,mask,index) {\
|
||||
register int idx = ((index) & 3)<< 1; \
|
||||
MfbBits _src = (src); \
|
||||
*(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)<< cfb24Shift[idx])&cfbmask[idx])) | \
|
||||
(((_src &(mask))<<cfb24Shift[idx])&cfbmask[idx])); \
|
||||
idx++; \
|
||||
*((dst)+1) = (*((dst)+1) & cfbrmask[idx] &(~(((mask)>>cfb24Shift[idx])&cfbmask[idx])) | \
|
||||
(((_src&(mask))>>cfb24Shift[idx])&cfbmask[idx])); \
|
||||
}
|
||||
#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,Copy)
|
||||
#endif
|
||||
|
||||
#if (MROP) == McopyInverted
|
||||
#define MROP_DECLARE()
|
||||
#define MROP_DECLARE_REG()
|
||||
#define MROP_INITIALIZE(alu,pm)
|
||||
#define MROP_SOLID(src,dst) (~(src))
|
||||
#define MROP_SOLID24(src,dst,index) {\
|
||||
register int idx = ((index) & 3)<< 1; \
|
||||
MfbBits _src = ~(src); \
|
||||
*(dst) = (*(dst) & cfbrmask[idx])|((_src << cfb24Shift[idx])&cfbmask[idx]); \
|
||||
idx++; \
|
||||
(dst)++; \
|
||||
*(dst) = (*(dst) & cfbrmask[idx])|((_src >>cfb24Shift[idx])&cfbmask[idx]); \
|
||||
(dst)--; \
|
||||
}
|
||||
#define MROP_MASK(src,dst,mask) (((dst) & ~(mask)) | ((~(src)) & (mask)))
|
||||
#define MROP_MASK24(src,dst,mask,index) {\
|
||||
register int idx = ((index) & 3)<< 1; \
|
||||
MfbBits _src = ~(src); \
|
||||
*(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)<< cfb24Shift[idx])&cfbmask[idx])) | \
|
||||
(((_src &(mask))<<cfb24Shift[idx])&cfbmask[idx])); \
|
||||
idx++; \
|
||||
(dst)++; \
|
||||
*(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)>>cfb24Shift[idx])&cfbmask[idx])) | \
|
||||
((((_src & (mask))>>cfb24Shift[idx])&cfbmask[idx])); \
|
||||
(dst)--; \
|
||||
}
|
||||
#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,CopyInverted)
|
||||
#endif
|
||||
|
||||
#if (MROP) == Mxor
|
||||
#define MROP_DECLARE()
|
||||
#define MROP_DECLARE_REG()
|
||||
#define MROP_INITIALIZE(alu,pm)
|
||||
#define MROP_SOLID(src,dst) ((src) ^ (dst))
|
||||
#define MROP_SOLID24(src,dst,index) {\
|
||||
register int idx = ((index) & 3)<< 1; \
|
||||
MfbBits _src = (src); \
|
||||
*(dst) ^= ((_src << cfb24Shift[idx])&cfbmask[idx]); \
|
||||
idx++; \
|
||||
(dst)++; \
|
||||
*(dst) ^= ((_src >>cfb24Shift[idx])&cfbmask[idx]); \
|
||||
(dst)--; \
|
||||
}
|
||||
#define MROP_MASK(src,dst,mask) (((src) & (mask)) ^ (dst))
|
||||
#define MROP_MASK24(src,dst,mask,index) {\
|
||||
register int idx = ((index) & 3)<< 1; \
|
||||
*(dst) ^= ((((src)&(mask))<<cfb24Shift[idx])&cfbmask[idx]); \
|
||||
idx++; \
|
||||
(dst)++; \
|
||||
*(dst) ^= ((((src)&(mask))>>cfb24Shift[idx])&cfbmask[idx]); \
|
||||
(dst)--; \
|
||||
}
|
||||
#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,Xor)
|
||||
#endif
|
||||
|
||||
#if (MROP) == Mor
|
||||
#define MROP_DECLARE()
|
||||
#define MROP_DECLARE_REG()
|
||||
#define MROP_INITIALIZE(alu,pm)
|
||||
#define MROP_SOLID(src,dst) ((src) | (dst))
|
||||
#define MROP_SOLID24(src,dst,index) {\
|
||||
register int idx = ((index) & 3)<< 1; \
|
||||
*(dst) |= (((src)<<cfb24Shift[idx])&cfbmask[idx]); \
|
||||
idx++; \
|
||||
(dst)++; \
|
||||
*(dst) |= (((src)>>cfb24Shift[idx])&cfbmask[idx]); \
|
||||
(dst)--; \
|
||||
}
|
||||
#define MROP_MASK(src,dst,mask) (((src) & (mask)) | (dst))
|
||||
#define MROP_MASK24(src,dst,mask,index) {\
|
||||
register int idx = ((index) & 3)<< 1; \
|
||||
MfbBits _src = (src); \
|
||||
*(dst) |= (((_src &(mask))<<cfb24Shift[idx])&cfbmask[idx]); \
|
||||
idx++; \
|
||||
(dst)++; \
|
||||
*(dst) |= (((_src &(mask))>>cfb24Shift[idx])&cfbmask[idx]); \
|
||||
(dst)--; \
|
||||
}
|
||||
#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,Or)
|
||||
#endif
|
||||
|
||||
#if (MROP) == (Mcopy|Mxor|MandReverse|Mor)
|
||||
#define MROP_DECLARE() MfbBits _ca1 = 0, _cx1 = 0;
|
||||
#define MROP_DECLARE_REG() register MROP_DECLARE()
|
||||
#define MROP_INITIALIZE(alu,pm) { \
|
||||
mergeRopPtr _bits; \
|
||||
_bits = mergeGetRopBits(alu); \
|
||||
_ca1 = _bits->ca1; \
|
||||
_cx1 = _bits->cx1; \
|
||||
}
|
||||
#define MROP_SOLID(src,dst) \
|
||||
(((dst) & (((src) & _ca1) ^ _cx1)) ^ (src))
|
||||
#define MROP_MASK(src,dst,mask) \
|
||||
(((dst) & ((((src) & _ca1) ^ _cx1)) | (~(mask)) ^ ((src) & (mask))))
|
||||
#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,CopyXorAndReverseOr)
|
||||
#define MROP_PREBUILD(src) PrebuildMergeRop(src)
|
||||
#define MROP_PREBUILT_DECLARE() DeclarePrebuiltMergeRop()
|
||||
#define MROP_PREBUILT_SOLID(src,dst) DoPrebuiltMergeRop(dst)
|
||||
#define MROP_PREBUILT_SOLID24(src,dst,index) DoPrebuiltMergeRop24(dst,index)
|
||||
#define MROP_PREBUILT_MASK(src,dst,mask) DoMaskPrebuiltMergeRop(dst,mask)
|
||||
#define MROP_PREBUILT_MASK24(src,dst,mask,index) DoMaskPrebuiltMergeRop24(dst,mask,index)
|
||||
#endif
|
||||
|
||||
#if (MROP) == 0
|
||||
#if !defined(PSZ) || (PSZ != 24)
|
||||
#define MROP_DECLARE() DeclareMergeRop()
|
||||
#define MROP_DECLARE_REG() register DeclareMergeRop()
|
||||
#define MROP_INITIALIZE(alu,pm) InitializeMergeRop(alu,pm)
|
||||
#define MROP_SOLID(src,dst) DoMergeRop(src,dst)
|
||||
#define MROP_MASK(src,dst,mask) DoMaskMergeRop(src, dst, mask)
|
||||
#else
|
||||
#define MROP_DECLARE() \
|
||||
DeclareMergeRop() \
|
||||
DeclareMergeRop24()
|
||||
#define MROP_DECLARE_REG() \
|
||||
register DeclareMergeRop()\
|
||||
DeclareMergeRop24()
|
||||
#define MROP_INITIALIZE(alu,pm) \
|
||||
InitializeMergeRop(alu,pm)\
|
||||
InitializeMergeRop24(alu,pm)
|
||||
#define MROP_SOLID(src,dst) DoMergeRop24u(src,dst,((int)(&(dst)-pdstBase) % 3))
|
||||
#define MROP_MASK(src,dst,mask) DoMaskMergeRop24u(src, dst, mask,((int)(&(dst) - pdstBase)%3))
|
||||
#endif
|
||||
#define MROP_SOLID24(src,dst,index) DoMergeRop24(src,dst,index)
|
||||
#define MROP_MASK24(src,dst,mask,index) DoMaskMergeRop24(src, dst, mask,index)
|
||||
#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,General)
|
||||
#define MROP_PREBUILD(src) PrebuildMergeRop(src)
|
||||
#define MROP_PREBUILT_DECLARE() DeclarePrebuiltMergeRop()
|
||||
#define MROP_PREBUILT_SOLID(src,dst) DoPrebuiltMergeRop(dst)
|
||||
#define MROP_PREBUILT_SOLID24(src,dst,index) DoPrebuiltMergeRop24(dst,index)
|
||||
#define MROP_PREBUILT_MASK(src,dst,mask) DoMaskPrebuiltMergeRop(dst,mask)
|
||||
#define MROP_PREBUILT_MASK24(src,dst,mask,index) \
|
||||
DoMaskPrebuiltMergeRop24(dst,mask,index)
|
||||
#endif
|
||||
|
||||
#ifndef MROP_PREBUILD
|
||||
#define MROP_PREBUILD(src)
|
||||
#define MROP_PREBUILT_DECLARE()
|
||||
#define MROP_PREBUILT_SOLID(src,dst) MROP_SOLID(src,dst)
|
||||
#define MROP_PREBUILT_SOLID24(src,dst,index) MROP_SOLID24(src,dst,index)
|
||||
#define MROP_PREBUILT_MASK(src,dst,mask) MROP_MASK(src,dst,mask)
|
||||
#define MROP_PREBUILT_MASK24(src,dst,mask,index) MROP_MASK24(src,dst,mask,index)
|
||||
#endif
|
||||
|
||||
#if !defined(UNIXCPP) || defined(ANSICPP)
|
||||
#define MROP_NAME_CAT(prefix,suffix) prefix##suffix
|
||||
#else
|
||||
#define MROP_NAME_CAT(prefix,suffix) prefix/**/suffix
|
||||
#endif
|
||||
|
||||
#endif
|
||||
500
mfb/mfbbitblt.c
500
mfb/mfbbitblt.c
|
|
@ -1,500 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xprotostr.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "regionstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "mi.h"
|
||||
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
|
||||
/* CopyArea and CopyPlane for a monchrome frame buffer
|
||||
|
||||
|
||||
clip the source rectangle to the source's available bits. (this
|
||||
avoids copying unnecessary pieces that will just get exposed anyway.)
|
||||
this becomes the new shape of the destination.
|
||||
clip the destination region to the composite clip in the
|
||||
GC. this requires translating the destination region to (dstx, dsty).
|
||||
build a list of source points, one for each rectangle in the
|
||||
destination. this is a simple translation.
|
||||
go do the multiple rectangle copies
|
||||
do graphics exposures
|
||||
*/
|
||||
/** Optimized for drawing pixmaps into windows, especially when drawing into
|
||||
** unobscured windows. Calls to the general-purpose region code were
|
||||
** replaced with rectangle-to-rectangle clipping comparisions. This is
|
||||
** possible, since the pixmap is a single rectangle. In an unobscured
|
||||
** window, the destination clip is also a single rectangle, and region
|
||||
** code can be avoided entirely. This is a big savings, since the region
|
||||
** code uses XAlloc() and makes many function calls.
|
||||
**
|
||||
** In addition, if source is a pixmap, there is no need to call the
|
||||
** expensive miHandleExposures() routine. Instead, we simply return NULL.
|
||||
**
|
||||
** Previously, drawing a pixmap into an unobscured window executed at least
|
||||
** 8 XAlloc()'s, 30 function calls, and hundreds of lines of code.
|
||||
**
|
||||
** Now, the same operation requires no XAlloc()'s, no region function calls,
|
||||
** and much less overhead. Nice for drawing lots of small pixmaps.
|
||||
*/
|
||||
|
||||
|
||||
void
|
||||
mfbDoBitblt (pSrc, pDst, alu, prgnDst, pptSrc)
|
||||
DrawablePtr pSrc, pDst;
|
||||
int alu;
|
||||
RegionPtr prgnDst;
|
||||
DDXPointPtr pptSrc;
|
||||
{
|
||||
switch (alu)
|
||||
{
|
||||
case GXcopy:
|
||||
mfbDoBitbltCopy (pSrc, pDst, alu, prgnDst, pptSrc);
|
||||
break;
|
||||
case GXxor:
|
||||
mfbDoBitbltXor (pSrc, pDst, alu, prgnDst, pptSrc);
|
||||
break;
|
||||
case GXcopyInverted:
|
||||
mfbDoBitbltCopyInverted (pSrc, pDst, alu, prgnDst, pptSrc);
|
||||
break;
|
||||
case GXor:
|
||||
mfbDoBitbltOr (pSrc, pDst, alu, prgnDst, pptSrc);
|
||||
break;
|
||||
default:
|
||||
mfbDoBitbltGeneral (pSrc, pDst, alu, prgnDst, pptSrc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RegionPtr
|
||||
mfbCopyArea(pSrcDrawable, pDstDrawable,
|
||||
pGC, srcx, srcy, width, height, dstx, dsty)
|
||||
register DrawablePtr pSrcDrawable;
|
||||
register DrawablePtr pDstDrawable;
|
||||
register GC *pGC;
|
||||
int srcx, srcy;
|
||||
int width, height;
|
||||
int dstx, dsty;
|
||||
{
|
||||
RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
|
||||
Bool freeSrcClip = FALSE;
|
||||
|
||||
RegionPtr prgnExposed;
|
||||
RegionRec rgnDst;
|
||||
DDXPointPtr pptSrc;
|
||||
register DDXPointPtr ppt;
|
||||
register BoxPtr pbox;
|
||||
int i;
|
||||
register int dx;
|
||||
register int dy;
|
||||
xRectangle origSource;
|
||||
DDXPointRec origDest;
|
||||
int numRects;
|
||||
BoxRec fastBox;
|
||||
int fastClip = 0; /* for fast clipping with pixmap source */
|
||||
int fastExpose = 0; /* for fast exposures with pixmap source */
|
||||
void (*localDoBitBlt)(
|
||||
DrawablePtr /*pSrc*/,
|
||||
DrawablePtr /*pDst*/,
|
||||
int /*alu*/,
|
||||
RegionPtr /*prgnDst*/,
|
||||
DDXPointPtr /*pptSrc*/);
|
||||
|
||||
origSource.x = srcx;
|
||||
origSource.y = srcy;
|
||||
origSource.width = width;
|
||||
origSource.height = height;
|
||||
origDest.x = dstx;
|
||||
origDest.y = dsty;
|
||||
|
||||
if ((pSrcDrawable != pDstDrawable) &&
|
||||
pSrcDrawable->pScreen->SourceValidate)
|
||||
{
|
||||
(*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height);
|
||||
}
|
||||
|
||||
switch (pGC->alu) {
|
||||
case GXcopy:
|
||||
localDoBitBlt = mfbDoBitbltCopy;
|
||||
break;
|
||||
case GXcopyInverted:
|
||||
localDoBitBlt = mfbDoBitbltCopyInverted;
|
||||
break;
|
||||
case GXxor:
|
||||
localDoBitBlt = mfbDoBitbltXor;
|
||||
break;
|
||||
case GXor:
|
||||
localDoBitBlt = mfbDoBitbltOr;
|
||||
break;
|
||||
default:
|
||||
localDoBitBlt = mfbDoBitbltGeneral;
|
||||
break;
|
||||
}
|
||||
|
||||
srcx += pSrcDrawable->x;
|
||||
srcy += pSrcDrawable->y;
|
||||
|
||||
/* clip the source */
|
||||
|
||||
if (pSrcDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
if ((pSrcDrawable == pDstDrawable) &&
|
||||
(pGC->clientClipType == CT_NONE))
|
||||
{
|
||||
prgnSrcClip = pGC->pCompositeClip;
|
||||
}
|
||||
else
|
||||
{
|
||||
fastClip = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pGC->subWindowMode == IncludeInferiors)
|
||||
{
|
||||
if (!((WindowPtr) pSrcDrawable)->parent)
|
||||
{
|
||||
/*
|
||||
* special case bitblt from root window in
|
||||
* IncludeInferiors mode; just like from a pixmap
|
||||
*/
|
||||
fastClip = 1;
|
||||
}
|
||||
else if ((pSrcDrawable == pDstDrawable) &&
|
||||
(pGC->clientClipType == CT_NONE))
|
||||
{
|
||||
prgnSrcClip = pGC->pCompositeClip;
|
||||
}
|
||||
else
|
||||
{
|
||||
prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
|
||||
freeSrcClip = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
|
||||
}
|
||||
}
|
||||
|
||||
fastBox.x1 = srcx;
|
||||
fastBox.y1 = srcy;
|
||||
fastBox.x2 = srcx + width;
|
||||
fastBox.y2 = srcy + height;
|
||||
|
||||
/* Don't create a source region if we are doing a fast clip */
|
||||
if (fastClip)
|
||||
{
|
||||
fastExpose = 1;
|
||||
/*
|
||||
* clip the source; if regions extend beyond the source size,
|
||||
* make sure exposure events get sent
|
||||
*/
|
||||
if (fastBox.x1 < pSrcDrawable->x)
|
||||
{
|
||||
fastBox.x1 = pSrcDrawable->x;
|
||||
fastExpose = 0;
|
||||
}
|
||||
if (fastBox.y1 < pSrcDrawable->y)
|
||||
{
|
||||
fastBox.y1 = pSrcDrawable->y;
|
||||
fastExpose = 0;
|
||||
}
|
||||
if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
|
||||
{
|
||||
fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
|
||||
fastExpose = 0;
|
||||
}
|
||||
if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
|
||||
{
|
||||
fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
|
||||
fastExpose = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
|
||||
REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
|
||||
}
|
||||
|
||||
dstx += pDstDrawable->x;
|
||||
dsty += pDstDrawable->y;
|
||||
|
||||
if (pDstDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
if (!((WindowPtr)pDstDrawable)->realized)
|
||||
{
|
||||
if (!fastClip)
|
||||
REGION_UNINIT(pGC->pScreen, &rgnDst);
|
||||
if (freeSrcClip)
|
||||
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
dx = srcx - dstx;
|
||||
dy = srcy - dsty;
|
||||
|
||||
/* Translate and clip the dst to the destination composite clip */
|
||||
if (fastClip)
|
||||
{
|
||||
RegionPtr cclip;
|
||||
|
||||
/* Translate the region directly */
|
||||
fastBox.x1 -= dx;
|
||||
fastBox.x2 -= dx;
|
||||
fastBox.y1 -= dy;
|
||||
fastBox.y2 -= dy;
|
||||
|
||||
/* If the destination composite clip is one rectangle we can
|
||||
do the clip directly. Otherwise we have to create a full
|
||||
blown region and call intersect */
|
||||
cclip = pGC->pCompositeClip;
|
||||
if (REGION_NUM_RECTS(cclip) == 1)
|
||||
{
|
||||
BoxPtr pBox = REGION_RECTS(cclip);
|
||||
|
||||
if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
|
||||
if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
|
||||
if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
|
||||
if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
|
||||
|
||||
/* Check to see if the region is empty */
|
||||
if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2)
|
||||
{
|
||||
REGION_NULL(pGC->pScreen, &rgnDst);
|
||||
}
|
||||
else
|
||||
{
|
||||
REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We must turn off fastClip now, since we must create
|
||||
a full blown region. It is intersected with the
|
||||
composite clip below. */
|
||||
fastClip = 0;
|
||||
REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
|
||||
}
|
||||
|
||||
if (!fastClip)
|
||||
{
|
||||
REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip);
|
||||
}
|
||||
|
||||
/* Do bit blitting */
|
||||
numRects = REGION_NUM_RECTS(&rgnDst);
|
||||
if (numRects && width && height)
|
||||
{
|
||||
if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
|
||||
sizeof(DDXPointRec))))
|
||||
{
|
||||
REGION_UNINIT(pGC->pScreen, &rgnDst);
|
||||
if (freeSrcClip)
|
||||
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
|
||||
return NULL;
|
||||
}
|
||||
pbox = REGION_RECTS(&rgnDst);
|
||||
ppt = pptSrc;
|
||||
for (i = numRects; --i >= 0; pbox++, ppt++)
|
||||
{
|
||||
ppt->x = pbox->x1 + dx;
|
||||
ppt->y = pbox->y1 + dy;
|
||||
}
|
||||
|
||||
if (pGC->planemask & 1)
|
||||
(*localDoBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc);
|
||||
|
||||
xfree(pptSrc);
|
||||
}
|
||||
|
||||
prgnExposed = NULL;
|
||||
if (pGC->fExpose)
|
||||
{
|
||||
/* Pixmap sources generate a NoExposed (we return NULL to do this) */
|
||||
if (!fastExpose)
|
||||
prgnExposed =
|
||||
miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
|
||||
origSource.x, origSource.y,
|
||||
(int)origSource.width,
|
||||
(int)origSource.height,
|
||||
origDest.x, origDest.y, (unsigned long)0);
|
||||
}
|
||||
REGION_UNINIT(pGC->pScreen, &rgnDst);
|
||||
if (freeSrcClip)
|
||||
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
|
||||
return prgnExposed;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Devices which use mfb for 1-bit pixmap support
|
||||
* must register a function for n-to-1 copy operations
|
||||
*/
|
||||
|
||||
static DevPrivateKey copyPlaneScreenKey = ©PlaneScreenKey;
|
||||
|
||||
Bool
|
||||
mfbRegisterCopyPlaneProc (pScreen, proc)
|
||||
ScreenPtr pScreen;
|
||||
RegionPtr (*proc)(
|
||||
DrawablePtr /* pSrcDrawable */,
|
||||
DrawablePtr /* pDstDrawable */,
|
||||
GCPtr /* pGC */,
|
||||
int /* srcx */,
|
||||
int /* srcy */,
|
||||
int /* width */,
|
||||
int /* height */,
|
||||
int /* dstx */,
|
||||
int /* dsty */,
|
||||
unsigned long /* bitPlane */);
|
||||
{
|
||||
dixSetPrivate(&pScreen->devPrivates, copyPlaneScreenKey, proc);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
if fg == 1 and bg ==0, we can do an ordinary CopyArea.
|
||||
if fg == bg, we can do a CopyArea with alu = mfbReduceRop(alu, fg)
|
||||
if fg == 0 and bg == 1, we use the same rasterop, with
|
||||
source operand inverted.
|
||||
|
||||
CopyArea deals with all of the graphics exposure events.
|
||||
This code depends on knowing that we can change the
|
||||
alu in the GC without having to call ValidateGC() before calling
|
||||
CopyArea().
|
||||
|
||||
*/
|
||||
|
||||
|
||||
RegionPtr
|
||||
mfbCopyPlane(pSrcDrawable, pDstDrawable,
|
||||
pGC, srcx, srcy, width, height, dstx, dsty, plane)
|
||||
DrawablePtr pSrcDrawable, pDstDrawable;
|
||||
register GC *pGC;
|
||||
int srcx, srcy;
|
||||
int width, height;
|
||||
int dstx, dsty;
|
||||
unsigned long plane;
|
||||
{
|
||||
int alu;
|
||||
RegionPtr prgnExposed;
|
||||
RegionPtr (*copyPlane)(
|
||||
DrawablePtr /* pSrcDrawable */,
|
||||
DrawablePtr /* pDstDrawable */,
|
||||
GCPtr /* pGC */,
|
||||
int /* srcx */,
|
||||
int /* srcy */,
|
||||
int /* width */,
|
||||
int /* height */,
|
||||
int /* dstx */,
|
||||
int /* dsty */,
|
||||
unsigned long /* bitPlane */);
|
||||
|
||||
|
||||
if (pSrcDrawable->depth != 1)
|
||||
{
|
||||
if ((copyPlane = dixLookupPrivate(&pSrcDrawable->pScreen->devPrivates,
|
||||
copyPlaneScreenKey)))
|
||||
{
|
||||
return (*copyPlane) (pSrcDrawable, pDstDrawable,
|
||||
pGC, srcx, srcy, width, height, dstx, dsty, plane);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError ("No copyPlane proc registered for depth %d\n",
|
||||
pSrcDrawable->depth);
|
||||
}
|
||||
}
|
||||
if (plane != 1)
|
||||
return NULL;
|
||||
|
||||
if ((pGC->fgPixel & 1) == 1 && (pGC->bgPixel & 1) == 0)
|
||||
{
|
||||
prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable,
|
||||
pGC, srcx, srcy, width, height, dstx, dsty);
|
||||
}
|
||||
else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1))
|
||||
{
|
||||
alu = pGC->alu;
|
||||
pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel);
|
||||
prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable,
|
||||
pGC, srcx, srcy, width, height, dstx, dsty);
|
||||
pGC->alu = alu;
|
||||
}
|
||||
else /* need to invert the src */
|
||||
{
|
||||
alu = pGC->alu;
|
||||
pGC->alu = InverseAlu[alu];
|
||||
prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable,
|
||||
pGC, srcx, srcy, width, height, dstx, dsty);
|
||||
pGC->alu = alu;
|
||||
}
|
||||
return prgnExposed;
|
||||
}
|
||||
|
||||
589
mfb/mfbblt.c
589
mfb/mfbblt.c
|
|
@ -1,589 +0,0 @@
|
|||
/*
|
||||
* mfb copy area
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Copyright 1989, 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.
|
||||
|
||||
Author: Keith Packard
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "mfb.h"
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "maskbits.h"
|
||||
#include "fastblt.h"
|
||||
#include "mergerop.h"
|
||||
|
||||
void
|
||||
MROP_NAME(mfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc)
|
||||
DrawablePtr pSrc, pDst;
|
||||
int alu;
|
||||
RegionPtr prgnDst;
|
||||
DDXPointPtr pptSrc;
|
||||
{
|
||||
PixelType *psrcBase, *pdstBase;
|
||||
/* start of src and dst bitmaps */
|
||||
int widthSrc, widthDst; /* add to get to same position in next line */
|
||||
|
||||
BoxPtr pbox;
|
||||
int nbox;
|
||||
|
||||
BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
|
||||
/* temporaries for shuffling rectangles */
|
||||
DDXPointPtr pptTmp, pptNew1, pptNew2;
|
||||
/* shuffling boxes entails shuffling the
|
||||
source points too */
|
||||
int w, h;
|
||||
int xdir; /* 1 = left right, -1 = right left/ */
|
||||
int ydir; /* 1 = top down, -1 = bottom up */
|
||||
|
||||
PixelType *psrcLine, *pdstLine;
|
||||
/* pointers to line with current src and dst */
|
||||
register PixelType *psrc;/* pointer to current src longword */
|
||||
register PixelType *pdst;/* pointer to current dst longword */
|
||||
|
||||
MROP_DECLARE_REG()
|
||||
|
||||
/* following used for looping through a line */
|
||||
PixelType startmask, endmask; /* masks for writing ends of dst */
|
||||
int nlMiddle; /* whole longwords in dst */
|
||||
int xoffSrc, xoffDst;
|
||||
register int leftShift, rightShift;
|
||||
register PixelType bits;
|
||||
register PixelType bits1;
|
||||
register int nl; /* temp copy of nlMiddle */
|
||||
int careful;
|
||||
|
||||
MROP_INITIALIZE(alu,0);
|
||||
|
||||
mfbGetPixelWidthAndPointer(pSrc, widthSrc, psrcBase);
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDst, widthDst, pdstBase);
|
||||
|
||||
/* XXX we have to err on the side of safety when both are windows,
|
||||
* because we don't know if IncludeInferiors is being used.
|
||||
*/
|
||||
careful = ((pSrc == pDst) ||
|
||||
((pSrc->type == DRAWABLE_WINDOW) &&
|
||||
(pDst->type == DRAWABLE_WINDOW)));
|
||||
|
||||
pbox = REGION_RECTS(prgnDst);
|
||||
nbox = REGION_NUM_RECTS(prgnDst);
|
||||
|
||||
pboxNew1 = NULL;
|
||||
pptNew1 = NULL;
|
||||
pboxNew2 = NULL;
|
||||
pptNew2 = NULL;
|
||||
if (careful && (pptSrc->y < pbox->y1))
|
||||
{
|
||||
/* walk source botttom to top */
|
||||
ydir = -1;
|
||||
widthSrc = -widthSrc;
|
||||
widthDst = -widthDst;
|
||||
|
||||
if (nbox > 1)
|
||||
{
|
||||
/* keep ordering in each band, reverse order of bands */
|
||||
pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
|
||||
if(!pboxNew1)
|
||||
return;
|
||||
pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
|
||||
if(!pptNew1)
|
||||
{
|
||||
xfree(pboxNew1);
|
||||
return;
|
||||
}
|
||||
pboxBase = pboxNext = pbox+nbox-1;
|
||||
while (pboxBase >= pbox)
|
||||
{
|
||||
while ((pboxNext >= pbox) &&
|
||||
(pboxBase->y1 == pboxNext->y1))
|
||||
pboxNext--;
|
||||
pboxTmp = pboxNext+1;
|
||||
pptTmp = pptSrc + (pboxTmp - pbox);
|
||||
while (pboxTmp <= pboxBase)
|
||||
{
|
||||
*pboxNew1++ = *pboxTmp++;
|
||||
*pptNew1++ = *pptTmp++;
|
||||
}
|
||||
pboxBase = pboxNext;
|
||||
}
|
||||
pboxNew1 -= nbox;
|
||||
pbox = pboxNew1;
|
||||
pptNew1 -= nbox;
|
||||
pptSrc = pptNew1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* walk source top to bottom */
|
||||
ydir = 1;
|
||||
}
|
||||
|
||||
if (careful && (pptSrc->x < pbox->x1))
|
||||
{
|
||||
/* walk source right to left */
|
||||
xdir = -1;
|
||||
|
||||
if (nbox > 1)
|
||||
{
|
||||
/* reverse order of rects in each band */
|
||||
pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
|
||||
pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
|
||||
if(!pboxNew2 || !pptNew2)
|
||||
{
|
||||
if (pptNew2) xfree(pptNew2);
|
||||
if (pboxNew2) xfree(pboxNew2);
|
||||
if (pboxNew1)
|
||||
{
|
||||
xfree(pptNew1);
|
||||
xfree(pboxNew1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
pboxBase = pboxNext = pbox;
|
||||
while (pboxBase < pbox+nbox)
|
||||
{
|
||||
while ((pboxNext < pbox+nbox) &&
|
||||
(pboxNext->y1 == pboxBase->y1))
|
||||
pboxNext++;
|
||||
pboxTmp = pboxNext;
|
||||
pptTmp = pptSrc + (pboxTmp - pbox);
|
||||
while (pboxTmp != pboxBase)
|
||||
{
|
||||
*pboxNew2++ = *--pboxTmp;
|
||||
*pptNew2++ = *--pptTmp;
|
||||
}
|
||||
pboxBase = pboxNext;
|
||||
}
|
||||
pboxNew2 -= nbox;
|
||||
pbox = pboxNew2;
|
||||
pptNew2 -= nbox;
|
||||
pptSrc = pptNew2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* walk source left to right */
|
||||
xdir = 1;
|
||||
}
|
||||
|
||||
while(nbox--)
|
||||
{
|
||||
w = pbox->x2 - pbox->x1;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
if (ydir == -1) /* start at last scanline of rectangle */
|
||||
{
|
||||
psrcLine = mfbScanlineDeltaSrc(psrcBase, -(pptSrc->y+h-1), widthSrc);
|
||||
pdstLine = mfbScanlineDeltaDst(pdstBase, -(pbox->y2-1), widthDst);
|
||||
}
|
||||
else /* start at first scanline */
|
||||
{
|
||||
psrcLine = mfbScanlineDeltaSrc(psrcBase, pptSrc->y, widthSrc);
|
||||
pdstLine = mfbScanlineDeltaDst(pdstBase, pbox->y1, widthDst);
|
||||
}
|
||||
if ((pbox->x1 & PIM) + w <= PPW)
|
||||
{
|
||||
maskpartialbits (pbox->x1, w, startmask);
|
||||
endmask = 0;
|
||||
nlMiddle = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
maskbits(pbox->x1, w, startmask, endmask, nlMiddle);
|
||||
}
|
||||
if (xdir == 1)
|
||||
{
|
||||
xoffSrc = pptSrc->x & PIM;
|
||||
xoffDst = pbox->x1 & PIM;
|
||||
pdstLine += (pbox->x1 >> PWSH);
|
||||
psrcLine += (pptSrc->x >> PWSH);
|
||||
#ifdef DO_UNALIGNED_BITBLT
|
||||
nl = xoffSrc - xoffDst;
|
||||
psrcLine = (PixelType *)
|
||||
(((unsigned char *) psrcLine) + nl);
|
||||
#else
|
||||
if (xoffSrc == xoffDst)
|
||||
#endif
|
||||
{
|
||||
while (h--)
|
||||
{
|
||||
psrc = psrcLine;
|
||||
pdst = pdstLine;
|
||||
if (startmask)
|
||||
{
|
||||
*pdst = MROP_MASK(*psrc, *pdst, startmask);
|
||||
psrc++;
|
||||
pdst++;
|
||||
}
|
||||
nl = nlMiddle;
|
||||
|
||||
#ifdef LARGE_INSTRUCTION_CACHE
|
||||
#ifdef FAST_CONSTANT_OFFSET_MODE
|
||||
|
||||
psrc += nl & (UNROLL-1);
|
||||
pdst += nl & (UNROLL-1);
|
||||
|
||||
#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
|
||||
#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
|
||||
|
||||
#define LoopReset \
|
||||
pdst += UNROLL; \
|
||||
psrc += UNROLL;
|
||||
|
||||
#else
|
||||
|
||||
#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
|
||||
#define BodyEven(n) BodyOdd(n)
|
||||
|
||||
#define LoopReset ;
|
||||
|
||||
#endif
|
||||
PackedLoop
|
||||
|
||||
#undef BodyOdd
|
||||
#undef BodyEven
|
||||
#undef LoopReset
|
||||
|
||||
#else
|
||||
#ifdef NOTDEF
|
||||
/* you'd think this would be faster --
|
||||
* a single instruction instead of 6
|
||||
* but measurements show it to be ~15% slower
|
||||
*/
|
||||
while ((nl -= 6) >= 0)
|
||||
{
|
||||
asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0"
|
||||
: "=m" (*(char *)pdst)
|
||||
: "m" (*(char *)psrc)
|
||||
: "d0", "d1", "d2", "d3",
|
||||
"a2", "a3");
|
||||
pdst += 6;
|
||||
}
|
||||
nl += 6;
|
||||
while (nl--)
|
||||
*pdst++ = *psrc++;
|
||||
#endif
|
||||
DuffL(nl, label1,
|
||||
*pdst = MROP_SOLID (*psrc, *pdst);
|
||||
pdst++; psrc++;)
|
||||
#endif
|
||||
|
||||
if (endmask)
|
||||
*pdst = MROP_MASK(*psrc, *pdst, endmask);
|
||||
mfbScanlineIncDst(pdstLine, widthDst);
|
||||
mfbScanlineIncSrc(psrcLine, widthSrc);
|
||||
}
|
||||
}
|
||||
#ifndef DO_UNALIGNED_BITBLT
|
||||
else
|
||||
{
|
||||
if (xoffSrc > xoffDst)
|
||||
{
|
||||
leftShift = (xoffSrc - xoffDst);
|
||||
rightShift = PPW - leftShift;
|
||||
}
|
||||
else
|
||||
{
|
||||
rightShift = (xoffDst - xoffSrc);
|
||||
leftShift = PPW - rightShift;
|
||||
}
|
||||
while (h--)
|
||||
{
|
||||
psrc = psrcLine;
|
||||
pdst = pdstLine;
|
||||
bits = 0;
|
||||
if (xoffSrc > xoffDst)
|
||||
bits = *psrc++;
|
||||
if (startmask)
|
||||
{
|
||||
bits1 = BitLeft(bits,leftShift);
|
||||
if (BitLeft(startmask, rightShift)) {
|
||||
bits = *psrc++;
|
||||
bits1 |= BitRight(bits,rightShift);
|
||||
}
|
||||
*pdst = MROP_MASK(bits1, *pdst, startmask);
|
||||
pdst++;
|
||||
}
|
||||
nl = nlMiddle;
|
||||
|
||||
#ifdef LARGE_INSTRUCTION_CACHE
|
||||
bits1 = bits;
|
||||
|
||||
#ifdef FAST_CONSTANT_OFFSET_MODE
|
||||
|
||||
psrc += nl & (UNROLL-1);
|
||||
pdst += nl & (UNROLL-1);
|
||||
|
||||
#define BodyOdd(n) \
|
||||
bits = psrc[-n]; \
|
||||
pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);
|
||||
|
||||
#define BodyEven(n) \
|
||||
bits1 = psrc[-n]; \
|
||||
pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);
|
||||
|
||||
#define LoopReset \
|
||||
pdst += UNROLL; \
|
||||
psrc += UNROLL;
|
||||
|
||||
#else
|
||||
|
||||
#define BodyOdd(n) \
|
||||
bits = *psrc++; \
|
||||
*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \
|
||||
pdst++;
|
||||
|
||||
#define BodyEven(n) \
|
||||
bits1 = *psrc++; \
|
||||
*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \
|
||||
pdst++;
|
||||
|
||||
#define LoopReset ;
|
||||
|
||||
#endif /* !FAST_CONSTANT_OFFSET_MODE */
|
||||
|
||||
PackedLoop
|
||||
|
||||
#undef BodyOdd
|
||||
#undef BodyEven
|
||||
#undef LoopReset
|
||||
|
||||
#else
|
||||
DuffL (nl,label2,
|
||||
bits1 = BitLeft(bits, leftShift);
|
||||
bits = *psrc++;
|
||||
*pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
|
||||
pdst++;
|
||||
)
|
||||
#endif
|
||||
|
||||
if (endmask)
|
||||
{
|
||||
bits1 = BitLeft(bits, leftShift);
|
||||
if (BitLeft(endmask, rightShift))
|
||||
{
|
||||
bits = *psrc;
|
||||
bits1 |= BitRight(bits, rightShift);
|
||||
}
|
||||
*pdst = MROP_MASK (bits1, *pdst, endmask);
|
||||
}
|
||||
mfbScanlineIncDst(pdstLine, widthDst);
|
||||
mfbScanlineIncSrc(psrcLine, widthSrc);
|
||||
}
|
||||
}
|
||||
#endif /* DO_UNALIGNED_BITBLT */
|
||||
}
|
||||
else /* xdir == -1 */
|
||||
{
|
||||
xoffSrc = (pptSrc->x + w - 1) & PIM;
|
||||
xoffDst = (pbox->x2 - 1) & PIM;
|
||||
pdstLine += ((pbox->x2-1) >> PWSH) + 1;
|
||||
psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1;
|
||||
#ifdef DO_UNALIGNED_BITBLT
|
||||
nl = xoffSrc - xoffDst;
|
||||
psrcLine = (PixelType *)
|
||||
(((unsigned char *) psrcLine) + nl);
|
||||
#else
|
||||
if (xoffSrc == xoffDst)
|
||||
#endif
|
||||
{
|
||||
while (h--)
|
||||
{
|
||||
psrc = psrcLine;
|
||||
pdst = pdstLine;
|
||||
if (endmask)
|
||||
{
|
||||
pdst--;
|
||||
psrc--;
|
||||
*pdst = MROP_MASK (*psrc, *pdst, endmask);
|
||||
}
|
||||
nl = nlMiddle;
|
||||
|
||||
#ifdef LARGE_INSTRUCTION_CACHE
|
||||
#ifdef FAST_CONSTANT_OFFSET_MODE
|
||||
psrc -= nl & (UNROLL - 1);
|
||||
pdst -= nl & (UNROLL - 1);
|
||||
|
||||
#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]);
|
||||
|
||||
#define BodyEven(n) BodyOdd(n)
|
||||
|
||||
#define LoopReset \
|
||||
pdst -= UNROLL;\
|
||||
psrc -= UNROLL;
|
||||
|
||||
#else
|
||||
|
||||
#define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst);
|
||||
#define BodyEven(n) BodyOdd(n)
|
||||
#define LoopReset ;
|
||||
|
||||
#endif
|
||||
PackedLoop
|
||||
|
||||
#undef BodyOdd
|
||||
#undef BodyEven
|
||||
#undef LoopReset
|
||||
|
||||
#else
|
||||
DuffL(nl,label3,
|
||||
--pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);)
|
||||
#endif
|
||||
|
||||
if (startmask)
|
||||
{
|
||||
--pdst;
|
||||
--psrc;
|
||||
*pdst = MROP_MASK(*psrc, *pdst, startmask);
|
||||
}
|
||||
mfbScanlineIncDst(pdstLine, widthDst);
|
||||
mfbScanlineIncSrc(psrcLine, widthSrc);
|
||||
}
|
||||
}
|
||||
#ifndef DO_UNALIGNED_BITBLT
|
||||
else
|
||||
{
|
||||
if (xoffDst > xoffSrc)
|
||||
{
|
||||
rightShift = (xoffDst - xoffSrc);
|
||||
leftShift = PPW - rightShift;
|
||||
}
|
||||
else
|
||||
{
|
||||
leftShift = (xoffSrc - xoffDst);
|
||||
rightShift = PPW - leftShift;
|
||||
}
|
||||
while (h--)
|
||||
{
|
||||
psrc = psrcLine;
|
||||
pdst = pdstLine;
|
||||
bits = 0;
|
||||
if (xoffDst > xoffSrc)
|
||||
bits = *--psrc;
|
||||
if (endmask)
|
||||
{
|
||||
bits1 = BitRight(bits, rightShift);
|
||||
if (BitRight(endmask, leftShift)) {
|
||||
bits = *--psrc;
|
||||
bits1 |= BitLeft(bits, leftShift);
|
||||
}
|
||||
pdst--;
|
||||
*pdst = MROP_MASK(bits1, *pdst, endmask);
|
||||
}
|
||||
nl = nlMiddle;
|
||||
|
||||
#ifdef LARGE_INSTRUCTION_CACHE
|
||||
bits1 = bits;
|
||||
#ifdef FAST_CONSTANT_OFFSET_MODE
|
||||
psrc -= nl & (UNROLL - 1);
|
||||
pdst -= nl & (UNROLL - 1);
|
||||
|
||||
#define BodyOdd(n) \
|
||||
bits = psrc[n-1]; \
|
||||
pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]);
|
||||
|
||||
#define BodyEven(n) \
|
||||
bits1 = psrc[n-1]; \
|
||||
pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]);
|
||||
|
||||
#define LoopReset \
|
||||
pdst -= UNROLL; \
|
||||
psrc -= UNROLL;
|
||||
|
||||
#else
|
||||
|
||||
#define BodyOdd(n) \
|
||||
bits = *--psrc; --pdst; \
|
||||
*pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst);
|
||||
|
||||
#define BodyEven(n) \
|
||||
bits1 = *--psrc; --pdst; \
|
||||
*pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst);
|
||||
|
||||
#define LoopReset ;
|
||||
|
||||
#endif
|
||||
|
||||
PackedLoop
|
||||
|
||||
#undef BodyOdd
|
||||
#undef BodyEven
|
||||
#undef LoopReset
|
||||
|
||||
#else
|
||||
DuffL (nl, label4,
|
||||
bits1 = BitRight(bits, rightShift);
|
||||
bits = *--psrc;
|
||||
--pdst;
|
||||
*pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst);
|
||||
)
|
||||
#endif
|
||||
|
||||
if (startmask)
|
||||
{
|
||||
bits1 = BitRight(bits, rightShift);
|
||||
if (BitRight (startmask, leftShift))
|
||||
{
|
||||
bits = *--psrc;
|
||||
bits1 |= BitLeft(bits, leftShift);
|
||||
}
|
||||
--pdst;
|
||||
*pdst = MROP_MASK(bits1, *pdst, startmask);
|
||||
}
|
||||
mfbScanlineIncDst(pdstLine, widthDst);
|
||||
mfbScanlineIncSrc(psrcLine, widthSrc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
pbox++;
|
||||
pptSrc++;
|
||||
}
|
||||
if (pboxNew2)
|
||||
{
|
||||
xfree(pptNew2);
|
||||
xfree(pboxNew2);
|
||||
}
|
||||
if (pboxNew1)
|
||||
{
|
||||
xfree(pptNew1);
|
||||
xfree(pboxNew1);
|
||||
}
|
||||
}
|
||||
368
mfb/mfbbres.c
368
mfb/mfbbres.c
|
|
@ -1,368 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "misc.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "miline.h"
|
||||
|
||||
/* Solid bresenham line */
|
||||
/* NOTES
|
||||
e2 is used less often than e1, so it's not in a register
|
||||
*/
|
||||
|
||||
void
|
||||
mfbBresS(rop, addrlbase, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len)
|
||||
int rop; /* a reduced rasterop */
|
||||
PixelType *addrlbase; /* pointer to base of bitmap */
|
||||
int nlwidth; /* width in longwords of bitmap */
|
||||
int signdx, signdy; /* signs of directions */
|
||||
int axis; /* major axis (Y_AXIS or X_AXIS) */
|
||||
int x1, y1; /* initial point */
|
||||
register int e; /* error accumulator */
|
||||
register int e1; /* bresenham increments */
|
||||
int e2;
|
||||
int len; /* length of line */
|
||||
{
|
||||
register int yinc; /* increment to next scanline, in bytes */
|
||||
register PixelType *addrl; /* bitmask 32-bit pointer */
|
||||
register PixelType bit; /* current bit being set/cleared/etc. */
|
||||
PixelType leftbit = mask[0]; /* leftmost bit to process in new word */
|
||||
PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */
|
||||
|
||||
register int e3 = e2-e1;
|
||||
PixelType tmp;
|
||||
|
||||
/* point to longword containing first point */
|
||||
addrl = mfbScanline(addrlbase, x1, y1, nlwidth);
|
||||
yinc = signdy * nlwidth;
|
||||
e = e-e1; /* to make looping easier */
|
||||
bit = mask[x1 & PIM];
|
||||
|
||||
if (!len)
|
||||
return;
|
||||
if (rop == RROP_BLACK)
|
||||
{
|
||||
if (axis == X_AXIS)
|
||||
{
|
||||
if (signdx > 0)
|
||||
{
|
||||
tmp = *addrl;
|
||||
for (;;)
|
||||
{
|
||||
tmp &= ~bit;
|
||||
if (!--len)
|
||||
break;
|
||||
bit = SCRRIGHT(bit,1);
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
*addrl = tmp;
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
if (!bit)
|
||||
{
|
||||
bit = leftbit;
|
||||
addrl ++;
|
||||
}
|
||||
tmp = *addrl;
|
||||
}
|
||||
else if (!bit)
|
||||
{
|
||||
*addrl = tmp;
|
||||
bit = leftbit;
|
||||
addrl ++;
|
||||
tmp = *addrl;
|
||||
}
|
||||
}
|
||||
*addrl = tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = *addrl;
|
||||
for (;;)
|
||||
{
|
||||
tmp &= ~bit;
|
||||
if (!--len)
|
||||
break;
|
||||
e += e1;
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (e >= 0)
|
||||
{
|
||||
*addrl = tmp;
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
if (!bit)
|
||||
{
|
||||
bit = rightbit;
|
||||
addrl --;
|
||||
}
|
||||
tmp = *addrl;
|
||||
}
|
||||
else if (!bit)
|
||||
{
|
||||
*addrl = tmp;
|
||||
bit = rightbit;
|
||||
addrl --;
|
||||
tmp = *addrl;
|
||||
}
|
||||
}
|
||||
*addrl = tmp;
|
||||
}
|
||||
} /* if X_AXIS */
|
||||
else
|
||||
{
|
||||
if (signdx > 0)
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
*addrl &= ~bit;
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit;addrl ++; }
|
||||
e += e3;
|
||||
}
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
*addrl &= ~bit;
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit;addrl --; }
|
||||
e += e3;
|
||||
}
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
}
|
||||
}
|
||||
} /* else Y_AXIS */
|
||||
}
|
||||
else if (rop == RROP_WHITE)
|
||||
{
|
||||
if (axis == X_AXIS)
|
||||
{
|
||||
if (signdx > 0)
|
||||
{
|
||||
tmp = *addrl;
|
||||
for (;;)
|
||||
{
|
||||
tmp |= bit;
|
||||
if (!--len)
|
||||
break;
|
||||
e += e1;
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (e >= 0)
|
||||
{
|
||||
*addrl = tmp;
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
if (!bit)
|
||||
{
|
||||
bit = leftbit;
|
||||
addrl ++;
|
||||
}
|
||||
tmp = *addrl;
|
||||
}
|
||||
else if (!bit)
|
||||
{
|
||||
*addrl = tmp;
|
||||
bit = leftbit;
|
||||
addrl ++;
|
||||
tmp = *addrl;
|
||||
}
|
||||
}
|
||||
*addrl = tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = *addrl;
|
||||
for (;;)
|
||||
{
|
||||
tmp |= bit;
|
||||
if (!--len)
|
||||
break;
|
||||
e += e1;
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (e >= 0)
|
||||
{
|
||||
*addrl = tmp;
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
if (!bit)
|
||||
{
|
||||
bit = rightbit;
|
||||
addrl --;
|
||||
}
|
||||
tmp = *addrl;
|
||||
}
|
||||
else if (!bit)
|
||||
{
|
||||
*addrl = tmp;
|
||||
bit = rightbit;
|
||||
addrl --;
|
||||
tmp = *addrl;
|
||||
}
|
||||
}
|
||||
*addrl = tmp;
|
||||
}
|
||||
} /* if X_AXIS */
|
||||
else
|
||||
{
|
||||
if (signdx > 0)
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
*addrl |= bit;
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit;addrl ++; }
|
||||
e += e3;
|
||||
}
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
*addrl |= bit;
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit;addrl --; }
|
||||
e += e3;
|
||||
}
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
}
|
||||
}
|
||||
} /* else Y_AXIS */
|
||||
}
|
||||
else if (rop == RROP_INVERT)
|
||||
{
|
||||
if (axis == X_AXIS)
|
||||
{
|
||||
if (signdx > 0)
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
}
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit;addrl ++; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
}
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit;addrl --; }
|
||||
}
|
||||
}
|
||||
} /* if X_AXIS */
|
||||
else
|
||||
{
|
||||
if (signdx > 0)
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit;addrl ++; }
|
||||
e += e3;
|
||||
}
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit; addrl --; }
|
||||
e += e3;
|
||||
}
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
}
|
||||
}
|
||||
} /* else Y_AXIS */
|
||||
}
|
||||
}
|
||||
207
mfb/mfbbresd.c
207
mfb/mfbbresd.c
|
|
@ -1,207 +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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "misc.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "miline.h"
|
||||
|
||||
/* Dashed bresenham line */
|
||||
|
||||
#define StepDash\
|
||||
if (!--dashRemaining) { \
|
||||
if (++ dashIndex == numInDashList) \
|
||||
dashIndex = 0; \
|
||||
dashRemaining = pDash[dashIndex]; \
|
||||
rop = fgrop; \
|
||||
if (dashIndex & 1) \
|
||||
rop = bgrop; \
|
||||
}
|
||||
|
||||
void
|
||||
mfbBresD(fgrop, bgrop,
|
||||
pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
|
||||
addrlbase, nlwidth,
|
||||
signdx, signdy, axis, x1, y1, e, e1, e2, len)
|
||||
int fgrop, bgrop;
|
||||
int *pdashIndex; /* current dash */
|
||||
unsigned char *pDash; /* dash list */
|
||||
int numInDashList; /* total length of dash list */
|
||||
int *pdashOffset; /* offset into current dash */
|
||||
int isDoubleDash;
|
||||
PixelType *addrlbase; /* pointer to base of bitmap */
|
||||
int nlwidth; /* width in longwords of bitmap */
|
||||
int signdx, signdy; /* signs of directions */
|
||||
int axis; /* major axis (Y_AXIS or X_AXIS) */
|
||||
int x1, y1; /* initial point */
|
||||
register int e; /* error accumulator */
|
||||
register int e1; /* bresenham increments */
|
||||
int e2;
|
||||
int len; /* length of line */
|
||||
{
|
||||
register int yinc; /* increment to next scanline, in bytes */
|
||||
register PixelType *addrl;
|
||||
register int e3 = e2-e1;
|
||||
register MfbBits bit;
|
||||
PixelType leftbit = mask[0]; /* leftmost bit to process in new word */
|
||||
PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */
|
||||
int dashIndex;
|
||||
int dashOffset;
|
||||
int dashRemaining;
|
||||
int rop;
|
||||
|
||||
dashOffset = *pdashOffset;
|
||||
dashIndex = *pdashIndex;
|
||||
dashRemaining = pDash[dashIndex] - dashOffset;
|
||||
rop = fgrop;
|
||||
if (!isDoubleDash)
|
||||
bgrop = -1;
|
||||
if (dashIndex & 1)
|
||||
rop = bgrop;
|
||||
|
||||
/* point to longword containing first point */
|
||||
addrl = mfbScanline(addrlbase, x1, y1, nlwidth);
|
||||
yinc = signdy * nlwidth;
|
||||
e = e-e1; /* to make looping easier */
|
||||
bit = mask[x1 & PIM];
|
||||
if (axis == X_AXIS)
|
||||
{
|
||||
if (signdx > 0)
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= ~bit;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= bit;
|
||||
else if (rop == RROP_INVERT)
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
}
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit;addrl ++; }
|
||||
StepDash
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= ~bit;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= bit;
|
||||
else if (rop == RROP_INVERT)
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
e += e3;
|
||||
}
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit;addrl --; }
|
||||
StepDash
|
||||
}
|
||||
}
|
||||
} /* if X_AXIS */
|
||||
else
|
||||
{
|
||||
if (signdx > 0)
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= ~bit;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= bit;
|
||||
else if (rop == RROP_INVERT)
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
bit = SCRRIGHT(bit,1);
|
||||
if (!bit) { bit = leftbit;addrl ++; }
|
||||
e += e3;
|
||||
}
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
StepDash
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= ~bit;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= bit;
|
||||
else if (rop == RROP_INVERT)
|
||||
*addrl ^= bit;
|
||||
e += e1;
|
||||
if (e >= 0)
|
||||
{
|
||||
bit = SCRLEFT(bit,1);
|
||||
if (!bit) { bit = rightbit;addrl --; }
|
||||
e += e3;
|
||||
}
|
||||
mfbScanlineInc(addrl, yinc);
|
||||
StepDash
|
||||
}
|
||||
}
|
||||
} /* else Y_AXIS */
|
||||
*pdashIndex = dashIndex;
|
||||
*pdashOffset = pDash[dashIndex] - dashRemaining;
|
||||
}
|
||||
280
mfb/mfbclip.c
280
mfb/mfbclip.c
|
|
@ -1,280 +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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "regionstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "gc.h"
|
||||
#include "maskbits.h"
|
||||
#include "mi.h"
|
||||
#include "mfb.h"
|
||||
|
||||
#define ADDRECT(reg,r,fr,rx1,ry1,rx2,ry2) \
|
||||
if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \
|
||||
(!((reg)->data->numRects && \
|
||||
((r-1)->y1 == (ry1)) && \
|
||||
((r-1)->y2 == (ry2)) && \
|
||||
((r-1)->x1 <= (rx1)) && \
|
||||
((r-1)->x2 >= (rx2))))) \
|
||||
{ \
|
||||
if ((reg)->data->numRects == (reg)->data->size) \
|
||||
{ \
|
||||
miRectAlloc(reg, 1); \
|
||||
fr = REGION_BOXPTR(reg); \
|
||||
r = fr + (reg)->data->numRects; \
|
||||
} \
|
||||
r->x1 = (rx1); \
|
||||
r->y1 = (ry1); \
|
||||
r->x2 = (rx2); \
|
||||
r->y2 = (ry2); \
|
||||
(reg)->data->numRects++; \
|
||||
if(r->x1 < (reg)->extents.x1) \
|
||||
(reg)->extents.x1 = r->x1; \
|
||||
if(r->x2 > (reg)->extents.x2) \
|
||||
(reg)->extents.x2 = r->x2; \
|
||||
r++; \
|
||||
}
|
||||
|
||||
/* Convert bitmap clip mask into clipping region.
|
||||
* First, goes through each line and makes boxes by noting the transitions
|
||||
* from 0 to 1 and 1 to 0.
|
||||
* Then it coalesces the current line with the previous if they have boxes
|
||||
* at the same X coordinates.
|
||||
*/
|
||||
RegionPtr
|
||||
mfbPixmapToRegion(pPix)
|
||||
PixmapPtr pPix;
|
||||
{
|
||||
register RegionPtr pReg;
|
||||
register PixelType *pw, w;
|
||||
register int ib;
|
||||
int width, h, base, rx1 = 0, crects;
|
||||
PixelType *pwLineEnd;
|
||||
int irectPrevStart, irectLineStart;
|
||||
register BoxPtr prectO, prectN;
|
||||
BoxPtr FirstRect, rects, prectLineStart;
|
||||
Bool fInBox, fSame;
|
||||
register PixelType mask0 = mask[0];
|
||||
PixelType *pwLine;
|
||||
int nWidth;
|
||||
|
||||
pReg = REGION_CREATE(pPix->drawable.pScreen, NULL, 1);
|
||||
if(!pReg)
|
||||
return NullRegion;
|
||||
FirstRect = REGION_BOXPTR(pReg);
|
||||
rects = FirstRect;
|
||||
|
||||
pwLine = (PixelType *) pPix->devPrivate.ptr;
|
||||
nWidth = pPix->devKind / PGSZB;
|
||||
|
||||
width = pPix->drawable.width;
|
||||
pReg->extents.x1 = width - 1;
|
||||
pReg->extents.x2 = 0;
|
||||
irectPrevStart = -1;
|
||||
for(h = 0; h < pPix->drawable.height; h++)
|
||||
{
|
||||
pw = pwLine;
|
||||
pwLine += nWidth;
|
||||
irectLineStart = rects - FirstRect;
|
||||
/* If the Screen left most bit of the word is set, we're starting in
|
||||
* a box */
|
||||
if(*pw & mask0)
|
||||
{
|
||||
fInBox = TRUE;
|
||||
rx1 = 0;
|
||||
}
|
||||
else
|
||||
fInBox = FALSE;
|
||||
/* Process all words which are fully in the pixmap */
|
||||
pwLineEnd = pw + (width >> PWSH);
|
||||
for (base = 0; pw < pwLineEnd; base += PPW)
|
||||
{
|
||||
w = *pw++;
|
||||
if (fInBox)
|
||||
{
|
||||
if (!~w)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!w)
|
||||
continue;
|
||||
}
|
||||
for(ib = 0; ib < PPW; ib++)
|
||||
{
|
||||
/* If the Screen left most bit of the word is set, we're
|
||||
* starting a box */
|
||||
if(w & mask0)
|
||||
{
|
||||
if(!fInBox)
|
||||
{
|
||||
rx1 = base + ib;
|
||||
/* start new box */
|
||||
fInBox = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fInBox)
|
||||
{
|
||||
/* end box */
|
||||
ADDRECT(pReg, rects, FirstRect,
|
||||
rx1, h, base + ib, h + 1);
|
||||
fInBox = FALSE;
|
||||
}
|
||||
}
|
||||
/* Shift the word VISUALLY left one. */
|
||||
w = SCRLEFT(w, 1);
|
||||
}
|
||||
}
|
||||
if(width & PIM)
|
||||
{
|
||||
/* Process final partial word on line */
|
||||
w = *pw++;
|
||||
for(ib = 0; ib < (width & PIM); ib++)
|
||||
{
|
||||
/* If the Screen left most bit of the word is set, we're
|
||||
* starting a box */
|
||||
if(w & mask0)
|
||||
{
|
||||
if(!fInBox)
|
||||
{
|
||||
rx1 = base + ib;
|
||||
/* start new box */
|
||||
fInBox = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fInBox)
|
||||
{
|
||||
/* end box */
|
||||
ADDRECT(pReg, rects, FirstRect,
|
||||
rx1, h, base + ib, h + 1);
|
||||
fInBox = FALSE;
|
||||
}
|
||||
}
|
||||
/* Shift the word VISUALLY left one. */
|
||||
w = SCRLEFT(w, 1);
|
||||
}
|
||||
}
|
||||
/* If scanline ended with last bit set, end the box */
|
||||
if(fInBox)
|
||||
{
|
||||
ADDRECT(pReg, rects, FirstRect,
|
||||
rx1, h, base + (width & PIM), h + 1);
|
||||
}
|
||||
/* if all rectangles on this line have the same x-coords as
|
||||
* those on the previous line, then add 1 to all the previous y2s and
|
||||
* throw away all the rectangles from this line
|
||||
*/
|
||||
fSame = FALSE;
|
||||
if(irectPrevStart != -1)
|
||||
{
|
||||
crects = irectLineStart - irectPrevStart;
|
||||
if(crects == ((rects - FirstRect) - irectLineStart))
|
||||
{
|
||||
prectO = FirstRect + irectPrevStart;
|
||||
prectN = prectLineStart = FirstRect + irectLineStart;
|
||||
fSame = TRUE;
|
||||
while(prectO < prectLineStart)
|
||||
{
|
||||
if((prectO->x1 != prectN->x1) || (prectO->x2 != prectN->x2))
|
||||
{
|
||||
fSame = FALSE;
|
||||
break;
|
||||
}
|
||||
prectO++;
|
||||
prectN++;
|
||||
}
|
||||
if (fSame)
|
||||
{
|
||||
prectO = FirstRect + irectPrevStart;
|
||||
while(prectO < prectLineStart)
|
||||
{
|
||||
prectO->y2 += 1;
|
||||
prectO++;
|
||||
}
|
||||
rects -= crects;
|
||||
pReg->data->numRects -= crects;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!fSame)
|
||||
irectPrevStart = irectLineStart;
|
||||
}
|
||||
if (!pReg->data->numRects)
|
||||
pReg->extents.x1 = pReg->extents.x2 = 0;
|
||||
else
|
||||
{
|
||||
pReg->extents.y1 = REGION_BOXPTR(pReg)->y1;
|
||||
pReg->extents.y2 = REGION_END(pReg)->y2;
|
||||
if (pReg->data->numRects == 1)
|
||||
{
|
||||
xfree(pReg->data);
|
||||
pReg->data = (RegDataPtr)NULL;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (!miValidRegion(pReg))
|
||||
FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__);
|
||||
#endif
|
||||
return(pReg);
|
||||
}
|
||||
|
||||
mfbPixmapToRegionProc *
|
||||
mfbPixmapToRegionWeak(void)
|
||||
{
|
||||
return mfbPixmapToRegion;
|
||||
}
|
||||
162
mfb/mfbcmap.c
162
mfb/mfbcmap.c
|
|
@ -1,162 +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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "colormapst.h"
|
||||
#include "resource.h"
|
||||
#include "micmap.h"
|
||||
#include "mfb.h"
|
||||
|
||||
/* A monochrome frame buffer is a static gray colormap with two entries.
|
||||
* We have a "required list" of length 1. Because we can only support 1
|
||||
* colormap, we never have to change it, but we may have to change the
|
||||
* name we call it. If someone installs a new colormap, we know it must
|
||||
* look just like the old one (because we've checked in dispatch that it was
|
||||
* a valid colormap identifier, and all the colormap IDs for this device
|
||||
* look the same). Nevertheless, we still have to uninstall the old colormap
|
||||
* and install the new one. Similarly, if someone uninstalls a colormap,
|
||||
* we have to install the default map, even though we know those two looked
|
||||
* alike.
|
||||
* The required list concept is pretty much irrelevant when you can only
|
||||
* have one map installed at a time.
|
||||
*/
|
||||
|
||||
int
|
||||
mfbListInstalledColormaps(pScreen, pmaps)
|
||||
ScreenPtr pScreen;
|
||||
Colormap *pmaps;
|
||||
{
|
||||
return miListInstalledColormaps(pScreen, pmaps);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
mfbInstallColormap(pmap)
|
||||
ColormapPtr pmap;
|
||||
{
|
||||
miInstallColormap(pmap);
|
||||
}
|
||||
|
||||
void
|
||||
mfbUninstallColormap(pmap)
|
||||
ColormapPtr pmap;
|
||||
{
|
||||
miUninstallColormap(pmap);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
mfbResolveColor (pred, pgreen, pblue, pVisual)
|
||||
unsigned short *pred;
|
||||
unsigned short *pgreen;
|
||||
unsigned short *pblue;
|
||||
VisualPtr pVisual;
|
||||
{
|
||||
/*
|
||||
* Gets intensity from RGB. If intensity is >= half, pick white, else
|
||||
* pick black. This may well be more trouble than it's worth.
|
||||
*/
|
||||
*pred = *pgreen = *pblue =
|
||||
(((30L * *pred +
|
||||
59L * *pgreen +
|
||||
11L * *pblue) >> 8) >= (((1<<8)-1)*50)) ? ~0 : 0;
|
||||
}
|
||||
|
||||
Bool
|
||||
mfbCreateColormap(pMap)
|
||||
ColormapPtr pMap;
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
unsigned short red0, green0, blue0;
|
||||
unsigned short red1, green1, blue1;
|
||||
Pixel pix;
|
||||
|
||||
pScreen = pMap->pScreen;
|
||||
if (pScreen->whitePixel == 0)
|
||||
{
|
||||
red0 = green0 = blue0 = ~0;
|
||||
red1 = green1 = blue1 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
red0 = green0 = blue0 = 0;
|
||||
red1 = green1 = blue1 = ~0;
|
||||
}
|
||||
|
||||
/* this is a monochrome colormap, it only has two entries, just fill
|
||||
* them in by hand. If it were a more complex static map, it would be
|
||||
* worth writing a for loop or three to initialize it */
|
||||
|
||||
/* this will be pixel 0 */
|
||||
pix = 0;
|
||||
if (AllocColor(pMap, &red0, &green0, &blue0, &pix, 0) != Success)
|
||||
return FALSE;
|
||||
|
||||
/* this will be pixel 1 */
|
||||
if (AllocColor(pMap, &red1, &green1, &blue1, &pix, 0) != Success)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
mfbDestroyColormap (pMap)
|
||||
ColormapPtr pMap;
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Bool
|
||||
mfbCreateDefColormap (pScreen)
|
||||
ScreenPtr pScreen;
|
||||
{
|
||||
return miCreateDefColormap(pScreen);
|
||||
}
|
||||
334
mfb/mfbfillarc.c
334
mfb/mfbfillarc.c
|
|
@ -1,334 +0,0 @@
|
|||
/************************************************************
|
||||
|
||||
Copyright 1989, 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xprotostr.h>
|
||||
#include "regionstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "mifillarc.h"
|
||||
#include "mi.h"
|
||||
|
||||
static void
|
||||
mfbFillEllipseSolid(
|
||||
DrawablePtr pDraw,
|
||||
xArc *arc,
|
||||
register int rop)
|
||||
{
|
||||
int x, y, e;
|
||||
int yk, xk, ym, xm, dx, dy, xorg, yorg;
|
||||
register int slw;
|
||||
miFillArcRec info;
|
||||
PixelType *addrlt, *addrlb;
|
||||
register PixelType *addrl;
|
||||
register int n;
|
||||
int nlwidth;
|
||||
register int xpos;
|
||||
PixelType startmask, endmask;
|
||||
int nlmiddle;
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDraw, nlwidth, addrlt);
|
||||
miFillArcSetup(arc, &info);
|
||||
MIFILLARCSETUP();
|
||||
xorg += pDraw->x;
|
||||
yorg += pDraw->y;
|
||||
addrlb = addrlt;
|
||||
addrlt += nlwidth * (yorg - y);
|
||||
addrlb += nlwidth * (yorg + y + dy);
|
||||
while (y)
|
||||
{
|
||||
addrlt += nlwidth;
|
||||
addrlb -= nlwidth;
|
||||
MIFILLARCSTEP(slw);
|
||||
if (!slw)
|
||||
continue;
|
||||
xpos = xorg - x;
|
||||
addrl = mfbScanlineOffset(addrlt, (xpos >> PWSH));
|
||||
if (((xpos & PIM) + slw) < PPW)
|
||||
{
|
||||
maskpartialbits(xpos, slw, startmask);
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= ~startmask;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= startmask;
|
||||
else
|
||||
*addrl ^= startmask;
|
||||
if (miFillArcLower(slw))
|
||||
{
|
||||
addrl = mfbScanlineOffset(addrlb, (xpos >> PWSH));
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= ~startmask;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= startmask;
|
||||
else
|
||||
*addrl ^= startmask;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
maskbits(xpos, slw, startmask, endmask, nlmiddle);
|
||||
if (startmask)
|
||||
{
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl++ &= ~startmask;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl++ |= startmask;
|
||||
else
|
||||
*addrl++ ^= startmask;
|
||||
}
|
||||
n = nlmiddle;
|
||||
if (rop == RROP_BLACK)
|
||||
while (n--)
|
||||
*addrl++ = 0;
|
||||
else if (rop == RROP_WHITE)
|
||||
while (n--)
|
||||
*addrl++ = ~0;
|
||||
else
|
||||
while (n--)
|
||||
*addrl++ ^= ~0;
|
||||
if (endmask)
|
||||
{
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= ~endmask;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= endmask;
|
||||
else
|
||||
*addrl ^= endmask;
|
||||
}
|
||||
if (!miFillArcLower(slw))
|
||||
continue;
|
||||
addrl = mfbScanlineOffset(addrlb, (xpos >> PWSH));
|
||||
if (startmask)
|
||||
{
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl++ &= ~startmask;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl++ |= startmask;
|
||||
else
|
||||
*addrl++ ^= startmask;
|
||||
}
|
||||
n = nlmiddle;
|
||||
if (rop == RROP_BLACK)
|
||||
while (n--)
|
||||
*addrl++ = 0;
|
||||
else if (rop == RROP_WHITE)
|
||||
while (n--)
|
||||
*addrl++ = ~0;
|
||||
else
|
||||
while (n--)
|
||||
*addrl++ ^= ~0;
|
||||
if (endmask)
|
||||
{
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= ~endmask;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= endmask;
|
||||
else
|
||||
*addrl ^= endmask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define FILLSPAN(xl,xr,addr) \
|
||||
if (xr >= xl) \
|
||||
{ \
|
||||
width = xr - xl + 1; \
|
||||
addrl = mfbScanlineOffset(addr, (xl >> PWSH)); \
|
||||
if (((xl & PIM) + width) < PPW) \
|
||||
{ \
|
||||
maskpartialbits(xl, width, startmask); \
|
||||
if (rop == RROP_BLACK) \
|
||||
*addrl &= ~startmask; \
|
||||
else if (rop == RROP_WHITE) \
|
||||
*addrl |= startmask; \
|
||||
else \
|
||||
*addrl ^= startmask; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
maskbits(xl, width, startmask, endmask, nlmiddle); \
|
||||
if (startmask) \
|
||||
{ \
|
||||
if (rop == RROP_BLACK) \
|
||||
*addrl++ &= ~startmask; \
|
||||
else if (rop == RROP_WHITE) \
|
||||
*addrl++ |= startmask; \
|
||||
else \
|
||||
*addrl++ ^= startmask; \
|
||||
} \
|
||||
n = nlmiddle; \
|
||||
if (rop == RROP_BLACK) \
|
||||
while (n--) \
|
||||
*addrl++ = 0; \
|
||||
else if (rop == RROP_WHITE) \
|
||||
while (n--) \
|
||||
*addrl++ = ~0; \
|
||||
else \
|
||||
while (n--) \
|
||||
*addrl++ ^= ~0; \
|
||||
if (endmask) \
|
||||
{ \
|
||||
if (rop == RROP_BLACK) \
|
||||
*addrl &= ~endmask; \
|
||||
else if (rop == RROP_WHITE) \
|
||||
*addrl |= endmask; \
|
||||
else \
|
||||
*addrl ^= endmask; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define FILLSLICESPANS(flip,addr) \
|
||||
if (!flip) \
|
||||
{ \
|
||||
FILLSPAN(xl, xr, addr); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
xc = xorg - x; \
|
||||
FILLSPAN(xc, xr, addr); \
|
||||
xc += slw - 1; \
|
||||
FILLSPAN(xl, xc, addr); \
|
||||
}
|
||||
|
||||
static void
|
||||
mfbFillArcSliceSolidCopy(
|
||||
DrawablePtr pDraw,
|
||||
GCPtr pGC,
|
||||
xArc *arc,
|
||||
register int rop)
|
||||
{
|
||||
register PixelType *addrl;
|
||||
register int n;
|
||||
int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
|
||||
register int x, y, e;
|
||||
miFillArcRec info;
|
||||
miArcSliceRec slice;
|
||||
int xl, xr, xc;
|
||||
PixelType *addrlt, *addrlb;
|
||||
int nlwidth;
|
||||
int width;
|
||||
PixelType startmask, endmask;
|
||||
int nlmiddle;
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDraw, nlwidth, addrlt);
|
||||
miFillArcSetup(arc, &info);
|
||||
miFillArcSliceSetup(arc, &slice, pGC);
|
||||
MIFILLARCSETUP();
|
||||
xorg += pDraw->x;
|
||||
yorg += pDraw->y;
|
||||
addrlb = addrlt;
|
||||
addrlt = mfbScanlineDeltaNoBankSwitch(addrlt, yorg - y, nlwidth);
|
||||
addrlb = mfbScanlineDeltaNoBankSwitch(addrlb, yorg + y + dy, nlwidth);
|
||||
slice.edge1.x += pDraw->x;
|
||||
slice.edge2.x += pDraw->x;
|
||||
while (y > 0)
|
||||
{
|
||||
mfbScanlineIncNoBankSwitch(addrlt, nlwidth);
|
||||
mfbScanlineIncNoBankSwitch(addrlb, -nlwidth);
|
||||
MIFILLARCSTEP(slw);
|
||||
MIARCSLICESTEP(slice.edge1);
|
||||
MIARCSLICESTEP(slice.edge2);
|
||||
if (miFillSliceUpper(slice))
|
||||
{
|
||||
MIARCSLICEUPPER(xl, xr, slice, slw);
|
||||
FILLSLICESPANS(slice.flip_top, addrlt);
|
||||
}
|
||||
if (miFillSliceLower(slice))
|
||||
{
|
||||
MIARCSLICELOWER(xl, xr, slice, slw);
|
||||
FILLSLICESPANS(slice.flip_bot, addrlb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mfbPolyFillArcSolid(pDraw, pGC, narcs, parcs)
|
||||
register DrawablePtr pDraw;
|
||||
GCPtr pGC;
|
||||
int narcs;
|
||||
xArc *parcs;
|
||||
{
|
||||
mfbPrivGC *priv;
|
||||
register xArc *arc;
|
||||
register int i;
|
||||
BoxRec box;
|
||||
int x2, y2;
|
||||
RegionPtr cclip;
|
||||
int rop;
|
||||
|
||||
priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
mfbGetGCPrivateKey());
|
||||
rop = priv->rop;
|
||||
if ((rop == RROP_NOP) || !(pGC->planemask & 1))
|
||||
return;
|
||||
cclip = pGC->pCompositeClip;
|
||||
for (arc = parcs, i = narcs; --i >= 0; arc++)
|
||||
{
|
||||
if (miFillArcEmpty(arc))
|
||||
continue;
|
||||
if (miCanFillArc(arc))
|
||||
{
|
||||
box.x1 = arc->x + pDraw->x;
|
||||
box.y1 = arc->y + pDraw->y;
|
||||
/*
|
||||
* Because box.x2 and box.y2 get truncated to 16 bits, and the
|
||||
* RECT_IN_REGION test treats the resulting number as a signed
|
||||
* integer, the RECT_IN_REGION test alone can go the wrong way.
|
||||
* This can result in a server crash because the rendering
|
||||
* routines in this file deal directly with cpu addresses
|
||||
* of pixels to be stored, and do not clip or otherwise check
|
||||
* that all such addresses are within their respective pixmaps.
|
||||
* So we only allow the RECT_IN_REGION test to be used for
|
||||
* values that can be expressed correctly in a signed short.
|
||||
*/
|
||||
x2 = box.x1 + (int)arc->width + 1;
|
||||
box.x2 = x2;
|
||||
y2 = box.y1 + (int)arc->height + 1;
|
||||
box.y2 = y2;
|
||||
if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
|
||||
(RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) )
|
||||
{
|
||||
if ((arc->angle2 >= FULLCIRCLE) ||
|
||||
(arc->angle2 <= -FULLCIRCLE))
|
||||
mfbFillEllipseSolid(pDraw, arc, rop);
|
||||
else
|
||||
mfbFillArcSliceSolidCopy(pDraw, pGC, arc, rop);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
miPolyFillArc(pDraw, pGC, 1, arc);
|
||||
}
|
||||
}
|
||||
227
mfb/mfbfillrct.c
227
mfb/mfbfillrct.c
|
|
@ -1,227 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xprotostr.h>
|
||||
#include "pixmapstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "miscstruct.h"
|
||||
#include "regionstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
#define MODEQ(a, b) ((a) %= (b))
|
||||
|
||||
/*
|
||||
filled rectangles.
|
||||
translate the rectangles, clip them, and call the
|
||||
helper function in the GC.
|
||||
*/
|
||||
|
||||
#define NUM_STACK_RECTS 1024
|
||||
|
||||
void
|
||||
mfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int nrectFill; /* number of rectangles to fill */
|
||||
xRectangle *prectInit; /* Pointer to first rectangle to fill */
|
||||
{
|
||||
xRectangle *prect;
|
||||
RegionPtr prgnClip;
|
||||
register BoxPtr pbox;
|
||||
register BoxPtr pboxClipped;
|
||||
BoxPtr pboxClippedBase;
|
||||
BoxPtr pextent;
|
||||
BoxRec stackRects[NUM_STACK_RECTS];
|
||||
int numRects;
|
||||
int n;
|
||||
int xorg, yorg;
|
||||
mfbPrivGC *priv;
|
||||
int alu;
|
||||
mfbFillAreaProcPtr pfn;
|
||||
PixmapPtr ppix;
|
||||
|
||||
if (!(pGC->planemask & 1))
|
||||
return;
|
||||
|
||||
priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
mfbGetGCPrivateKey());
|
||||
alu = priv->ropFillArea;
|
||||
pfn = priv->FillArea;
|
||||
ppix = pGC->pRotatedPixmap;
|
||||
prgnClip = pGC->pCompositeClip;
|
||||
|
||||
prect = prectInit;
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
if (xorg || yorg)
|
||||
{
|
||||
prect = prectInit;
|
||||
n = nrectFill;
|
||||
Duff (n, prect->x += xorg; prect->y += yorg; prect++);
|
||||
}
|
||||
|
||||
|
||||
prect = prectInit;
|
||||
|
||||
numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
|
||||
if (numRects > NUM_STACK_RECTS)
|
||||
{
|
||||
pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
|
||||
if (!pboxClippedBase)
|
||||
return;
|
||||
}
|
||||
else
|
||||
pboxClippedBase = stackRects;
|
||||
|
||||
pboxClipped = pboxClippedBase;
|
||||
|
||||
if (REGION_NUM_RECTS(prgnClip) == 1)
|
||||
{
|
||||
int x1, y1, x2, y2, bx2, by2;
|
||||
|
||||
pextent = REGION_RECTS(prgnClip);
|
||||
x1 = pextent->x1;
|
||||
y1 = pextent->y1;
|
||||
x2 = pextent->x2;
|
||||
y2 = pextent->y2;
|
||||
while (nrectFill--)
|
||||
{
|
||||
if ((pboxClipped->x1 = prect->x) < x1)
|
||||
pboxClipped->x1 = x1;
|
||||
|
||||
if ((pboxClipped->y1 = prect->y) < y1)
|
||||
pboxClipped->y1 = y1;
|
||||
|
||||
bx2 = (int) prect->x + (int) prect->width;
|
||||
if (bx2 > x2)
|
||||
bx2 = x2;
|
||||
pboxClipped->x2 = bx2;
|
||||
|
||||
by2 = (int) prect->y + (int) prect->height;
|
||||
if (by2 > y2)
|
||||
by2 = y2;
|
||||
pboxClipped->y2 = by2;
|
||||
|
||||
prect++;
|
||||
if ((pboxClipped->x1 < pboxClipped->x2) &&
|
||||
(pboxClipped->y1 < pboxClipped->y2))
|
||||
{
|
||||
pboxClipped++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int x1, y1, x2, y2, bx2, by2;
|
||||
|
||||
pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
|
||||
x1 = pextent->x1;
|
||||
y1 = pextent->y1;
|
||||
x2 = pextent->x2;
|
||||
y2 = pextent->y2;
|
||||
while (nrectFill--)
|
||||
{
|
||||
BoxRec box;
|
||||
|
||||
if ((box.x1 = prect->x) < x1)
|
||||
box.x1 = x1;
|
||||
|
||||
if ((box.y1 = prect->y) < y1)
|
||||
box.y1 = y1;
|
||||
|
||||
bx2 = (int) prect->x + (int) prect->width;
|
||||
if (bx2 > x2)
|
||||
bx2 = x2;
|
||||
box.x2 = bx2;
|
||||
|
||||
by2 = (int) prect->y + (int) prect->height;
|
||||
if (by2 > y2)
|
||||
by2 = y2;
|
||||
box.y2 = by2;
|
||||
|
||||
prect++;
|
||||
|
||||
if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
|
||||
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--)
|
||||
{
|
||||
pboxClipped->x1 = max(box.x1, pbox->x1);
|
||||
pboxClipped->y1 = max(box.y1, pbox->y1);
|
||||
pboxClipped->x2 = min(box.x2, pbox->x2);
|
||||
pboxClipped->y2 = min(box.y2, pbox->y2);
|
||||
pbox++;
|
||||
|
||||
/* see if clipping left anything */
|
||||
if(pboxClipped->x1 < pboxClipped->x2 &&
|
||||
pboxClipped->y1 < pboxClipped->y2)
|
||||
{
|
||||
pboxClipped++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pboxClipped != pboxClippedBase)
|
||||
(*pfn) (pDrawable,pboxClipped-pboxClippedBase, pboxClippedBase, alu, ppix);
|
||||
if (pboxClippedBase != stackRects)
|
||||
xfree(pboxClippedBase);
|
||||
}
|
||||
1029
mfb/mfbfillsp.c
1029
mfb/mfbfillsp.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,87 +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.
|
||||
|
||||
*/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "mfb.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "dixfontstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
/*ARGSUSED*/
|
||||
Bool
|
||||
mfbRealizeFont( pscr, pFont)
|
||||
ScreenPtr pscr;
|
||||
FontPtr pFont;
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
mfbRealizeFontProc *
|
||||
mfbRealizeFontWeak(void)
|
||||
{
|
||||
return mfbRealizeFont;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
Bool
|
||||
mfbUnrealizeFont( pscr, pFont)
|
||||
ScreenPtr pscr;
|
||||
FontPtr pFont;
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
mfbUnrealizeFontProc *
|
||||
mfbUnrealizeFontWeak(void)
|
||||
{
|
||||
return mfbUnrealizeFont;
|
||||
}
|
||||
1120
mfb/mfbgc.c
1120
mfb/mfbgc.c
File diff suppressed because it is too large
Load diff
157
mfb/mfbgetsp.c
157
mfb/mfbgetsp.c
|
|
@ -1,157 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
|
||||
#include "misc.h"
|
||||
#include "region.h"
|
||||
#include "gc.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
#include "servermd.h"
|
||||
|
||||
/* GetSpans -- for each span, gets bits from drawable starting at ppt[i]
|
||||
* and continuing for pwidth[i] bits
|
||||
* Each scanline returned will be server scanline padded, i.e., it will come
|
||||
* out to an integral number of words.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
|
||||
DrawablePtr pDrawable; /* drawable from which to get bits */
|
||||
int wMax; /* largest value of all *pwidths */
|
||||
register DDXPointPtr ppt; /* points to start copying from */
|
||||
int *pwidth; /* list of number of bits to copy */
|
||||
int nspans; /* number of scanlines to copy */
|
||||
char *pchardstStart; /* where to put the bits */
|
||||
{
|
||||
PixelType *pdstStart = (PixelType *)(pointer)pchardstStart;
|
||||
register PixelType *pdst; /* where to put the bits */
|
||||
register PixelType *psrc; /* where to get the bits */
|
||||
register PixelType tmpSrc; /* scratch buffer for bits */
|
||||
PixelType *psrcBase; /* start of src bitmap */
|
||||
int widthSrc; /* width of pixmap in bytes */
|
||||
register DDXPointPtr pptLast; /* one past last point to get */
|
||||
int xEnd; /* last pixel to copy from */
|
||||
register int nstart;
|
||||
int nend = 0;
|
||||
int srcStartOver;
|
||||
PixelType startmask, endmask;
|
||||
unsigned int srcBit;
|
||||
int nlMiddle, nl;
|
||||
int w;
|
||||
|
||||
pptLast = ppt + nspans;
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDrawable, widthSrc, psrcBase);
|
||||
pdst = pdstStart;
|
||||
|
||||
while(ppt < pptLast)
|
||||
{
|
||||
/* XXX should this really be << PWSH, or * 8, or * PGSZB? */
|
||||
xEnd = min(ppt->x + *pwidth, widthSrc << PWSH);
|
||||
pwidth++;
|
||||
psrc = mfbScanline(psrcBase, ppt->x, ppt->y, widthSrc);
|
||||
w = xEnd - ppt->x;
|
||||
srcBit = ppt->x & PIM;
|
||||
|
||||
if (srcBit + w <= PPW)
|
||||
{
|
||||
getandputbits0(psrc, srcBit, w, pdst);
|
||||
pdst++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
maskbits(ppt->x, w, startmask, endmask, nlMiddle);
|
||||
if (startmask)
|
||||
nstart = PPW - srcBit;
|
||||
else
|
||||
nstart = 0;
|
||||
if (endmask)
|
||||
nend = xEnd & PIM;
|
||||
srcStartOver = srcBit + nstart > PLST;
|
||||
if (startmask)
|
||||
{
|
||||
getandputbits0(psrc, srcBit, nstart, pdst);
|
||||
if(srcStartOver)
|
||||
psrc++;
|
||||
}
|
||||
nl = nlMiddle;
|
||||
#ifdef FASTPUTBITS
|
||||
Duff(nl, putbits(*psrc, nstart, PPW, pdst); psrc++; pdst++;);
|
||||
#else
|
||||
while (nl--)
|
||||
{
|
||||
tmpSrc = *psrc;
|
||||
putbits(tmpSrc, nstart, PPW, pdst);
|
||||
psrc++;
|
||||
pdst++;
|
||||
}
|
||||
#endif
|
||||
if (endmask)
|
||||
{
|
||||
putbits(*psrc, nstart, nend, pdst);
|
||||
if(nstart + nend > PPW)
|
||||
pdst++;
|
||||
}
|
||||
if (startmask || endmask)
|
||||
pdst++;
|
||||
}
|
||||
ppt++;
|
||||
}
|
||||
}
|
||||
177
mfb/mfbhrzvert.c
177
mfb/mfbhrzvert.c
|
|
@ -1,177 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
|
||||
#include "gc.h"
|
||||
#include "window.h"
|
||||
#include "pixmap.h"
|
||||
#include "region.h"
|
||||
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
/* horizontal solid line
|
||||
abs(len) > 1
|
||||
*/
|
||||
void
|
||||
mfbHorzS(rop, addrl, nlwidth, x1, y1, len)
|
||||
int rop; /* a reduced rasterop */
|
||||
register PixelType *addrl; /* pointer to base of bitmap */
|
||||
register int nlwidth; /* width in longwords of bitmap */
|
||||
int x1; /* initial point */
|
||||
int y1;
|
||||
int len; /* length of line */
|
||||
{
|
||||
register PixelType startmask;
|
||||
register PixelType endmask;
|
||||
register int nlmiddle;
|
||||
|
||||
|
||||
/* force the line to go left to right
|
||||
but don't draw the last point
|
||||
*/
|
||||
if (len < 0)
|
||||
{
|
||||
x1 += len;
|
||||
x1 += 1;
|
||||
len = -len;
|
||||
}
|
||||
|
||||
addrl = mfbScanline(addrl, x1, y1, nlwidth);
|
||||
|
||||
/* all bits inside same longword */
|
||||
if ( ((x1 & PIM) + len) < PPW)
|
||||
{
|
||||
maskpartialbits(x1, len, startmask);
|
||||
if (rop == RROP_BLACK)
|
||||
{
|
||||
*addrl &= ~startmask;
|
||||
}
|
||||
else if (rop == RROP_WHITE)
|
||||
{
|
||||
*addrl |= startmask;
|
||||
}
|
||||
else if (rop == RROP_INVERT)
|
||||
{
|
||||
*addrl ^= startmask;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
maskbits(x1, len, startmask, endmask, nlmiddle);
|
||||
if (rop == RROP_BLACK)
|
||||
{
|
||||
if (startmask)
|
||||
*addrl++ &= ~startmask;
|
||||
Duff (nlmiddle, *addrl++ = 0x0);
|
||||
if (endmask)
|
||||
*addrl &= ~endmask;
|
||||
}
|
||||
else if (rop == RROP_WHITE)
|
||||
{
|
||||
if (startmask)
|
||||
*addrl++ |= startmask;
|
||||
Duff (nlmiddle, *addrl++ = ~0);
|
||||
if (endmask)
|
||||
*addrl |= endmask;
|
||||
}
|
||||
else if (rop == RROP_INVERT)
|
||||
{
|
||||
if (startmask)
|
||||
*addrl++ ^= startmask;
|
||||
Duff (nlmiddle, *addrl++ ^= ~0);
|
||||
if (endmask)
|
||||
*addrl ^= endmask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* vertical solid line
|
||||
this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates
|
||||
better code. sigh. we know that len will never be 0 or 1, so
|
||||
it's OK to use it.
|
||||
*/
|
||||
|
||||
void
|
||||
mfbVertS(rop, addrl, nlwidth, x1, y1, len)
|
||||
int rop; /* a reduced rasterop */
|
||||
register PixelType *addrl; /* pointer to base of bitmap */
|
||||
register int nlwidth; /* width in longwords of bitmap */
|
||||
int x1, y1; /* initial point */
|
||||
register int len; /* length of line */
|
||||
{
|
||||
register PixelType bitmask;
|
||||
|
||||
addrl = mfbScanline(addrl, x1, y1, nlwidth);
|
||||
|
||||
if (len < 0)
|
||||
{
|
||||
nlwidth = -nlwidth;
|
||||
len = -len;
|
||||
}
|
||||
|
||||
if (rop == RROP_BLACK)
|
||||
{
|
||||
bitmask = rmask[x1 & PIM];
|
||||
Duff(len, *addrl &= bitmask; mfbScanlineInc(addrl, nlwidth) );
|
||||
}
|
||||
else if (rop == RROP_WHITE)
|
||||
{
|
||||
bitmask = mask[x1 & PIM];
|
||||
Duff(len, *addrl |= bitmask; mfbScanlineInc(addrl, nlwidth) );
|
||||
}
|
||||
else if (rop == RROP_INVERT)
|
||||
{
|
||||
bitmask = mask[x1 & PIM];
|
||||
Duff(len, *addrl ^= bitmask; mfbScanlineInc(addrl, nlwidth) );
|
||||
}
|
||||
}
|
||||
177
mfb/mfbimage.c
177
mfb/mfbimage.c
|
|
@ -1,177 +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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "gcstruct.h"
|
||||
|
||||
#include "mfb.h"
|
||||
#include "mi.h"
|
||||
#include <X11/Xmd.h>
|
||||
|
||||
#include "maskbits.h"
|
||||
|
||||
#include "servermd.h"
|
||||
|
||||
/* Put and Get images on a monochrome frame buffer
|
||||
*
|
||||
* we do this by creating a temporary pixmap and making its
|
||||
* pointer to bits point to the buffer read in from the client.
|
||||
* this works because of the padding rules specified at startup
|
||||
*
|
||||
* Note that CopyArea must know how to copy a bitmap into the server-format
|
||||
* temporary pixmap.
|
||||
*
|
||||
* For speed, mfbPutImage should allocate the temporary pixmap on the stack.
|
||||
*
|
||||
* even though an XYBitmap and an XYPixmap have the same
|
||||
* format (for this device), PutImage has different semantics for the
|
||||
* two. XYPixmap just does the copy; XYBitmap takes gc.fgPixel for
|
||||
* a 1 bit, gc.bgPixel for a 0 bit, which we notice is exactly
|
||||
* like CopyPlane.
|
||||
*
|
||||
* written by drewry, september 1986
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
mfbPutImage(dst, pGC, depth, x, y, w, h, leftPad, format, pImage)
|
||||
DrawablePtr dst;
|
||||
GCPtr pGC;
|
||||
int depth, x, y, w, h;
|
||||
int leftPad;
|
||||
int format;
|
||||
char *pImage;
|
||||
{
|
||||
PixmapPtr pPixmap;
|
||||
|
||||
if (!(pGC->planemask & 1))
|
||||
return;
|
||||
|
||||
/* 0 may confuse CreatePixmap, and will sometimes be
|
||||
passed by the mi text code
|
||||
*/
|
||||
if ((w == 0) || (h == 0))
|
||||
return;
|
||||
|
||||
pPixmap = GetScratchPixmapHeader(dst->pScreen, w+leftPad, h, 1, 1,
|
||||
BitmapBytePad(w+leftPad), (pointer)pImage);
|
||||
if (!pPixmap)
|
||||
return;
|
||||
|
||||
pGC->fExpose = FALSE;
|
||||
if (format != XYBitmap)
|
||||
(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, dst, pGC, leftPad, 0,
|
||||
w, h, x, y);
|
||||
else
|
||||
(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, dst, pGC, leftPad, 0,
|
||||
w, h, x, y, 1);
|
||||
pGC->fExpose = TRUE;
|
||||
FreeScratchPixmapHeader(pPixmap);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* pdstLine points to space allocated by caller, which he can do since
|
||||
* he knows dimensions of the pixmap
|
||||
* we can call mfbDoBitblt because the dispatcher has promised not to send us
|
||||
* anything that would require going over the edge of the screen.
|
||||
*
|
||||
* XYPixmap and ZPixmap are the same for mfb.
|
||||
* For any planemask with bit 0 == 0, just fill the dst with 0.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
mfbGetImage( pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
|
||||
DrawablePtr pDrawable;
|
||||
int sx, sy, w, h;
|
||||
unsigned int format;
|
||||
unsigned long planeMask;
|
||||
char *pdstLine;
|
||||
{
|
||||
BoxRec box;
|
||||
DDXPointRec ptSrc;
|
||||
RegionRec rgnDst;
|
||||
|
||||
if (planeMask & 0x1)
|
||||
{
|
||||
ScreenPtr pScreen = pDrawable->pScreen;
|
||||
PixmapPtr pPixmap;
|
||||
|
||||
pPixmap = GetScratchPixmapHeader(pScreen, w, h, /*depth*/ 1, /*bpp*/ 1,
|
||||
BitmapBytePad(w), (pointer)pdstLine);
|
||||
if (!pPixmap)
|
||||
return;
|
||||
|
||||
ptSrc.x = sx + pDrawable->x;
|
||||
ptSrc.y = sy + pDrawable->y;
|
||||
box.x1 = 0;
|
||||
box.y1 = 0;
|
||||
box.x2 = w;
|
||||
box.y2 = h;
|
||||
REGION_INIT(pScreen, &rgnDst, &box, 1);
|
||||
mfbDoBitblt(pDrawable, (DrawablePtr)pPixmap,
|
||||
GXcopy, &rgnDst, &ptSrc);
|
||||
REGION_UNINIT(pScreen, &rgnDst);
|
||||
FreeScratchPixmapHeader(pPixmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
bzero(pdstLine, BitmapBytePad(w) * h);
|
||||
}
|
||||
}
|
||||
444
mfb/mfbimggblt.c
444
mfb/mfbimggblt.c
|
|
@ -1,444 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "mfb.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "dixfontstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
/*
|
||||
we should eventually special-case fixed-width fonts for ImageText.
|
||||
|
||||
this works for fonts with glyphs <= 32 bits wide.
|
||||
|
||||
the clipping calculations are done for worst-case fonts.
|
||||
we make no assumptions about the heights, widths, or bearings
|
||||
of the glyphs. if we knew that the glyphs are all the same height,
|
||||
we could clip the tops and bottoms per clipping box, rather
|
||||
than per character per clipping box. if we knew that the glyphs'
|
||||
left and right bearings were wlle-behaved, we could clip a single
|
||||
character at the start, output until the last unclipped
|
||||
character, and then clip the last one. this is all straightforward
|
||||
to determine based on max-bounds and min-bounds from the font.
|
||||
there is some inefficiency introduced in the per-character
|
||||
clipping to make what's going on clearer.
|
||||
|
||||
(it is possible, for example, for a font to be defined in which the
|
||||
next-to-last character in a font would be clipped out, but the last
|
||||
one wouldn't. the code below deals with this.)
|
||||
|
||||
Image text looks at the bits in the glyph and the fg and bg in the
|
||||
GC. it paints a rectangle, as defined in the protocol dcoument,
|
||||
and the paints the characters.
|
||||
|
||||
to avoid source proliferation, this file is compiled
|
||||
three times:
|
||||
MFBIMAGEGLYPHBLT OPEQ
|
||||
mfbImageGlyphBltWhite |=
|
||||
mfbImageGlyphBltBlack &=~
|
||||
|
||||
the register allocations for startmask and endmask may not
|
||||
be the right thing. are there two other deserving candidates?
|
||||
xoff, pdst, pglyph, and tmpSrc seem like the right things, though.
|
||||
*/
|
||||
|
||||
void
|
||||
MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
|
||||
DrawablePtr pDrawable;
|
||||
GC *pGC;
|
||||
int x, y;
|
||||
unsigned int nglyph;
|
||||
CharInfoPtr *ppci; /* array of character info */
|
||||
pointer pglyphBase; /* start of array of glyphs */
|
||||
{
|
||||
ExtentInfoRec info; /* used by QueryGlyphExtents() */
|
||||
BoxRec bbox; /* string's bounding box */
|
||||
xRectangle backrect;/* backing rectangle to paint.
|
||||
in the general case, NOT necessarily
|
||||
the same as the string's bounding box
|
||||
*/
|
||||
|
||||
CharInfoPtr pci;
|
||||
int xorg, yorg; /* origin of drawable in bitmap */
|
||||
int widthDst; /* width of dst in longwords */
|
||||
|
||||
/* these keep track of the character origin */
|
||||
PixelType *pdstBase;
|
||||
/* points to longword with character origin */
|
||||
int xchar; /* xorigin of char (mod 32) */
|
||||
|
||||
/* these are used for placing the glyph */
|
||||
register int xoff; /* x offset of left edge of glyph (mod 32) */
|
||||
register PixelType *pdst;
|
||||
/* pointer to current longword in dst */
|
||||
|
||||
int w; /* width of glyph in bits */
|
||||
int h; /* height of glyph */
|
||||
int widthGlyph; /* width of glyph, in bytes */
|
||||
register unsigned char *pglyph;
|
||||
/* pointer to current row of glyph */
|
||||
|
||||
/* used for putting down glyph */
|
||||
register PixelType tmpSrc;
|
||||
/* for getting bits from glyph */
|
||||
register PixelType startmask;
|
||||
register PixelType endmask;
|
||||
|
||||
register int nFirst;/* bits of glyph in current longword */
|
||||
mfbPrivGC *pPrivGC;
|
||||
mfbFillAreaProcPtr oldFillArea;
|
||||
/* we might temporarily usurp this
|
||||
field in devPriv */
|
||||
|
||||
if (!(pGC->planemask & 1))
|
||||
return;
|
||||
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase);
|
||||
|
||||
QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
|
||||
|
||||
backrect.x = x;
|
||||
backrect.y = y - FONTASCENT(pGC->font);
|
||||
backrect.width = info.overallWidth;
|
||||
backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
|
||||
|
||||
x += xorg;
|
||||
y += yorg;
|
||||
|
||||
bbox.x1 = x + info.overallLeft;
|
||||
bbox.x2 = x + info.overallRight;
|
||||
bbox.y1 = y - info.overallAscent;
|
||||
bbox.y2 = y + info.overallDescent;
|
||||
|
||||
/* UNCLEAN CODE
|
||||
we know the mfbPolyFillRect uses only two fields in
|
||||
devPrivate[mfbGCPrivateIndex].ptr, one of which (ropFillArea) is
|
||||
irrelevant for solid filling, so we just poke the FillArea
|
||||
field. the GC is now in an inconsistent state, but we'll fix
|
||||
it as soon as PolyFillRect returns. fortunately, the server
|
||||
is single threaded.
|
||||
|
||||
NOTE:
|
||||
if you are not using the standard mfbFillRectangle code, you
|
||||
need to poke any fields in the GC the rectangle stuff need
|
||||
(probably alu, fgPixel, and fillStyle) and in devPrivate[mfbGCPrivateIndex].ptr
|
||||
(probably rop or ropFillArea.) You could just call ValidateGC,
|
||||
but that is usually not a cheap thing to do.
|
||||
*/
|
||||
|
||||
pPrivGC = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
mfbGetGCPrivateKey());
|
||||
oldFillArea = pPrivGC->FillArea;
|
||||
|
||||
if (pGC->bgPixel & 1)
|
||||
pPrivGC->FillArea = mfbSolidWhiteArea;
|
||||
else
|
||||
pPrivGC->FillArea = mfbSolidBlackArea;
|
||||
|
||||
mfbPolyFillRect(pDrawable, pGC, 1, &backrect);
|
||||
pPrivGC->FillArea = oldFillArea;
|
||||
|
||||
/* the faint-hearted can open their eyes now */
|
||||
switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
|
||||
{
|
||||
case rgnOUT:
|
||||
break;
|
||||
case rgnIN:
|
||||
pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
|
||||
xchar = x & PIM;
|
||||
|
||||
while(nglyph--)
|
||||
{
|
||||
pci = *ppci;
|
||||
pglyph = FONTGLYPHBITS(pglyphBase, pci);
|
||||
w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
|
||||
h = pci->metrics.ascent + pci->metrics.descent;
|
||||
widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
||||
|
||||
/* start at top scanline of glyph */
|
||||
pdst = pdstBase;
|
||||
|
||||
/* find correct word in scanline and x offset within it
|
||||
for left edge of glyph
|
||||
*/
|
||||
xoff = xchar + pci->metrics.leftSideBearing;
|
||||
if (xoff > PLST)
|
||||
{
|
||||
pdst++;
|
||||
xoff &= PIM;
|
||||
}
|
||||
else if (xoff < 0)
|
||||
{
|
||||
xoff += PPW;
|
||||
pdst--;
|
||||
}
|
||||
|
||||
pdst = mfbScanlineDelta(pdst, -pci->metrics.ascent, widthDst);
|
||||
|
||||
if ((xoff + w) <= PPW)
|
||||
{
|
||||
/* glyph all in one longword */
|
||||
maskpartialbits(xoff, w, startmask);
|
||||
while (h--)
|
||||
{
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
pglyph += widthGlyph;
|
||||
mfbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* glyph crosses longword boundary */
|
||||
maskPPWbits(xoff, w, startmask, endmask);
|
||||
nFirst = PPW - xoff;
|
||||
while (h--)
|
||||
{
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
*(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask);
|
||||
pglyph += widthGlyph;
|
||||
mfbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
} /* glyph crosses longwords boundary */
|
||||
|
||||
/* update character origin */
|
||||
x += pci->metrics.characterWidth;
|
||||
xchar += pci->metrics.characterWidth;
|
||||
if (xchar > PLST)
|
||||
{
|
||||
xchar -= PPW;
|
||||
pdstBase++;
|
||||
}
|
||||
else if (xchar < 0)
|
||||
{
|
||||
xchar += PPW;
|
||||
pdstBase--;
|
||||
}
|
||||
ppci++;
|
||||
} /* while nglyph-- */
|
||||
break;
|
||||
case rgnPART:
|
||||
{
|
||||
TEXTPOS *ppos;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
RegionPtr cclip;
|
||||
int xpos; /* x position of char origin */
|
||||
int i;
|
||||
BoxRec clip;
|
||||
int leftEdge, rightEdge;
|
||||
int topEdge, bottomEdge;
|
||||
int glyphRow; /* first row of glyph not wholly
|
||||
clipped out */
|
||||
int glyphCol; /* leftmost visible column of glyph */
|
||||
#if GETLEFTBITS_ALIGNMENT > 1
|
||||
int getWidth; /* bits to get from glyph */
|
||||
#endif
|
||||
|
||||
if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS))))
|
||||
return;
|
||||
|
||||
pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
|
||||
xpos = x;
|
||||
xchar = xpos & PIM;
|
||||
|
||||
for (i=0; i<nglyph; i++)
|
||||
{
|
||||
pci = ppci[i];
|
||||
|
||||
ppos[i].xpos = xpos;
|
||||
ppos[i].xchar = xchar;
|
||||
ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
|
||||
ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
|
||||
ppos[i].topEdge = y - pci->metrics.ascent;
|
||||
ppos[i].bottomEdge = y + pci->metrics.descent;
|
||||
ppos[i].pdstBase = pdstBase;
|
||||
ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
||||
|
||||
xpos += pci->metrics.characterWidth;
|
||||
xchar += pci->metrics.characterWidth;
|
||||
if (xchar > PLST)
|
||||
{
|
||||
xchar &= PIM;
|
||||
pdstBase++;
|
||||
}
|
||||
else if (xchar < 0)
|
||||
{
|
||||
xchar += PPW;
|
||||
pdstBase--;
|
||||
}
|
||||
}
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
pbox = REGION_RECTS(cclip);
|
||||
nbox = REGION_NUM_RECTS(cclip);
|
||||
|
||||
/* HACK ALERT
|
||||
since we continue out of the loop below so often, it
|
||||
is easier to increment pbox at the top than at the end.
|
||||
don't try this at home.
|
||||
*/
|
||||
pbox--;
|
||||
while(nbox--)
|
||||
{
|
||||
pbox++;
|
||||
clip.x1 = max(bbox.x1, pbox->x1);
|
||||
clip.y1 = max(bbox.y1, pbox->y1);
|
||||
clip.x2 = min(bbox.x2, pbox->x2);
|
||||
clip.y2 = min(bbox.y2, pbox->y2);
|
||||
if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
|
||||
continue;
|
||||
|
||||
for(i=0; i<nglyph; i++)
|
||||
{
|
||||
pci = ppci[i];
|
||||
xchar = ppos[i].xchar;
|
||||
|
||||
/* clip the left and right edges */
|
||||
if (ppos[i].leftEdge < clip.x1)
|
||||
leftEdge = clip.x1;
|
||||
else
|
||||
leftEdge = ppos[i].leftEdge;
|
||||
|
||||
if (ppos[i].rightEdge > clip.x2)
|
||||
rightEdge = clip.x2;
|
||||
else
|
||||
rightEdge = ppos[i].rightEdge;
|
||||
|
||||
w = rightEdge - leftEdge;
|
||||
if (w <= 0)
|
||||
continue;
|
||||
|
||||
/* clip the top and bottom edges */
|
||||
if (ppos[i].topEdge < clip.y1)
|
||||
topEdge = clip.y1;
|
||||
else
|
||||
topEdge = ppos[i].topEdge;
|
||||
|
||||
if (ppos[i].bottomEdge > clip.y2)
|
||||
bottomEdge = clip.y2;
|
||||
else
|
||||
bottomEdge = ppos[i].bottomEdge;
|
||||
|
||||
h = bottomEdge - topEdge;
|
||||
if (h <= 0)
|
||||
continue;
|
||||
|
||||
glyphRow = (topEdge - y) + pci->metrics.ascent;
|
||||
widthGlyph = ppos[i].widthGlyph;
|
||||
pglyph = FONTGLYPHBITS(pglyphBase, pci);
|
||||
pglyph += (glyphRow * widthGlyph);
|
||||
|
||||
pdst = ppos[i].pdstBase;
|
||||
|
||||
glyphCol = (leftEdge - ppos[i].xpos) -
|
||||
(pci->metrics.leftSideBearing);
|
||||
#if GETLEFTBITS_ALIGNMENT > 1
|
||||
getWidth = w + glyphCol;
|
||||
#endif
|
||||
xoff = xchar + (leftEdge - ppos[i].xpos);
|
||||
if (xoff > PLST)
|
||||
{
|
||||
xoff &= PIM;
|
||||
pdst++;
|
||||
}
|
||||
else if (xoff < 0)
|
||||
{
|
||||
xoff += PPW;
|
||||
pdst--;
|
||||
}
|
||||
|
||||
pdst = mfbScanlineDelta(pdst, -(y-topEdge), widthDst);
|
||||
|
||||
if ((xoff + w) <= PPW)
|
||||
{
|
||||
maskpartialbits(xoff, w, startmask);
|
||||
while (h--)
|
||||
{
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
pglyph += widthGlyph;
|
||||
mfbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
maskPPWbits(xoff, w, startmask, endmask);
|
||||
nFirst = PPW - xoff;
|
||||
while (h--)
|
||||
{
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
*(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask);
|
||||
pglyph += widthGlyph;
|
||||
mfbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
}
|
||||
} /* for each glyph */
|
||||
} /* while nbox-- */
|
||||
xfree(ppos);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
759
mfb/mfbline.c
759
mfb/mfbline.c
|
|
@ -1,759 +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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "mistruct.h"
|
||||
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "miline.h"
|
||||
|
||||
/* single-pixel lines on a color frame buffer
|
||||
|
||||
NON-SLOPED LINES
|
||||
horizontal lines are always drawn left to right; we have to
|
||||
move the endpoints right by one after they're swapped.
|
||||
horizontal lines will be confined to a single band of a
|
||||
region. the code finds that band (giving up if the lower
|
||||
bound of the band is above the line we're drawing); then it
|
||||
finds the first box in that band that contains part of the
|
||||
line. we clip the line to subsequent boxes in that band.
|
||||
vertical lines are always drawn top to bottom (y-increasing.)
|
||||
this requires adding one to the y-coordinate of each endpoint
|
||||
after swapping.
|
||||
|
||||
SLOPED LINES
|
||||
when clipping a sloped line, we bring the second point inside
|
||||
the clipping box, rather than one beyond it, and then add 1 to
|
||||
the length of the line before drawing it. this lets us use
|
||||
the same box for finding the outcodes for both endpoints. since
|
||||
the equation for clipping the second endpoint to an edge gives us
|
||||
1 beyond the edge, we then have to move the point towards the
|
||||
first point by one step on the major axis.
|
||||
eventually, there will be a diagram here to explain what's going
|
||||
on. the method uses Cohen-Sutherland outcodes to determine
|
||||
outsideness, and a method similar to Pike's layers for doing the
|
||||
actual clipping.
|
||||
|
||||
*/
|
||||
|
||||
void
|
||||
#ifdef POLYSEGMENT
|
||||
mfbSegmentSS (pDrawable, pGC, nseg, pSeg)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int nseg;
|
||||
register xSegment *pSeg;
|
||||
#else
|
||||
mfbLineSS (pDrawable, pGC, mode, npt, pptInit)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int mode; /* Origin or Previous */
|
||||
int npt; /* number of points */
|
||||
DDXPointPtr pptInit;
|
||||
#endif
|
||||
{
|
||||
int nboxInit;
|
||||
register int nbox;
|
||||
BoxPtr pboxInit;
|
||||
register BoxPtr pbox;
|
||||
#ifndef POLYSEGMENT
|
||||
register DDXPointPtr ppt; /* pointer to list of translated points */
|
||||
#endif
|
||||
|
||||
unsigned int oc1; /* outcode of point 1 */
|
||||
unsigned int oc2; /* outcode of point 2 */
|
||||
|
||||
PixelType *addrlBase; /* pointer to start of drawable */
|
||||
#ifndef POLYSEGMENT
|
||||
PixelType *addrl; /* address of destination pixmap */
|
||||
#endif
|
||||
int nlwidth; /* width in longwords of destination pixmap */
|
||||
int xorg, yorg; /* origin of window */
|
||||
|
||||
int adx; /* abs values of dx and dy */
|
||||
int ady;
|
||||
int signdx; /* sign of dx and dy */
|
||||
int signdy;
|
||||
int e, e1, e2; /* bresenham error and increments */
|
||||
int len; /* length of segment */
|
||||
int axis; /* major axis */
|
||||
int octant;
|
||||
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
|
||||
|
||||
/* a bunch of temporaries */
|
||||
register int y1, y2;
|
||||
register int x1, x2;
|
||||
RegionPtr cclip;
|
||||
int alu;
|
||||
|
||||
if (!(pGC->planemask & 1))
|
||||
return;
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
alu = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
mfbGetGCPrivateKey()))->rop;
|
||||
pboxInit = REGION_RECTS(cclip);
|
||||
nboxInit = REGION_NUM_RECTS(cclip);
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
|
||||
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
#ifdef POLYSEGMENT
|
||||
while (nseg--)
|
||||
#else
|
||||
ppt = pptInit;
|
||||
x2 = ppt->x + xorg;
|
||||
y2 = ppt->y + yorg;
|
||||
while(--npt)
|
||||
#endif
|
||||
{
|
||||
nbox = nboxInit;
|
||||
pbox = pboxInit;
|
||||
|
||||
#ifdef POLYSEGMENT
|
||||
x1 = pSeg->x1 + xorg;
|
||||
y1 = pSeg->y1 + yorg;
|
||||
x2 = pSeg->x2 + xorg;
|
||||
y2 = pSeg->y2 + yorg;
|
||||
pSeg++;
|
||||
#else
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
++ppt;
|
||||
if (mode == CoordModePrevious)
|
||||
{
|
||||
xorg = x1;
|
||||
yorg = y1;
|
||||
}
|
||||
x2 = ppt->x + xorg;
|
||||
y2 = ppt->y + yorg;
|
||||
#endif
|
||||
|
||||
if (x1 == x2) /* vertical line */
|
||||
{
|
||||
/* make the line go top to bottom of screen, keeping
|
||||
endpoint semantics
|
||||
*/
|
||||
if (y1 > y2)
|
||||
{
|
||||
register int tmp;
|
||||
|
||||
tmp = y2;
|
||||
y2 = y1 + 1;
|
||||
y1 = tmp + 1;
|
||||
#ifdef POLYSEGMENT
|
||||
if (pGC->capStyle != CapNotLast)
|
||||
y1--;
|
||||
#endif
|
||||
}
|
||||
#ifdef POLYSEGMENT
|
||||
else if (pGC->capStyle != CapNotLast)
|
||||
y2++;
|
||||
#endif
|
||||
/* get to first band that might contain part of line */
|
||||
while ((nbox) && (pbox->y2 <= y1))
|
||||
{
|
||||
pbox++;
|
||||
nbox--;
|
||||
}
|
||||
|
||||
if (nbox)
|
||||
{
|
||||
/* stop when lower edge of box is beyond end of line */
|
||||
while((nbox) && (y2 >= pbox->y1))
|
||||
{
|
||||
if ((x1 >= pbox->x1) && (x1 < pbox->x2))
|
||||
{
|
||||
int y1t, y2t;
|
||||
/* this box has part of the line in it */
|
||||
y1t = max(y1, pbox->y1);
|
||||
y2t = min(y2, pbox->y2);
|
||||
if (y1t != y2t)
|
||||
{
|
||||
mfbVertS (alu,
|
||||
addrlBase, nlwidth,
|
||||
x1, y1t, y2t-y1t);
|
||||
}
|
||||
}
|
||||
nbox--;
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
#ifndef POLYSEGMENT
|
||||
y2 = ppt->y + yorg;
|
||||
#endif
|
||||
}
|
||||
else if (y1 == y2) /* horizontal line */
|
||||
{
|
||||
/* force line from left to right, keeping
|
||||
endpoint semantics
|
||||
*/
|
||||
if (x1 > x2)
|
||||
{
|
||||
register int tmp;
|
||||
|
||||
tmp = x2;
|
||||
x2 = x1 + 1;
|
||||
x1 = tmp + 1;
|
||||
#ifdef POLYSEGMENT
|
||||
if (pGC->capStyle != CapNotLast)
|
||||
x1--;
|
||||
#endif
|
||||
}
|
||||
#ifdef POLYSEGMENT
|
||||
else if (pGC->capStyle != CapNotLast)
|
||||
x2++;
|
||||
#endif
|
||||
|
||||
/* find the correct band */
|
||||
while( (nbox) && (pbox->y2 <= y1))
|
||||
{
|
||||
pbox++;
|
||||
nbox--;
|
||||
}
|
||||
|
||||
/* try to draw the line, if we haven't gone beyond it */
|
||||
if ((nbox) && (pbox->y1 <= y1))
|
||||
{
|
||||
int tmp;
|
||||
|
||||
/* when we leave this band, we're done */
|
||||
tmp = pbox->y1;
|
||||
while((nbox) && (pbox->y1 == tmp))
|
||||
{
|
||||
int x1t, x2t;
|
||||
|
||||
if (pbox->x2 <= x1)
|
||||
{
|
||||
/* skip boxes until one might contain start point */
|
||||
nbox--;
|
||||
pbox++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* stop if left of box is beyond right of line */
|
||||
if (pbox->x1 >= x2)
|
||||
{
|
||||
nbox = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
x1t = max(x1, pbox->x1);
|
||||
x2t = min(x2, pbox->x2);
|
||||
if (x1t != x2t)
|
||||
{
|
||||
mfbHorzS (alu,
|
||||
addrlBase, nlwidth,
|
||||
x1t, y1, x2t-x1t);
|
||||
}
|
||||
nbox--;
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
#ifndef POLYSEGMENT
|
||||
x2 = ppt->x + xorg;
|
||||
#endif
|
||||
}
|
||||
else /* sloped line */
|
||||
{
|
||||
CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
|
||||
1, 1, octant);
|
||||
|
||||
if (adx > ady)
|
||||
{
|
||||
axis = X_AXIS;
|
||||
e1 = ady << 1;
|
||||
e2 = e1 - (adx << 1);
|
||||
e = e1 - adx;
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = Y_AXIS;
|
||||
e1 = adx << 1;
|
||||
e2 = e1 - (ady << 1);
|
||||
e = e1 - ady;
|
||||
SetYMajorOctant(octant);
|
||||
}
|
||||
|
||||
FIXUP_ERROR(e, octant, bias);
|
||||
|
||||
/* we have bresenham parameters and two points.
|
||||
all we have to do now is clip and draw.
|
||||
*/
|
||||
|
||||
while(nbox--)
|
||||
{
|
||||
oc1 = 0;
|
||||
oc2 = 0;
|
||||
OUTCODES(oc1, x1, y1, pbox);
|
||||
OUTCODES(oc2, x2, y2, pbox);
|
||||
if ((oc1 | oc2) == 0)
|
||||
{
|
||||
if (axis == X_AXIS)
|
||||
len = adx;
|
||||
else
|
||||
len = ady;
|
||||
#ifdef POLYSEGMENT
|
||||
if (pGC->capStyle != CapNotLast)
|
||||
len++;
|
||||
#endif
|
||||
mfbBresS (alu,
|
||||
addrlBase, nlwidth,
|
||||
signdx, signdy, axis, x1, y1,
|
||||
e, e1, e2, len);
|
||||
break;
|
||||
}
|
||||
else if (oc1 & oc2)
|
||||
{
|
||||
pbox++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
|
||||
int clip1 = 0, clip2 = 0;
|
||||
int clipdx, clipdy;
|
||||
int err;
|
||||
|
||||
if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
|
||||
pbox->y2-1,
|
||||
&new_x1, &new_y1, &new_x2, &new_y2,
|
||||
adx, ady, &clip1, &clip2,
|
||||
octant, bias, oc1, oc2) == -1)
|
||||
{
|
||||
pbox++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (axis == X_AXIS)
|
||||
len = abs(new_x2 - new_x1);
|
||||
else
|
||||
len = abs(new_y2 - new_y1);
|
||||
#ifdef POLYSEGMENT
|
||||
if (clip2 != 0 || pGC->capStyle != CapNotLast)
|
||||
len++;
|
||||
#else
|
||||
len += (clip2 != 0);
|
||||
#endif
|
||||
if (len)
|
||||
{
|
||||
/* unwind bresenham error term to first point */
|
||||
if (clip1)
|
||||
{
|
||||
clipdx = abs(new_x1 - x1);
|
||||
clipdy = abs(new_y1 - y1);
|
||||
if (axis == X_AXIS)
|
||||
err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
|
||||
else
|
||||
err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
|
||||
}
|
||||
else
|
||||
err = e;
|
||||
mfbBresS
|
||||
(alu,
|
||||
addrlBase, nlwidth,
|
||||
signdx, signdy, axis, new_x1, new_y1,
|
||||
err, e1, e2, len);
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
} /* while (nbox--) */
|
||||
} /* sloped line */
|
||||
} /* while (nline--) */
|
||||
|
||||
#ifndef POLYSEGMENT
|
||||
|
||||
/* paint the last point if the end style isn't CapNotLast.
|
||||
(Assume that a projecting, butt, or round cap that is one
|
||||
pixel wide is the same as the single pixel of the endpoint.)
|
||||
*/
|
||||
|
||||
if ((pGC->capStyle != CapNotLast) &&
|
||||
((ppt->x + xorg != pptInit->x + pDrawable->x) ||
|
||||
(ppt->y + yorg != pptInit->y + pDrawable->y) ||
|
||||
(ppt == pptInit + 1)))
|
||||
{
|
||||
PixelType _mask;
|
||||
|
||||
if (alu == RROP_BLACK)
|
||||
_mask = rmask[x2 & PIM];
|
||||
else
|
||||
_mask = mask[x2 & PIM];
|
||||
|
||||
nbox = nboxInit;
|
||||
pbox = pboxInit;
|
||||
while (nbox--)
|
||||
{
|
||||
if ((x2 >= pbox->x1) &&
|
||||
(y2 >= pbox->y1) &&
|
||||
(x2 < pbox->x2) &&
|
||||
(y2 < pbox->y2))
|
||||
{
|
||||
addrl = mfbScanline(addrlBase, x2, y2, nlwidth);
|
||||
switch(alu)
|
||||
{
|
||||
case RROP_BLACK:
|
||||
*addrl &= _mask;
|
||||
break;
|
||||
case RROP_WHITE:
|
||||
*addrl |= _mask;
|
||||
break;
|
||||
case RROP_INVERT:
|
||||
*addrl ^= _mask;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw dashed 1-pixel lines.
|
||||
*/
|
||||
|
||||
void
|
||||
#ifdef POLYSEGMENT
|
||||
mfbSegmentSD (pDrawable, pGC, nseg, pSeg)
|
||||
DrawablePtr pDrawable;
|
||||
register GCPtr pGC;
|
||||
int nseg;
|
||||
register xSegment *pSeg;
|
||||
#else
|
||||
mfbLineSD( pDrawable, pGC, mode, npt, pptInit)
|
||||
DrawablePtr pDrawable;
|
||||
register GCPtr pGC;
|
||||
int mode; /* Origin or Previous */
|
||||
int npt; /* number of points */
|
||||
DDXPointPtr pptInit;
|
||||
#endif
|
||||
{
|
||||
int nboxInit;
|
||||
register int nbox;
|
||||
BoxPtr pboxInit;
|
||||
register BoxPtr pbox;
|
||||
#ifndef POLYSEGMENT
|
||||
register DDXPointPtr ppt; /* pointer to list of translated points */
|
||||
#endif
|
||||
|
||||
register unsigned int oc1; /* outcode of point 1 */
|
||||
register unsigned int oc2; /* outcode of point 2 */
|
||||
|
||||
PixelType *addrl; /* address of destination pixmap */
|
||||
int nlwidth; /* width in longwords of destination pixmap */
|
||||
int xorg, yorg; /* origin of window */
|
||||
|
||||
int adx; /* abs values of dx and dy */
|
||||
int ady;
|
||||
int signdx; /* sign of dx and dy */
|
||||
int signdy;
|
||||
int e, e1, e2; /* bresenham error and increments */
|
||||
int len; /* length of segment */
|
||||
int axis; /* major axis */
|
||||
int octant;
|
||||
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
|
||||
int x1, x2, y1, y2;
|
||||
RegionPtr cclip;
|
||||
int fgrop = 0, bgrop = 0;
|
||||
unsigned char *pDash;
|
||||
int dashOffset;
|
||||
int numInDashList;
|
||||
int dashIndex;
|
||||
int isDoubleDash;
|
||||
int dashIndexTmp, dashOffsetTmp;
|
||||
int unclippedlen;
|
||||
|
||||
if (!(pGC->planemask & 1))
|
||||
return;
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
fgrop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
mfbGetGCPrivateKey()))->rop;
|
||||
pboxInit = REGION_RECTS(cclip);
|
||||
nboxInit = REGION_NUM_RECTS(cclip);
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl);
|
||||
|
||||
/* compute initial dash values */
|
||||
|
||||
pDash = (unsigned char *) pGC->dash;
|
||||
numInDashList = pGC->numInDashList;
|
||||
isDoubleDash = (pGC->lineStyle == LineDoubleDash);
|
||||
dashIndex = 0;
|
||||
dashOffset = 0;
|
||||
miStepDash ((int)pGC->dashOffset, &dashIndex, pDash,
|
||||
numInDashList, &dashOffset);
|
||||
|
||||
if (isDoubleDash)
|
||||
bgrop = mfbReduceRop(pGC->alu, pGC->bgPixel);
|
||||
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
#ifdef POLYSEGMENT
|
||||
while (nseg--)
|
||||
#else
|
||||
ppt = pptInit;
|
||||
x2 = ppt->x + xorg;
|
||||
y2 = ppt->y + yorg;
|
||||
while(--npt)
|
||||
#endif
|
||||
{
|
||||
nbox = nboxInit;
|
||||
pbox = pboxInit;
|
||||
|
||||
#ifdef POLYSEGMENT
|
||||
x1 = pSeg->x1 + xorg;
|
||||
y1 = pSeg->y1 + yorg;
|
||||
x2 = pSeg->x2 + xorg;
|
||||
y2 = pSeg->y2 + yorg;
|
||||
pSeg++;
|
||||
#else
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
++ppt;
|
||||
if (mode == CoordModePrevious)
|
||||
{
|
||||
xorg = x1;
|
||||
yorg = y1;
|
||||
}
|
||||
x2 = ppt->x + xorg;
|
||||
y2 = ppt->y + yorg;
|
||||
#endif
|
||||
|
||||
CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
|
||||
|
||||
if (adx > ady)
|
||||
{
|
||||
axis = X_AXIS;
|
||||
e1 = ady << 1;
|
||||
e2 = e1 - (adx << 1);
|
||||
e = e1 - adx;
|
||||
unclippedlen = adx;
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = Y_AXIS;
|
||||
e1 = adx << 1;
|
||||
e2 = e1 - (ady << 1);
|
||||
e = e1 - ady;
|
||||
unclippedlen = ady;
|
||||
SetYMajorOctant(octant);
|
||||
}
|
||||
|
||||
FIXUP_ERROR(e, octant, bias);
|
||||
|
||||
/* we have bresenham parameters and two points.
|
||||
all we have to do now is clip and draw.
|
||||
*/
|
||||
|
||||
while(nbox--)
|
||||
{
|
||||
oc1 = 0;
|
||||
oc2 = 0;
|
||||
OUTCODES(oc1, x1, y1, pbox);
|
||||
OUTCODES(oc2, x2, y2, pbox);
|
||||
if ((oc1 | oc2) == 0)
|
||||
{
|
||||
#ifdef POLYSEGMENT
|
||||
if (pGC->capStyle != CapNotLast)
|
||||
unclippedlen++;
|
||||
dashIndexTmp = dashIndex;
|
||||
dashOffsetTmp = dashOffset;
|
||||
mfbBresD (fgrop, bgrop,
|
||||
&dashIndexTmp, pDash, numInDashList,
|
||||
&dashOffsetTmp, isDoubleDash,
|
||||
addrl, nlwidth,
|
||||
signdx, signdy, axis, x1, y1,
|
||||
e, e1, e2, unclippedlen);
|
||||
break;
|
||||
#else
|
||||
mfbBresD (fgrop, bgrop,
|
||||
&dashIndex, pDash, numInDashList,
|
||||
&dashOffset, isDoubleDash,
|
||||
addrl, nlwidth,
|
||||
signdx, signdy, axis, x1, y1,
|
||||
e, e1, e2, unclippedlen);
|
||||
goto dontStep;
|
||||
#endif
|
||||
}
|
||||
else if (oc1 & oc2)
|
||||
{
|
||||
pbox++;
|
||||
}
|
||||
else /* have to clip */
|
||||
{
|
||||
int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
|
||||
int clip1 = 0, clip2 = 0;
|
||||
int clipdx, clipdy;
|
||||
int err;
|
||||
|
||||
if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, pbox->y2-1,
|
||||
&new_x1, &new_y1, &new_x2, &new_y2,
|
||||
adx, ady, &clip1, &clip2,
|
||||
octant, bias, oc1, oc2) == -1)
|
||||
{
|
||||
pbox++;
|
||||
continue;
|
||||
}
|
||||
dashIndexTmp = dashIndex;
|
||||
dashOffsetTmp = dashOffset;
|
||||
if (clip1)
|
||||
{
|
||||
int dlen;
|
||||
|
||||
if (axis == X_AXIS)
|
||||
dlen = abs(new_x1 - x1);
|
||||
else
|
||||
dlen = abs(new_y1 - y1);
|
||||
miStepDash (dlen, &dashIndexTmp, pDash,
|
||||
numInDashList, &dashOffsetTmp);
|
||||
}
|
||||
if (axis == X_AXIS)
|
||||
len = abs(new_x2 - new_x1);
|
||||
else
|
||||
len = abs(new_y2 - new_y1);
|
||||
#ifdef POLYSEGMENT
|
||||
if (clip2 != 0 || pGC->capStyle != CapNotLast)
|
||||
len++;
|
||||
#else
|
||||
len += (clip2 != 0);
|
||||
#endif
|
||||
if (len)
|
||||
{
|
||||
/* unwind bresenham error term to first point */
|
||||
if (clip1)
|
||||
{
|
||||
clipdx = abs(new_x1 - x1);
|
||||
clipdy = abs(new_y1 - y1);
|
||||
if (axis == X_AXIS)
|
||||
err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
|
||||
else
|
||||
err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
|
||||
}
|
||||
else
|
||||
err = e;
|
||||
mfbBresD (fgrop, bgrop,
|
||||
&dashIndexTmp, pDash, numInDashList,
|
||||
&dashOffsetTmp, isDoubleDash,
|
||||
addrl, nlwidth,
|
||||
signdx, signdy, axis, new_x1, new_y1,
|
||||
err, e1, e2, len);
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
} /* while (nbox--) */
|
||||
#ifndef POLYSEGMENT
|
||||
/*
|
||||
* walk the dash list around to the next line
|
||||
*/
|
||||
miStepDash (unclippedlen, &dashIndex, pDash,
|
||||
numInDashList, &dashOffset);
|
||||
dontStep: ;
|
||||
#endif
|
||||
} /* while (nline--) */
|
||||
|
||||
#ifndef POLYSEGMENT
|
||||
/* paint the last point if the end style isn't CapNotLast.
|
||||
(Assume that a projecting, butt, or round cap that is one
|
||||
pixel wide is the same as the single pixel of the endpoint.)
|
||||
*/
|
||||
|
||||
if ((pGC->capStyle != CapNotLast) &&
|
||||
((dashIndex & 1) == 0 || isDoubleDash) &&
|
||||
((ppt->x + xorg != pptInit->x + pDrawable->x) ||
|
||||
(ppt->y + yorg != pptInit->y + pDrawable->y) ||
|
||||
(ppt == pptInit + 1)))
|
||||
{
|
||||
nbox = nboxInit;
|
||||
pbox = pboxInit;
|
||||
while (nbox--)
|
||||
{
|
||||
if ((x2 >= pbox->x1) &&
|
||||
(y2 >= pbox->y1) &&
|
||||
(x2 < pbox->x2) &&
|
||||
(y2 < pbox->y2))
|
||||
{
|
||||
MfbBits _mask;
|
||||
int rop;
|
||||
|
||||
rop = fgrop;
|
||||
if (dashIndex & 1)
|
||||
rop = bgrop;
|
||||
if (rop == RROP_BLACK)
|
||||
_mask = rmask[x2 & PIM];
|
||||
else
|
||||
_mask = mask[x2 & PIM];
|
||||
addrl = mfbScanline(addrl, x2, y2, nlwidth);
|
||||
if (rop == RROP_BLACK)
|
||||
*addrl &= _mask;
|
||||
else if (rop == RROP_WHITE)
|
||||
*addrl |= _mask;
|
||||
else
|
||||
*addrl ^= _mask;
|
||||
break;
|
||||
}
|
||||
else
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,99 +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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "misc.h"
|
||||
#include "cursor.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "mfb.h"
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
mfbQueryBestSize(class, pwidth, pheight, pScreen)
|
||||
int class;
|
||||
unsigned short *pwidth;
|
||||
unsigned short *pheight;
|
||||
ScreenPtr pScreen;
|
||||
{
|
||||
unsigned width, test;
|
||||
|
||||
switch(class)
|
||||
{
|
||||
case CursorShape:
|
||||
if (*pwidth > pScreen->width)
|
||||
*pwidth = pScreen->width;
|
||||
if (*pheight > pScreen->height)
|
||||
*pheight = pScreen->height;
|
||||
break;
|
||||
case TileShape:
|
||||
case StippleShape:
|
||||
width = *pwidth;
|
||||
if (!width) break;
|
||||
/* Return the closes power of two not less than what they gave me */
|
||||
test = 0x80000000;
|
||||
/* Find the highest 1 bit in the width given */
|
||||
while(!(test & width))
|
||||
test >>= 1;
|
||||
/* If their number is greater than that, bump up to the next
|
||||
* power of two */
|
||||
if((test - 1) & width)
|
||||
test <<= 1;
|
||||
*pwidth = test;
|
||||
/* We don't care what height they use */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mfbQueryBestSizeProc *
|
||||
mfbQueryBestSizeWeak(void)
|
||||
{
|
||||
return mfbQueryBestSize;
|
||||
}
|
||||
298
mfb/mfbpixmap.c
298
mfb/mfbpixmap.c
|
|
@ -1,298 +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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
/* pixmap management
|
||||
written by drewry, september 1986
|
||||
|
||||
on a monchrome device, a pixmap is a bitmap.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/Xmd.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
#include "mfb.h"
|
||||
#include "mi.h"
|
||||
|
||||
#include "servermd.h"
|
||||
|
||||
|
||||
PixmapPtr
|
||||
mfbCreatePixmap (pScreen, width, height, depth, usage_hint)
|
||||
ScreenPtr pScreen;
|
||||
int width;
|
||||
int height;
|
||||
int depth;
|
||||
unsigned usage_hint;
|
||||
{
|
||||
PixmapPtr pPixmap;
|
||||
size_t datasize;
|
||||
size_t paddedWidth;
|
||||
|
||||
if (depth != 1)
|
||||
return NullPixmap;
|
||||
paddedWidth = BitmapBytePad(width);
|
||||
if (paddedWidth / 4 > 32767 || height > 32767)
|
||||
return NullPixmap;
|
||||
datasize = height * paddedWidth;
|
||||
pPixmap = AllocatePixmap(pScreen, datasize);
|
||||
if (!pPixmap)
|
||||
return NullPixmap;
|
||||
pPixmap->drawable.type = DRAWABLE_PIXMAP;
|
||||
pPixmap->drawable.class = 0;
|
||||
pPixmap->drawable.pScreen = pScreen;
|
||||
pPixmap->drawable.depth = depth;
|
||||
pPixmap->drawable.bitsPerPixel = depth;
|
||||
pPixmap->drawable.id = 0;
|
||||
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
pPixmap->drawable.x = 0;
|
||||
pPixmap->drawable.y = 0;
|
||||
pPixmap->drawable.width = width;
|
||||
pPixmap->drawable.height = height;
|
||||
pPixmap->devKind = paddedWidth;
|
||||
pPixmap->refcnt = 1;
|
||||
pPixmap->devPrivate.ptr = datasize ?
|
||||
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
|
||||
pPixmap->usage_hint = usage_hint;
|
||||
return pPixmap;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
mfbDestroyPixmap(pPixmap)
|
||||
PixmapPtr pPixmap;
|
||||
{
|
||||
if(--pPixmap->refcnt)
|
||||
return TRUE;
|
||||
dixFreePrivates(pPixmap->devPrivates);
|
||||
xfree(pPixmap);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
PixmapPtr
|
||||
mfbCopyPixmap(pSrc)
|
||||
register PixmapPtr pSrc;
|
||||
{
|
||||
register PixmapPtr pDst;
|
||||
int size;
|
||||
ScreenPtr pScreen;
|
||||
|
||||
size = pSrc->drawable.height * pSrc->devKind;
|
||||
pScreen = pSrc->drawable.pScreen;
|
||||
pDst = (*pScreen->CreatePixmap) (pScreen, pSrc->drawable.width,
|
||||
pSrc->drawable.height, pSrc->drawable.depth, 0);
|
||||
if (!pDst)
|
||||
return NullPixmap;
|
||||
memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size);
|
||||
return pDst;
|
||||
}
|
||||
|
||||
|
||||
/* replicates a pattern to be a full 32 bits wide.
|
||||
relies on the fact that each scnaline is longword padded.
|
||||
doesn't do anything if pixmap is not a factor of 32 wide.
|
||||
changes width field of pixmap if successful, so that the fast
|
||||
XRotatePixmap code gets used if we rotate the pixmap later.
|
||||
|
||||
calculate number of times to repeat
|
||||
for each scanline of pattern
|
||||
zero out area to be filled with replicate
|
||||
left shift and or in original as many times as needed
|
||||
*/
|
||||
void
|
||||
mfbPadPixmap(pPixmap)
|
||||
PixmapPtr pPixmap;
|
||||
{
|
||||
register int width = pPixmap->drawable.width;
|
||||
register int h;
|
||||
register PixelType mask;
|
||||
register PixelType *p;
|
||||
register PixelType bits; /* real pattern bits */
|
||||
register int i;
|
||||
int rep; /* repeat count for pattern */
|
||||
|
||||
if (width >= PPW)
|
||||
return;
|
||||
|
||||
rep = PPW/width;
|
||||
if (rep*width != PPW)
|
||||
return;
|
||||
|
||||
mask = endtab[width];
|
||||
|
||||
p = (PixelType *)(pPixmap->devPrivate.ptr);
|
||||
for (h=0; h < pPixmap->drawable.height; h++)
|
||||
{
|
||||
*p &= mask;
|
||||
bits = *p;
|
||||
for(i=1; i<rep; i++)
|
||||
{
|
||||
bits = SCRRIGHT(bits, width);
|
||||
*p |= bits;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
pPixmap->drawable.width = PPW;
|
||||
}
|
||||
|
||||
/* Rotates pixmap pPix by w pixels to the right on the screen. Assumes that
|
||||
* words are PPW bits wide, and that the least significant bit appears on the
|
||||
* left.
|
||||
*/
|
||||
void
|
||||
mfbXRotatePixmap(pPix, rw)
|
||||
PixmapPtr pPix;
|
||||
register int rw;
|
||||
{
|
||||
register PixelType *pw, *pwFinal;
|
||||
register PixelType t;
|
||||
|
||||
if (pPix == NullPixmap)
|
||||
return;
|
||||
|
||||
pw = (PixelType *)pPix->devPrivate.ptr;
|
||||
rw %= (int)pPix->drawable.width;
|
||||
if (rw < 0)
|
||||
rw += (int)pPix->drawable.width;
|
||||
if(pPix->drawable.width == PPW)
|
||||
{
|
||||
pwFinal = pw + pPix->drawable.height;
|
||||
while(pw < pwFinal)
|
||||
{
|
||||
t = *pw;
|
||||
*pw++ = SCRRIGHT(t, rw) |
|
||||
(SCRLEFT(t, (PPW-rw)) & endtab[rw]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We no longer do this. Validate doesn't try to rotate odd-size
|
||||
* tiles or stipples. mfbUnnatural<tile/stipple>FS works directly off
|
||||
* the unrotate tile/stipple in the GC
|
||||
*/
|
||||
ErrorF("X internal error: trying to rotate odd-sized pixmap.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Rotates pixmap pPix by h lines. Assumes that h is always less than
|
||||
pPix->height
|
||||
works on any width.
|
||||
*/
|
||||
void
|
||||
mfbYRotatePixmap(pPix, rh)
|
||||
register PixmapPtr pPix;
|
||||
int rh;
|
||||
{
|
||||
int nbyDown; /* bytes to move down to row 0; also offset of
|
||||
row rh */
|
||||
int nbyUp; /* bytes to move up to line rh; also
|
||||
offset of first line moved down to 0 */
|
||||
char *pbase;
|
||||
char *ptmp;
|
||||
int height;
|
||||
|
||||
if (pPix == NullPixmap)
|
||||
return;
|
||||
height = (int) pPix->drawable.height;
|
||||
rh %= height;
|
||||
if (rh < 0)
|
||||
rh += height;
|
||||
|
||||
pbase = (char *)pPix->devPrivate.ptr;
|
||||
|
||||
nbyDown = rh * pPix->devKind;
|
||||
nbyUp = (pPix->devKind * height) - nbyDown;
|
||||
if(!(ptmp = (char *)xalloc(nbyUp)))
|
||||
return;
|
||||
|
||||
memmove(ptmp, pbase, nbyUp); /* save the low rows */
|
||||
memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */
|
||||
memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rh */
|
||||
xfree(ptmp);
|
||||
}
|
||||
|
||||
void
|
||||
mfbCopyRotatePixmap(psrcPix, ppdstPix, xrot, yrot)
|
||||
register PixmapPtr psrcPix, *ppdstPix;
|
||||
int xrot, yrot;
|
||||
{
|
||||
register PixmapPtr pdstPix;
|
||||
|
||||
if ((pdstPix = *ppdstPix) &&
|
||||
(pdstPix->devKind == psrcPix->devKind) &&
|
||||
(pdstPix->drawable.height == psrcPix->drawable.height))
|
||||
{
|
||||
memmove((char *)pdstPix->devPrivate.ptr,
|
||||
(char *)psrcPix->devPrivate.ptr,
|
||||
psrcPix->drawable.height * psrcPix->devKind);
|
||||
pdstPix->drawable.width = psrcPix->drawable.width;
|
||||
pdstPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pdstPix)
|
||||
/* FIX XBUG 6168 */
|
||||
(*pdstPix->drawable.pScreen->DestroyPixmap)(pdstPix);
|
||||
*ppdstPix = pdstPix = mfbCopyPixmap(psrcPix);
|
||||
if (!pdstPix)
|
||||
return;
|
||||
}
|
||||
mfbPadPixmap(pdstPix);
|
||||
if (xrot)
|
||||
mfbXRotatePixmap(pdstPix, xrot);
|
||||
if (yrot)
|
||||
mfbYRotatePixmap(pdstPix, yrot);
|
||||
}
|
||||
261
mfb/mfbply1rct.c
261
mfb/mfbply1rct.c
|
|
@ -1,261 +0,0 @@
|
|||
/*
|
||||
*
|
||||
Copyright 1990, 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.
|
||||
*
|
||||
* Author: Keith Packard, MIT X Consortium
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "mistruct.h"
|
||||
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
#if defined(mips) || defined(sparc)
|
||||
#define GetHighWord(x) (((int) (x)) >> 16)
|
||||
#else
|
||||
#define GetHighWord(x) (((int) (x)) / 65536)
|
||||
#endif
|
||||
|
||||
#if IMAGE_BYTE_ORDER == MSBFirst
|
||||
#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i))))
|
||||
#define coordToInt(x,y) (((x) << 16) | ((y) & 0xffff))
|
||||
#define intToX(i) (GetHighWord(i))
|
||||
#define intToY(i) ((int) ((short) i))
|
||||
#else
|
||||
#define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i)))
|
||||
#define coordToInt(x,y) (((y) << 16) | ((x) & 0xffff))
|
||||
#define intToX(i) ((int) ((short) (i)))
|
||||
#define intToY(i) (GetHighWord(i))
|
||||
#endif
|
||||
|
||||
void
|
||||
MFBFILLPOLY1RECT (pDrawable, pGC, shape, mode, count, ptsIn)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int shape;
|
||||
int mode;
|
||||
int count;
|
||||
DDXPointPtr ptsIn;
|
||||
{
|
||||
int nlwidth;
|
||||
PixelType *addrl, *addr;
|
||||
int maxy;
|
||||
int origin;
|
||||
register int vertex1, vertex2;
|
||||
int c;
|
||||
BoxPtr extents;
|
||||
int clip;
|
||||
int y;
|
||||
int *vertex1p = NULL, *vertex2p;
|
||||
int *endp;
|
||||
int x1 = 0, x2 = 0;
|
||||
int dx1 = 0, dx2 = 0;
|
||||
int dy1 = 0, dy2 = 0;
|
||||
int e1 = 0, e2 = 0;
|
||||
int step1 = 0, step2 = 0;
|
||||
int sign1 = 0, sign2 = 0;
|
||||
int h;
|
||||
int l, r;
|
||||
PixelType mask, bits = ~((PixelType)0);
|
||||
int nmiddle;
|
||||
|
||||
if (mode == CoordModePrevious || shape != Convex ||
|
||||
REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
|
||||
{
|
||||
miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
|
||||
return;
|
||||
}
|
||||
origin = *((int *) &pDrawable->x);
|
||||
vertex2 = origin - ((origin & 0x8000) << 1);
|
||||
extents = &pGC->pCompositeClip->extents;
|
||||
vertex1 = *((int *) &extents->x1) - vertex2;
|
||||
vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001;
|
||||
clip = 0;
|
||||
y = 32767;
|
||||
maxy = 0;
|
||||
vertex2p = (int *) ptsIn;
|
||||
endp = vertex2p + count;
|
||||
while (count--)
|
||||
{
|
||||
c = *vertex2p;
|
||||
clip |= (c - vertex1) | (vertex2 - c);
|
||||
c = intToY(c);
|
||||
if (c < y)
|
||||
{
|
||||
y = c;
|
||||
vertex1p = vertex2p;
|
||||
}
|
||||
vertex2p++;
|
||||
if (c > maxy)
|
||||
maxy = c;
|
||||
}
|
||||
if (y == maxy)
|
||||
return;
|
||||
|
||||
if (clip & 0x80008000)
|
||||
{
|
||||
miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn);
|
||||
return;
|
||||
}
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl);
|
||||
addrl = mfbScanlineDelta(addrl, y + pDrawable->y, nlwidth);
|
||||
origin = intToX(origin);
|
||||
vertex2p = vertex1p;
|
||||
vertex2 = vertex1 = *vertex2p++;
|
||||
if (vertex2p == endp)
|
||||
vertex2p = (int *) ptsIn;
|
||||
#define Setup(c,x,vertex,dx,dy,e,sign,step) {\
|
||||
x = intToX(vertex); \
|
||||
if ((dy = intToY(c) - y)) { \
|
||||
dx = intToX(c) - x; \
|
||||
step = 0; \
|
||||
if (dx >= 0) \
|
||||
{ \
|
||||
e = 0; \
|
||||
sign = 1; \
|
||||
if (dx >= dy) {\
|
||||
step = dx / dy; \
|
||||
dx = dx % dy; \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
e = 1 - dy; \
|
||||
sign = -1; \
|
||||
dx = -dx; \
|
||||
if (dx >= dy) { \
|
||||
step = - (dx / dy); \
|
||||
dx = dx % dy; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
x += origin; \
|
||||
vertex = c; \
|
||||
}
|
||||
|
||||
#define Step(x,dx,dy,e,sign,step) {\
|
||||
x += step; \
|
||||
if ((e += dx) > 0) \
|
||||
{ \
|
||||
x += sign; \
|
||||
e -= dy; \
|
||||
} \
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
if (y == intToY(vertex1))
|
||||
{
|
||||
do
|
||||
{
|
||||
if (vertex1p == (int *) ptsIn)
|
||||
vertex1p = endp;
|
||||
c = *--vertex1p;
|
||||
Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1)
|
||||
} while (y >= intToY(vertex1));
|
||||
h = dy1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Step(x1,dx1,dy1,e1,sign1,step1)
|
||||
h = intToY(vertex1) - y;
|
||||
}
|
||||
if (y == intToY(vertex2))
|
||||
{
|
||||
do
|
||||
{
|
||||
c = *vertex2p++;
|
||||
if (vertex2p == endp)
|
||||
vertex2p = (int *) ptsIn;
|
||||
Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2)
|
||||
} while (y >= intToY(vertex2));
|
||||
if (dy2 < h)
|
||||
h = dy2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Step(x2,dx2,dy2,e2,sign2,step2)
|
||||
if ((c = (intToY(vertex2) - y)) < h)
|
||||
h = c;
|
||||
}
|
||||
/* fill spans for this segment */
|
||||
y += h;
|
||||
for (;;)
|
||||
{
|
||||
l = x1;
|
||||
r = x2;
|
||||
nmiddle = x2 - x1;
|
||||
if (nmiddle < 0)
|
||||
{
|
||||
nmiddle = -nmiddle;
|
||||
l = x2;
|
||||
r = x1;
|
||||
}
|
||||
c = l & PIM;
|
||||
l -= c;
|
||||
l = l >> PWSH;
|
||||
addr = addrl + l;
|
||||
if (c + nmiddle < PPW)
|
||||
{
|
||||
mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle);
|
||||
*addr OPEQ mask;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (c)
|
||||
{
|
||||
mask = SCRRIGHT(bits, c);
|
||||
*addr OPEQ mask;
|
||||
nmiddle += c - PPW;
|
||||
addr++;
|
||||
}
|
||||
nmiddle >>= PWSH;
|
||||
Duff (nmiddle, *addr++ EQWHOLEWORD)
|
||||
if ((mask = ~SCRRIGHT(bits, r & PIM)))
|
||||
*addr OPEQ mask;
|
||||
}
|
||||
if (!--h)
|
||||
break;
|
||||
mfbScanlineInc(addrl, nlwidth);
|
||||
Step(x1,dx1,dy1,e1,sign1,step1)
|
||||
Step(x2,dx2,dy2,e2,sign2,step2)
|
||||
}
|
||||
if (y == maxy)
|
||||
break;
|
||||
mfbScanlineInc(addrl, nlwidth);
|
||||
}
|
||||
}
|
||||
397
mfb/mfbplygblt.c
397
mfb/mfbplygblt.c
|
|
@ -1,397 +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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "mfb.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "dixfontstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "maskbits.h"
|
||||
#include "miscstruct.h"
|
||||
|
||||
/*
|
||||
we should eventually special-case fixed-width fonts, although
|
||||
its more important for ImageText, which is meant for terminal
|
||||
emulators.
|
||||
|
||||
this works for fonts with glyphs <= 32 bits wide.
|
||||
|
||||
the clipping calculations are done for worst-case fonts.
|
||||
we make no assumptions about the heights, widths, or bearings
|
||||
of the glyphs. if we knew that the glyphs are all the same height,
|
||||
we could clip the tops and bottoms per clipping box, rather
|
||||
than per character per clipping box. if we knew that the glyphs'
|
||||
left and right bearings were well-behaved, we could clip a single
|
||||
character at the start, output until the last unclipped
|
||||
character, and then clip the last one. this is all straightforward
|
||||
to determine based on max-bounds and min-bounds from the font.
|
||||
there is some inefficiency introduced in the per-character
|
||||
clipping to make what's going on clearer.
|
||||
|
||||
(it is possible, for example, for a font to be defined in which the
|
||||
next-to-last character in a font would be clipped out, but the last
|
||||
one wouldn't. the code below deals with this.)
|
||||
|
||||
PolyText looks at the fg color and the rasterop; mfbValidateGC
|
||||
swaps in the right routine after looking at the reduced ratserop
|
||||
in the private field of the GC.
|
||||
|
||||
the register allocations are provisional; in particualr startmask and
|
||||
endmask might not be the right things. pglyph, xoff, pdst, and tmpSrc
|
||||
are fairly obvious, though.
|
||||
|
||||
to avoid source proliferation, this file is compiled
|
||||
three times:
|
||||
MFBPOLYGLYPHBLT OPEQ
|
||||
mfbPolyGlyphBltWhite |=
|
||||
mfbPolyGlyphBltBlack &=~
|
||||
mfbPolyGlyphBltInvert ^=
|
||||
*/
|
||||
|
||||
void
|
||||
MFBPOLYGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int x, y;
|
||||
unsigned int nglyph;
|
||||
CharInfoPtr *ppci; /* array of character info */
|
||||
pointer pglyphBase; /* start of array of glyphs (unused in R5) */
|
||||
{
|
||||
ExtentInfoRec info; /* used by QueryGlyphExtents() */
|
||||
BoxRec bbox; /* string's bounding box */
|
||||
|
||||
CharInfoPtr pci;
|
||||
int xorg, yorg; /* origin of drawable in bitmap */
|
||||
int widthDst; /* width of dst in longwords */
|
||||
|
||||
/* these keep track of the character origin */
|
||||
PixelType *pdstBase;
|
||||
/* points to longword with character origin */
|
||||
int xchar; /* xorigin of char (mod 32) */
|
||||
|
||||
/* these are used for placing the glyph */
|
||||
register int xoff; /* x offset of left edge of glyph (mod 32) */
|
||||
register PixelType *pdst;
|
||||
/* pointer to current longword in dst */
|
||||
|
||||
int w; /* width of glyph in bits */
|
||||
int h; /* height of glyph */
|
||||
int widthGlyph; /* width of glyph, in bytes */
|
||||
register unsigned char *pglyph;
|
||||
/* pointer to current row of glyph */
|
||||
|
||||
/* used for putting down glyph */
|
||||
register PixelType tmpSrc;
|
||||
/* for getting bits from glyph */
|
||||
register PixelType startmask;
|
||||
register PixelType endmask;
|
||||
register int nFirst;/* bits of glyph in current longword */
|
||||
|
||||
if (!(pGC->planemask & 1))
|
||||
return;
|
||||
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase);
|
||||
|
||||
x += xorg;
|
||||
y += yorg;
|
||||
|
||||
QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
|
||||
bbox.x1 = x + info.overallLeft;
|
||||
bbox.x2 = x + info.overallRight;
|
||||
bbox.y1 = y - info.overallAscent;
|
||||
bbox.y2 = y + info.overallDescent;
|
||||
|
||||
switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
|
||||
{
|
||||
case rgnOUT:
|
||||
break;
|
||||
case rgnIN:
|
||||
pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
|
||||
xchar = x & PIM;
|
||||
|
||||
while(nglyph--)
|
||||
{
|
||||
pci = *ppci;
|
||||
pglyph = FONTGLYPHBITS(pglyphBase, pci);
|
||||
w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
|
||||
h = pci->metrics.ascent + pci->metrics.descent;
|
||||
widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
||||
|
||||
/* start at top scanline of glyph */
|
||||
pdst = pdstBase;
|
||||
|
||||
/* find correct word in scanline and x offset within it
|
||||
for left edge of glyph
|
||||
*/
|
||||
xoff = xchar + pci->metrics.leftSideBearing;
|
||||
if (xoff > PLST)
|
||||
{
|
||||
pdst++;
|
||||
xoff &= PIM;
|
||||
}
|
||||
else if (xoff < 0)
|
||||
{
|
||||
xoff += PPW;
|
||||
pdst--;
|
||||
}
|
||||
|
||||
pdst = mfbScanlineDelta(pdst, -pci->metrics.ascent, widthDst);
|
||||
|
||||
if ((xoff + w) <= PPW)
|
||||
{
|
||||
/* glyph all in one longword */
|
||||
maskpartialbits(xoff, w, startmask);
|
||||
while (h--)
|
||||
{
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
pglyph += widthGlyph;
|
||||
mfbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* glyph crosses longword boundary */
|
||||
maskPPWbits(xoff, w, startmask, endmask);
|
||||
nFirst = PPW - xoff;
|
||||
while (h--)
|
||||
{
|
||||
getleftbits(pglyph, w, tmpSrc);
|
||||
*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
*(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask);
|
||||
pglyph += widthGlyph;
|
||||
mfbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
} /* glyph crosses longwords boundary */
|
||||
|
||||
/* update character origin */
|
||||
x += pci->metrics.characterWidth;
|
||||
xchar += pci->metrics.characterWidth;
|
||||
if (xchar > PLST)
|
||||
{
|
||||
xchar -= PPW;
|
||||
pdstBase++;
|
||||
}
|
||||
else if (xchar < 0)
|
||||
{
|
||||
xchar += PPW;
|
||||
pdstBase--;
|
||||
}
|
||||
ppci++;
|
||||
} /* while nglyph-- */
|
||||
break;
|
||||
case rgnPART:
|
||||
{
|
||||
TEXTPOS *ppos;
|
||||
RegionPtr cclip;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
int xpos; /* x position of char origin */
|
||||
int i;
|
||||
BoxRec clip;
|
||||
int leftEdge, rightEdge;
|
||||
int topEdge, bottomEdge;
|
||||
int glyphRow; /* first row of glyph not wholly
|
||||
clipped out */
|
||||
int glyphCol; /* leftmost visible column of glyph */
|
||||
#if GETLEFTBITS_ALIGNMENT > 1
|
||||
int getWidth; /* bits to get from glyph */
|
||||
#endif
|
||||
|
||||
if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS))))
|
||||
return;
|
||||
|
||||
pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
|
||||
xpos = x;
|
||||
xchar = xpos & PIM;
|
||||
|
||||
for (i=0; i<nglyph; i++)
|
||||
{
|
||||
pci = ppci[i];
|
||||
|
||||
ppos[i].xpos = xpos;
|
||||
ppos[i].xchar = xchar;
|
||||
ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
|
||||
ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
|
||||
ppos[i].topEdge = y - pci->metrics.ascent;
|
||||
ppos[i].bottomEdge = y + pci->metrics.descent;
|
||||
ppos[i].pdstBase = pdstBase;
|
||||
ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
||||
|
||||
xpos += pci->metrics.characterWidth;
|
||||
xchar += pci->metrics.characterWidth;
|
||||
if (xchar > PLST)
|
||||
{
|
||||
xchar &= PIM;
|
||||
pdstBase++;
|
||||
}
|
||||
else if (xchar < 0)
|
||||
{
|
||||
xchar += PPW;
|
||||
pdstBase--;
|
||||
}
|
||||
}
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
pbox = REGION_RECTS(cclip);
|
||||
nbox = REGION_NUM_RECTS(cclip);
|
||||
|
||||
for (; --nbox >= 0; pbox++)
|
||||
{
|
||||
clip.x1 = max(bbox.x1, pbox->x1);
|
||||
clip.y1 = max(bbox.y1, pbox->y1);
|
||||
clip.x2 = min(bbox.x2, pbox->x2);
|
||||
clip.y2 = min(bbox.y2, pbox->y2);
|
||||
if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
|
||||
continue;
|
||||
|
||||
for(i=0; i<nglyph; i++)
|
||||
{
|
||||
pci = ppci[i];
|
||||
xchar = ppos[i].xchar;
|
||||
|
||||
/* clip the left and right edges */
|
||||
if (ppos[i].leftEdge < clip.x1)
|
||||
leftEdge = clip.x1;
|
||||
else
|
||||
leftEdge = ppos[i].leftEdge;
|
||||
|
||||
if (ppos[i].rightEdge > clip.x2)
|
||||
rightEdge = clip.x2;
|
||||
else
|
||||
rightEdge = ppos[i].rightEdge;
|
||||
|
||||
w = rightEdge - leftEdge;
|
||||
if (w <= 0)
|
||||
continue;
|
||||
|
||||
/* clip the top and bottom edges */
|
||||
if (ppos[i].topEdge < clip.y1)
|
||||
topEdge = clip.y1;
|
||||
else
|
||||
topEdge = ppos[i].topEdge;
|
||||
|
||||
if (ppos[i].bottomEdge > clip.y2)
|
||||
bottomEdge = clip.y2;
|
||||
else
|
||||
bottomEdge = ppos[i].bottomEdge;
|
||||
|
||||
h = bottomEdge - topEdge;
|
||||
if (h <= 0)
|
||||
continue;
|
||||
|
||||
glyphRow = (topEdge - y) + pci->metrics.ascent;
|
||||
widthGlyph = ppos[i].widthGlyph;
|
||||
pglyph = FONTGLYPHBITS(pglyphBase, pci);
|
||||
pglyph += (glyphRow * widthGlyph);
|
||||
|
||||
pdst = ppos[i].pdstBase;
|
||||
|
||||
glyphCol = (leftEdge - ppos[i].xpos) -
|
||||
(pci->metrics.leftSideBearing);
|
||||
#if GETLEFTBITS_ALIGNMENT > 1
|
||||
getWidth = w + glyphCol;
|
||||
#endif
|
||||
xoff = xchar + (leftEdge - ppos[i].xpos);
|
||||
if (xoff > PLST)
|
||||
{
|
||||
xoff &= PIM;
|
||||
pdst++;
|
||||
}
|
||||
else if (xoff < 0)
|
||||
{
|
||||
xoff += PPW;
|
||||
pdst--;
|
||||
}
|
||||
|
||||
pdst = mfbScanlineDelta(pdst, -(y-topEdge), widthDst);
|
||||
|
||||
if ((xoff + w) <= PPW)
|
||||
{
|
||||
maskpartialbits(xoff, w, startmask);
|
||||
while (h--)
|
||||
{
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
pglyph += widthGlyph;
|
||||
mfbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
maskPPWbits(xoff, w, startmask, endmask);
|
||||
nFirst = PPW - xoff;
|
||||
while (h--)
|
||||
{
|
||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
||||
*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
|
||||
*(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask);
|
||||
pglyph += widthGlyph;
|
||||
mfbScanlineInc(pdst, widthDst);
|
||||
}
|
||||
}
|
||||
} /* for each glyph */
|
||||
} /* while nbox-- */
|
||||
xfree(ppos);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
299
mfb/mfbpntarea.c
299
mfb/mfbpntarea.c
|
|
@ -1,299 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
|
||||
#include "windowstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
/*
|
||||
the solid fillers are called for rectangles and window backgrounds.
|
||||
the boxes are already translated.
|
||||
maybe this should always take a pixmap instead of a drawable?
|
||||
|
||||
NOTE:
|
||||
iy = ++iy < tileHeight ? iy : 0
|
||||
is equivalent to iy%= tileheight, and saves a division.
|
||||
*/
|
||||
|
||||
/*
|
||||
MFBSOLIDFILLAREA OPEQ EQWHOLEOWRD
|
||||
mfbSolidWhiteArea |= = ~0
|
||||
mfbSolidBlackArea &=~ = 0
|
||||
mfbSolidInvertArea ^= ^= ~0
|
||||
|
||||
EQWHOLEWORD is used to write whole longwords. it could use OPEQ,
|
||||
but *p++ |= ~0 on at least two compilers generates much
|
||||
worse code than *p++ = ~0. similarly for *p++ &= ~~0
|
||||
and *p++ = 0.
|
||||
|
||||
*/
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
MFBSOLIDFILLAREA(pDraw, nbox, pbox, alu, nop)
|
||||
DrawablePtr pDraw;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
int alu;
|
||||
PixmapPtr nop;
|
||||
{
|
||||
int nlwidth; /* width in longwords of the drawable */
|
||||
int w; /* width of current box */
|
||||
register int h; /* height of current box */
|
||||
register PixelType *p; /* pointer to bits we're writing */
|
||||
register int nlw; /* loop version of nlwMiddle */
|
||||
register PixelType startmask;
|
||||
register PixelType endmask;/* masks for reggedy bits at either end of line */
|
||||
register int nlwExtra;
|
||||
/* to get from right of box to left of next span */
|
||||
int nlwMiddle; /* number of longwords between sides of boxes */
|
||||
PixelType *pbits; /* pointer to start of drawable */
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDraw, nlwidth, pbits);
|
||||
|
||||
while (nbox--)
|
||||
{
|
||||
w = pbox->x2 - pbox->x1;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
p = mfbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
|
||||
|
||||
if ( ((pbox->x1 & PIM) + w) < PPW)
|
||||
{
|
||||
maskpartialbits(pbox->x1, w, startmask);
|
||||
nlwExtra = nlwidth;
|
||||
Duff(h, *p OPEQ startmask; mfbScanlineInc(p, nlwExtra));
|
||||
}
|
||||
else
|
||||
{
|
||||
maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
|
||||
nlwExtra = nlwidth - nlwMiddle;
|
||||
|
||||
if (startmask && endmask)
|
||||
{
|
||||
nlwExtra -= 1;
|
||||
while (h--)
|
||||
{
|
||||
nlw = nlwMiddle;
|
||||
*p OPEQ startmask;
|
||||
p++;
|
||||
Duff(nlw, *p++ EQWHOLEWORD);
|
||||
*p OPEQ endmask;
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
else if (startmask && !endmask)
|
||||
{
|
||||
nlwExtra -= 1;
|
||||
while (h--)
|
||||
{
|
||||
nlw = nlwMiddle;
|
||||
*p OPEQ startmask;
|
||||
p++;
|
||||
Duff(nlw, *p++ EQWHOLEWORD);
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
else if (!startmask && endmask)
|
||||
{
|
||||
while (h--)
|
||||
{
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ EQWHOLEWORD);
|
||||
*p OPEQ endmask;
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
else /* no ragged bits at either end */
|
||||
{
|
||||
while (h--)
|
||||
{
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ EQWHOLEWORD);
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* stipple a list of boxes
|
||||
|
||||
you can use the reduced rasterop for stipples. if rrop is
|
||||
black, AND the destination with (not stipple pattern). if rrop is
|
||||
white OR the destination with the stipple pattern. if rrop is invert,
|
||||
XOR the destination with the stipple pattern.
|
||||
|
||||
MFBSTIPPLEFILLAREA OPEQ
|
||||
mfbStippleWhiteArea |=
|
||||
mfbStippleBlackArea &=~
|
||||
mfbStippleInveryArea ^=
|
||||
*/
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
MFBSTIPPLEFILLAREA(pDraw, nbox, pbox, alu, pstipple)
|
||||
DrawablePtr pDraw;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
int alu;
|
||||
PixmapPtr pstipple;
|
||||
{
|
||||
register PixelType *psrc;
|
||||
/* pointer to bits in tile, if needed */
|
||||
int tileHeight; /* height of the tile */
|
||||
register PixelType srcpix;
|
||||
|
||||
int nlwidth; /* width in longwords of the drawable */
|
||||
int w; /* width of current box */
|
||||
register int nlw; /* loop version of nlwMiddle */
|
||||
register PixelType *p; /* pointer to bits we're writing */
|
||||
register int h; /* height of current box */
|
||||
PixelType startmask;
|
||||
PixelType endmask; /* masks for reggedy bits at either end of line */
|
||||
int nlwMiddle; /* number of longwords between sides of boxes */
|
||||
int nlwExtra; /* to get from right of box to left of next span */
|
||||
register int iy; /* index of current scanline in tile */
|
||||
PixelType *pbits; /* pointer to start of drawable */
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDraw, nlwidth, pbits);
|
||||
|
||||
tileHeight = pstipple->drawable.height;
|
||||
psrc = (PixelType *)(pstipple->devPrivate.ptr);
|
||||
|
||||
while (nbox--)
|
||||
{
|
||||
w = pbox->x2 - pbox->x1;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
iy = pbox->y1 % tileHeight;
|
||||
p = mfbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
|
||||
|
||||
if ( ((pbox->x1 & PIM) + w) < PPW)
|
||||
{
|
||||
maskpartialbits(pbox->x1, w, startmask);
|
||||
nlwExtra = nlwidth;
|
||||
while (h--)
|
||||
{
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
*p OPEQ (srcpix & startmask);
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
|
||||
nlwExtra = nlwidth - nlwMiddle;
|
||||
|
||||
if (startmask && endmask)
|
||||
{
|
||||
nlwExtra -= 1;
|
||||
while (h--)
|
||||
{
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
*p OPEQ (srcpix & startmask);
|
||||
p++;
|
||||
Duff (nlw, *p++ OPEQ srcpix);
|
||||
*p OPEQ (srcpix & endmask);
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
else if (startmask && !endmask)
|
||||
{
|
||||
nlwExtra -= 1;
|
||||
while (h--)
|
||||
{
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
*p OPEQ (srcpix & startmask);
|
||||
p++;
|
||||
Duff(nlw, *p++ OPEQ srcpix);
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
else if (!startmask && endmask)
|
||||
{
|
||||
while (h--)
|
||||
{
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ OPEQ srcpix);
|
||||
*p OPEQ (srcpix & endmask);
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
else /* no ragged bits at either end */
|
||||
{
|
||||
while (h--)
|
||||
{
|
||||
srcpix = psrc[iy];
|
||||
iy = ++iy < tileHeight ? iy : 0;
|
||||
nlw = nlwMiddle;
|
||||
Duff(nlw, *p++ OPEQ srcpix);
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
144
mfb/mfbpolypnt.c
144
mfb/mfbpolypnt.c
|
|
@ -1,144 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xprotostr.h>
|
||||
#include "pixmapstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "miscstruct.h"
|
||||
#include "regionstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
void
|
||||
mfbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
|
||||
register DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
int mode; /* Origin or Previous */
|
||||
int npt;
|
||||
xPoint *pptInit;
|
||||
{
|
||||
|
||||
register BoxPtr pbox;
|
||||
register int nbox;
|
||||
|
||||
register PixelType *addrl;
|
||||
int nlwidth;
|
||||
|
||||
int nptTmp;
|
||||
register xPoint *ppt;
|
||||
|
||||
register int x;
|
||||
register int y;
|
||||
register int rop;
|
||||
mfbPrivGC *pGCPriv;
|
||||
|
||||
if (!(pGC->planemask & 1))
|
||||
return;
|
||||
|
||||
pGCPriv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
mfbGetGCPrivateKey());
|
||||
rop = pGCPriv->rop;
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl);
|
||||
|
||||
if ((mode == CoordModePrevious) && (npt > 1))
|
||||
{
|
||||
for (ppt = pptInit + 1, nptTmp = npt - 1; --nptTmp >= 0; ppt++)
|
||||
{
|
||||
ppt->x += (ppt-1)->x;
|
||||
ppt->y += (ppt-1)->y;
|
||||
}
|
||||
}
|
||||
|
||||
nbox = REGION_NUM_RECTS(pGC->pCompositeClip);
|
||||
pbox = REGION_RECTS(pGC->pCompositeClip);
|
||||
for (; --nbox >= 0; pbox++)
|
||||
{
|
||||
if (rop == RROP_BLACK)
|
||||
{
|
||||
for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++)
|
||||
{
|
||||
x = ppt->x + pDrawable->x;
|
||||
y = ppt->y + pDrawable->y;
|
||||
if ((x >= pbox->x1) && (x < pbox->x2) &&
|
||||
(y >= pbox->y1) && (y < pbox->y2))
|
||||
*mfbScanline(addrl, x, y, nlwidth) &= rmask[x & PIM];
|
||||
}
|
||||
}
|
||||
else if (rop == RROP_WHITE)
|
||||
{
|
||||
for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++)
|
||||
{
|
||||
x = ppt->x + pDrawable->x;
|
||||
y = ppt->y + pDrawable->y;
|
||||
if ((x >= pbox->x1) && (x < pbox->x2) &&
|
||||
(y >= pbox->y1) && (y < pbox->y2))
|
||||
*mfbScanline(addrl, x, y, nlwidth) |= mask[x & PIM];
|
||||
}
|
||||
}
|
||||
else if (rop == RROP_INVERT)
|
||||
{
|
||||
for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++)
|
||||
{
|
||||
x = ppt->x + pDrawable->x;
|
||||
y = ppt->y + pDrawable->y;
|
||||
if ((x >= pbox->x1) && (x < pbox->x2) &&
|
||||
(y >= pbox->y1) && (y < pbox->y2))
|
||||
*mfbScanline(addrl, x, y, nlwidth) ^= mask[x & PIM];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
287
mfb/mfbpushpxl.c
287
mfb/mfbpushpxl.c
|
|
@ -1,287 +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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "gcstruct.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "miscstruct.h"
|
||||
#include "maskbits.h"
|
||||
#include "regionstr.h"
|
||||
#include "mfb.h"
|
||||
|
||||
/* mfbSolidPP is courtesy of xhacks@csri.toronto.edu
|
||||
|
||||
For fillStyle==FillSolid, a monochrome PushPixels can be reduced to
|
||||
a ROP in the following way: (Note that the ROP is the same as the
|
||||
result of ROP(src=0x3,dst=0x5))
|
||||
|
||||
src=0011 0000 0011
|
||||
dst=0101 0101 0101
|
||||
rop fg=0 fg=1
|
||||
GXclear 0x0 0000 0100 0100 0
|
||||
GXand 0x1 0001 0100 0101 s&d
|
||||
GXandReverse 0x2 0010 0100 0110 s&~d
|
||||
GXcopy 0x3 0011 0100 0111 s
|
||||
GXandInverted 0x4 0100 0101 0100 ~s&d
|
||||
GXnoop 0x5 0101 0101 0101 d
|
||||
GXxor 0x6 0110 0101 0110 s^d
|
||||
GXor 0x7 0111 0101 0111 s|d
|
||||
GXnor 0x8 1000 0110 0100 ~s&~d
|
||||
GXequiv 0x9 1001 0110 0101 ~s^d
|
||||
GXinvert 0xa 1010 0110 0110 ~d
|
||||
GXorReverse 0xb 1011 0110 0111 s|~d
|
||||
GXcopyInverted 0xc 1100 0111 0100 ~s
|
||||
GXorInverted 0xd 1101 0111 0101 ~s|d
|
||||
GXnand 0xe 1110 0111 0110 ~s|~d
|
||||
GXset 0xf 1111 0111 0111 1
|
||||
|
||||
For src=0: newRop = 0x4|(rop>>2)
|
||||
For src=1: newRop = 0x4|(rop&3)
|
||||
*/
|
||||
|
||||
/* mfbSolidPP -- squeegees the forground color of pGC through pBitMap
|
||||
* into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may
|
||||
* be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit
|
||||
* is set in the bitmap, the fill style is put onto the drawable using
|
||||
* the GC's logical function. The drawable is not changed where the bitmap
|
||||
* has a zero bit or outside the area covered by the stencil.
|
||||
*/
|
||||
void
|
||||
mfbSolidPP(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
|
||||
GCPtr pGC;
|
||||
PixmapPtr pBitMap;
|
||||
DrawablePtr pDrawable;
|
||||
int dx, dy, xOrg, yOrg;
|
||||
{
|
||||
unsigned char alu;
|
||||
RegionRec rgnDst;
|
||||
DDXPointPtr pptSrc;
|
||||
BoxRec srcBox;
|
||||
register DDXPointPtr ppt;
|
||||
register BoxPtr pbox;
|
||||
int i;
|
||||
|
||||
if (!(pGC->planemask & 1)) return;
|
||||
|
||||
/* compute the reduced rop function */
|
||||
alu = pGC->alu;
|
||||
if (!(pGC->fgPixel&1)) alu >>= 2;
|
||||
alu = (alu & 0x3) | 0x4;
|
||||
if (alu == GXnoop) return;
|
||||
|
||||
srcBox.x1 = xOrg;
|
||||
srcBox.y1 = yOrg;
|
||||
srcBox.x2 = xOrg + dx;
|
||||
srcBox.y2 = yOrg + dy;
|
||||
REGION_INIT(pGC->pScreen, &rgnDst, &srcBox, 1);
|
||||
|
||||
/* clip the shape of the dst to the destination composite clip */
|
||||
REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip);
|
||||
|
||||
if (!REGION_NIL(&rgnDst))
|
||||
{
|
||||
i = REGION_NUM_RECTS(&rgnDst);
|
||||
pptSrc = (DDXPointPtr)xalloc(i * sizeof(DDXPointRec));
|
||||
if(pptSrc)
|
||||
{
|
||||
for (pbox = REGION_RECTS(&rgnDst), ppt = pptSrc;
|
||||
--i >= 0;
|
||||
pbox++, ppt++)
|
||||
{
|
||||
ppt->x = pbox->x1 - xOrg;
|
||||
ppt->y = pbox->y1 - yOrg;
|
||||
}
|
||||
mfbDoBitblt((DrawablePtr)pBitMap, pDrawable, alu, &rgnDst, pptSrc);
|
||||
xfree(pptSrc);
|
||||
}
|
||||
}
|
||||
REGION_UNINIT(pGC->pScreen, &rgnDst);
|
||||
}
|
||||
|
||||
#define NPT 128
|
||||
|
||||
/* mfbPushPixels -- squeegees the forground color of pGC through pBitMap
|
||||
* into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may
|
||||
* be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit
|
||||
* is set in the bitmap, the fill style is put onto the drawable using
|
||||
* the GC's logical function. The drawable is not changed where the bitmap
|
||||
* has a zero bit or outside the area covered by the stencil.
|
||||
*/
|
||||
void
|
||||
mfbPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
|
||||
GCPtr pGC;
|
||||
PixmapPtr pBitMap;
|
||||
DrawablePtr pDrawable;
|
||||
int dx, dy, xOrg, yOrg;
|
||||
{
|
||||
int h, dxDivPPW, ibEnd;
|
||||
PixelType *pwLineStart;
|
||||
register PixelType *pw, *pwEnd;
|
||||
register PixelType mask;
|
||||
register int ib;
|
||||
register PixelType w;
|
||||
register int ipt; /* index into above arrays */
|
||||
Bool fInBox;
|
||||
DDXPointRec pt[NPT];
|
||||
int width[NPT];
|
||||
|
||||
/* Now scan convert the pixmap and use the result to call fillspans in
|
||||
* in the drawable with the original GC */
|
||||
ipt = 0;
|
||||
dxDivPPW = dx/PPW;
|
||||
for(h = 0; h < dy; h++)
|
||||
{
|
||||
|
||||
pw = (PixelType *)(pointer)
|
||||
(((char *)(pBitMap->devPrivate.ptr))+(h * pBitMap->devKind));
|
||||
pwLineStart = pw;
|
||||
/* Process all words which are fully in the pixmap */
|
||||
|
||||
fInBox = FALSE;
|
||||
pwEnd = pwLineStart + dxDivPPW;
|
||||
while(pw < pwEnd)
|
||||
{
|
||||
w = *pw;
|
||||
mask = endtab[1];
|
||||
for(ib = 0; ib < PPW; ib++)
|
||||
{
|
||||
if(w & mask)
|
||||
{
|
||||
if(!fInBox)
|
||||
{
|
||||
pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
|
||||
pt[ipt].y = h + yOrg;
|
||||
/* start new box */
|
||||
fInBox = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fInBox)
|
||||
{
|
||||
width[ipt] = ((pw - pwLineStart) << PWSH) +
|
||||
ib + xOrg - pt[ipt].x;
|
||||
if (++ipt >= NPT)
|
||||
{
|
||||
(*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt,
|
||||
width, TRUE);
|
||||
ipt = 0;
|
||||
}
|
||||
/* end box */
|
||||
fInBox = FALSE;
|
||||
}
|
||||
}
|
||||
mask = SCRRIGHT(mask, 1);
|
||||
}
|
||||
pw++;
|
||||
}
|
||||
ibEnd = dx & PIM;
|
||||
if(ibEnd)
|
||||
{
|
||||
/* Process final partial word on line */
|
||||
w = *pw;
|
||||
mask = endtab[1];
|
||||
for(ib = 0; ib < ibEnd; ib++)
|
||||
{
|
||||
if(w & mask)
|
||||
{
|
||||
if(!fInBox)
|
||||
{
|
||||
/* start new box */
|
||||
pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
|
||||
pt[ipt].y = h + yOrg;
|
||||
fInBox = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fInBox)
|
||||
{
|
||||
/* end box */
|
||||
width[ipt] = ((pw - pwLineStart) << PWSH) +
|
||||
ib + xOrg - pt[ipt].x;
|
||||
if (++ipt >= NPT)
|
||||
{
|
||||
(*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt,
|
||||
width, TRUE);
|
||||
ipt = 0;
|
||||
}
|
||||
fInBox = FALSE;
|
||||
}
|
||||
}
|
||||
mask = SCRRIGHT(mask, 1);
|
||||
}
|
||||
}
|
||||
/* If scanline ended with last bit set, end the box */
|
||||
if(fInBox)
|
||||
{
|
||||
width[ipt] = dx + xOrg - pt[ipt].x;
|
||||
if (++ipt >= NPT)
|
||||
{
|
||||
(*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE);
|
||||
ipt = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Flush any remaining spans */
|
||||
if (ipt)
|
||||
{
|
||||
(*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
mfbPushPixelsProc *mfbPushPixelsWeak(void)
|
||||
{
|
||||
return mfbPushPixels;
|
||||
}
|
||||
|
|
@ -1,64 +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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "mfb.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
/*ARGSUSED*/
|
||||
Bool
|
||||
mfbCloseScreen(index, pScreen)
|
||||
int index;
|
||||
register ScreenPtr pScreen;
|
||||
{
|
||||
xfree(pScreen->devPrivate);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
183
mfb/mfbscrinit.c
183
mfb/mfbscrinit.c
|
|
@ -1,183 +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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h> /* for xColorItem */
|
||||
#include <X11/Xmd.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "resource.h"
|
||||
#include "colormap.h"
|
||||
#include "mfb.h"
|
||||
#include "mistruct.h"
|
||||
#include "dix.h"
|
||||
#include "mi.h"
|
||||
#include "mibstore.h"
|
||||
#include "migc.h"
|
||||
#include "servermd.h"
|
||||
|
||||
#ifdef PIXMAP_PER_WINDOW
|
||||
static DevPrivateKey frameWindowPrivateKey = &frameWindowPrivateKey;
|
||||
DevPrivateKey frameGetWindowPrivateKey(void) { return frameWindowPrivateKey; }
|
||||
#endif
|
||||
static DevPrivateKey mfbGCPrivateKey = &mfbGCPrivateKey;
|
||||
DevPrivateKey mfbGetGCPrivateKey(void) { return mfbGCPrivateKey; }
|
||||
static unsigned long mfbGeneration = 0;
|
||||
|
||||
static VisualRec visual = {
|
||||
/* vid class bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */
|
||||
0, StaticGray, 1, 2, 1, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static VisualID VID;
|
||||
|
||||
static DepthRec depth = {
|
||||
/* depth numVid vids */
|
||||
1, 1, &VID
|
||||
};
|
||||
|
||||
Bool
|
||||
mfbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
|
||||
{
|
||||
if (mfbGeneration != serverGeneration)
|
||||
{
|
||||
visual.vid = FakeClientID(0);
|
||||
VID = visual.vid;
|
||||
mfbGeneration = serverGeneration;
|
||||
}
|
||||
if (pGCKey)
|
||||
*pGCKey = mfbGCPrivateKey;
|
||||
pScreen->GetWindowPixmap = mfbGetWindowPixmap;
|
||||
pScreen->SetWindowPixmap = mfbSetWindowPixmap;
|
||||
return dixRequestPrivate(mfbGCPrivateKey, sizeof(mfbPrivGC));
|
||||
}
|
||||
|
||||
|
||||
/* dts * (inch/dot) * (25.4 mm / inch) = mm */
|
||||
Bool
|
||||
mfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
|
||||
register ScreenPtr pScreen;
|
||||
pointer pbits; /* pointer to screen bitmap */
|
||||
int xsize, ysize; /* in pixels */
|
||||
int dpix, dpiy; /* dots per inch */
|
||||
int width; /* pixel width of frame buffer */
|
||||
{
|
||||
if (!mfbAllocatePrivates(pScreen, NULL))
|
||||
return FALSE;
|
||||
pScreen->defColormap = (Colormap) FakeClientID(0);
|
||||
/* whitePixel, blackPixel */
|
||||
pScreen->QueryBestSize = mfbQueryBestSize;
|
||||
/* SaveScreen */
|
||||
pScreen->GetImage = mfbGetImage;
|
||||
pScreen->GetSpans = mfbGetSpans;
|
||||
pScreen->CreateWindow = mfbCreateWindow;
|
||||
pScreen->PositionWindow = mfbPositionWindow;
|
||||
pScreen->RealizeWindow = mfbMapWindow;
|
||||
pScreen->UnrealizeWindow = mfbUnmapWindow;
|
||||
pScreen->CopyWindow = mfbCopyWindow;
|
||||
pScreen->CreatePixmap = mfbCreatePixmap;
|
||||
pScreen->DestroyPixmap = mfbDestroyPixmap;
|
||||
pScreen->RealizeFont = mfbRealizeFont;
|
||||
pScreen->UnrealizeFont = mfbUnrealizeFont;
|
||||
pScreen->CreateGC = mfbCreateGC;
|
||||
pScreen->CreateColormap = mfbCreateColormap;
|
||||
pScreen->DestroyColormap = mfbDestroyColormap;
|
||||
pScreen->InstallColormap = mfbInstallColormap;
|
||||
pScreen->UninstallColormap = mfbUninstallColormap;
|
||||
pScreen->ListInstalledColormaps = mfbListInstalledColormaps;
|
||||
pScreen->StoreColors = (StoreColorsProcPtr)NoopDDA;
|
||||
pScreen->ResolveColor = mfbResolveColor;
|
||||
pScreen->BitmapToRegion = mfbPixmapToRegion;
|
||||
if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
|
||||
1, 1, &depth, VID, 1, &visual))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PixmapPtr
|
||||
mfbGetWindowPixmap(pWin)
|
||||
WindowPtr pWin;
|
||||
{
|
||||
#ifdef PIXMAP_PER_WINDOW
|
||||
return (PixmapPtr)dixLookupPrivate(&pWin->devPrivates,
|
||||
frameWindowPrivateKey);
|
||||
#else
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
|
||||
return (* pScreen->GetScreenPixmap)(pScreen);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
mfbSetWindowPixmap(pWin, pPix)
|
||||
WindowPtr pWin;
|
||||
PixmapPtr pPix;
|
||||
{
|
||||
#ifdef PIXMAP_PER_WINDOW
|
||||
dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey, pPix);
|
||||
#else
|
||||
(* pWin->drawable.pScreen->SetScreenPixmap)(pPix);
|
||||
#endif
|
||||
}
|
||||
|
||||
void mfbFillInScreen(ScreenPtr pScreen)
|
||||
{
|
||||
pScreen->ChangeWindowAttributes = mfbChangeWindowAttributes;
|
||||
pScreen->RealizeWindow = mfbMapWindow;
|
||||
pScreen->UnrealizeWindow = mfbUnmapWindow;
|
||||
pScreen->DestroyPixmap = mfbDestroyPixmap;
|
||||
pScreen->RealizeFont = mfbRealizeFont;
|
||||
pScreen->UnrealizeFont = mfbUnrealizeFont;
|
||||
pScreen->BitmapToRegion = mfbPixmapToRegion;
|
||||
}
|
||||
281
mfb/mfbsetsp.c
281
mfb/mfbsetsp.c
|
|
@ -1,281 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
|
||||
#include "misc.h"
|
||||
#include "regionstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
#include "servermd.h"
|
||||
|
||||
|
||||
/* mfbSetScanline -- copies the bits from psrc to the drawable starting at
|
||||
* (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc
|
||||
* starts on the scanline. (I.e., if this scanline passes through multiple
|
||||
* boxes, we may not want to start grabbing bits at psrc but at some offset
|
||||
* further on.)
|
||||
*/
|
||||
void
|
||||
mfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst)
|
||||
int y;
|
||||
int xOrigin; /* where this scanline starts */
|
||||
int xStart; /* first bit to use from scanline */
|
||||
int xEnd; /* last bit to use from scanline + 1 */
|
||||
register PixelType *psrc;
|
||||
register int alu; /* raster op */
|
||||
PixelType *pdstBase; /* start of the drawable */
|
||||
int widthDst; /* width of drawable in words */
|
||||
{
|
||||
int w; /* width of scanline in bits */
|
||||
register PixelType *pdst; /* where to put the bits */
|
||||
register PixelType tmpSrc; /* scratch buffer to collect bits in */
|
||||
int dstBit; /* offset in bits from beginning of
|
||||
* word */
|
||||
register int nstart; /* number of bits from first partial */
|
||||
register int nend; /* " " last partial word */
|
||||
int offSrc;
|
||||
PixelType startmask, endmask;
|
||||
int nlMiddle, nl;
|
||||
|
||||
pdst = mfbScanline(pdstBase, xStart, y, widthDst);
|
||||
psrc += (xStart - xOrigin) >> PWSH;
|
||||
offSrc = (xStart - xOrigin) & PIM;
|
||||
w = xEnd - xStart;
|
||||
dstBit = xStart & PIM;
|
||||
|
||||
if (dstBit + w <= PPW)
|
||||
{
|
||||
getandputrop(psrc, offSrc, dstBit, w, pdst, alu)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
maskbits(xStart, w, startmask, endmask, nlMiddle);
|
||||
if (startmask)
|
||||
nstart = PPW - dstBit;
|
||||
else
|
||||
nstart = 0;
|
||||
if (endmask)
|
||||
nend = xEnd & PIM;
|
||||
else
|
||||
nend = 0;
|
||||
if (startmask)
|
||||
{
|
||||
getandputrop(psrc, offSrc, dstBit, nstart, pdst, alu)
|
||||
pdst++;
|
||||
offSrc += nstart;
|
||||
if (offSrc > PLST)
|
||||
{
|
||||
psrc++;
|
||||
offSrc -= PPW;
|
||||
}
|
||||
}
|
||||
nl = nlMiddle;
|
||||
while (nl--)
|
||||
{
|
||||
getbits(psrc, offSrc, PPW, tmpSrc);
|
||||
DoRop(*pdst, alu, tmpSrc, *pdst);
|
||||
pdst++;
|
||||
psrc++;
|
||||
}
|
||||
if (endmask)
|
||||
{
|
||||
getandputrop0(psrc, offSrc, nend, pdst, alu);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at
|
||||
* ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines
|
||||
* are in increasing Y order.
|
||||
* Source bit lines are server scanline padded so that they always begin
|
||||
* on a word boundary.
|
||||
*/
|
||||
void
|
||||
mfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)
|
||||
DrawablePtr pDrawable;
|
||||
GCPtr pGC;
|
||||
char *pcharsrc;
|
||||
register DDXPointPtr ppt;
|
||||
int *pwidth;
|
||||
int nspans;
|
||||
int fSorted;
|
||||
{
|
||||
PixelType *psrc = (PixelType *)(pointer)pcharsrc;
|
||||
PixelType *pdstBase; /* start of dst bitmap */
|
||||
int widthDst; /* width of bitmap in words */
|
||||
register BoxPtr pbox, pboxLast, pboxTest;
|
||||
register DDXPointPtr pptLast;
|
||||
int alu;
|
||||
RegionPtr prgnDst;
|
||||
int xStart, xEnd;
|
||||
int yMax;
|
||||
|
||||
alu = pGC->alu;
|
||||
prgnDst = pGC->pCompositeClip;
|
||||
|
||||
pptLast = ppt + nspans;
|
||||
|
||||
yMax = pDrawable->y + (int) pDrawable->height;
|
||||
mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase);
|
||||
|
||||
pbox = REGION_RECTS(prgnDst);
|
||||
pboxLast = pbox + REGION_NUM_RECTS(prgnDst);
|
||||
|
||||
if(fSorted)
|
||||
{
|
||||
/* scan lines sorted in ascending order. Because they are sorted, we
|
||||
* don't have to check each scanline against each clip box. We can be
|
||||
* sure that this scanline only has to be clipped to boxes at or after the
|
||||
* beginning of this y-band
|
||||
*/
|
||||
pboxTest = pbox;
|
||||
while(ppt < pptLast)
|
||||
{
|
||||
pbox = pboxTest;
|
||||
if(ppt->y >= yMax)
|
||||
break;
|
||||
while(pbox < pboxLast)
|
||||
{
|
||||
if(pbox->y1 > ppt->y)
|
||||
{
|
||||
/* scanline is before clip box */
|
||||
break;
|
||||
}
|
||||
else if(pbox->y2 <= ppt->y)
|
||||
{
|
||||
/* clip box is before scanline */
|
||||
pboxTest = ++pbox;
|
||||
continue;
|
||||
}
|
||||
else if(pbox->x1 > ppt->x + *pwidth)
|
||||
{
|
||||
/* clip box is to right of scanline */
|
||||
break;
|
||||
}
|
||||
else if(pbox->x2 <= ppt->x)
|
||||
{
|
||||
/* scanline is to right of clip box */
|
||||
pbox++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* at least some of the scanline is in the current clip box */
|
||||
xStart = max(pbox->x1, ppt->x);
|
||||
xEnd = min(ppt->x + *pwidth, pbox->x2);
|
||||
mfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu,
|
||||
pdstBase, widthDst);
|
||||
if(ppt->x + *pwidth <= pbox->x2)
|
||||
{
|
||||
/* End of the line, as it were */
|
||||
break;
|
||||
}
|
||||
else
|
||||
pbox++;
|
||||
}
|
||||
/* We've tried this line against every box; it must be outside them
|
||||
* all. move on to the next point */
|
||||
ppt++;
|
||||
psrc += PixmapWidthInPadUnits(*pwidth, 1);
|
||||
pwidth++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* scan lines not sorted. We must clip each line against all the boxes */
|
||||
while(ppt < pptLast)
|
||||
{
|
||||
if(ppt->y >= 0 && ppt->y < yMax)
|
||||
{
|
||||
|
||||
for(pbox = REGION_RECTS(prgnDst); pbox< pboxLast; pbox++)
|
||||
{
|
||||
if(pbox->y1 > ppt->y)
|
||||
{
|
||||
/* rest of clip region is above this scanline,
|
||||
* skip it */
|
||||
break;
|
||||
}
|
||||
if(pbox->y2 <= ppt->y)
|
||||
{
|
||||
/* clip box is below scanline */
|
||||
pbox++;
|
||||
break;
|
||||
}
|
||||
if(pbox->x1 <= ppt->x + *pwidth &&
|
||||
pbox->x2 > ppt->x)
|
||||
{
|
||||
xStart = max(pbox->x1, ppt->x);
|
||||
xEnd = min(pbox->x2, ppt->x + *pwidth);
|
||||
mfbSetScanline(ppt->y, ppt->x, xStart, xEnd,
|
||||
psrc, alu, pdstBase, widthDst);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
psrc += PixmapWidthInPadUnits(*pwidth, 1);
|
||||
ppt++;
|
||||
pwidth++;
|
||||
}
|
||||
}
|
||||
}
|
||||
366
mfb/mfbtegblt.c
366
mfb/mfbtegblt.c
|
|
@ -1,366 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "mfb.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "dixfontstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
/*
|
||||
this works for fonts with glyphs <= PPW bits wide.
|
||||
|
||||
This should be called only with a terminal-emulator font;
|
||||
this means that the FIXED_METRICS flag is set, and that
|
||||
glyphbounds == charbounds.
|
||||
|
||||
in theory, this goes faster; even if it doesn't, it reduces the
|
||||
flicker caused by writing a string over itself with image text (since
|
||||
the background gets repainted per character instead of per string.)
|
||||
this seems to be important for some converted X10 applications.
|
||||
|
||||
Image text looks at the bits in the glyph and the fg and bg in the
|
||||
GC. it paints a rectangle, as defined in the protocol dcoument,
|
||||
and the paints the characters.
|
||||
|
||||
to avoid source proliferation, this file is compiled
|
||||
two times:
|
||||
MFBTEGLYPHBLT OP
|
||||
mfbTEGlyphBltWhite (white text, black bg )
|
||||
mfbTEGlyphBltBlack ~ (black text, white bg )
|
||||
|
||||
*/
|
||||
|
||||
#if defined(NO_3_60_CG4) && defined(FASTPUTBITS) && defined(FASTGETBITS)
|
||||
#define FASTCHARS
|
||||
#endif
|
||||
|
||||
/*
|
||||
* this macro "knows" that only characters <= 8 bits wide will
|
||||
* fit this case (which is why it is independent of GLYPHPADBYTES)
|
||||
*/
|
||||
|
||||
#if (BITMAP_BIT_ORDER == MSBFirst) && (GLYPHPADBYTES != 4)
|
||||
#if GLYPHPADBYTES == 1
|
||||
#define ShiftAmnt 24
|
||||
#else
|
||||
#define ShiftAmnt 16
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX XXX XXX There is something horribly, massively wrong here. There are
|
||||
* hardcoded shifts by 64 below; these cannot work on any present-day
|
||||
* architecture.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Note: for BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER, SCRRIGHT() evaluates its
|
||||
* first argument more than once. Thus the imbedded char++ have to be moved.
|
||||
* (DHD)
|
||||
*/
|
||||
#if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER
|
||||
#define GetBits4 c = (*char1++ << ShiftAmnt) | \
|
||||
SCRRIGHT (*char2++ << ShiftAmnt, xoff2) | \
|
||||
SCRRIGHT (*char3++ << ShiftAmnt, xoff3) | \
|
||||
SCRRIGHT (*char4++ << ShiftAmnt, xoff4);
|
||||
#else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */
|
||||
#define GetBits4 c = (*char1++ << ShiftAmnt) | \
|
||||
SCRRIGHT (*char2 << ShiftAmnt, xoff2) | \
|
||||
SCRRIGHT (*char3 << ShiftAmnt, xoff3) | \
|
||||
SCRRIGHT (*char4 << ShiftAmnt, xoff4); \
|
||||
char2++; char3++; char4++;
|
||||
#endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */
|
||||
|
||||
#else /* (BITMAP_BIT_ORDER != MSBFirst) || (GLYPHPADBYTES == 4) */
|
||||
|
||||
#if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER
|
||||
#define GetBits4 c = *char1++ | \
|
||||
SCRRIGHT (*char2++, xoff2) | \
|
||||
SCRRIGHT (*char3++, xoff3) | \
|
||||
SCRRIGHT (*char4++, xoff4);
|
||||
#else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */
|
||||
#define GetBits4 c = *char1++ | \
|
||||
SCRRIGHT (*char2, xoff2) | \
|
||||
SCRRIGHT (*char3, xoff3) | \
|
||||
SCRRIGHT (*char4, xoff4); \
|
||||
char2++; char3++; char4++;
|
||||
#endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */
|
||||
|
||||
#endif /* BITMAP_BIT_ORDER && GLYPHPADBYTES */
|
||||
|
||||
|
||||
#if GLYPHPADBYTES == 1
|
||||
typedef unsigned char *glyphPointer;
|
||||
#define USE_LEFTBITS
|
||||
#endif
|
||||
|
||||
#if GLYPHPADBYTES == 2
|
||||
typedef unsigned short *glyphPointer;
|
||||
#define USE_LEFTBITS
|
||||
#endif
|
||||
|
||||
#if GLYPHPADBYTES == 4
|
||||
typedef unsigned int *glyphPointer;
|
||||
#endif
|
||||
|
||||
#ifdef USE_LEFTBITS
|
||||
#define GetBits1 getleftbits (char1, widthGlyph, c); \
|
||||
c &= glyphMask; \
|
||||
char1 = (glyphPointer) (((char *) char1) + glyphBytes);
|
||||
#else
|
||||
#define GetBits1 c = *char1++;
|
||||
#endif
|
||||
|
||||
void
|
||||
MFBTEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
|
||||
DrawablePtr pDrawable;
|
||||
GC *pGC;
|
||||
int x, y;
|
||||
unsigned int nglyph;
|
||||
CharInfoPtr *ppci; /* array of character info */
|
||||
pointer pglyphBase; /* start of array of glyphs */
|
||||
{
|
||||
FontPtr pfont = pGC->font;
|
||||
int widthDst;
|
||||
PixelType *pdstBase; /* pointer to longword with top row
|
||||
of current glyph */
|
||||
|
||||
int h; /* height of glyph and char */
|
||||
register int xpos; /* current x */
|
||||
int ypos; /* current y */
|
||||
int widthGlyph;
|
||||
|
||||
int hTmp; /* counter for height */
|
||||
register PixelType startmask, endmask;
|
||||
int nfirst; /* used if glyphs spans a longword boundary */
|
||||
BoxRec bbox; /* for clipping */
|
||||
int widthGlyphs;
|
||||
register PixelType *dst;
|
||||
register PixelType c;
|
||||
register int xoff1, xoff2, xoff3, xoff4;
|
||||
register glyphPointer char1, char2, char3, char4;
|
||||
|
||||
#ifdef USE_LEFTBITS
|
||||
register PixelType glyphMask;
|
||||
register PixelType tmpSrc;
|
||||
register int glyphBytes;
|
||||
#endif
|
||||
|
||||
if (!(pGC->planemask & 1))
|
||||
return;
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase);
|
||||
|
||||
xpos = x + pDrawable->x;
|
||||
ypos = y + pDrawable->y;
|
||||
|
||||
widthGlyph = FONTMAXBOUNDS(pfont,characterWidth);
|
||||
h = FONTASCENT(pfont) + FONTDESCENT(pfont);
|
||||
|
||||
xpos += FONTMAXBOUNDS(pfont,leftSideBearing);
|
||||
ypos -= FONTASCENT(pfont);
|
||||
|
||||
bbox.x1 = xpos;
|
||||
bbox.x2 = xpos + (widthGlyph * nglyph);
|
||||
bbox.y1 = ypos;
|
||||
bbox.y2 = ypos + h;
|
||||
|
||||
switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
|
||||
{
|
||||
case rgnPART:
|
||||
/* this is the WRONG thing to do, but it works.
|
||||
calling the non-terminal text is easy, but slow, given
|
||||
what we know about the font.
|
||||
|
||||
the right thing to do is something like:
|
||||
for each clip rectangle
|
||||
compute at which row the glyph starts to be in it,
|
||||
and at which row the glyph ceases to be in it
|
||||
compute which is the first glyph inside the left
|
||||
edge, and the last one inside the right edge
|
||||
draw a fractional first glyph, using only
|
||||
the rows we know are in
|
||||
draw all the whole glyphs, using the appropriate rows
|
||||
draw any pieces of the last glyph, using the right rows
|
||||
|
||||
this way, the code would take advantage of knowing that
|
||||
all glyphs are the same height and don't overlap.
|
||||
|
||||
one day...
|
||||
*/
|
||||
CLIPTETEXT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
|
||||
case rgnOUT:
|
||||
return;
|
||||
}
|
||||
pdstBase = mfbScanlineDeltaNoBankSwitch(pdstBase, ypos, widthDst);
|
||||
widthGlyphs = widthGlyph * PGSZB;
|
||||
|
||||
#ifdef USE_LEFTBITS
|
||||
glyphMask = endtab[widthGlyph];
|
||||
glyphBytes = GLYPHWIDTHBYTESPADDED(*ppci);
|
||||
#endif
|
||||
|
||||
if (nglyph >= PGSZB && widthGlyphs <= PPW)
|
||||
{
|
||||
while (nglyph >= PGSZB)
|
||||
{
|
||||
nglyph -= PGSZB;
|
||||
xoff1 = xpos & PIM;
|
||||
xoff2 = widthGlyph;
|
||||
xoff3 = xoff2 + widthGlyph;
|
||||
xoff4 = xoff3 + widthGlyph;
|
||||
char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
|
||||
char2 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
|
||||
char3 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
|
||||
char4 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
|
||||
|
||||
hTmp = h;
|
||||
dst = mfbScanlineOffset(pdstBase, (xpos >> PWSH)); /* switch now */
|
||||
|
||||
#ifndef FASTCHARS
|
||||
if (xoff1 + widthGlyphs <= PPW)
|
||||
{
|
||||
maskpartialbits (xoff1, widthGlyphs, startmask);
|
||||
#endif
|
||||
while (hTmp--)
|
||||
{
|
||||
GetBits4
|
||||
#ifdef FASTCHARS
|
||||
# if BITMAP_BIT_ORDER == MSBFirst
|
||||
c >>= PPW - widthGlyphs;
|
||||
# endif
|
||||
FASTPUTBITS(OP(c), xoff1, widthGlyphs, dst);
|
||||
#else
|
||||
*(dst) = ((*dst) & ~startmask) | (OP(SCRRIGHT(c, xoff1)) & startmask);
|
||||
#endif
|
||||
mfbScanlineInc(dst, widthDst);
|
||||
}
|
||||
#ifndef FASTCHARS
|
||||
}
|
||||
else
|
||||
{
|
||||
maskPPWbits (xoff1, widthGlyphs, startmask, endmask);
|
||||
nfirst = PPW - xoff1;
|
||||
while (hTmp--)
|
||||
{
|
||||
GetBits4
|
||||
dst[0] = (dst[0] & ~startmask) |
|
||||
(OP(SCRRIGHT(c,xoff1)) & startmask);
|
||||
dst[1] = (dst[1] & ~endmask) |
|
||||
(OP(SCRLEFT(c,nfirst)) & endmask);
|
||||
mfbScanlineInc(dst, widthDst);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
xpos += widthGlyphs;
|
||||
}
|
||||
}
|
||||
|
||||
while(nglyph--)
|
||||
{
|
||||
xoff1 = xpos & PIM;
|
||||
char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
|
||||
hTmp = h;
|
||||
dst = mfbScanlineOffset(pdstBase, (xpos >> PWSH));
|
||||
|
||||
#ifndef FASTCHARS
|
||||
if (xoff1 + widthGlyph <= PPW)
|
||||
{
|
||||
maskpartialbits (xoff1, widthGlyph, startmask);
|
||||
#endif
|
||||
while (hTmp--)
|
||||
{
|
||||
#ifdef FASTCHARS
|
||||
#ifdef USE_LEFTBITS
|
||||
FASTGETBITS (char1,0,widthGlyph,c);
|
||||
char1 = (glyphPointer) (((char *) char1) + glyphBytes);
|
||||
#else
|
||||
c = *char1++;
|
||||
#if BITMAP_BIT_ORDER == MSBFirst
|
||||
c >>= PPW - widthGlyph;
|
||||
#endif
|
||||
#endif
|
||||
FASTPUTBITS (OP(c),xoff1,widthGlyph,dst);
|
||||
#else
|
||||
GetBits1
|
||||
(*dst) = ((*dst) & ~startmask) | (OP(SCRRIGHT(c, xoff1)) & startmask);
|
||||
#endif
|
||||
mfbScanlineInc(dst, widthDst);
|
||||
}
|
||||
#ifndef FASTCHARS
|
||||
}
|
||||
else
|
||||
{
|
||||
maskPPWbits (xoff1, widthGlyph, startmask, endmask);
|
||||
nfirst = PPW - xoff1;
|
||||
while (hTmp--)
|
||||
{
|
||||
GetBits1
|
||||
dst[0] = (dst[0] & ~startmask) |
|
||||
(OP(SCRRIGHT(c,xoff1)) & startmask);
|
||||
dst[1] = (dst[1] & ~endmask) |
|
||||
(OP(SCRLEFT(c,nfirst)) & endmask);
|
||||
mfbScanlineInc(dst, widthDst);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
xpos += widthGlyph;
|
||||
}
|
||||
}
|
||||
238
mfb/mfbtile.c
238
mfb/mfbtile.c
|
|
@ -1,238 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
|
||||
#include "windowstr.h"
|
||||
#include "regionstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
#include "mergerop.h"
|
||||
/*
|
||||
|
||||
the boxes are already translated.
|
||||
|
||||
NOTE:
|
||||
iy = ++iy < tileHeight ? iy : 0
|
||||
is equivalent to iy%= tileheight, and saves a division.
|
||||
*/
|
||||
|
||||
/*
|
||||
tile area with a PPW bit wide pixmap
|
||||
*/
|
||||
void
|
||||
MROP_NAME(mfbTileAreaPPW)(pDraw, nbox, pbox, alu, ptile)
|
||||
DrawablePtr pDraw;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
int alu;
|
||||
PixmapPtr ptile;
|
||||
{
|
||||
register PixelType *psrc;
|
||||
/* pointer to bits in tile, if needed */
|
||||
int tileHeight; /* height of the tile */
|
||||
register PixelType srcpix;
|
||||
int nlwidth; /* width in longwords of the drawable */
|
||||
int w; /* width of current box */
|
||||
MROP_DECLARE_REG ()
|
||||
register int h; /* height of current box */
|
||||
register int nlw; /* loop version of nlwMiddle */
|
||||
register PixelType *p; /* pointer to bits we're writing */
|
||||
PixelType startmask;
|
||||
PixelType endmask; /* masks for reggedy bits at either end of line */
|
||||
int nlwMiddle; /* number of longwords between sides of boxes */
|
||||
int nlwExtra; /* to get from right of box to left of next span */
|
||||
register int iy; /* index of current scanline in tile */
|
||||
PixelType *pbits; /* pointer to start of drawable */
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDraw, nlwidth, pbits);
|
||||
|
||||
MROP_INITIALIZE(alu,~0)
|
||||
|
||||
tileHeight = ptile->drawable.height;
|
||||
psrc = (PixelType *)(ptile->devPrivate.ptr);
|
||||
|
||||
while (nbox--)
|
||||
{
|
||||
w = pbox->x2 - pbox->x1;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
iy = pbox->y1 % tileHeight;
|
||||
p = mfbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
|
||||
|
||||
if ( ((pbox->x1 & PIM) + w) < PPW)
|
||||
{
|
||||
maskpartialbits(pbox->x1, w, startmask);
|
||||
nlwExtra = nlwidth;
|
||||
while (h--)
|
||||
{
|
||||
srcpix = psrc[iy];
|
||||
iy++;
|
||||
if (iy == tileHeight)
|
||||
iy = 0;
|
||||
*p = MROP_MASK(srcpix,*p,startmask);
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
|
||||
nlwExtra = nlwidth - nlwMiddle;
|
||||
|
||||
if (startmask && endmask)
|
||||
{
|
||||
nlwExtra -= 1;
|
||||
while (h--)
|
||||
{
|
||||
srcpix = psrc[iy];
|
||||
iy++;
|
||||
if (iy == tileHeight)
|
||||
iy = 0;
|
||||
nlw = nlwMiddle;
|
||||
*p = MROP_MASK (srcpix,*p,startmask);
|
||||
p++;
|
||||
while (nlw--)
|
||||
{
|
||||
*p = MROP_SOLID(srcpix,*p);
|
||||
p++;
|
||||
}
|
||||
|
||||
*p = MROP_MASK(srcpix,*p,endmask);
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
else if (startmask && !endmask)
|
||||
{
|
||||
nlwExtra -= 1;
|
||||
while (h--)
|
||||
{
|
||||
srcpix = psrc[iy];
|
||||
iy++;
|
||||
if (iy == tileHeight)
|
||||
iy = 0;
|
||||
nlw = nlwMiddle;
|
||||
*p = MROP_MASK(srcpix,*p,startmask);
|
||||
p++;
|
||||
while (nlw--)
|
||||
{
|
||||
*p = MROP_SOLID(srcpix,*p);
|
||||
p++;
|
||||
}
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
else if (!startmask && endmask)
|
||||
{
|
||||
while (h--)
|
||||
{
|
||||
srcpix = psrc[iy];
|
||||
iy++;
|
||||
if (iy == tileHeight)
|
||||
iy = 0;
|
||||
nlw = nlwMiddle;
|
||||
while (nlw--)
|
||||
{
|
||||
*p = MROP_SOLID(srcpix,*p);
|
||||
p++;
|
||||
}
|
||||
|
||||
*p = MROP_MASK(srcpix,*p,endmask);
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
else /* no ragged bits at either end */
|
||||
{
|
||||
while (h--)
|
||||
{
|
||||
srcpix = psrc[iy];
|
||||
iy++;
|
||||
if (iy == tileHeight)
|
||||
iy = 0;
|
||||
nlw = nlwMiddle;
|
||||
while (nlw--)
|
||||
{
|
||||
*p = MROP_SOLID (srcpix,*p);
|
||||
p++;
|
||||
}
|
||||
mfbScanlineInc(p, nlwExtra);
|
||||
}
|
||||
}
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
|
||||
#if (MROP) == 0
|
||||
void
|
||||
mfbTileAreaPPW (pDraw, nbox, pbox, alu, ptile)
|
||||
DrawablePtr pDraw;
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
int alu;
|
||||
PixmapPtr ptile;
|
||||
{
|
||||
void (*f)(
|
||||
DrawablePtr /*pDraw*/,
|
||||
int /*nbox*/,
|
||||
BoxPtr /*pbox*/,
|
||||
int /*alu*/,
|
||||
PixmapPtr /*ptile*/);
|
||||
|
||||
if (alu == GXcopy)
|
||||
f = mfbTileAreaPPWCopy;
|
||||
else
|
||||
f = mfbTileAreaPPWGeneral;
|
||||
(*f) (pDraw, nbox, pbox, alu, ptile);
|
||||
}
|
||||
#endif
|
||||
168
mfb/mfbwindow.c
168
mfb/mfbwindow.c
|
|
@ -1,168 +0,0 @@
|
|||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
||||
/***********************************************************
|
||||
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "privates.h"
|
||||
#include "mfb.h"
|
||||
#include "mistruct.h"
|
||||
#include "regionstr.h"
|
||||
#include "maskbits.h"
|
||||
|
||||
Bool
|
||||
mfbCreateWindow(pWin)
|
||||
register WindowPtr pWin;
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/* This always returns true, because Xfree can't fail. It might be possible
|
||||
* on some devices for Destroy to fail */
|
||||
Bool
|
||||
mfbDestroyWindow(WindowPtr pWin)
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
Bool mfbMapWindow(pWindow)
|
||||
WindowPtr pWindow;
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/* (x, y) is the upper left corner of the window on the screen
|
||||
do we really need to pass this? (is it a;ready in pWin->absCorner?)
|
||||
we only do the rotation for pixmaps that are 32 bits wide (padded
|
||||
or otherwise.)
|
||||
mfbChangeWindowAttributes() has already put a copy of the pixmap
|
||||
in pPrivWin->pRotated*
|
||||
*/
|
||||
|
||||
/*ARGSUSED*/
|
||||
Bool
|
||||
mfbPositionWindow(pWin, x, y)
|
||||
register WindowPtr pWin;
|
||||
int x, y;
|
||||
{
|
||||
/* This is the "wrong" fix to the right problem, but it doesn't really
|
||||
* cost very much. When the window is moved, we need to invalidate any
|
||||
* RotatedPixmap that exists in any GC currently validated against this
|
||||
* window.
|
||||
*/
|
||||
pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
|
||||
/* Again, we have no failure modes indicated by any of the routines
|
||||
* we've called, so we have to assume it worked */
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
Bool
|
||||
mfbUnmapWindow(pWindow)
|
||||
WindowPtr pWindow;
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/* UNCLEAN!
|
||||
this code calls the bitblt helper code directly.
|
||||
|
||||
mfbCopyWindow copies only the parts of the destination that are
|
||||
visible in the source.
|
||||
*/
|
||||
|
||||
|
||||
void
|
||||
mfbCopyWindow(pWin, ptOldOrg, prgnSrc)
|
||||
WindowPtr pWin;
|
||||
DDXPointRec ptOldOrg;
|
||||
RegionPtr prgnSrc;
|
||||
{
|
||||
DDXPointPtr pptSrc;
|
||||
register DDXPointPtr ppt;
|
||||
RegionPtr prgnDst;
|
||||
register BoxPtr pbox;
|
||||
register int dx, dy;
|
||||
register int i, nbox;
|
||||
WindowPtr pwinRoot;
|
||||
|
||||
pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
|
||||
|
||||
prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
|
||||
|
||||
dx = ptOldOrg.x - pWin->drawable.x;
|
||||
dy = ptOldOrg.y - pWin->drawable.y;
|
||||
REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
|
||||
REGION_INTERSECT(pWin->drawable.pScreen, prgnDst, &pWin->borderClip,
|
||||
prgnSrc);
|
||||
|
||||
pbox = REGION_RECTS(prgnDst);
|
||||
nbox = REGION_NUM_RECTS(prgnDst);
|
||||
if(!(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
|
||||
return;
|
||||
ppt = pptSrc;
|
||||
|
||||
for (i=nbox; --i >= 0; ppt++, pbox++)
|
||||
{
|
||||
ppt->x = pbox->x1 + dx;
|
||||
ppt->y = pbox->y1 + dy;
|
||||
}
|
||||
|
||||
mfbDoBitblt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
|
||||
GXcopy, prgnDst, pptSrc);
|
||||
xfree(pptSrc);
|
||||
REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
|
||||
}
|
||||
259
mfb/mfbzerarc.c
259
mfb/mfbzerarc.c
|
|
@ -1,259 +0,0 @@
|
|||
/************************************************************
|
||||
|
||||
Copyright 1989, 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
|
||||
/* Derived from:
|
||||
* "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
|
||||
* by M. L. V. Pitteway
|
||||
* The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xprotostr.h>
|
||||
#include "regionstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "mfb.h"
|
||||
#include "maskbits.h"
|
||||
#include "mizerarc.h"
|
||||
#include "mi.h"
|
||||
|
||||
/*
|
||||
* Note: LEFTMOST must be the bit leftmost in the actual screen
|
||||
* representation. This depends also on the IMAGE_BYTE_ORDER.
|
||||
* LONG2CHARS() takes care of the re-ordering as required. (DHD)
|
||||
*/
|
||||
#if (BITMAP_BIT_ORDER == MSBFirst)
|
||||
#define LEFTMOST ((PixelType) LONG2CHARS(((MfbBits)1 << PLST)))
|
||||
#else
|
||||
#define LEFTMOST ((PixelType) LONG2CHARS(1))
|
||||
#endif
|
||||
|
||||
#define PixelateWhite(addr,yoff,xoff) \
|
||||
*mfbScanlineOffset(addr, (yoff)+((xoff)>>PWSH)) |= \
|
||||
SCRRIGHT (LEFTMOST, ((xoff) & PIM))
|
||||
#define PixelateBlack(addr,yoff,xoff) \
|
||||
*mfbScanlineOffset(addr, (yoff)+((xoff)>>PWSH)) &= \
|
||||
~(SCRRIGHT (LEFTMOST, ((xoff) & PIM)))
|
||||
|
||||
#define Pixelate(base,yoff,xoff) \
|
||||
{ \
|
||||
paddr = mfbScanlineOffset(base, (yoff) + ((xoff)>>PWSH)); \
|
||||
pmask = SCRRIGHT(LEFTMOST, (xoff) & PIM); \
|
||||
*paddr = (*paddr & ~pmask) | (pixel & pmask); \
|
||||
}
|
||||
|
||||
#define DoPix(bit,base,yoff,xoff) if (mask & bit) Pixelate(base,yoff,xoff);
|
||||
|
||||
static void
|
||||
mfbZeroArcSS(
|
||||
DrawablePtr pDraw,
|
||||
GCPtr pGC,
|
||||
xArc *arc)
|
||||
{
|
||||
miZeroArcRec info;
|
||||
Bool do360;
|
||||
register int x, y, a, b, d, mask;
|
||||
register int k1, k3, dx, dy;
|
||||
PixelType *addrl;
|
||||
PixelType *yorgl, *yorgol;
|
||||
PixelType pixel;
|
||||
int nlwidth, yoffset, dyoffset;
|
||||
PixelType pmask;
|
||||
register PixelType *paddr;
|
||||
|
||||
if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
mfbGetGCPrivateKey()))->rop ==
|
||||
RROP_BLACK)
|
||||
pixel = 0;
|
||||
else
|
||||
pixel = ~0;
|
||||
|
||||
mfbGetPixelWidthAndPointer(pDraw, nlwidth, addrl);
|
||||
do360 = miZeroArcSetup(arc, &info, TRUE);
|
||||
yorgl = addrl + ((info.yorg + pDraw->y) * nlwidth);
|
||||
yorgol = addrl + ((info.yorgo + pDraw->y) * nlwidth);
|
||||
info.xorg += pDraw->x;
|
||||
info.xorgo += pDraw->x;
|
||||
MIARCSETUP();
|
||||
yoffset = y ? nlwidth : 0;
|
||||
dyoffset = 0;
|
||||
mask = info.initialMask;
|
||||
if (!(arc->width & 1))
|
||||
{
|
||||
DoPix(2, yorgl, 0, info.xorgo);
|
||||
DoPix(8, yorgol, 0, info.xorgo);
|
||||
}
|
||||
if (!info.end.x || !info.end.y)
|
||||
{
|
||||
mask = info.end.mask;
|
||||
info.end = info.altend;
|
||||
}
|
||||
if (do360 && (arc->width == arc->height) && !(arc->width & 1))
|
||||
{
|
||||
int xoffset = nlwidth;
|
||||
PixelType *yorghl = mfbScanlineDeltaNoBankSwitch(yorgl, info.h, nlwidth);
|
||||
int xorghp = info.xorg + info.h;
|
||||
int xorghn = info.xorg - info.h;
|
||||
|
||||
if (pixel)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
PixelateWhite(yorgl, yoffset, info.xorg + x);
|
||||
PixelateWhite(yorgl, yoffset, info.xorg - x);
|
||||
PixelateWhite(yorgol, -yoffset, info.xorg - x);
|
||||
PixelateWhite(yorgol, -yoffset, info.xorg + x);
|
||||
if (a < 0)
|
||||
break;
|
||||
PixelateWhite(yorghl, -xoffset, xorghp - y);
|
||||
PixelateWhite(yorghl, -xoffset, xorghn + y);
|
||||
PixelateWhite(yorghl, xoffset, xorghn + y);
|
||||
PixelateWhite(yorghl, xoffset, xorghp - y);
|
||||
xoffset += nlwidth;
|
||||
MIARCCIRCLESTEP(yoffset += nlwidth;);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
PixelateBlack(yorgl, yoffset, info.xorg + x);
|
||||
PixelateBlack(yorgl, yoffset, info.xorg - x);
|
||||
PixelateBlack(yorgol, -yoffset, info.xorg - x);
|
||||
PixelateBlack(yorgol, -yoffset, info.xorg + x);
|
||||
if (a < 0)
|
||||
break;
|
||||
PixelateBlack(yorghl, -xoffset, xorghp - y);
|
||||
PixelateBlack(yorghl, -xoffset, xorghn + y);
|
||||
PixelateBlack(yorghl, xoffset, xorghn + y);
|
||||
PixelateBlack(yorghl, xoffset, xorghp - y);
|
||||
xoffset += nlwidth;
|
||||
MIARCCIRCLESTEP(yoffset += nlwidth;);
|
||||
}
|
||||
}
|
||||
x = info.w;
|
||||
yoffset = info.h * nlwidth;
|
||||
}
|
||||
else if (do360)
|
||||
{
|
||||
while (y < info.h || x < info.w)
|
||||
{
|
||||
MIARCOCTANTSHIFT(dyoffset = nlwidth;);
|
||||
Pixelate(yorgl, yoffset, info.xorg + x);
|
||||
Pixelate(yorgl, yoffset, info.xorgo - x);
|
||||
Pixelate(yorgol, -yoffset, info.xorgo - x);
|
||||
Pixelate(yorgol, -yoffset, info.xorg + x);
|
||||
MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (y < info.h || x < info.w)
|
||||
{
|
||||
MIARCOCTANTSHIFT(dyoffset = nlwidth;);
|
||||
if ((x == info.start.x) || (y == info.start.y))
|
||||
{
|
||||
mask = info.start.mask;
|
||||
info.start = info.altstart;
|
||||
}
|
||||
DoPix(1, yorgl, yoffset, info.xorg + x);
|
||||
DoPix(2, yorgl, yoffset, info.xorgo - x);
|
||||
DoPix(4, yorgol, -yoffset, info.xorgo - x);
|
||||
DoPix(8, yorgol, -yoffset, info.xorg + x);
|
||||
if ((x == info.end.x) || (y == info.end.y))
|
||||
{
|
||||
mask = info.end.mask;
|
||||
info.end = info.altend;
|
||||
}
|
||||
MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
|
||||
}
|
||||
}
|
||||
if ((x == info.start.x) || (y == info.start.y))
|
||||
mask = info.start.mask;
|
||||
DoPix(1, yorgl, yoffset, info.xorg + x);
|
||||
DoPix(4, yorgol, -yoffset, info.xorgo - x);
|
||||
if (arc->height & 1)
|
||||
{
|
||||
DoPix(2, yorgl, yoffset, info.xorgo - x);
|
||||
DoPix(8, yorgol, -yoffset, info.xorg + x);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mfbZeroPolyArcSS(pDraw, pGC, narcs, parcs)
|
||||
DrawablePtr pDraw;
|
||||
GCPtr pGC;
|
||||
int narcs;
|
||||
xArc *parcs;
|
||||
{
|
||||
register xArc *arc;
|
||||
register int i;
|
||||
BoxRec box;
|
||||
int x2, y2;
|
||||
RegionPtr cclip;
|
||||
|
||||
if (!(pGC->planemask & 1))
|
||||
return;
|
||||
cclip = pGC->pCompositeClip;
|
||||
for (arc = parcs, i = narcs; --i >= 0; arc++)
|
||||
{
|
||||
if (miCanZeroArc(arc))
|
||||
{
|
||||
box.x1 = arc->x + pDraw->x;
|
||||
box.y1 = arc->y + pDraw->y;
|
||||
/*
|
||||
* Because box.x2 and box.y2 get truncated to 16 bits, and the
|
||||
* RECT_IN_REGION test treats the resulting number as a signed
|
||||
* integer, the RECT_IN_REGION test alone can go the wrong way.
|
||||
* This can result in a server crash because the rendering
|
||||
* routines in this file deal directly with cpu addresses
|
||||
* of pixels to be stored, and do not clip or otherwise check
|
||||
* that all such addresses are within their respective pixmaps.
|
||||
* So we only allow the RECT_IN_REGION test to be used for
|
||||
* values that can be expressed correctly in a signed short.
|
||||
*/
|
||||
x2 = box.x1 + (int)arc->width + 1;
|
||||
box.x2 = x2;
|
||||
y2 = box.y1 + (int)arc->height + 1;
|
||||
box.y2 = y2;
|
||||
if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
|
||||
(RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) )
|
||||
mfbZeroArcSS(pDraw, pGC, arc);
|
||||
else
|
||||
miZeroPolyArc(pDraw, pGC, 1, arc);
|
||||
}
|
||||
else
|
||||
miPolyArc(pDraw, pGC, 1, arc);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue