~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/xfree86/xf8_16bpp/cfbwindow.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   Copyright (C) 1999.  The XFree86 Project Inc.
 
3
 
 
4
   Written by Mark Vojkovich (mvojkovi@ucsd.edu)
 
5
*/
 
6
 
 
7
/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c,v 1.4tsi Exp $ */
 
8
 
 
9
#ifdef HAVE_XORG_CONFIG_H
 
10
#include <xorg-config.h>
 
11
#endif
 
12
 
 
13
#include <X11/X.h>
 
14
#include "scrnintstr.h"
 
15
#include "windowstr.h"
 
16
#define PSZ 8
 
17
#include "cfb.h"
 
18
#undef PSZ
 
19
#include "cfb16.h"
 
20
#include "cfb8_16.h"
 
21
#include "mistruct.h"
 
22
#include "regionstr.h"
 
23
#include "cfbmskbits.h"
 
24
#include "xf86.h"
 
25
 
 
26
/* We don't bother with cfb's fastBackground/Border so we don't
 
27
   need to use the Window privates */
 
28
 
 
29
 
 
30
Bool
 
31
cfb8_16CreateWindow(WindowPtr pWin)
 
32
{
 
33
    cfbPrivWin *pPrivWin = cfbGetWindowPrivate(pWin);
 
34
 
 
35
    pPrivWin->pRotatedBorder = NullPixmap;
 
36
    pPrivWin->pRotatedBackground = NullPixmap;
 
37
    pPrivWin->fastBackground = FALSE;
 
38
    pPrivWin->fastBorder = FALSE;
 
39
    pPrivWin->oldRotate.x = 0;
 
40
    pPrivWin->oldRotate.y = 0;
 
41
 
 
42
    return TRUE;
 
43
}
 
44
 
 
45
 
 
46
Bool
 
47
cfb8_16DestroyWindow(WindowPtr pWin)
 
48
{
 
49
    return TRUE;
 
50
}
 
51
 
 
52
Bool
 
53
cfb8_16PositionWindow(
 
54
    WindowPtr pWin,
 
55
    int x, int y
 
56
){
 
57
    return TRUE;
 
58
}
 
59
 
 
60
 
 
61
void
 
62
cfb8_16CopyWindow(
 
63
    WindowPtr pWin,
 
64
    DDXPointRec ptOldOrg,
 
65
    RegionPtr prgnSrc
 
66
){
 
67
    ScreenPtr pScreen = pWin->drawable.pScreen;
 
68
    cfb8_16ScreenPtr pScreenPriv = 
 
69
                CFB8_16_GET_SCREEN_PRIVATE(pWin->drawable.pScreen);
 
70
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
 
71
    DDXPointPtr ppt, pptSrc;
 
72
    RegionRec rgnDst;
 
73
    BoxPtr pbox;
 
74
    int i, nbox, dx, dy;
 
75
    WindowPtr pRoot = WindowTable[pScreen->myNum];
 
76
 
 
77
    REGION_NULL(pScreen, &rgnDst);
 
78
 
 
79
    dx = ptOldOrg.x - pWin->drawable.x;
 
80
    dy = ptOldOrg.y - pWin->drawable.y;
 
81
    REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
 
82
    REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
 
83
 
 
84
    nbox = REGION_NUM_RECTS(&rgnDst);
 
85
    if(nbox &&
 
86
        (pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) {
 
87
 
 
88
        pbox = REGION_RECTS(&rgnDst);
 
89
        for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
 
90
            ppt->x = pbox->x1 + dx;
 
91
            ppt->y = pbox->y1 + dy;
 
92
        }
 
93
        cfbDoBitbltCopy((DrawablePtr)pRoot, (DrawablePtr)pRoot,
 
94
                                GXcopy, &rgnDst, pptSrc, ~0L);
 
95
        if(pWin->drawable.bitsPerPixel == 16)
 
96
            cfb16DoBitbltCopy((DrawablePtr)pScreenPriv->pix16, 
 
97
                              (DrawablePtr)pScreenPriv->pix16,
 
98
                                GXcopy, &rgnDst, pptSrc, ~0L);
 
99
 
 
100
        DEALLOCATE_LOCAL(pptSrc);
 
101
    }
 
102
 
 
103
    REGION_UNINIT(pScreen, &rgnDst);
 
104
 
 
105
    if(pWin->drawable.depth == 8) {
 
106
      REGION_NULL(pScreen, &rgnDst);
 
107
      miSegregateChildren(pWin, &rgnDst, pScrn->depth);
 
108
      if(REGION_NOTEMPTY(pScreen, &rgnDst)) {
 
109
        REGION_INTERSECT(pScreen, &rgnDst, &rgnDst, prgnSrc);
 
110
        nbox = REGION_NUM_RECTS(&rgnDst);
 
111
        if(nbox &&
 
112
          (pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))){
 
113
 
 
114
            pbox = REGION_RECTS(&rgnDst);
 
115
            for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
 
116
                ppt->x = pbox->x1 + dx;
 
117
                ppt->y = pbox->y1 + dy;
 
118
            }
 
119
 
 
120
            cfb16DoBitbltCopy((DrawablePtr)pScreenPriv->pix16, 
 
121
                              (DrawablePtr)pScreenPriv->pix16,
 
122
                              GXcopy, &rgnDst, pptSrc, ~0L);
 
123
            DEALLOCATE_LOCAL(pptSrc);
 
124
        }
 
125
      }
 
