1 /*
2 * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
3 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25 #include "scope.h"
26 #include "x11.h"
27 #include "renderscope.h"
28
29 /* Print the portion of the render request header common to all requests */
30 static inline void
RenderRequestHeader(FD fd,const unsigned char * buf)31 RenderRequestHeader(FD fd, const unsigned char *buf)
32 {
33 PrintField(buf, 0, 1, REQUEST, REQUESTHEADER); /* RenderRequest */
34 PrintField(buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER); /* minor op */
35 if (Verbose > 1)
36 PrintField(SBf, 0, 4, CARD32, "sequence number");
37 }
38
39 void
RenderQueryVersion(FD fd,const unsigned char * buf)40 RenderQueryVersion(FD fd, const unsigned char *buf)
41 {
42 RenderRequestHeader(fd, buf);
43 if (Verbose < 1)
44 return;
45
46 printreqlen(buf, fd, CONST2(2));
47 PrintField(buf, 4, 4, CARD32, "major-version");
48 PrintField(buf, 8, 4, CARD32, "minor-version");
49 }
50
51 void
RenderQueryVersionReply(FD fd,const unsigned char * buf)52 RenderQueryVersionReply(FD fd, const unsigned char *buf)
53 {
54 PrintField(RBf, 0, 1, REPLY, REPLYHEADER); /* RenderRequest reply */
55 PrintField(RBf, 1, 1, RENDERREPLY,
56 RENDERREPLYHEADER); /* RenderQueryVersion reply */
57 if (Verbose < 1)
58 return;
59 printfield(buf, 2, 2, CARD16, "sequence number");
60 printfield(buf, 4, 4, DVALUE4(0), "reply length");
61 PrintField(buf, 8, 4, CARD32, "major-version");
62 PrintField(buf, 12, 4, CARD32, "minor-version");
63 }
64
65 void
RenderQueryPictFormats(FD fd,const unsigned char * buf)66 RenderQueryPictFormats(FD fd, const unsigned char *buf)
67 {
68 RenderRequestHeader(fd, buf);
69 if (Verbose < 1)
70 return;
71
72 printreqlen(buf, fd, CONST2(2));
73 }
74
75 void
RenderQueryPictFormatsReply(FD fd,const unsigned char * buf)76 RenderQueryPictFormatsReply(FD fd, const unsigned char *buf)
77 {
78 long n;
79 long f;
80 long s;
81 long d;
82 long v;
83
84 PrintField(RBf, 0, 1, REPLY, REPLYHEADER); /* RenderRequest reply */
85 PrintField(RBf, 1, 1, RENDERREPLY,
86 RENDERREPLYHEADER); /* RenderQueryVersion reply */
87 if (Verbose < 1)
88 return;
89 printfield(buf, 2, 2, CARD16, "sequence number");
90 printfield(buf, 4, 4, DVALUE4(0), "reply length");
91 n = ILong(&buf[4]);
92 f = ILong(&buf[8]);
93 s = ILong(&buf[12]);
94 d = ILong(&buf[16]);
95 v = ILong(&buf[20]);
96 PrintList(&buf[32], (long) f, PICTFORMINFO, "pict-formats");
97 }
98
99 void
RenderQueryPictIndexValues(FD fd,const unsigned char * buf)100 RenderQueryPictIndexValues(FD fd, const unsigned char *buf)
101 {
102 RenderRequestHeader(fd, buf);
103 if (Verbose < 1)
104 return;
105
106 printreqlen(buf, fd, CONST2(2));
107 PrintField(buf, 4, 4, PICTFORMAT, "format");
108 }
109
110 void
RenderQueryPictIndexValuesReply(FD fd,const unsigned char * buf)111 RenderQueryPictIndexValuesReply(FD fd, const unsigned char *buf)
112 {
113 PrintField(RBf, 0, 1, REPLY, REPLYHEADER); /* RenderRequest reply */
114 PrintField(RBf, 1, 1, RENDERREPLY,
115 RENDERREPLYHEADER); /* RenderQueryVersion reply */
116 if (Verbose < 1)
117 return;
118 printfield(buf, 2, 2, CARD16, "sequence number");
119 printfield(buf, 4, 4, DVALUE4(0), "reply length");
120 }
121
122 void
RenderQueryDithers(FD fd,const unsigned char * buf)123 RenderQueryDithers(FD fd, const unsigned char *buf)
124 {
125 RenderRequestHeader(fd, buf);
126 if (Verbose < 1)
127 return;
128
129 printreqlen(buf, fd, CONST2(2));
130 }
131
132 void
RenderQueryDithersReply(FD fd,const unsigned char * buf)133 RenderQueryDithersReply(FD fd, const unsigned char *buf)
134 {
135 PrintField(RBf, 0, 1, REPLY, REPLYHEADER); /* RenderRequest reply */
136 PrintField(RBf, 1, 1, RENDERREPLY,
137 RENDERREPLYHEADER); /* RenderQueryVersion reply */
138 if (Verbose < 1)
139 return;
140 printfield(buf, 2, 2, CARD16, "sequence number");
141 printfield(buf, 4, 4, DVALUE4(0), "reply length");
142 }
143
144 void
RenderCreatePicture(FD fd,const unsigned char * buf)145 RenderCreatePicture(FD fd, const unsigned char *buf)
146 {
147 RenderRequestHeader(fd, buf);
148 if (Verbose < 1)
149 return;
150
151 printreqlen(buf, fd, DVALUE2(5 + n));
152 PrintField(buf, 4, 4, PICTURE, "picture");
153 PrintField(buf, 8, 4, DRAWABLE, "drawable");
154 PrintField(buf, 12, 4, PICTFORMAT, "format");
155 PrintField(buf, 16, 4, PICTURE_BITMASK, "value-mask");
156 PrintValues(&buf[16], 4, PICTURE_BITMASK, &buf[20], "value-list");
157 }
158
159 void
RenderChangePicture(FD fd,const unsigned char * buf)160 RenderChangePicture(FD fd, const unsigned char *buf)
161 {
162 RenderRequestHeader(fd, buf);
163 if (Verbose < 1)
164 return;
165
166 printreqlen(buf, fd, DVALUE2(3 + n));
167 PrintField(buf, 4, 4, PICTURE, "picture");
168 PrintField(buf, 8, 4, PICTURE_BITMASK, "value-mask");
169 PrintValues(&buf[8], 4, PICTURE_BITMASK, &buf[12], "value-list");
170 }
171
172 void
RenderSetPictureClipRectangles(FD fd,const unsigned char * buf)173 RenderSetPictureClipRectangles(FD fd, const unsigned char *buf)
174 {
175 RenderRequestHeader(fd, buf);
176 if (Verbose < 1)
177 return;
178
179 printreqlen(buf, fd, CONST2(2));
180 }
181
182 void
RenderFreePicture(FD fd,const unsigned char * buf)183 RenderFreePicture(FD fd, const unsigned char *buf)
184 {
185 RenderRequestHeader(fd, buf);
186 if (Verbose < 1)
187 return;
188
189 printreqlen(buf, fd, CONST2(2));
190 PrintField(buf, 4, 4, PICTURE, "picture");
191 }
192
193 void
RenderComposite(FD fd,const unsigned char * buf)194 RenderComposite(FD fd, const unsigned char *buf)
195 {
196 RenderRequestHeader(fd, buf);
197 if (Verbose < 1)
198 return;
199
200 printreqlen(buf, fd, CONST2(2));
201 PrintField(buf, 4, 1, PICTOP, "op");
202 PrintField(buf, 8, 4, PICTURE, "source");
203 PrintField(buf, 12, 4, PICTURE, "mask");
204 PrintField(buf, 16, 4, PICTURE, "dest");
205 PrintField(buf, 20, 2, INT16, "source x");
206 PrintField(buf, 22, 2, INT16, "source y");
207 PrintField(buf, 24, 2, INT16, "mask x");
208 PrintField(buf, 26, 2, INT16, "mask y");
209 PrintField(buf, 28, 2, INT16, "dest x");
210 PrintField(buf, 30, 2, INT16, "dest y");
211 PrintField(buf, 32, 2, CARD16, "width");
212 PrintField(buf, 34, 2, CARD16, "height");
213 }
214
215 void
RenderScale(FD fd,const unsigned char * buf)216 RenderScale(FD fd, const unsigned char *buf)
217 {
218 RenderRequestHeader(fd, buf);
219 if (Verbose < 1)
220 return;
221
222 printreqlen(buf, fd, CONST2(2));
223 PrintField(buf, 4, 4, PICTURE, "source");
224 PrintField(buf, 8, 4, PICTURE, "dest");
225 PrintField(buf, 12, 4, CARD32, "color scale");
226 PrintField(buf, 16, 4, CARD32, "alpha scale");
227 PrintField(buf, 20, 2, INT16, "source x");
228 PrintField(buf, 22, 2, INT16, "source y");
229 PrintField(buf, 24, 2, INT16, "dest x");
230 PrintField(buf, 26, 2, INT16, "dest y");
231 PrintField(buf, 28, 2, CARD16, "width");
232 PrintField(buf, 30, 2, CARD16, "height");
233 }
234
235 void
RenderTrapezoids(FD fd,const unsigned char * buf)236 RenderTrapezoids(FD fd, const unsigned char *buf)
237 {
238 int n;
239
240 RenderRequestHeader(fd, buf);
241 if (Verbose < 1)
242 return;
243
244 printreqlen(buf, fd, CONST2(2));
245 PrintField(buf, 4, 1, PICTOP, "op");
246 PrintField(buf, 8, 4, PICTURE, "source");
247 PrintField(buf, 12, 4, PICTURE, "dest");
248 PrintField(buf, 16, 4, PICTFORMAT, "mask format");
249 PrintField(buf, 20, 2, INT16, "source x");
250 PrintField(buf, 22, 2, INT16, "source y");
251
252 n = (CS[fd].requestLen - 6) / 10;
253 PrintList(&buf[24], (long) n, TRAPEZOID, "trapezoids");
254 }
255
256 void
RenderTriangles(FD fd,const unsigned char * buf)257 RenderTriangles(FD fd, const unsigned char *buf)
258 {
259 long n;
260
261 RenderRequestHeader(fd, buf);
262 if (Verbose < 1)
263 return;
264
265 printreqlen(buf, fd, CONST2(2));
266 PrintField(buf, 4, 1, PICTOP, "op");
267 PrintField(buf, 8, 4, PICTURE, "source");
268 PrintField(buf, 12, 4, PICTURE, "dest");
269 PrintField(buf, 16, 4, PICTFORMAT, "mask format");
270 PrintField(buf, 20, 2, INT16, "source x");
271 PrintField(buf, 22, 2, INT16, "source y");
272
273 n = (CS[fd].requestLen - 6) / 6;
274 PrintList(&buf[24], (long) n, TRIANGLE, "triangles");
275 }
276
277 void
RenderTriStrip(FD fd,const unsigned char * buf)278 RenderTriStrip(FD fd, const unsigned char *buf)
279 {
280 long n;
281
282 RenderRequestHeader(fd, buf);
283 if (Verbose < 1)
284 return;
285
286 printreqlen(buf, fd, CONST2(2));
287 PrintField(buf, 4, 1, PICTOP, "op");
288 PrintField(buf, 8, 4, PICTURE, "source");
289 PrintField(buf, 12, 4, PICTURE, "dest");
290 PrintField(buf, 16, 4, PICTFORMAT, "mask format");
291 PrintField(buf, 20, 2, INT16, "source x");
292 PrintField(buf, 22, 2, INT16, "source y");
293
294 n = (CS[fd].requestLen - 6) / 2;
295 PrintList(&buf[24], n, POINTFIXED, "points");
296 }
297
298 void
RenderTriFan(FD fd,const unsigned char * buf)299 RenderTriFan(FD fd, const unsigned char *buf)
300 {
301 long n;
302
303 RenderRequestHeader(fd, buf);
304 if (Verbose < 1)
305 return;
306
307 printreqlen(buf, fd, CONST2(2));
308 PrintField(buf, 4, 1, PICTOP, "op");
309 PrintField(buf, 8, 4, PICTURE, "source");
310 PrintField(buf, 12, 4, PICTURE, "dest");
311 PrintField(buf, 16, 4, PICTFORMAT, "mask format");
312 PrintField(buf, 20, 2, INT16, "source x");
313 PrintField(buf, 22, 2, INT16, "source y");
314
315 n = (CS[fd].requestLen - 6) / 2;
316 PrintList(&buf[24], n, POINTFIXED, "points");
317 }
318
319 void
RenderColorTrapezoids(FD fd,const unsigned char * buf)320 RenderColorTrapezoids(FD fd, const unsigned char *buf)
321 {
322 RenderRequestHeader(fd, buf);
323 if (Verbose < 1)
324 return;
325
326 printreqlen(buf, fd, CONST2(2));
327 }
328
329 void
RenderColorTriangles(FD fd,const unsigned char * buf)330 RenderColorTriangles(FD fd, const unsigned char *buf)
331 {
332 RenderRequestHeader(fd, buf);
333 if (Verbose < 1)
334 return;
335
336 printreqlen(buf, fd, CONST2(2));
337 }
338
339 void
RenderTransform(FD fd,const unsigned char * buf)340 RenderTransform(FD fd, const unsigned char *buf)
341 {
342 RenderRequestHeader(fd, buf);
343 if (Verbose < 1)
344 return;
345
346 printreqlen(buf, fd, CONST2(2));
347 }
348
349 void
RenderCreateGlyphSet(FD fd,const unsigned char * buf)350 RenderCreateGlyphSet(FD fd, const unsigned char *buf)
351 {
352 RenderRequestHeader(fd, buf);
353 if (Verbose < 1)
354 return;
355
356 printreqlen(buf, fd, CONST2(2));
357 PrintField(buf, 4, 4, GLYPHSET, "glyphset");
358 PrintField(buf, 8, 4, PICTFORMAT, "format");
359 }
360
361 void
RenderReferenceGlyphSet(FD fd,const unsigned char * buf)362 RenderReferenceGlyphSet(FD fd, const unsigned char *buf)
363 {
364 RenderRequestHeader(fd, buf);
365 if (Verbose < 1)
366 return;
367
368 printreqlen(buf, fd, CONST2(2));
369 PrintField(buf, 4, 4, GLYPHSET, "glyphset");
370 PrintField(buf, 4, 4, GLYPHSET, "existing");
371 }
372
373 void
RenderFreeGlyphSet(FD fd,const unsigned char * buf)374 RenderFreeGlyphSet(FD fd, const unsigned char *buf)
375 {
376 RenderRequestHeader(fd, buf);
377 if (Verbose < 1)
378 return;
379
380 printreqlen(buf, fd, CONST2(2));
381 PrintField(buf, 4, 4, GLYPHSET, "glyphset");
382 }
383
384 static void
PrintGlyphs(const unsigned char * buf,int n,const char * name)385 PrintGlyphs(const unsigned char *buf, int n, const char *name)
386 {
387 const unsigned char *gids;
388 const unsigned char *glyphs;
389 int i;
390
391 fprintf(stdout, "%s%20s:\n", Leader, name);
392 gids = buf;
393 glyphs = gids + 4 * n;
394 for (i = 0; i < n; i++) {
395 PrintField(gids, 0, 4, CARD32, "glyphid");
396 PrintField(glyphs, 0, 2, CARD16, "width");
397 PrintField(glyphs, 2, 2, CARD16, "height");
398 PrintField(glyphs, 4, 2, INT16, "x");
399 PrintField(glyphs, 6, 2, INT16, "y");
400 PrintField(glyphs, 8, 2, INT16, "xOff");
401 PrintField(glyphs, 10, 2, INT16, "yOff");
402
403 glyphs += 12;
404 }
405 }
406
407 void
RenderAddGlyphs(FD fd,const unsigned char * buf)408 RenderAddGlyphs(FD fd, const unsigned char *buf)
409 {
410 RenderRequestHeader(fd, buf);
411 if (Verbose < 1)
412 return;
413
414 printreqlen(buf, fd, CONST2(2));
415 PrintField(buf, 4, 4, GLYPHSET, "glyphset");
416 PrintField(buf, 8, 4, CARD32, "nglyphs");
417 PrintGlyphs(&buf[12], ILong(&buf[8]), "glyphs");
418 }
419
420 void
RenderAddGlyphsFromPicture(FD fd,const unsigned char * buf)421 RenderAddGlyphsFromPicture(FD fd, const unsigned char *buf)
422 {
423 RenderRequestHeader(fd, buf);
424 if (Verbose < 1)
425 return;
426
427 printreqlen(buf, fd, CONST2(2));
428 PrintField(buf, 4, 4, GLYPHSET, "glyphset");
429 /* Todo: print list of glyphs */
430 }
431
432 void
RenderFreeGlyphs(FD fd,const unsigned char * buf)433 RenderFreeGlyphs(FD fd, const unsigned char *buf)
434 {
435 uint32_t n;
436
437 RenderRequestHeader(fd, buf);
438 if (Verbose < 1)
439 return;
440
441 n = (getreqlen(fd, buf) - 2);
442 printreqlen(buf, fd, CONST2(2));
443 PrintField(buf, 4, 4, GLYPHSET, "glyphset");
444 (void) PrintList(&buf[8], (long) n, CARD32, "glyphs");
445 }
446
447 static void
PrintGlyphList(const unsigned char * buf,int length,const char * name,int size)448 PrintGlyphList(const unsigned char *buf, int length, const char *name, int size)
449 {
450 short n;
451
452 fprintf(stdout, "%s%20s:\n", Leader, name);
453 while (length >= 8) {
454 n = IByte(&buf[0]);
455 if (n != 255) {
456 printfield(buf, 0, 1, CARD8, "length");
457 PrintField(buf, 4, 2, INT16, "delta x");
458 PrintField(buf, 6, 2, INT16, "delta y");
459
460 switch (size) {
461 case 1:
462 PrintTString8(&buf[8], (long) n, "glyph item 8 string");
463 break;
464 case 2:
465 PrintTString16(&buf[8], (long) n, "glyph item 16 string");
466 break;
467 case 4:
468 break;
469 }
470 n = ((n * size + 8) + 3) & ~3;
471 buf += n;
472 length -= n;
473 }
474 else {
475 PrintField(buf, 8, 4, GLYPHSET, "glyphset");
476 buf += 12;
477 length -= 12;
478 }
479 }
480 }
481
482 void
RenderCompositeGlyphs8(FD fd,const unsigned char * buf)483 RenderCompositeGlyphs8(FD fd, const unsigned char *buf)
484 {
485 int n;
486
487 RenderRequestHeader(fd, buf);
488 if (Verbose < 1)
489 return;
490
491 printreqlen(buf, fd, CONST2(2));
492 n = (CS[fd].requestLen - 7) * 4;
493 PrintField(buf, 4, 1, PICTOP, "op");
494 PrintField(buf, 8, 4, PICTURE, "source");
495 PrintField(buf, 12, 4, PICTURE, "dest");
496 PrintField(buf, 16, 4, PICTFORMAT, "mask format");
497 PrintField(buf, 20, 4, GLYPHSET, "glyphset");
498 PrintField(buf, 24, 2, INT16, "x-src");
499 PrintField(buf, 26, 2, INT16, "y-src");
500 PrintGlyphList(&buf[28], n, "items", 1);
501 }
502
503 void
RenderCompositeGlyphs16(FD fd,const unsigned char * buf)504 RenderCompositeGlyphs16(FD fd, const unsigned char *buf)
505 {
506 int n;
507
508 RenderRequestHeader(fd, buf);
509 if (Verbose < 1)
510 return;
511
512 printreqlen(buf, fd, CONST2(2));
513 n = (CS[fd].requestLen - 7) * 4;
514
515 PrintField(buf, 4, 1, PICTOP, "op");
516 PrintField(buf, 8, 4, PICTURE, "source");
517 PrintField(buf, 12, 4, PICTURE, "dest");
518 PrintField(buf, 16, 4, PICTFORMAT, "mask format");
519 PrintField(buf, 20, 4, GLYPHSET, "glyphset");
520 PrintField(buf, 24, 2, INT16, "x-src");
521 PrintField(buf, 26, 2, INT16, "y-src");
522 PrintGlyphList(&buf[28], n, "items", 2);
523 }
524
525 void
RenderCompositeGlyphs32(FD fd,const unsigned char * buf)526 RenderCompositeGlyphs32(FD fd, const unsigned char *buf)
527 {
528 int n;
529
530 RenderRequestHeader(fd, buf);
531 if (Verbose < 1)
532 return;
533
534 printreqlen(buf, fd, CONST2(2));
535 n = (CS[fd].requestLen - 7) * 4;
536 PrintField(buf, 4, 1, PICTOP, "op");
537 PrintField(buf, 8, 4, PICTURE, "source");
538 PrintField(buf, 12, 4, PICTURE, "dest");
539 PrintField(buf, 16, 4, PICTFORMAT, "mask format");
540 PrintField(buf, 20, 4, GLYPHSET, "glyphset");
541 PrintField(buf, 24, 2, INT16, "x-src");
542 PrintField(buf, 26, 2, INT16, "y-src");
543 PrintGlyphList(&buf[28], n, "items", 4);
544 }
545
546 void
RenderFillRectangles(FD fd,const unsigned char * buf)547 RenderFillRectangles(FD fd, const unsigned char *buf)
548 {
549 int n;
550
551 RenderRequestHeader(fd, buf);
552 if (Verbose < 1)
553 return;
554
555 printreqlen(buf, fd, CONST2(2));
556 n = (CS[fd].requestLen - 5) / 2;
557 PrintField(buf, 4, 1, PICTOP, "op");
558 PrintField(buf, 8, 4, PICTURE, "dest");
559 PrintField(buf, 12, 8, RENDERCOLOR, "color");
560 (void) PrintList(&buf[20], (long) n, RECTANGLE, "rectangles");
561 }
562
563 void
RenderCreateCursor(FD fd,const unsigned char * buf)564 RenderCreateCursor(FD fd, const unsigned char *buf)
565 {
566 RenderRequestHeader(fd, buf);
567 if (Verbose < 1)
568 return;
569
570 printreqlen(buf, fd, CONST2(2));
571 PrintField(buf, 4, 4, CURSOR, "cursor-id");
572 PrintField(buf, 8, 4, PICTURE, "source");
573 PrintField(buf, 12, 2, CARD16, "x");
574 PrintField(buf, 14, 2, CARD16, "y");
575 }
576
577 void
RenderSetPictureTransform(FD fd,const unsigned char * buf)578 RenderSetPictureTransform(FD fd, const unsigned char *buf)
579 {
580 RenderRequestHeader(fd, buf);
581 if (Verbose < 1)
582 return;
583
584 printreqlen(buf, fd, CONST2(2));
585 PrintField(buf, 4, 4, PICTURE, "picture");
586 PrintField(buf, 8, 9 * 8, RENDERTRANSFORM, "transform");
587 }
588
589 void
RenderQueryFilters(FD fd,const unsigned char * buf)590 RenderQueryFilters(FD fd, const unsigned char *buf)
591 {
592 RenderRequestHeader(fd, buf);
593 if (Verbose < 1)
594 return;
595
596 printreqlen(buf, fd, CONST2(2));
597 PrintField(buf, 4, 4, DRAWABLE, "drawable");
598 }
599
600 void
RenderQueryFiltersReply(FD fd,const unsigned char * buf)601 RenderQueryFiltersReply(FD fd, const unsigned char *buf)
602 {
603 long a;
604 long f;
605
606 PrintField(RBf, 0, 1, REPLY, REPLYHEADER); /* RenderRequest reply */
607 PrintField(RBf, 1, 1, RENDERREPLY,
608 RENDERREPLYHEADER); /* RenderQueryFilters reply */
609 if (Verbose < 1)
610 return;
611 printfield(buf, 2, 2, CARD16, "sequence number");
612 printfield(buf, 4, 4, DVALUE4(0), "reply length");
613 a = ILong(&buf[8]);
614 f = ILong(&buf[12]);
615 PrintList(&buf[32], a, FILTERALIAS, "aliases");
616 PrintListSTR(&buf[32 + (2 * a)], f, "filters");
617 }
618
619 void
RenderSetPictureFilter(FD fd,const unsigned char * buf)620 RenderSetPictureFilter(FD fd, const unsigned char *buf)
621 {
622 int n;
623
624 RenderRequestHeader(fd, buf);
625 if (Verbose < 1)
626 return;
627
628 printreqlen(buf, fd, CONST2(2));
629 PrintField(buf, 4, 4, PICTURE, "picture");
630 n = IShort(&buf[8]);
631 PrintString8(&buf[12], n, "filter");
632 /* Todo: print list of optional values */
633 }
634
635 void
RenderCreateAnimCursor(FD fd,const unsigned char * buf)636 RenderCreateAnimCursor(FD fd, const unsigned char *buf)
637 {
638 RenderRequestHeader(fd, buf);
639 if (Verbose < 1)
640 return;
641
642 printreqlen(buf, fd, CONST2(2));
643 PrintField(buf, 4, 4, CURSOR, "cursor-id");
644 /* Todo: print list of cursor animation elements */
645 }
646
647 void
RenderAddTraps(FD fd,const unsigned char * buf)648 RenderAddTraps(FD fd, const unsigned char *buf)
649 {
650 int n;
651
652 RenderRequestHeader(fd, buf);
653 if (Verbose < 1)
654 return;
655
656 printreqlen(buf, fd, CONST2(2));
657 PrintField(buf, 4, 4, PICTURE, "picture");
658 PrintField(buf, 8, 2, CARD16, "xOff");
659 PrintField(buf, 10, 2, CARD16, "yOff");
660
661 n = (CS[fd].requestLen - 3) / 10;
662 PrintList(&buf[24], (long) n, TRAPEZOID, "trapezoids");
663 }
664
665 void
RenderCreateSolidFill(FD fd,const unsigned char * buf)666 RenderCreateSolidFill(FD fd, const unsigned char *buf)
667 {
668 RenderRequestHeader(fd, buf);
669 if (Verbose < 1)
670 return;
671
672 printreqlen(buf, fd, CONST2(2));
673 PrintField(buf, 4, 4, PICTURE, "picture");
674 PrintField(buf, 8, 8, RENDERCOLOR, "color");
675 }
676
677 void
RenderCreateLinearGradient(FD fd,const unsigned char * buf)678 RenderCreateLinearGradient(FD fd, const unsigned char *buf)
679 {
680 RenderRequestHeader(fd, buf);
681 if (Verbose < 1)
682 return;
683
684 printreqlen(buf, fd, CONST2(2));
685 PrintField(buf, 4, 4, PICTURE, "picture");
686 PrintField(buf, 8, 8, POINTFIXED, "p1");
687 PrintField(buf, 16, 8, POINTFIXED, "p2");
688 PrintField(buf, 24, 4, CARD32, "num stops");
689 /* Todo: print list of stops & colors for each */
690 }
691
692 void
RenderCreateRadialGradient(FD fd,const unsigned char * buf)693 RenderCreateRadialGradient(FD fd, const unsigned char *buf)
694 {
695 RenderRequestHeader(fd, buf);
696 if (Verbose < 1)
697 return;
698
699 printreqlen(buf, fd, CONST2(2));
700 PrintField(buf, 4, 4, PICTURE, "picture");
701 PrintField(buf, 8, 8, POINTFIXED, "inner");
702 PrintField(buf, 16, 8, POINTFIXED, "outer");
703 PrintField(buf, 24, 4, FIXED, "inner_radius");
704 PrintField(buf, 28, 4, FIXED, "outer_radius");
705 PrintField(buf, 32, 4, CARD32, "num stops");
706 /* Todo: print list of stops & colors for each */
707 }
708
709 void
RenderCreateConicalGradient(FD fd,const unsigned char * buf)710 RenderCreateConicalGradient(FD fd, const unsigned char *buf)
711 {
712 RenderRequestHeader(fd, buf);
713 if (Verbose < 1)
714 return;
715
716 printreqlen(buf, fd, CONST2(2));
717 PrintField(buf, 4, 4, PICTURE, "picture");
718 PrintField(buf, 8, 8, POINTFIXED, "center");
719 PrintField(buf, 16, 4, FIXED, "angle");
720 PrintField(buf, 20, 4, CARD32, "num stops");
721 /* Todo: print list of stops & colors for each */
722 }
723
724 void
RenderPictFormatError(FD fd,const unsigned char * buf)725 RenderPictFormatError(FD fd, const unsigned char *buf)
726 {
727 printErrorWithValue(buf, PICTFORMAT, "format");
728 }
729
730 void
RenderPictureError(FD fd,const unsigned char * buf)731 RenderPictureError(FD fd, const unsigned char *buf)
732 {
733 printErrorWithValue(buf, PICTURE, "picture");
734 }
735
736 void
RenderPictOpError(FD fd,const unsigned char * buf)737 RenderPictOpError(FD fd, const unsigned char *buf)
738 {
739 printErrorWithValue(buf, PICTOP, "pictop");
740 }
741
742 void
RenderGlyphSetError(FD fd,const unsigned char * buf)743 RenderGlyphSetError(FD fd, const unsigned char *buf)
744 {
745 printErrorWithValue(buf, GLYPHSET, "glyphset");
746 }
747
748 void
RenderGlyphError(FD fd,const unsigned char * buf)749 RenderGlyphError(FD fd, const unsigned char *buf)
750 {
751 printErrorWithValue(buf, CARD32, "glyph");
752 }
753