summaryrefslogtreecommitdiff
path: root/hw/xfree86/xf8_32wid/cfbwid.c
blob: 83258109351472f6c84198cca9e03fc3baf970c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/* $XFree86$ */

#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/misc.h>
#include "servermd.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "resource.h"
#include "colormap.h"
#include "colormapst.h"

#include "mfb.h"
#define PSZ 8
#include "cfb.h"
#undef PSZ
#include "cfb16.h"
#include "cfb24.h"
#include "cfb32.h"

#include "cfb8_32wid.h"

static void
WidFillBox1(DrawablePtr pixWid, DrawablePtr pWinDraw, int nbox, BoxPtr pBox)
{
	WindowPtr pWin = (WindowPtr) pWinDraw;
	cfb8_32WidScreenPtr pScreenPriv = 
		CFB8_32WID_GET_SCREEN_PRIVATE(pWin->drawable.pScreen);
	unsigned int wid = pScreenPriv->WIDOps->WidGet(pWin);

	if (wid & 1)
		mfbSolidWhiteArea((DrawablePtr)pWin, nbox, pBox, GXset, NullPixmap);
	else
		mfbSolidBlackArea((DrawablePtr)pWin, nbox, pBox, GXset, NullPixmap);
}

static void
WidCopyArea1(DrawablePtr pixWid, RegionPtr pRgn, DDXPointPtr pptSrc)
{
	mfbDoBitbltCopy(pixWid, pixWid, GXcopy, pRgn, pptSrc);
}

static void
WidFillBox8(DrawablePtr pixWid, DrawablePtr pWinDraw, int nbox, BoxPtr pBox)
{
	WindowPtr pWin = (WindowPtr) pWinDraw;
	cfb8_32WidScreenPtr pScreenPriv = 
		CFB8_32WID_GET_SCREEN_PRIVATE(pWin->drawable.pScreen);
	unsigned int wid = pScreenPriv->WIDOps->WidGet(pWin);

	cfbFillBoxSolid(pixWid, nbox, pBox, wid);
}

static void
WidCopyArea8(DrawablePtr pixWid, RegionPtr pRgn, DDXPointPtr pptSrc)
{
	cfbDoBitbltCopy(pixWid, pixWid, GXcopy, pRgn, pptSrc, ~0L);
}

static void
WidFillBox16(DrawablePtr pixWid, DrawablePtr pWinDraw, int nbox, BoxPtr pBox)
{
	WindowPtr pWin = (WindowPtr) pWinDraw;
	cfb8_32WidScreenPtr pScreenPriv = 
		CFB8_32WID_GET_SCREEN_PRIVATE(pWin->drawable.pScreen);
	unsigned int wid = pScreenPriv->WIDOps->WidGet(pWin);

	cfb16FillBoxSolid(pixWid, nbox, pBox, wid);
}

static void
WidCopyArea16(DrawablePtr pixWid, RegionPtr pRgn, DDXPointPtr pptSrc)
{
	cfb16DoBitbltCopy(pixWid, pixWid, GXcopy, pRgn, pptSrc, ~0L);
}

static void
WidFillBox24(DrawablePtr pixWid, DrawablePtr pWinDraw, int nbox, BoxPtr pBox)
{
	WindowPtr pWin = (WindowPtr) pWinDraw;
	cfb8_32WidScreenPtr pScreenPriv = 
		CFB8_32WID_GET_SCREEN_PRIVATE(pWin->drawable.pScreen);
	unsigned int wid = pScreenPriv->WIDOps->WidGet(pWin);

	cfb24FillBoxSolid(pixWid, nbox, pBox, wid);
}

static void
WidCopyArea24(DrawablePtr pixWid, RegionPtr pRgn, DDXPointPtr pptSrc)
{
	cfb24DoBitbltCopy(pixWid, pixWid, GXcopy, pRgn, pptSrc, ~0L);
}

static void
WidFillBox32(DrawablePtr pixWid, DrawablePtr pWinDraw, int nbox, BoxPtr pBox)
{
	WindowPtr pWin = (WindowPtr) pWinDraw;
	cfb8_32WidScreenPtr pScreenPriv = 
		CFB8_32WID_GET_SCREEN_PRIVATE(pWin->drawable.pScreen);
	unsigned int wid = pScreenPriv->WIDOps->WidGet(pWin);

	cfb32FillBoxSolid(pixWid, nbox, pBox, wid);
}

static void
WidCopyArea32(DrawablePtr pixWid, RegionPtr pRgn, DDXPointPtr pptSrc)
{
	cfb32DoBitbltCopy(pixWid, pixWid, GXcopy, pRgn, pptSrc, ~0L);
}

Bool
cfb8_32WidGenericOpsInit(cfb8_32WidScreenPtr pScreenPriv)
{
	cfb8_32WidOps *WIDOps = pScreenPriv->WIDOps;

	switch (pScreenPriv->bitsPerWid) {
	case 1:
		WIDOps->WidFillBox = WidFillBox1;
		WIDOps->WidCopyArea = WidCopyArea1;
		break;

	case 8:
		WIDOps->WidFillBox = WidFillBox8;
		WIDOps->WidCopyArea = WidCopyArea8;
		break;

	case 16:
		WIDOps->WidFillBox = WidFillBox16;
		WIDOps->WidCopyArea = WidCopyArea16;
		break;

	case 24:
		WIDOps->WidFillBox = WidFillBox24;
		WIDOps->WidCopyArea = WidCopyArea24;
		break;

	case 32:
		WIDOps->WidFillBox = WidFillBox32;
		WIDOps->WidCopyArea = WidCopyArea32;
		break;

	default:
		return FALSE;
	};

	return TRUE;
}