File: ClientCache.H

package info (click to toggle)
dxpc 3.9.2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,140 kB
  • ctags: 1,253
  • sloc: cpp: 12,036; sh: 2,823; makefile: 78
file content (205 lines) | stat: -rw-r--r-- 5,755 bytes parent folder | download | duplicates (3)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#ifndef ClientCache_H
# define ClientCache_H

# include "constants.H"
# include "EncodeBuffer.H"
# include "IntCache.H"
# include "CharCache.H"
# include "TextCompressor.H"
# include "HuffmanCoder.H"
# include "PixelCache.H"
# include "LastPixels.H"


static const unsigned int PUT_IMAGE_PIXEL_CACHE_SIZE = 251;
static const unsigned int CLIENT_TEXT_CACHE_SIZE = 9999;


class ClientCache
{
  public:
    ClientCache();
    ~ClientCache();

    // General-purpose caches:
    CharCache textCache[CLIENT_TEXT_CACHE_SIZE];
    IntCache cursorCache;
    IntCache gcCache;
    IntCache drawableCache;
    IntCache windowCache;
    IntCache colormapCache;
    IntCache visualCache;
    CharCache depthCache;
    unsigned int lastFont;
    unsigned int lastRequestSequenceNum;

    // Opcode prediction caches (predict next opcode based on previous one)
    CharCache opcodeCache[256];
    unsigned char lastOpcode;

    // AllocColor request
    IntCache *allocColorRGBCache[3];

    // ChangeProperty request
    CharCache changePropertyFormatCache;
    IntCache changePropertyPropertyCache;
    IntCache changePropertyTypeCache;
    IntCache changePropertyData32Cache;
    TextCompressor changePropertyTextCompressor;

    // ClearArea request
    IntCache *clearAreaGeomCache[4];

    // ConfigureWindow request
    IntCache configureWindowBitmaskCache;
    IntCache *configureWindowAttrCache[7];

    // ConvertSelection request
    IntCache convertSelectionRequestorCache;
    IntCache *convertSelectionAtomCache[3];
    unsigned int convertSelectionLastTimestamp;

    // CopyArea request
    IntCache *copyAreaGeomCache[6];

    // CopyPlane request
    IntCache *copyPlaneGeomCache[6];
    IntCache copyPlaneBitPlaneCache;

    // CreateGC request
    IntCache createGCBitmaskCache;
    IntCache *createGCAttrCache[23];

    // CreatePixmap request
    unsigned int createPixmapLastPixmap;
    IntCache createPixmapXCache;
    IntCache createPixmapYCache;

    // CreateWindow request
    IntCache *createWindowGeomCache[6];
    IntCache createWindowBitmaskCache;
    IntCache *createWindowAttrCache[15];

    // FillPoly request
    IntCache fillPolyNumPointsCache;
    IntCache *fillPolyXRelCache[FILL_POLY_MAX_POINTS];
    IntCache *fillPolyXAbsCache[FILL_POLY_MAX_POINTS];
    IntCache *fillPolyYRelCache[FILL_POLY_MAX_POINTS];
    IntCache *fillPolyYAbsCache[FILL_POLY_MAX_POINTS];
    unsigned int fillPolyRecentX[8];
    unsigned int fillPolyRecentY[8];
    unsigned int fillPolyIndex;

    // GetSelectionOwner request
    IntCache getSelectionOwnerSelectionCache;

    // GrabButton request
    // (also used for GrabPointer)
    IntCache grabButtonEventMaskCache;
    IntCache grabButtonConfineCache;
    CharCache grabButtonButtonCache;
    IntCache grabButtonModifierCache;

    // GrabKeyboard request
    unsigned int grabKeyboardLastTimestamp;

    // ImageText8 request
    unsigned int imageText8LastX;
    unsigned int imageText8LastY;
    IntCache imageText8CacheX;
    IntCache imageText8CacheY;
    TextCompressor imageText8TextCompressor;

    // InternAtom request
    TextCompressor internAtomTextCompressor;

    // OpenFont request
    TextCompressor openFontTextCompressor;

    // PolyFillRectangle request
    IntCache *polyFillRectangleCacheX[2];
    IntCache *polyFillRectangleCacheY[2];
    IntCache *polyFillRectangleCacheWidth[2];
    IntCache *polyFillRectangleCacheHeight[2];

    // PolyLine request
    IntCache *polyLineCacheX[2];
    IntCache *polyLineCacheY[2];

    // PolyPoint request
    IntCache *polyPointCacheX[2];
    IntCache *polyPointCacheY[2];

    // PolyRectangle request
    IntCache *polyRectangleGeomCache[4];

    // PolySegment request
    IntCache polySegmentCacheX;
    IntCache polySegmentCacheY;
    unsigned int polySegmentLastX[2];
    unsigned int polySegmentLastY[2];
    unsigned int polySegmentCacheIndex;

    // PolyText8 request
    unsigned int polyText8LastX;
    unsigned int polyText8LastY;
    IntCache polyText8CacheX;
    IntCache polyText8CacheY;
    IntCache polyText8FontCache;
    CharCache polyText8DeltaCache;
    TextCompressor polyText8TextCompressor;

    // PutImage request
    IntCache putImageWidthCache;
    IntCache putImageHeightCache;
    unsigned int putImageLastX;
    unsigned int putImageLastY;
    IntCache putImageXCache;
    IntCache putImageYCache;
    CharCache putImageOffsetCache;
    HuffmanCoder putImagePixel0Coder;
    HuffmanCoder putImagePixel1Coder;
    HuffmanCoder putImageDiffCoder;
    PixelCache putImagePixelCache[PUT_IMAGE_PIXEL_CACHE_SIZE];
    LastPixels putImageLastPixels;
    HuffmanCoder columnPixel0Coder;
    HuffmanCoder columnPixel1Coder;
    unsigned int *putImageReferenceLine;
    unsigned int *putImageCodingLine;
    unsigned int putImageLineSize;
    CharCache putImageByteCache;

    // QueryColors request
    unsigned int queryColorsLastPixel;

    // SetClipRectangles request
    IntCache setClipRectanglesXCache;
    IntCache setClipRectanglesYCache;
    IntCache *setClipRectanglesGeomCache[4];

    // SetDashes request
    IntCache setDashesLengthCache;
    IntCache setDashesOffsetCache;
    CharCache setDashesDashCache_[2];

    // SetSelectionOwner request
    IntCache setSelectionOwnerCache;
    IntCache setSelectionOwnerTimestampCache;

    // TranslateCoords request
    IntCache translateCoordsSrcCache;
    IntCache translateCoordsDestCache;
    IntCache translateCoordsXCache;
    IntCache translateCoordsYCache;
};


// Codes for representing patterns between scan lines of a compressed bitmap:
enum ScanlineDiff
{
    SD_VERTICAL_0, SD_VERTICAL_PLUS_1, SD_VERTICAL_MINUS_1,
    SD_HORIZONTAL, SD_PASS, SD_VERTICAL_MINUS_2,
    SD_VERTICAL_PLUS_2, SD_NUM_CODES
};

#endif /* ClientCache_H */