aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/sun/sunMultiDepth.c
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2011-10-10 17:43:39 +0200
committerReinhard Tartler <siretart@tauware.de>2011-10-10 17:43:39 +0200
commitf4092abdf94af6a99aff944d6264bc1284e8bdd4 (patch)
tree2ac1c9cc16ceb93edb2c4382c088dac5aeafdf0f /nx-X11/programs/Xserver/hw/sun/sunMultiDepth.c
parenta840692edc9c6d19cd7c057f68e39c7d95eb767d (diff)
downloadnx-libs-f4092abdf94af6a99aff944d6264bc1284e8bdd4.tar.gz
nx-libs-f4092abdf94af6a99aff944d6264bc1284e8bdd4.tar.bz2
nx-libs-f4092abdf94af6a99aff944d6264bc1284e8bdd4.zip
Imported nx-X11-3.1.0-1.tar.gznx-X11/3.1.0-1
Summary: Imported nx-X11-3.1.0-1.tar.gz Keywords: Imported nx-X11-3.1.0-1.tar.gz into Git repository
Diffstat (limited to 'nx-X11/programs/Xserver/hw/sun/sunMultiDepth.c')
-rw-r--r--nx-X11/programs/Xserver/hw/sun/sunMultiDepth.c277
1 files changed, 277 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/sun/sunMultiDepth.c b/nx-X11/programs/Xserver/hw/sun/sunMultiDepth.c
new file mode 100644
index 000000000..a8adf353f
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/sun/sunMultiDepth.c
@@ -0,0 +1,277 @@
+/* $Xorg: sunMultiDepth.c,v 1.4 2001/02/09 02:04:44 xorgcvs Exp $ */
+/*
+
+Copyright 1992, 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.
+
+*/
+
+/* $XFree86: xc/programs/Xserver/hw/sun/sunMultiDepth.c,v 1.5 2001/01/17 22:36:51 dawes Exp $ */
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include "servermd.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "resource.h"
+#include "colormap.h"
+#include "colormapst.h"
+#include "mi.h"
+#include "mistruct.h"
+#include "dix.h"
+#include "gcstruct.h"
+#include "mibstore.h"
+
+#ifndef SINGLEDEPTH
+
+static Bool
+sunCfbCreateGC(pGC)
+ GCPtr pGC;
+{
+ if (pGC->depth == 1)
+ {
+ return mfbCreateGC (pGC);
+ }
+ else if (pGC->depth <= 8)
+ {
+ return cfbCreateGC (pGC);
+ }
+ else if (pGC->depth <= 16)
+ {
+ return cfb16CreateGC (pGC);
+ }
+ else if (pGC->depth <= 32)
+ {
+ return cfb32CreateGC (pGC);
+ }
+ return FALSE;
+}
+
+static void
+sunCfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart)
+ 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 *pdstStart; /* where to put the bits */
+{
+ switch (pDrawable->bitsPerPixel) {
+ case 1:
+ mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 8:
+ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 16:
+ cfb16GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 32:
+ cfb32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ }
+ return;
+}
+
+static void
+sunCfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
+ DrawablePtr pDrawable;
+ int sx, sy, w, h;
+ unsigned int format;
+ unsigned long planeMask;
+ char *pdstLine;
+{
+ switch (pDrawable->bitsPerPixel)
+ {
+ case 1:
+ mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 8:
+ cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 16:
+ cfb16GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 32:
+ cfb32GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ }
+}
+
+Bool
+sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ 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 */
+ int bpp; /* bits per pixel of root */
+{
+ extern int cfbWindowPrivateIndex;
+ extern int cfbGCPrivateIndex;
+ int ret;
+
+ sunRegisterPixmapFormat( /* depth */ 1, /* bits per pixel */ 1);
+ sunRegisterPixmapFormat( /* depth */ 8, /* bits per pixel */ 8);
+ sunRegisterPixmapFormat( /* depth */ 12, /* bits per pixel */ 16);
+ sunRegisterPixmapFormat( /* depth */ 24, /* bits per pixel */ 32);
+
+ switch (bpp) {
+ case 8:
+ ret = cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ case 16:
+ ret = cfb16SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ case 32:
+ ret = cfb32SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ default:
+ return FALSE;
+ }
+ pScreen->CreateGC = sunCfbCreateGC;
+ pScreen->GetImage = sunCfbGetImage;
+ pScreen->GetSpans = sunCfbGetSpans;
+ return ret;
+}
+
+extern BSFuncRec cfbBSFuncRec, cfb16BSFuncRec, cfb32BSFuncRec;
+extern int cfb16ScreenPrivateIndex, cfb32ScreenPrivateIndex;
+extern Bool cfbCloseScreen(), cfb16CloseScreen(), cfb32CloseScreen();
+
+Bool
+sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ 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 */
+ int bpp;
+{
+ int i;
+ pointer oldDevPrivate;
+ VisualPtr visuals;
+ int nvisuals;
+ DepthPtr depths;
+ int ndepths;
+ VisualID defaultVisual;
+ int rootdepth;
+
+ if (!cfbInitVisuals(&visuals, &depths, &nvisuals, &ndepths,
+ &rootdepth, &defaultVisual, 1 << (bpp - 1), 8))
+ return FALSE;
+ oldDevPrivate = pScreen->devPrivate;
+ if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
+ rootdepth, ndepths, depths,
+ defaultVisual, nvisuals, visuals))
+ return FALSE;
+ switch (bpp)
+ {
+ case 8:
+ pScreen->CloseScreen = cfbCloseScreen;
+ pScreen->BackingStoreFuncs = cfbBSFuncRec;
+ break;
+ case 16:
+ pScreen->CloseScreen = cfb16CloseScreen;
+ pScreen->devPrivates[cfb16ScreenPrivateIndex].ptr =
+ pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+ pScreen->BackingStoreFuncs = cfb16BSFuncRec;
+ break;
+ case 32:
+ pScreen->CloseScreen = cfb32CloseScreen;
+ pScreen->devPrivates[cfb32ScreenPrivateIndex].ptr =
+ pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+ pScreen->BackingStoreFuncs = cfb32BSFuncRec;
+ break;
+ }
+ return TRUE;
+}
+
+
+Bool
+sunCfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ 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 */
+ int bpp;
+{
+ if (!sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width, bpp))
+ return FALSE;
+ return sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix,
+ dpiy, width, bpp);
+}
+
+
+#else /* SINGLEDEPTH */
+
+/* stuff for 8-bit only server */
+
+Bool
+sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ 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 */
+ int bpp; /* bits per pixel of root */
+{
+ sunRegisterPixmapFormat( /* depth */ 1, /* bits per pixel */ 1);
+ sunRegisterPixmapFormat( /* depth */ 8, /* bits per pixel */ 8);
+ return cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width);
+}
+
+Bool
+sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ 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 */
+ int bpp;
+{
+ return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width);
+}
+
+Bool
+sunCfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ 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 */
+ int bpp;
+{
+ sunRegisterPixmapFormat( /* depth */ 1, /* bits per pixel */ 1);
+ sunRegisterPixmapFormat( /* depth */ 8, /* bits per pixel */ 8);
+ return cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+}
+
+#endif /* SINGLEDEPTH */