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

« back to all changes in this revision

Viewing changes to hw/xfree86/xf8_32bpp/cfbbstore.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
/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbbstore.c,v 1.2 1999/01/31 12:22:17 dawes Exp $ */
 
2
 
 
3
#define PSZ 8
 
4
#ifdef HAVE_XORG_CONFIG_H
 
5
#include <xorg-config.h>
 
6
#endif
 
7
 
 
8
#include "cfb.h"
 
9
#undef PSZ
 
10
#include "cfb32.h"
 
11
#include "cfb8_32.h"
 
12
#include <X11/X.h>
 
13
#include "mibstore.h"
 
14
#include "regionstr.h"
 
15
#include "scrnintstr.h"
 
16
#include "pixmapstr.h"
 
17
#include "windowstr.h"
 
18
 
 
19
void
 
20
cfb8_32SaveAreas(
 
21
    PixmapPtr           pPixmap,
 
22
    RegionPtr           prgnSave, 
 
23
    int                 xorg,
 
24
    int                 yorg,
 
25
    WindowPtr           pWin
 
26
){
 
27
    DDXPointPtr pPt;
 
28
    DDXPointPtr pPtsInit;
 
29
    BoxPtr      pBox;
 
30
    int         i;
 
31
    ScreenPtr   pScreen = pPixmap->drawable.pScreen;
 
32
    PixmapPtr   pScrPix;
 
33
 
 
34
    if(pPixmap->drawable.bitsPerPixel == 32) {
 
35
        cfb32SaveAreas(pPixmap, prgnSave, xorg, yorg, pWin);
 
36
        return;
 
37
    }
 
38
    
 
39
    i = REGION_NUM_RECTS(prgnSave);
 
40
    pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec));
 
41
    if (!pPtsInit)
 
42
        return;
 
43
    
 
44
    pBox = REGION_RECTS(prgnSave);
 
45
    pPt = pPtsInit;
 
46
    while (--i >= 0) {
 
47
        pPt->x = pBox->x1 + xorg;
 
48
        pPt->y = pBox->y1 + yorg;
 
49
        pPt++;
 
50
        pBox++;
 
51
    }
 
52
 
 
53
    pScrPix = (PixmapPtr) pScreen->devPrivate;
 
54
 
 
55
    cfbDoBitblt32To8((DrawablePtr) pScrPix, (DrawablePtr)pPixmap,
 
56
                    GXcopy, prgnSave, pPtsInit, ~0L);
 
57
 
 
58
    DEALLOCATE_LOCAL (pPtsInit);
 
59
}
 
60
 
 
61
 
 
62
void
 
63
cfb8_32RestoreAreas(
 
64
    PixmapPtr           pPixmap, 
 
65
    RegionPtr           prgnRestore,
 
66
    int                 xorg,
 
67
    int                 yorg,
 
68
    WindowPtr           pWin
 
69
){
 
70
    DDXPointPtr pPt;
 
71
    DDXPointPtr pPtsInit;
 
72
    BoxPtr      pBox;
 
73
    int         i;
 
74
    ScreenPtr   pScreen = pPixmap->drawable.pScreen;
 
75
    PixmapPtr   pScrPix;
 
76
 
 
77
    i = REGION_NUM_RECTS(prgnRestore);
 
78
    pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i*sizeof(DDXPointRec));
 
79
    if (!pPtsInit)
 
80
        return;
 
81
    
 
82
    pBox = REGION_RECTS(prgnRestore);
 
83
    pPt = pPtsInit;
 
84
    while (--i >= 0) {
 
85
        pPt->x = pBox->x1 - xorg;
 
86
        pPt->y = pBox->y1 - yorg;
 
87
        pPt++;
 
88
        pBox++;
 
89
    }
 
90
 
 
91
    pScrPix = (PixmapPtr) pScreen->devPrivate;
 
92
 
 
93
    if(pPixmap->drawable.bitsPerPixel == 32) {
 
94
        if(pWin->drawable.depth == 24)
 
95
            cfb32DoBitbltCopy((DrawablePtr)pPixmap, (DrawablePtr) pScrPix,
 
96
                    GXcopy, prgnRestore, pPtsInit, 0x00ffffff);
 
97
        else
 
98
            cfb32DoBitbltCopy((DrawablePtr)pPixmap, (DrawablePtr) pScrPix,
 
99
                    GXcopy, prgnRestore, pPtsInit, ~0);
 
100
    } else {
 
101
        cfbDoBitblt8To32((DrawablePtr)pPixmap, (DrawablePtr) pScrPix,
 
102
                    GXcopy, prgnRestore, pPtsInit, ~0L);
 
103
    }
 
104
 
 
105
    DEALLOCATE_LOCAL (pPtsInit);
 
106
}