1
/* $XdotOrg: xserver/xorg/hw/xfree86/xaa/xaaPaintWin.c,v 1.6 2005/07/03 08:53:49 daniels Exp $ */
2
/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPaintWin.c,v 1.10 2001/10/28 03:34:04 tsi Exp $ */
4
#ifdef HAVE_XORG_CONFIG_H
5
#include <xorg-config.h>
10
#include "xf86_ansic.h"
11
#include "xf86_OSproc.h"
14
#include "scrnintstr.h"
15
#include "windowstr.h"
20
#include "pixmapstr.h"
24
#include "panoramiX.h"
25
#include "panoramiXsrv.h"
35
ScreenPtr pScreen = pWin->drawable.pScreen;
36
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
37
int nBox = REGION_NUM_RECTS(prgn);
38
BoxPtr pBox = REGION_RECTS(prgn);
40
PixmapPtr pPix = NULL;
42
if(!infoRec->pScrn->vtSema) goto BAILOUT;
46
switch(pWin->backgroundState) {
49
do { pWin = pWin->parent; }
50
while(pWin->backgroundState == ParentRelative);
51
(*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, what);
54
fg = pWin->background.pixel;
56
case BackgroundPixmap:
57
pPix = pWin->background.pixmap;
62
if (pWin->borderIsPixel)
63
fg = pWin->border.pixel;
65
pPix = pWin->border.pixmap;
72
if(infoRec->FillSolidRects &&
73
(!(infoRec->FillSolidRectsFlags & RGB_EQUAL) ||
74
(CHECK_RGB_EQUAL(fg))) ) {
75
(*infoRec->FillSolidRects)(infoRec->pScrn, fg, GXcopy, ~0,
80
XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
81
WindowPtr pBgWin = pWin;
85
/* Hack so we can use this with the dual framebuffer layers
86
which only support the pixmap cache in the primary bpp */
87
if(pPix->drawable.bitsPerPixel != infoRec->pScrn->bitsPerPixel)
90
if (what == PW_BORDER) {
92
pBgWin->backgroundState == ParentRelative;
93
pBgWin = pBgWin->parent);
96
xorg = pBgWin->drawable.x;
97
yorg = pBgWin->drawable.y;
100
if(!noPanoramiXExtension) {
101
int index = pScreen->myNum;
102
if(WindowTable[index] == pBgWin) {
103
xorg -= panoramiXdataPtr[index].x;
104
yorg -= panoramiXdataPtr[index].y;
109
if(IS_OFFSCREEN_PIXMAP(pPix) && infoRec->FillCacheBltRects) {
110
XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec);
112
pCache->x = pPriv->offscreenArea->box.x1;
113
pCache->y = pPriv->offscreenArea->box.y1;
114
pCache->w = pCache->orig_w =
115
pPriv->offscreenArea->box.x2 - pCache->x;
116
pCache->h = pCache->orig_h =
117
pPriv->offscreenArea->box.y2 - pCache->y;
118
pCache->trans_color = -1;
120
(*infoRec->FillCacheBltRects)(infoRec->pScrn, GXcopy, ~0,
121
nBox, pBox, xorg, yorg, pCache);
125
if(pPriv->flags & DIRTY) {
126
pPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
127
pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
130
if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
131
(infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
132
XAACheckTileReducibility(pPix, infoRec->CanDoMono8x8);
135
if(pPriv->flags & REDUCIBLE_TO_8x8) {
136
if((pPriv->flags & REDUCIBLE_TO_2_COLOR) &&
137
infoRec->CanDoMono8x8 && infoRec->FillMono8x8PatternRects &&
138
!(infoRec->FillMono8x8PatternRectsFlags & TRANSPARENCY_ONLY) &&
139
(!(infoRec->FillMono8x8PatternRectsFlags & RGB_EQUAL) ||
140
(CHECK_RGB_EQUAL(pPriv->fg) && CHECK_RGB_EQUAL(pPriv->bg)))) {
142
(*infoRec->FillMono8x8PatternRects)(infoRec->pScrn,
143
pPriv->fg, pPriv->bg, GXcopy, ~0, nBox, pBox,
144
pPriv->pattern0, pPriv->pattern1, xorg, yorg);
147
if(infoRec->CanDoColor8x8 && !NoCache &&
148
infoRec->FillColor8x8PatternRects) {
149
XAACacheInfoPtr pCache = (*infoRec->CacheColor8x8Pattern)(
150
infoRec->pScrn, pPix, -1, -1);
152
(*infoRec->FillColor8x8PatternRects) ( infoRec->pScrn,
153
GXcopy, ~0, nBox, pBox, xorg, yorg, pCache);
158
/* The window size check is to reduce pixmap cache thrashing
159
when there are lots of little windows with pixmap backgrounds
160
like are sometimes used for buttons, etc... */
162
if(infoRec->UsingPixmapCache &&
163
infoRec->FillCacheBltRects && !NoCache &&
164
((what == PW_BORDER) ||
165
(pPix->drawable.height != pWin->drawable.height) ||
166
(pPix->drawable.width != pWin->drawable.width)) &&
167
(pPix->drawable.height <= infoRec->MaxCacheableTileHeight) &&
168
(pPix->drawable.width <= infoRec->MaxCacheableTileWidth)) {
170
XAACacheInfoPtr pCache =
171
(*infoRec->CacheTile)(infoRec->pScrn, pPix);
172
(*infoRec->FillCacheBltRects)(infoRec->pScrn, GXcopy, ~0,
173
nBox, pBox, xorg, yorg, pCache);
177
if(infoRec->FillImageWriteRects &&
178
!(infoRec->FillImageWriteRectsFlags & NO_GXCOPY)) {
179
(*infoRec->FillImageWriteRects) (infoRec->pScrn, GXcopy,
180
~0, nBox, pBox, xorg, yorg, pPix);
186
if(infoRec->NeedToSync) {
187
(*infoRec->Sync)(infoRec->pScrn);
188
infoRec->NeedToSync = FALSE;
193
if(what == PW_BACKGROUND) {
194
XAA_SCREEN_PROLOGUE (pScreen, PaintWindowBackground);
195
(*pScreen->PaintWindowBackground) (pWin, prgn, what);
196
XAA_SCREEN_EPILOGUE(pScreen, PaintWindowBackground, XAAPaintWindow);
198
XAA_SCREEN_PROLOGUE (pScreen, PaintWindowBorder);
199
(*pScreen->PaintWindowBorder) (pWin, prgn, what);
200
XAA_SCREEN_EPILOGUE(pScreen, PaintWindowBorder, XAAPaintWindow);