-
Notifications
You must be signed in to change notification settings - Fork 68
/
BitBltDispatch.h
149 lines (137 loc) · 4.52 KB
/
BitBltDispatch.h
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
148
149
/*
* Copyright © 2013 Raspberry Pi Foundation
* Copyright © 2013 RISC OS Open Ltd
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of the copyright holders not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. The copyright holders make no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
*/
#ifndef BITBLTDISPATCH_H_
#define BITBLTDISPATCH_H_
#include <stdbool.h>
#include "sqVirtualMachine.h"
#ifndef ColorMapPresent
#define ColorMapPresent 1
#define ColorMapFixedPart 2
#define ColorMapIndexedPart 4
#endif
typedef enum {
CR_clearWord, /* 0 */
CR_bitAnd, /* 1 */
CR_bitAndInvert, /* 2 */
CR_sourceWord, /* 3 */
CR_bitInvertAnd, /* 4 */
CR_destinationWord, /* 5 */
CR_bitXor, /* 6 */
CR_bitOr, /* 7 */
CR_bitInvertAndInvert, /* 8 */
CR_bitInvertXor, /* 9 */
CR_bitInvertDestination, /* 10 */
CR_bitOrInvert, /* 11 */
CR_bitInvertSource, /* 12 */
CR_bitInvertOr, /* 13 */
CR_bitInvertOrInvert, /* 14 */
CR_destinationWord_alt1, /* 15 */
CR_destinationWord_alt2, /* 16 */
CR_destinationWord_alt3, /* 17 */
CR_addWord, /* 18 */
CR_subWord, /* 19 */
CR_rgbAdd, /* 20 */
CR_rgbSub, /* 21 */
CR_OLDrgbDiff, /* 22 */
CR_OLDtallyIntoMap, /* 23 */
CR_alphaBlend, /* 24 */
CR_pixPaint, /* 25 */
CR_pixMask, /* 26 */
CR_rgbMax, /* 27 */
CR_rgbMin, /* 28 */
CR_rgbMinInvert, /* 29 */
CR_alphaBlendConst, /* 30 */
CR_alphaPaintConst, /* 31 */
CR_rgbDiff, /* 32 */
CR_tallyIntoMap, /* 33 */
CR_alphaBlendScaled, /* 34 */
CR_alphaBlendScaled_alt1, /* 35 */
CR_alphaBlendScaled_alt2, /* 36 */
CR_rgbMul, /* 37 */
CR_pixSwap, /* 38 */
CR_pixClear, /* 39 */
CR_fixAlpha, /* 40 */
CR_rgbComponentAlpha, /* 41 */
CR_any = -1u
}
combination_rule_t;
typedef enum {
MR_pixelMatch, /* 0 */
MR_notAnotB, /* 1 */
MR_notAmatchB, /* 2 */
}
match_rule_t;
typedef struct {
void *bits;
usqInt depth;
usqInt pitch;
bool msb;
sqInt x;
sqInt y;
}
src_or_dest_t;
typedef struct {
combination_rule_t combinationRule;
bool noSource;
src_or_dest_t src;
src_or_dest_t dest;
usqInt width;
usqInt height;
sqInt cmFlags;
int (*cmShiftTable)[4];
unsigned int (*cmMaskTable)[4];
usqInt cmMask;
unsigned int (*cmLookupTable)[];
bool noHalftone;
usqInt halftoneHeight;
sqInt (*halftoneBase)[];
union {
sqInt sourceAlpha;
struct {
sqInt componentAlphaModeColor;
sqInt componentAlphaModeAlpha;
unsigned char (*gammaLookupTable)[256];
unsigned char (*ungammaLookupTable)[256];
} componentAlpha;
} opt;
}
operation_t;
typedef struct {
match_rule_t matchRule;
bool tally;
src_or_dest_t srcA;
src_or_dest_t srcB;
usqInt width;
usqInt height;
usqInt colorA;
usqInt colorB;
}
compare_operation_t;
typedef usqInt (*compare_colors_fn_t)(const compare_operation_t *op, usqInt log2bppA, usqInt log2bppB);
extern compare_colors_fn_t compareColorsFns[3*2*3*3];
void initialiseCopyBits(void);
void copyBitsDispatch(operation_t *op);
sqInt compareColorsDispatch(const compare_operation_t *op);
#endif /* BITBLTDISPATCH_H_ */