126
      REGION_UNINIT(pScreen, &rgnDst);
 
127
    }
 
128
}
 
129
 
 
130
Bool
 
131
cfb8_16ChangeWindowAttributes(
 
132
    WindowPtr pWin,
 
133
    unsigned long mask
 
134
){
 
135
    if (pWin->drawable.bitsPerPixel == 16)
 
136
        return cfb16ChangeWindowAttributes(pWin,mask);
 
137
    else
 
138
        return cfbChangeWindowAttributes(pWin,mask);
 
139
}
 
140
 
 
141
void
 
142
cfb8_16WindowExposures(
 
143
   WindowPtr pWin,
 
144
   RegionPtr pReg,
 
145
   RegionPtr pOtherReg
 
146
){
 
147
 
 
148
    if(REGION_NUM_RECTS(pReg) && (pWin->drawable.bitsPerPixel == 16)) {
 
149
        cfb8_16ScreenPtr pScreenPriv = 
 
150
                CFB8_16_GET_SCREEN_PRIVATE(pWin->drawable.pScreen);
 
151
 
 
152
        cfbFillBoxSolid((DrawablePtr)pScreenPriv->pix8,
 
153
                REGION_NUM_RECTS(pReg), REGION_RECTS(pReg),
 
154
                pScreenPriv->key);
 
155
    }
 
156
 
 
157
    miWindowExposures(pWin, pReg, pOtherReg);
 
158
}
 
159
 
 
160
 
 
161
void
 
162
cfb8_16PaintWindow (
 
163
    WindowPtr   pWin,
 
164
    RegionPtr   pRegion,
 
165
    int         what
 
166
){
 
167
    if(pWin->drawable.bitsPerPixel == 16) {
 
168
        cfb16PaintWindow(pWin, pRegion, what);
 
169
        if(what == PW_BORDER) {
 
170
            cfb8_16ScreenPtr pScreenPriv = 
 
171
                CFB8_16_GET_SCREEN_PRIVATE(pWin->drawable.pScreen);
 
172
 
 
173
            cfbFillBoxSolid((DrawablePtr)pScreenPriv->pix8,
 
174
                REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion),
 
175
                pScreenPriv->key);
 
176
        }
 
177
    } else
 
178
        cfbPaintWindow(pWin, pRegion, what);
 
179
 
 
180
}
 
181