xserver-multidpi/hw/xfree86/xaa/xaaOffscreen.c
Keith Packard 9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00

164 lines
4.3 KiB
C

/*
Copyright (c) 1999 - The XFree86 Project Inc.
Written by Mark Vojkovich
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "misc.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#include <X11/X.h>
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "windowstr.h"
#include "xf86str.h"
#include "mi.h"
#include "miline.h"
#include "xaa.h"
#include "xaalocal.h"
#include "xaawrap.h"
#include "xf86fbman.h"
#include "servermd.h"
void
XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
XAAPixmapPtr pPriv;
while (pLink) {
pPriv = XAA_GET_PIXMAP_PRIVATE(pLink->pPix);
pLink->area = pPriv->offscreenArea;
XAAMoveOutOffscreenPixmap(pLink->pPix);
pLink = pLink->next;
}
}
void
XAAMoveInOffscreenPixmaps(ScreenPtr pScreen)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
PixmapPtr pPix, pScreenPix, tmpPix;
pointer data;
XAAPixmapPtr pPriv;
GCPtr pGC;
FBAreaPtr area;
pScreenPix = (*pScreen->GetScreenPixmap) (pScreen);
while (pLink) {
pPix = pLink->pPix;
pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
area = pLink->area;
data = pPix->devPrivate.ptr;
tmpPix = GetScratchPixmapHeader(pScreen,
pPix->drawable.width,
pPix->drawable.height,
pPix->drawable.depth,
pPix->drawable.bitsPerPixel,
pPix->devKind, data);
pPriv->freeData = FALSE;
pPix->drawable.x = area->box.x1;
pPix->drawable.y = area->box.y1;
pPix->devKind = pScreenPix->devKind;
pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
pPix->drawable.bitsPerPixel = infoRec->pScrn->bitsPerPixel;
pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
if (!tmpPix) {
pPriv->offscreenArea = area;
free(data);
pLink = pLink->next;
continue;
}
pGC = GetScratchGC(pPix->drawable.depth, pScreen);
ValidateGC((DrawablePtr) pPix, pGC);
(*pGC->ops->CopyArea) ((DrawablePtr) tmpPix, (DrawablePtr) pPix, pGC,
0, 0, pPix->drawable.width,
pPix->drawable.height, 0, 0);
free(data);
tmpPix->devPrivate.ptr = NULL;
FreeScratchGC(pGC);
FreeScratchPixmapHeader(tmpPix);
pPriv->offscreenArea = area;
pLink->area = NULL;
pLink = pLink->next;
}
}
void
XAARemoveAreaCallback(FBAreaPtr area)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(area->pScreen);
PixmapPtr pPix = (PixmapPtr) area->devPrivate.ptr;
XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
XAAMoveOutOffscreenPixmap(pPix);
pPriv->flags &= ~OFFSCREEN;
DELIST_OFFSCREEN_PIXMAP(pPix);
}
void
XAAMoveOutOffscreenPixmap(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
int width, height, devKind, bitsPerPixel;
PixmapPtr tmpPix;
unsigned char *data;
GCPtr pGC;
width = pPix->drawable.width;
height = pPix->drawable.height;
bitsPerPixel = pPix->drawable.bitsPerPixel;
devKind = BitmapBytePad(width * bitsPerPixel);
if (!(data = malloc(devKind * height)))
FatalError("Out of memory\n");
tmpPix = GetScratchPixmapHeader(pScreen, width, height,
pPix->drawable.depth, bitsPerPixel, devKind,
data);
if (!tmpPix) {
free(data);
FatalError("Out of memory\n");
}
pGC = GetScratchGC(pPix->drawable.depth, pScreen);
ValidateGC((DrawablePtr) tmpPix, pGC);
(*pGC->ops->CopyArea) ((DrawablePtr) pPix, (DrawablePtr) tmpPix,
pGC, 0, 0, width, height, 0, 0);
FreeScratchGC(pGC);
FreeScratchPixmapHeader(tmpPix);
pPix->drawable.x = 0;
pPix->drawable.y = 0;
pPix->devKind = devKind;
pPix->devPrivate.ptr = data;
pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pPriv->offscreenArea = NULL;
pPriv->freeData = TRUE;
}