diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-08-12 22:19:42 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-08-12 22:22:47 -0700 |
commit | 20ae2b2fb439643cf75dc134a84ce21753c5ce70 (patch) | |
tree | 8c1ad934e0cbafabf8eabf196ec3ab321003a6c4 | |
parent | f6b577a009b1dd9e31e89768bc1ff516b47b8dc1 (diff) | |
download | xscope-20ae2b2fb439643cf75dc134a84ce21753c5ce70.tar.gz |
Update Render extension decoding from protocol rev 0.5 to 0.11
Filled in most, but not all, of the details for new & existing requests
Corrected print-outs several existing requests
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r-- | decode_render.c | 139 | ||||
-rw-r--r-- | print_render.c | 393 | ||||
-rw-r--r-- | renderscope.h | 11 | ||||
-rw-r--r-- | x11.h | 2 |
4 files changed, 430 insertions, 115 deletions
diff --git a/decode_render.c b/decode_render.c index 0eaafaa..cd10ee2 100644 --- a/decode_render.c +++ b/decode_render.c @@ -19,6 +19,35 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons + * to whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT + * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + * + * Except as contained in this notice, the name of a copyright holder + * shall not be used in advertising or otherwise to promote the sale, use + * or other dealings in this Software without prior written authorization + * of the copyright holder. + */ + #include <stdio.h> @@ -70,6 +99,16 @@ render_decode_req ( case 24: RenderCompositeGlyphs16 (fd, buf); break; case 25: RenderCompositeGlyphs32 (fd, buf); break; case 26: RenderFillRectangles (fd, buf); break; + case 27: RenderCreateCursor (fd, buf); break; + case 28: RenderSetPictureTransform (fd, buf); break; + case 29: RenderQueryFilters (fd, buf); ExtendedReplyExpected (fd, Major, Minor); break; + case 30: RenderSetPictureFilter (fd, buf); break; + case 31: RenderCreateAnimCursor (fd, buf); break; + case 32: RenderAddTraps (fd, buf); break; + case 33: RenderCreateSolidFill (fd, buf); break; + case 34: RenderCreateLinearGradient (fd, buf); break; + case 35: RenderCreateRadialGradient (fd, buf); break; + case 36: RenderCreateConicalGradient (fd, buf); break; default: ExtendedRequest(fd, buf); ExtendedReplyExpected(fd, Major, Minor); @@ -88,6 +127,7 @@ render_decode_reply ( case 1: RenderQueryPictFormatsReply (fd, buf); break; case 2: RenderQueryPictIndexValuesReply (fd, buf); break; case 3: RenderQueryDithersReply (fd, buf); break; + case 29: RenderQueryFiltersReply (fd, buf); break; default: UnknownReply(buf); break; } } @@ -233,6 +273,41 @@ PrintTRIANGLE ( return 24; } +static int +PrintFILTERALIAS ( + const unsigned char *buf) +{ + /* print a FILTERALIAS -- CARD16 plus -1 = None */ + short n = IShort (buf); + if (n == -1) + fprintf(stdout, "AliasNone"); + else + fprintf(stdout, "FILTERALIAS %04x", n); + return(2); +} + +static int +PrintRENDERTRANSFORM(const unsigned char *buf) +{ + const unsigned char *next = buf; + int i, j; + + for (i = 0 ; i < 3; i++) { + for (j = 0 ; j < 3; j++) { + long f = ILong(next); + next += 4; + fprintf(stdout, " %7.2f", f / 65536.0); + } + if (i < 2) { + fprintf(stdout, "\n%s%20s ", Leader, ""); + } else { + fprintf(stdout, "\n"); + } + } + return (next - buf); +} + + void InitializeRENDER ( const unsigned char *buf) @@ -280,12 +355,30 @@ InitializeRENDER ( DefineEValue(p, 24L, "RenderCompositeGlyphs16"); DefineEValue(p, 25L, "RenderCompositeGlyphs32"); DefineEValue(p, 26L, "RenderFillRectangles"); + /* Added in 0.5: */ + DefineEValue(p, 27L, "RenderCreateCursor"); + /* Added in 0.6: */ + DefineEValue(p, 28L, "RenderSetPictureTransform"); + DefineEValue(p, 29L, "RenderQueryFilters"); + DefineEValue(p, 30L, "RenderSetPictureFilter"); + /* Added in 0.8: */ + DefineEValue(p, 31L, "RenderCreateAnimCursor"); + /* Added in 0.9: */ + DefineEValue(p, 32L, "RenderAddTraps"); + /* Added in 0.10: */ + DefineEValue(p, 33L, "RenderCreateSolidFill"); + DefineEValue(p, 34L, "RenderCreateLinearGradient"); + DefineEValue(p, 35L, "RenderCreateRadialGradient"); + DefineEValue(p, 36L, "RenderCreateConicalGradient"); + /* no new requests in 0.11 */ p = DefineType(RENDERREPLY, ENUMERATED, "RENDERREPLY", (PrintProcType) PrintENUMERATED); DefineEValue (p, 0L, "QueryVersion"); DefineEValue (p, 1L, "QueryPictFormats"); DefineEValue (p, 2L, "QueryPictIndexValues"); DefineEValue (p, 3L, "QueryDithers"); + /* Added in 0.6: */ + DefineEValue (p, 29L, "QueryFilters"); DefineType(PICTURE, BUILTIN, "PICTURE", PrintPICTURE); DefineType(PICTFORMAT, BUILTIN, "PICTFORMAT", PrintPICTFORMAT); @@ -325,10 +418,56 @@ InitializeRENDER ( DefineEValue (p, 12L, "Add"); DefineEValue (p, 13L, "Saturate"); + /* Operators only available in version 0.2 */ + DefineEValue (p, 0x10, "PictOpDisjointClear"); + DefineEValue (p, 0x11, "PictOpDisjointSrc"); + DefineEValue (p, 0x12, "PictOpDisjointDst"); + DefineEValue (p, 0x13, "PictOpDisjointOver"); + DefineEValue (p, 0x14, "PictOpDisjointOverReverse"); + DefineEValue (p, 0x15, "PictOpDisjointIn"); + DefineEValue (p, 0x16, "PictOpDisjointInReverse"); + DefineEValue (p, 0x17, "PictOpDisjointOut"); + DefineEValue (p, 0x18, "PictOpDisjointOutReverse"); + DefineEValue (p, 0x19, "PictOpDisjointAtop"); + DefineEValue (p, 0x1a, "PictOpDisjointAtopReverse"); + DefineEValue (p, 0x1b, "PictOpDisjointXor"); + + DefineEValue (p, 0x20, "PictOpConjointClear"); + DefineEValue (p, 0x21, "PictOpConjointSrc"); + DefineEValue (p, 0x22, "PictOpConjointDst"); + DefineEValue (p, 0x23, "PictOpConjointOver"); + DefineEValue (p, 0x24, "PictOpConjointOverReverse"); + DefineEValue (p, 0x25, "PictOpConjointIn"); + DefineEValue (p, 0x26, "PictOpConjointInReverse"); + DefineEValue (p, 0x27, "PictOpConjointOut"); + DefineEValue (p, 0x28, "PictOpConjointOutReverse"); + DefineEValue (p, 0x29, "PictOpConjointAtop"); + DefineEValue (p, 0x2a, "PictOpConjointAtopReverse"); + DefineEValue (p, 0x2b, "PictOpConjointXor"); + + /* Operators only available in version 0.11 */ + DefineEValue (p, 0x30, "PictOpMultiply"); + DefineEValue (p, 0x31, "PictOpScreen"); + DefineEValue (p, 0x32, "PictOpOverlay"); + DefineEValue (p, 0x33, "PictOpDarken"); + DefineEValue (p, 0x34, "PictOpLighten"); + DefineEValue (p, 0x35, "PictOpColorDodge"); + DefineEValue (p, 0x36, "PictOpColorBurn"); + DefineEValue (p, 0x37, "PictOpHardLight"); + DefineEValue (p, 0x38, "PictOpSoftLight"); + DefineEValue (p, 0x39, "PictOpDifference"); + DefineEValue (p, 0x3a, "PictOpExclusion"); + DefineEValue (p, 0x3b, "PictOpHSLHue"); + DefineEValue (p, 0x3c, "PictOpHSLSaturation"); + DefineEValue (p, 0x3d, "PictOpHSLColor"); + DefineEValue (p, 0x3e, "PictOpHSLLuminosity"); + DefineType(FIXED, BUILTIN, "FIXED", PrintFIXED); DefineType(POINTFIXED, BUILTIN, "POINTFIXED", PrintPOINTFIXED); DefineType(TRIANGLE, RECORD, "TRIANGLE", PrintTRIANGLE); DefineType(TRAPEZOID, RECORD, "TRAPEZOID", PrintTRAPEZOID); + DefineType(FILTERALIAS, BUILTIN, "FILTERALIAS", PrintFILTERALIAS); + DefineType(RENDERTRANSFORM, BUILTIN, "RENDERTRANSFORM", PrintRENDERTRANSFORM); InitializeExtensionDecoder(RENDERRequest, render_decode_req, render_decode_reply); diff --git a/print_render.c b/print_render.c index ed53929..c45a046 100644 --- a/print_render.c +++ b/print_render.c @@ -19,22 +19,59 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons + * to whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT + * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + * + * Except as contained in this notice, the name of a copyright holder + * shall not be used in advertising or otherwise to promote the sale, use + * or other dealings in this Software without prior written authorization + * of the copyright holder. + */ #include "scope.h" #include "x11.h" #include "renderscope.h" +/* Print the portion of the render request header common to all requests */ +static inline void +RenderRequestHeader (FD fd, const unsigned char *buf) +{ + PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; + PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* minor op */ ; + if (Verbose > 1) + PrintField(SBf, 0, 4, CARD32, "sequence number"); +} + void RenderQueryVersion (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, CARD32, "major-version"); + PrintField(buf, 8, 4, CARD32, "minor-version"); } void @@ -46,19 +83,16 @@ RenderQueryVersionReply (FD fd, const unsigned char *buf) return; printfield(buf, 2, 2, CARD16, "sequence number"); printfield(buf, 4, 4, DVALUE4(0), "reply length"); - PrintField(buf, 8, 2, CARD16, "major-version"); - PrintField(buf, 10, 2, CARD16, "minor-version"); + PrintField(buf, 8, 4, CARD32, "major-version"); + PrintField(buf, 12, 4, CARD32, "minor-version"); } void RenderQueryPictFormats (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); } @@ -89,14 +123,12 @@ RenderQueryPictFormatsReply (FD fd, const unsigned char *buf) void RenderQueryPictIndexValues (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, PICTFORMAT, "format"); } void @@ -113,12 +145,9 @@ RenderQueryPictIndexValuesReply (FD fd, const unsigned char *buf) void RenderQueryDithers (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); } @@ -137,12 +166,9 @@ RenderQueryDithersReply (FD fd, const unsigned char *buf) void RenderCreatePicture (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, DVALUE2(5+n)); PrintField(buf, 4, 4, PICTURE, "picture"); @@ -155,12 +181,9 @@ RenderCreatePicture (FD fd, const unsigned char *buf) void RenderChangePicture (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, DVALUE2(3+n)); PrintField(buf, 4, 4, PICTURE, "picture"); @@ -171,12 +194,9 @@ RenderChangePicture (FD fd, const unsigned char *buf) void RenderSetPictureClipRectangles (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); } @@ -184,60 +204,71 @@ RenderSetPictureClipRectangles (FD fd, const unsigned char *buf) void RenderFreePicture (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, PICTURE, "picture"); } void RenderComposite (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); + PrintField (buf, 4, 1, PICTOP, "op"); + PrintField(buf, 8, 4, PICTURE, "source"); + PrintField(buf, 12, 4, PICTURE, "mask"); + PrintField(buf, 16, 4, PICTURE, "dest"); + PrintField(buf, 20, 2, INT16, "source x"); + PrintField(buf, 22, 2, INT16, "source y"); + PrintField(buf, 24, 2, INT16, "mask x"); + PrintField(buf, 26, 2, INT16, "mask y"); + PrintField(buf, 28, 2, INT16, "dest x"); + PrintField(buf, 30, 2, INT16, "dest y"); + PrintField(buf, 32, 2, CARD16, "width"); + PrintField(buf, 34, 2, CARD16, "height"); } void RenderScale (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, PICTURE, "source"); + PrintField(buf, 8, 4, PICTURE, "dest"); + PrintField(buf, 12, 4, CARD32, "color scale"); + PrintField(buf, 16, 4, CARD32, "alpha scale"); + PrintField(buf, 20, 2, INT16, "source x"); + PrintField(buf, 22, 2, INT16, "source y"); + PrintField(buf, 24, 2, INT16, "dest x"); + PrintField(buf, 26, 2, INT16, "dest y"); + PrintField(buf, 28, 2, CARD16, "width"); + PrintField(buf, 30, 2, CARD16, "height"); } void RenderTrapezoids (FD fd, const unsigned char *buf) { int n; - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); PrintField (buf, 4, 1, PICTOP, "op"); PrintField(buf, 8, 4, PICTURE, "source"); PrintField(buf, 12, 4, PICTURE, "dest"); PrintField(buf, 16, 4, PICTFORMAT, "mask format"); - PrintField(buf, 20, 2, CARD16, "source x"); - PrintField(buf, 22, 2, CARD16, "source y"); + PrintField(buf, 20, 2, INT16, "source x"); + PrintField(buf, 22, 2, INT16, "source y"); n = (CS[fd].requestLen - 6) / 10; PrintList(&buf[24], (long)n, TRAPEZOID, "trapezoids"); } @@ -246,20 +277,17 @@ void RenderTriangles (FD fd, const unsigned char *buf) { long n; - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); PrintField (buf, 4, 1, PICTOP, "op"); PrintField(buf, 8, 4, PICTURE, "source"); PrintField(buf, 12, 4, PICTURE, "dest"); PrintField(buf, 16, 4, PICTFORMAT, "mask format"); - PrintField(buf, 20, 2, CARD16, "source x"); - PrintField(buf, 22, 2, CARD16, "source y"); + PrintField(buf, 20, 2, INT16, "source x"); + PrintField(buf, 22, 2, INT16, "source y"); n = (CS[fd].requestLen - 6) / 6; PrintList(&buf[24], (long)n, TRIANGLE, "triangles"); } @@ -267,38 +295,47 @@ RenderTriangles (FD fd, const unsigned char *buf) void RenderTriStrip (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + long n; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); + PrintField (buf, 4, 1, PICTOP, "op"); + PrintField(buf, 8, 4, PICTURE, "source"); + PrintField(buf, 12, 4, PICTURE, "dest"); + PrintField(buf, 16, 4, PICTFORMAT, "mask format"); + PrintField(buf, 20, 2, INT16, "source x"); + PrintField(buf, 22, 2, INT16, "source y"); + n = (CS[fd].requestLen - 6) / 2; + PrintList(&buf[24], n, POINTFIXED, "points"); } void RenderTriFan (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + long n; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); + PrintField (buf, 4, 1, PICTOP, "op"); + PrintField(buf, 8, 4, PICTURE, "source"); + PrintField(buf, 12, 4, PICTURE, "dest"); + PrintField(buf, 16, 4, PICTFORMAT, "mask format"); + PrintField(buf, 20, 2, INT16, "source x"); + PrintField(buf, 22, 2, INT16, "source y"); + n = (CS[fd].requestLen - 6) / 2; + PrintList(&buf[24], n, POINTFIXED, "points"); } void RenderColorTrapezoids (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); } @@ -306,12 +343,9 @@ RenderColorTrapezoids (FD fd, const unsigned char *buf) void RenderColorTriangles (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); } @@ -319,12 +353,9 @@ RenderColorTriangles (FD fd, const unsigned char *buf) void RenderTransform (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); } @@ -332,12 +363,9 @@ RenderTransform (FD fd, const unsigned char *buf) void RenderCreateGlyphSet (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, GLYPHSET, "glyphset"); @@ -347,25 +375,21 @@ RenderCreateGlyphSet (FD fd, const unsigned char *buf) void RenderReferenceGlyphSet (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, GLYPHSET, "glyphset"); + PrintField(buf, 4, 4, GLYPHSET, "existing"); } void RenderFreeGlyphSet (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, GLYPHSET, "glyphset"); @@ -397,12 +421,9 @@ PrintGlyphs(const unsigned char *buf, int n, char *name) void RenderAddGlyphs (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, GLYPHSET, "glyphset"); @@ -413,27 +434,22 @@ RenderAddGlyphs (FD fd, const unsigned char *buf) void RenderAddGlyphsFromPicture (FD fd, const unsigned char *buf) { - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); - + PrintField(buf, 4, 4, GLYPHSET, "glyphset"); + /* Todo: print list of glyphs */ } void RenderFreeGlyphs (FD fd, const unsigned char *buf) { unsigned short n; - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); PrintField(buf, 4, 4, GLYPHSET, "glyphset"); @@ -481,12 +497,9 @@ RenderCompositeGlyphs8 (FD fd, const unsigned char *buf) { int n; - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); n = (CS[fd].requestLen - 7) * 4; @@ -505,12 +518,9 @@ RenderCompositeGlyphs16 (FD fd, const unsigned char *buf) { int n; - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); n = (CS[fd].requestLen - 7) * 4; @@ -530,12 +540,9 @@ RenderCompositeGlyphs32 (FD fd, const unsigned char *buf) { int n; - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); n = (CS[fd].requestLen - 7) * 4; @@ -553,12 +560,9 @@ void RenderFillRectangles (FD fd, const unsigned char *buf) { int n; - PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; - PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; + RenderRequestHeader (fd, buf); if (Verbose < 1) return; - if (Verbose > 1) - PrintField(SBf, 0, 4, CARD32, "sequence number"); printreqlen(buf, fd, CONST2(2)); n = (CS[fd].requestLen - 5) / 2; @@ -569,6 +573,165 @@ RenderFillRectangles (FD fd, const unsigned char *buf) } void +RenderCreateCursor (FD fd, const unsigned char *buf) +{ + RenderRequestHeader (fd, buf); + if (Verbose < 1) + return; + + printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, CURSOR, "cursor-id"); + PrintField(buf, 8, 4, PICTURE, "source"); + PrintField(buf, 12, 2, CARD16, "x"); + PrintField(buf, 14, 2, CARD16, "y"); +} + +void +RenderSetPictureTransform (FD fd, const unsigned char *buf) +{ + RenderRequestHeader (fd, buf); + if (Verbose < 1) + return; + + printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, PICTURE, "picture"); + PrintField(buf, 8, 9 * 8, RENDERTRANSFORM, "transform"); +} + +void +RenderQueryFilters (FD fd, const unsigned char *buf) +{ + RenderRequestHeader (fd, buf); + if (Verbose < 1) + return; + + printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, DRAWABLE, "drawable"); +} + +void +RenderQueryFiltersReply (FD fd, const unsigned char *buf) +{ + long a; + long f; + + PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RenderRequest reply */ ; + PrintField(RBf, 1, 1, RENDERREPLY, RENDERREPLYHEADER) /* RenderQueryFilters reply */; + if (Verbose < 1) + return; + printfield(buf, 2, 2, CARD16, "sequence number"); + printfield(buf, 4, 4, DVALUE4(0), "reply length"); + a = ILong (&buf[8]); + f = ILong (&buf[12]); + PrintList (&buf[32], a, FILTERALIAS, "aliases"); + PrintListSTR (&buf[32 + (2 * a)], f, "filters"); +} + + +void +RenderSetPictureFilter (FD fd, const unsigned char *buf) +{ + int n; + RenderRequestHeader (fd, buf); + if (Verbose < 1) + return; + + printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, PICTURE, "picture"); + n = IShort(&buf[8]); + PrintString8(&buf[12], n, "filter"); + /* Todo: print list of optional values */ +} + +void +RenderCreateAnimCursor (FD fd, const unsigned char *buf) +{ + RenderRequestHeader (fd, buf); + if (Verbose < 1) + return; + + printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, CURSOR, "cursor-id"); + /* Todo: print list of cursor animation elements */ +} + +void +RenderAddTraps (FD fd, const unsigned char *buf) +{ + int n; + RenderRequestHeader (fd, buf); + if (Verbose < 1) + return; + + printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, PICTURE, "picture"); + PrintField(buf, 8, 2, CARD16, "xOff"); + PrintField(buf, 10, 2, CARD16, "yOff"); + n = (CS[fd].requestLen - 3) / 10; + PrintList(&buf[24], (long)n, TRAPEZOID, "trapezoids"); +} + +void +RenderCreateSolidFill (FD fd, const unsigned char *buf) +{ + RenderRequestHeader (fd, buf); + if (Verbose < 1) + return; + + printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, PICTURE, "picture"); + PrintField(buf, 8, 8, RENDERCOLOR, "color"); +} + +void +RenderCreateLinearGradient (FD fd, const unsigned char *buf) +{ + RenderRequestHeader (fd, buf); + if (Verbose < 1) + return; + + printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, PICTURE, "picture"); + PrintField(buf, 8, 8, POINTFIXED, "p1"); + PrintField(buf, 16, 8, POINTFIXED, "p2"); + PrintField(buf, 24, 4, CARD32, "num stops"); + /* Todo: print list of stops & colors for each */ +} + +void +RenderCreateRadialGradient (FD fd, const unsigned char *buf) +{ + RenderRequestHeader (fd, buf); + if (Verbose < 1) + return; + + printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, PICTURE, "picture"); + PrintField(buf, 8, 8, POINTFIXED, "inner"); + PrintField(buf, 16, 8, POINTFIXED, "outer"); + PrintField(buf, 24, 4, FIXED, "inner_radius"); + PrintField(buf, 28, 4, FIXED, "outer_radius"); + PrintField(buf, 32, 4, CARD32, "num stops"); + /* Todo: print list of stops & colors for each */ +} + +void +RenderCreateConicalGradient (FD fd, const unsigned char *buf) +{ + RenderRequestHeader (fd, buf); + if (Verbose < 1) + return; + + printreqlen(buf, fd, CONST2(2)); + PrintField(buf, 4, 4, PICTURE, "picture"); + PrintField(buf, 8, 8, POINTFIXED, "center"); + PrintField(buf, 16, 4, FIXED, "angle"); + PrintField(buf, 20, 4, CARD32, "num stops"); + /* Todo: print list of stops & colors for each */ +} + + +void RenderPictFormatError (FD fd, const unsigned char *buf) { PrintField(buf, 1, 1, ERROR, ERRORHEADER) /* Request */ ; diff --git a/renderscope.h b/renderscope.h index f38224f..db9e718 100644 --- a/renderscope.h +++ b/renderscope.h @@ -43,6 +43,17 @@ extern void RenderCompositeGlyphs8 (FD fd, const unsigned char *buf); extern void RenderCompositeGlyphs16 (FD fd, const unsigned char *buf); extern void RenderCompositeGlyphs32 (FD fd, const unsigned char *buf); extern void RenderFillRectangles (FD fd, const unsigned char *buf); +extern void RenderCreateCursor (FD fd, const unsigned char *buf); +extern void RenderSetPictureTransform (FD fd, const unsigned char *buf); +extern void RenderQueryFilters (FD fd, const unsigned char *buf); +extern void RenderQueryFiltersReply (FD fd, const unsigned char *buf); +extern void RenderSetPictureFilter (FD fd, const unsigned char *buf); +extern void RenderCreateAnimCursor (FD fd, const unsigned char *buf); +extern void RenderAddTraps (FD fd, const unsigned char *buf); +extern void RenderCreateSolidFill (FD fd, const unsigned char *buf); +extern void RenderCreateLinearGradient (FD fd, const unsigned char *buf); +extern void RenderCreateRadialGradient (FD fd, const unsigned char *buf); +extern void RenderCreateConicalGradient (FD fd, const unsigned char *buf); extern void RenderPictFormatError (FD fd, const unsigned char *buf); extern void RenderPictureError (FD fd, const unsigned char *buf); @@ -245,6 +245,8 @@ #define TRIANGLE 143 #define POINTFIXED 144 #define FIXED 145 +#define FILTERALIAS 146 +#define RENDERTRANSFORM 147 #define RANDRREQUEST 150 #define RANDRREPLY 151 |