1 /* 2 * This file generated automatically from render.xml by c_client.py. 3 * Edit at your peril. 4 */ 5 6 #ifdef HAVE_CONFIG_H 7 #include "config.h" 8 #endif 9 #include <stdlib.h> 10 #include <string.h> 11 #include <assert.h> 12 #include <stddef.h> /* for offsetof() */ 13 #include "xcbext.h" 14 #include "render.h" 15 16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) 17 #include "xproto.h" 18 19 xcb_extension_t xcb_render_id = { "RENDER", 0 }; 20 21 void 22 xcb_render_glyph_next (xcb_render_glyph_iterator_t *i) 23 { 24 --i->rem; 25 ++i->data; 26 i->index += sizeof(xcb_render_glyph_t); 27 } 28 29 xcb_generic_iterator_t 30 xcb_render_glyph_end (xcb_render_glyph_iterator_t i) 31 { 32 xcb_generic_iterator_t ret; 33 ret.data = i.data + i.rem; 34 ret.index = i.index + ((char *) ret.data - (char *) i.data); 35 ret.rem = 0; 36 return ret; 37 } 38 39 void 40 xcb_render_glyphset_next (xcb_render_glyphset_iterator_t *i) 41 { 42 --i->rem; 43 ++i->data; 44 i->index += sizeof(xcb_render_glyphset_t); 45 } 46 47 xcb_generic_iterator_t 48 xcb_render_glyphset_end (xcb_render_glyphset_iterator_t i) 49 { 50 xcb_generic_iterator_t ret; 51 ret.data = i.data + i.rem; 52 ret.index = i.index + ((char *) ret.data - (char *) i.data); 53 ret.rem = 0; 54 return ret; 55 } 56 57 void 58 xcb_render_picture_next (xcb_render_picture_iterator_t *i) 59 { 60 --i->rem; 61 ++i->data; 62 i->index += sizeof(xcb_render_picture_t); 63 } 64 65 xcb_generic_iterator_t 66 xcb_render_picture_end (xcb_render_picture_iterator_t i) 67 { 68 xcb_generic_iterator_t ret; 69 ret.data = i.data + i.rem; 70 ret.index = i.index + ((char *) ret.data - (char *) i.data); 71 ret.rem = 0; 72 return ret; 73 } 74 75 void 76 xcb_render_pictformat_next (xcb_render_pictformat_iterator_t *i) 77 { 78 --i->rem; 79 ++i->data; 80 i->index += sizeof(xcb_render_pictformat_t); 81 } 82 83 xcb_generic_iterator_t 84 xcb_render_pictformat_end (xcb_render_pictformat_iterator_t i) 85 { 86 xcb_generic_iterator_t ret; 87 ret.data = i.data + i.rem; 88 ret.index = i.index + ((char *) ret.data - (char *) i.data); 89 ret.rem = 0; 90 return ret; 91 } 92 93 void 94 xcb_render_fixed_next (xcb_render_fixed_iterator_t *i) 95 { 96 --i->rem; 97 ++i->data; 98 i->index += sizeof(xcb_render_fixed_t); 99 } 100 101 xcb_generic_iterator_t 102 xcb_render_fixed_end (xcb_render_fixed_iterator_t i) 103 { 104 xcb_generic_iterator_t ret; 105 ret.data = i.data + i.rem; 106 ret.index = i.index + ((char *) ret.data - (char *) i.data); 107 ret.rem = 0; 108 return ret; 109 } 110 111 void 112 xcb_render_directformat_next (xcb_render_directformat_iterator_t *i) 113 { 114 --i->rem; 115 ++i->data; 116 i->index += sizeof(xcb_render_directformat_t); 117 } 118 119 xcb_generic_iterator_t 120 xcb_render_directformat_end (xcb_render_directformat_iterator_t i) 121 { 122 xcb_generic_iterator_t ret; 123 ret.data = i.data + i.rem; 124 ret.index = i.index + ((char *) ret.data - (char *) i.data); 125 ret.rem = 0; 126 return ret; 127 } 128 129 void 130 xcb_render_pictforminfo_next (xcb_render_pictforminfo_iterator_t *i) 131 { 132 --i->rem; 133 ++i->data; 134 i->index += sizeof(xcb_render_pictforminfo_t); 135 } 136 137 xcb_generic_iterator_t 138 xcb_render_pictforminfo_end (xcb_render_pictforminfo_iterator_t i) 139 { 140 xcb_generic_iterator_t ret; 141 ret.data = i.data + i.rem; 142 ret.index = i.index + ((char *) ret.data - (char *) i.data); 143 ret.rem = 0; 144 return ret; 145 } 146 147 void 148 xcb_render_pictvisual_next (xcb_render_pictvisual_iterator_t *i) 149 { 150 --i->rem; 151 ++i->data; 152 i->index += sizeof(xcb_render_pictvisual_t); 153 } 154 155 xcb_generic_iterator_t 156 xcb_render_pictvisual_end (xcb_render_pictvisual_iterator_t i) 157 { 158 xcb_generic_iterator_t ret; 159 ret.data = i.data + i.rem; 160 ret.index = i.index + ((char *) ret.data - (char *) i.data); 161 ret.rem = 0; 162 return ret; 163 } 164 165 int 166 xcb_render_pictdepth_sizeof (const void *_buffer) 167 { 168 char *xcb_tmp = (char *)_buffer; 169 const xcb_render_pictdepth_t *_aux = (xcb_render_pictdepth_t *)_buffer; 170 unsigned int xcb_buffer_len = 0; 171 unsigned int xcb_block_len = 0; 172 unsigned int xcb_pad = 0; 173 unsigned int xcb_align_to = 0; 174 175 176 xcb_block_len += sizeof(xcb_render_pictdepth_t); 177 xcb_tmp += xcb_block_len; 178 xcb_buffer_len += xcb_block_len; 179 xcb_block_len = 0; 180 /* visuals */ 181 xcb_block_len += _aux->num_visuals * sizeof(xcb_render_pictvisual_t); 182 xcb_tmp += xcb_block_len; 183 xcb_align_to = ALIGNOF(xcb_render_pictvisual_t); 184 /* insert padding */ 185 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 186 xcb_buffer_len += xcb_block_len + xcb_pad; 187 if (0 != xcb_pad) { 188 xcb_tmp += xcb_pad; 189 xcb_pad = 0; 190 } 191 xcb_block_len = 0; 192 193 return xcb_buffer_len; 194 } 195 196 xcb_render_pictvisual_t * 197 xcb_render_pictdepth_visuals (const xcb_render_pictdepth_t *R) 198 { 199 return (xcb_render_pictvisual_t *) (R + 1); 200 } 201 202 int 203 xcb_render_pictdepth_visuals_length (const xcb_render_pictdepth_t *R) 204 { 205 return R->num_visuals; 206 } 207 208 xcb_render_pictvisual_iterator_t 209 xcb_render_pictdepth_visuals_iterator (const xcb_render_pictdepth_t *R) 210 { 211 xcb_render_pictvisual_iterator_t i; 212 i.data = (xcb_render_pictvisual_t *) (R + 1); 213 i.rem = R->num_visuals; 214 i.index = (char *) i.data - (char *) R; 215 return i; 216 } 217 218 void 219 xcb_render_pictdepth_next (xcb_render_pictdepth_iterator_t *i) 220 { 221 xcb_render_pictdepth_t *R = i->data; 222 xcb_generic_iterator_t child; 223 child.data = (xcb_render_pictdepth_t *)(((char *)R) + xcb_render_pictdepth_sizeof(R)); 224 i->index = (char *) child.data - (char *) i->data; 225 --i->rem; 226 i->data = (xcb_render_pictdepth_t *) child.data; 227 } 228 229 xcb_generic_iterator_t 230 xcb_render_pictdepth_end (xcb_render_pictdepth_iterator_t i) 231 { 232 xcb_generic_iterator_t ret; 233 while(i.rem > 0) 234 xcb_render_pictdepth_next(&i); 235 ret.data = i.data; 236 ret.rem = i.rem; 237 ret.index = i.index; 238 return ret; 239 } 240 241 int 242 xcb_render_pictscreen_sizeof (const void *_buffer) 243 { 244 char *xcb_tmp = (char *)_buffer; 245 const xcb_render_pictscreen_t *_aux = (xcb_render_pictscreen_t *)_buffer; 246 unsigned int xcb_buffer_len = 0; 247 unsigned int xcb_block_len = 0; 248 unsigned int xcb_pad = 0; 249 unsigned int xcb_align_to = 0; 250 251 unsigned int i; 252 unsigned int xcb_tmp_len; 253 254 xcb_block_len += sizeof(xcb_render_pictscreen_t); 255 xcb_tmp += xcb_block_len; 256 xcb_buffer_len += xcb_block_len; 257 xcb_block_len = 0; 258 /* depths */ 259 for(i=0; i<_aux->num_depths; i++) { 260 xcb_tmp_len = xcb_render_pictdepth_sizeof(xcb_tmp); 261 xcb_block_len += xcb_tmp_len; 262 xcb_tmp += xcb_tmp_len; 263 } 264 xcb_align_to = ALIGNOF(xcb_render_pictdepth_t); 265 /* insert padding */ 266 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 267 xcb_buffer_len += xcb_block_len + xcb_pad; 268 if (0 != xcb_pad) { 269 xcb_tmp += xcb_pad; 270 xcb_pad = 0; 271 } 272 xcb_block_len = 0; 273 274 return xcb_buffer_len; 275 } 276 277 int 278 xcb_render_pictscreen_depths_length (const xcb_render_pictscreen_t *R) 279 { 280 return R->num_depths; 281 } 282 283 xcb_render_pictdepth_iterator_t 284 xcb_render_pictscreen_depths_iterator (const xcb_render_pictscreen_t *R) 285 { 286 xcb_render_pictdepth_iterator_t i; 287 i.data = (xcb_render_pictdepth_t *) (R + 1); 288 i.rem = R->num_depths; 289 i.index = (char *) i.data - (char *) R; 290 return i; 291 } 292 293 void 294 xcb_render_pictscreen_next (xcb_render_pictscreen_iterator_t *i) 295 { 296 xcb_render_pictscreen_t *R = i->data; 297 xcb_generic_iterator_t child; 298 child.data = (xcb_render_pictscreen_t *)(((char *)R) + xcb_render_pictscreen_sizeof(R)); 299 i->index = (char *) child.data - (char *) i->data; 300 --i->rem; 301 i->data = (xcb_render_pictscreen_t *) child.data; 302 } 303 304 xcb_generic_iterator_t 305 xcb_render_pictscreen_end (xcb_render_pictscreen_iterator_t i) 306 { 307 xcb_generic_iterator_t ret; 308 while(i.rem > 0) 309 xcb_render_pictscreen_next(&i); 310 ret.data = i.data; 311 ret.rem = i.rem; 312 ret.index = i.index; 313 return ret; 314 } 315 316 void 317 xcb_render_indexvalue_next (xcb_render_indexvalue_iterator_t *i) 318 { 319 --i->rem; 320 ++i->data; 321 i->index += sizeof(xcb_render_indexvalue_t); 322 } 323 324 xcb_generic_iterator_t 325 xcb_render_indexvalue_end (xcb_render_indexvalue_iterator_t i) 326 { 327 xcb_generic_iterator_t ret; 328 ret.data = i.data + i.rem; 329 ret.index = i.index + ((char *) ret.data - (char *) i.data); 330 ret.rem = 0; 331 return ret; 332 } 333 334 void 335 xcb_render_color_next (xcb_render_color_iterator_t *i) 336 { 337 --i->rem; 338 ++i->data; 339 i->index += sizeof(xcb_render_color_t); 340 } 341 342 xcb_generic_iterator_t 343 xcb_render_color_end (xcb_render_color_iterator_t i) 344 { 345 xcb_generic_iterator_t ret; 346 ret.data = i.data + i.rem; 347 ret.index = i.index + ((char *) ret.data - (char *) i.data); 348 ret.rem = 0; 349 return ret; 350 } 351 352 void 353 xcb_render_pointfix_next (xcb_render_pointfix_iterator_t *i) 354 { 355 --i->rem; 356 ++i->data; 357 i->index += sizeof(xcb_render_pointfix_t); 358 } 359 360 xcb_generic_iterator_t 361 xcb_render_pointfix_end (xcb_render_pointfix_iterator_t i) 362 { 363 xcb_generic_iterator_t ret; 364 ret.data = i.data + i.rem; 365 ret.index = i.index + ((char *) ret.data - (char *) i.data); 366 ret.rem = 0; 367 return ret; 368 } 369 370 void 371 xcb_render_linefix_next (xcb_render_linefix_iterator_t *i) 372 { 373 --i->rem; 374 ++i->data; 375 i->index += sizeof(xcb_render_linefix_t); 376 } 377 378 xcb_generic_iterator_t 379 xcb_render_linefix_end (xcb_render_linefix_iterator_t i) 380 { 381 xcb_generic_iterator_t ret; 382 ret.data = i.data + i.rem; 383 ret.index = i.index + ((char *) ret.data - (char *) i.data); 384 ret.rem = 0; 385 return ret; 386 } 387 388 void 389 xcb_render_triangle_next (xcb_render_triangle_iterator_t *i) 390 { 391 --i->rem; 392 ++i->data; 393 i->index += sizeof(xcb_render_triangle_t); 394 } 395 396 xcb_generic_iterator_t 397 xcb_render_triangle_end (xcb_render_triangle_iterator_t i) 398 { 399 xcb_generic_iterator_t ret; 400 ret.data = i.data + i.rem; 401 ret.index = i.index + ((char *) ret.data - (char *) i.data); 402 ret.rem = 0; 403 return ret; 404 } 405 406 void 407 xcb_render_trapezoid_next (xcb_render_trapezoid_iterator_t *i) 408 { 409 --i->rem; 410 ++i->data; 411 i->index += sizeof(xcb_render_trapezoid_t); 412 } 413 414 xcb_generic_iterator_t 415 xcb_render_trapezoid_end (xcb_render_trapezoid_iterator_t i) 416 { 417 xcb_generic_iterator_t ret; 418 ret.data = i.data + i.rem; 419 ret.index = i.index + ((char *) ret.data - (char *) i.data); 420 ret.rem = 0; 421 return ret; 422 } 423 424 void 425 xcb_render_glyphinfo_next (xcb_render_glyphinfo_iterator_t *i) 426 { 427 --i->rem; 428 ++i->data; 429 i->index += sizeof(xcb_render_glyphinfo_t); 430 } 431 432 xcb_generic_iterator_t 433 xcb_render_glyphinfo_end (xcb_render_glyphinfo_iterator_t i) 434 { 435 xcb_generic_iterator_t ret; 436 ret.data = i.data + i.rem; 437 ret.index = i.index + ((char *) ret.data - (char *) i.data); 438 ret.rem = 0; 439 return ret; 440 } 441 442 xcb_render_query_version_cookie_t 443 xcb_render_query_version (xcb_connection_t *c, 444 uint32_t client_major_version, 445 uint32_t client_minor_version) 446 { 447 static const xcb_protocol_request_t xcb_req = { 448 .count = 2, 449 .ext = &xcb_render_id, 450 .opcode = XCB_RENDER_QUERY_VERSION, 451 .isvoid = 0 452 }; 453 454 struct iovec xcb_parts[4]; 455 xcb_render_query_version_cookie_t xcb_ret; 456 xcb_render_query_version_request_t xcb_out; 457 458 xcb_out.client_major_version = client_major_version; 459 xcb_out.client_minor_version = client_minor_version; 460 461 xcb_parts[2].iov_base = (char *) &xcb_out; 462 xcb_parts[2].iov_len = sizeof(xcb_out); 463 xcb_parts[3].iov_base = 0; 464 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 465 466 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 467 return xcb_ret; 468 } 469 470 xcb_render_query_version_cookie_t 471 xcb_render_query_version_unchecked (xcb_connection_t *c, 472 uint32_t client_major_version, 473 uint32_t client_minor_version) 474 { 475 static const xcb_protocol_request_t xcb_req = { 476 .count = 2, 477 .ext = &xcb_render_id, 478 .opcode = XCB_RENDER_QUERY_VERSION, 479 .isvoid = 0 480 }; 481 482 struct iovec xcb_parts[4]; 483 xcb_render_query_version_cookie_t xcb_ret; 484 xcb_render_query_version_request_t xcb_out; 485 486 xcb_out.client_major_version = client_major_version; 487 xcb_out.client_minor_version = client_minor_version; 488 489 xcb_parts[2].iov_base = (char *) &xcb_out; 490 xcb_parts[2].iov_len = sizeof(xcb_out); 491 xcb_parts[3].iov_base = 0; 492 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 493 494 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 495 return xcb_ret; 496 } 497 498 xcb_render_query_version_reply_t * 499 xcb_render_query_version_reply (xcb_connection_t *c, 500 xcb_render_query_version_cookie_t cookie /**< */, 501 xcb_generic_error_t **e) 502 { 503 return (xcb_render_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 504 } 505 506 int 507 xcb_render_query_pict_formats_sizeof (const void *_buffer) 508 { 509 char *xcb_tmp = (char *)_buffer; 510 const xcb_render_query_pict_formats_reply_t *_aux = (xcb_render_query_pict_formats_reply_t *)_buffer; 511 unsigned int xcb_buffer_len = 0; 512 unsigned int xcb_block_len = 0; 513 unsigned int xcb_pad = 0; 514 unsigned int xcb_align_to = 0; 515 516 unsigned int i; 517 unsigned int xcb_tmp_len; 518 519 xcb_block_len += sizeof(xcb_render_query_pict_formats_reply_t); 520 xcb_tmp += xcb_block_len; 521 xcb_buffer_len += xcb_block_len; 522 xcb_block_len = 0; 523 /* formats */ 524 xcb_block_len += _aux->num_formats * sizeof(xcb_render_pictforminfo_t); 525 xcb_tmp += xcb_block_len; 526 xcb_align_to = ALIGNOF(xcb_render_pictforminfo_t); 527 /* insert padding */ 528 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 529 xcb_buffer_len += xcb_block_len + xcb_pad; 530 if (0 != xcb_pad) { 531 xcb_tmp += xcb_pad; 532 xcb_pad = 0; 533 } 534 xcb_block_len = 0; 535 /* screens */ 536 for(i=0; i<_aux->num_screens; i++) { 537 xcb_tmp_len = xcb_render_pictscreen_sizeof(xcb_tmp); 538 xcb_block_len += xcb_tmp_len; 539 xcb_tmp += xcb_tmp_len; 540 } 541 xcb_align_to = ALIGNOF(xcb_render_pictscreen_t); 542 /* insert padding */ 543 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 544 xcb_buffer_len += xcb_block_len + xcb_pad; 545 if (0 != xcb_pad) { 546 xcb_tmp += xcb_pad; 547 xcb_pad = 0; 548 } 549 xcb_block_len = 0; 550 /* subpixels */ 551 xcb_block_len += _aux->num_subpixel * sizeof(uint32_t); 552 xcb_tmp += xcb_block_len; 553 xcb_align_to = ALIGNOF(uint32_t); 554 /* insert padding */ 555 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 556 xcb_buffer_len += xcb_block_len + xcb_pad; 557 if (0 != xcb_pad) { 558 xcb_tmp += xcb_pad; 559 xcb_pad = 0; 560 } 561 xcb_block_len = 0; 562 563 return xcb_buffer_len; 564 } 565 566 xcb_render_query_pict_formats_cookie_t 567 xcb_render_query_pict_formats (xcb_connection_t *c) 568 { 569 static const xcb_protocol_request_t xcb_req = { 570 .count = 2, 571 .ext = &xcb_render_id, 572 .opcode = XCB_RENDER_QUERY_PICT_FORMATS, 573 .isvoid = 0 574 }; 575 576 struct iovec xcb_parts[4]; 577 xcb_render_query_pict_formats_cookie_t xcb_ret; 578 xcb_render_query_pict_formats_request_t xcb_out; 579 580 581 xcb_parts[2].iov_base = (char *) &xcb_out; 582 xcb_parts[2].iov_len = sizeof(xcb_out); 583 xcb_parts[3].iov_base = 0; 584 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 585 586 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 587 return xcb_ret; 588 } 589 590 xcb_render_query_pict_formats_cookie_t 591 xcb_render_query_pict_formats_unchecked (xcb_connection_t *c) 592 { 593 static const xcb_protocol_request_t xcb_req = { 594 .count = 2, 595 .ext = &xcb_render_id, 596 .opcode = XCB_RENDER_QUERY_PICT_FORMATS, 597 .isvoid = 0 598 }; 599 600 struct iovec xcb_parts[4]; 601 xcb_render_query_pict_formats_cookie_t xcb_ret; 602 xcb_render_query_pict_formats_request_t xcb_out; 603 604 605 xcb_parts[2].iov_base = (char *) &xcb_out; 606 xcb_parts[2].iov_len = sizeof(xcb_out); 607 xcb_parts[3].iov_base = 0; 608 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 609 610 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 611 return xcb_ret; 612 } 613 614 xcb_render_pictforminfo_t * 615 xcb_render_query_pict_formats_formats (const xcb_render_query_pict_formats_reply_t *R) 616 { 617 return (xcb_render_pictforminfo_t *) (R + 1); 618 } 619 620 int 621 xcb_render_query_pict_formats_formats_length (const xcb_render_query_pict_formats_reply_t *R) 622 { 623 return R->num_formats; 624 } 625 626 xcb_render_pictforminfo_iterator_t 627 xcb_render_query_pict_formats_formats_iterator (const xcb_render_query_pict_formats_reply_t *R) 628 { 629 xcb_render_pictforminfo_iterator_t i; 630 i.data = (xcb_render_pictforminfo_t *) (R + 1); 631 i.rem = R->num_formats; 632 i.index = (char *) i.data - (char *) R; 633 return i; 634 } 635 636 int 637 xcb_render_query_pict_formats_screens_length (const xcb_render_query_pict_formats_reply_t *R) 638 { 639 return R->num_screens; 640 } 641 642 xcb_render_pictscreen_iterator_t 643 xcb_render_query_pict_formats_screens_iterator (const xcb_render_query_pict_formats_reply_t *R) 644 { 645 xcb_render_pictscreen_iterator_t i; 646 xcb_generic_iterator_t prev = xcb_render_pictforminfo_end(xcb_render_query_pict_formats_formats_iterator(R)); 647 i.data = (xcb_render_pictscreen_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_pictscreen_t, prev.index)); 648 i.rem = R->num_screens; 649 i.index = (char *) i.data - (char *) R; 650 return i; 651 } 652 653 uint32_t * 654 xcb_render_query_pict_formats_subpixels (const xcb_render_query_pict_formats_reply_t *R) 655 { 656 xcb_generic_iterator_t prev = xcb_render_pictscreen_end(xcb_render_query_pict_formats_screens_iterator(R)); 657 return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); 658 } 659 660 int 661 xcb_render_query_pict_formats_subpixels_length (const xcb_render_query_pict_formats_reply_t *R) 662 { 663 return R->num_subpixel; 664 } 665 666 xcb_generic_iterator_t 667 xcb_render_query_pict_formats_subpixels_end (const xcb_render_query_pict_formats_reply_t *R) 668 { 669 xcb_generic_iterator_t i; 670 xcb_generic_iterator_t prev = xcb_render_pictscreen_end(xcb_render_query_pict_formats_screens_iterator(R)); 671 i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->num_subpixel); 672 i.rem = 0; 673 i.index = (char *) i.data - (char *) R; 674 return i; 675 } 676 677 xcb_render_query_pict_formats_reply_t * 678 xcb_render_query_pict_formats_reply (xcb_connection_t *c, 679 xcb_render_query_pict_formats_cookie_t cookie /**< */, 680 xcb_generic_error_t **e) 681 { 682 return (xcb_render_query_pict_formats_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 683 } 684 685 int 686 xcb_render_query_pict_index_values_sizeof (const void *_buffer) 687 { 688 char *xcb_tmp = (char *)_buffer; 689 const xcb_render_query_pict_index_values_reply_t *_aux = (xcb_render_query_pict_index_values_reply_t *)_buffer; 690 unsigned int xcb_buffer_len = 0; 691 unsigned int xcb_block_len = 0; 692 unsigned int xcb_pad = 0; 693 unsigned int xcb_align_to = 0; 694 695 696 xcb_block_len += sizeof(xcb_render_query_pict_index_values_reply_t); 697 xcb_tmp += xcb_block_len; 698 xcb_buffer_len += xcb_block_len; 699 xcb_block_len = 0; 700 /* values */ 701 xcb_block_len += _aux->num_values * sizeof(xcb_render_indexvalue_t); 702 xcb_tmp += xcb_block_len; 703 xcb_align_to = ALIGNOF(xcb_render_indexvalue_t); 704 /* insert padding */ 705 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 706 xcb_buffer_len += xcb_block_len + xcb_pad; 707 if (0 != xcb_pad) { 708 xcb_tmp += xcb_pad; 709 xcb_pad = 0; 710 } 711 xcb_block_len = 0; 712 713 return xcb_buffer_len; 714 } 715 716 xcb_render_query_pict_index_values_cookie_t 717 xcb_render_query_pict_index_values (xcb_connection_t *c, 718 xcb_render_pictformat_t format) 719 { 720 static const xcb_protocol_request_t xcb_req = { 721 .count = 2, 722 .ext = &xcb_render_id, 723 .opcode = XCB_RENDER_QUERY_PICT_INDEX_VALUES, 724 .isvoid = 0 725 }; 726 727 struct iovec xcb_parts[4]; 728 xcb_render_query_pict_index_values_cookie_t xcb_ret; 729 xcb_render_query_pict_index_values_request_t xcb_out; 730 731 xcb_out.format = format; 732 733 xcb_parts[2].iov_base = (char *) &xcb_out; 734 xcb_parts[2].iov_len = sizeof(xcb_out); 735 xcb_parts[3].iov_base = 0; 736 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 737 738 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 739 return xcb_ret; 740 } 741 742 xcb_render_query_pict_index_values_cookie_t 743 xcb_render_query_pict_index_values_unchecked (xcb_connection_t *c, 744 xcb_render_pictformat_t format) 745 { 746 static const xcb_protocol_request_t xcb_req = { 747 .count = 2, 748 .ext = &xcb_render_id, 749 .opcode = XCB_RENDER_QUERY_PICT_INDEX_VALUES, 750 .isvoid = 0 751 }; 752 753 struct iovec xcb_parts[4]; 754 xcb_render_query_pict_index_values_cookie_t xcb_ret; 755 xcb_render_query_pict_index_values_request_t xcb_out; 756 757 xcb_out.format = format; 758 759 xcb_parts[2].iov_base = (char *) &xcb_out; 760 xcb_parts[2].iov_len = sizeof(xcb_out); 761 xcb_parts[3].iov_base = 0; 762 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 763 764 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 765 return xcb_ret; 766 } 767 768 xcb_render_indexvalue_t * 769 xcb_render_query_pict_index_values_values (const xcb_render_query_pict_index_values_reply_t *R) 770 { 771 return (xcb_render_indexvalue_t *) (R + 1); 772 } 773 774 int 775 xcb_render_query_pict_index_values_values_length (const xcb_render_query_pict_index_values_reply_t *R) 776 { 777 return R->num_values; 778 } 779 780 xcb_render_indexvalue_iterator_t 781 xcb_render_query_pict_index_values_values_iterator (const xcb_render_query_pict_index_values_reply_t *R) 782 { 783 xcb_render_indexvalue_iterator_t i; 784 i.data = (xcb_render_indexvalue_t *) (R + 1); 785 i.rem = R->num_values; 786 i.index = (char *) i.data - (char *) R; 787 return i; 788 } 789 790 xcb_render_query_pict_index_values_reply_t * 791 xcb_render_query_pict_index_values_reply (xcb_connection_t *c, 792 xcb_render_query_pict_index_values_cookie_t cookie /**< */, 793 xcb_generic_error_t **e) 794 { 795 return (xcb_render_query_pict_index_values_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 796 } 797 798 int 799 xcb_render_create_picture_value_list_serialize (void **_buffer, 800 uint32_t value_mask, 801 const xcb_render_create_picture_value_list_t *_aux) 802 { 803 char *xcb_out = *_buffer; 804 unsigned int xcb_buffer_len = 0; 805 unsigned int xcb_align_to = 0; 806 unsigned int xcb_padding_offset = 0; 807 808 unsigned int xcb_pad = 0; 809 char xcb_pad0[3] = {0, 0, 0}; 810 struct iovec xcb_parts[14]; 811 unsigned int xcb_parts_idx = 0; 812 unsigned int xcb_block_len = 0; 813 unsigned int i; 814 char *xcb_tmp; 815 816 if(value_mask & XCB_RENDER_CP_REPEAT) { 817 /* xcb_render_create_picture_value_list_t.repeat */ 818 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->repeat; 819 xcb_block_len += sizeof(uint32_t); 820 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); 821 xcb_parts_idx++; 822 xcb_align_to = ALIGNOF(uint32_t); 823 } 824 if(value_mask & XCB_RENDER_CP_ALPHA_MAP) { 825 /* xcb_render_create_picture_value_list_t.alphamap */ 826 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->alphamap; 827 xcb_block_len += sizeof(xcb_render_picture_t); 828 xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_render_picture_t); 829 xcb_parts_idx++; 830 xcb_align_to = ALIGNOF(xcb_render_picture_t); 831 } 832 if(value_mask & XCB_RENDER_CP_ALPHA_X_ORIGIN) { 833 /* xcb_render_create_picture_value_list_t.alphaxorigin */ 834 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->alphaxorigin; 835 xcb_block_len += sizeof(int32_t); 836 xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); 837 xcb_parts_idx++; 838 xcb_align_to = ALIGNOF(int32_t); 839 } 840 if(value_mask & XCB_RENDER_CP_ALPHA_Y_ORIGIN) { 841 /* xcb_render_create_picture_value_list_t.alphayorigin */ 842 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->alphayorigin; 843 xcb_block_len += sizeof(int32_t); 844 xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); 845 xcb_parts_idx++; 846 xcb_align_to = ALIGNOF(int32_t); 847 } 848 if(value_mask & XCB_RENDER_CP_CLIP_X_ORIGIN) { 849 /* xcb_render_create_picture_value_list_t.clipxorigin */ 850 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clipxorigin; 851 xcb_block_len += sizeof(int32_t); 852 xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); 853 xcb_parts_idx++; 854 xcb_align_to = ALIGNOF(int32_t); 855 } 856 if(value_mask & XCB_RENDER_CP_CLIP_Y_ORIGIN) { 857 /* xcb_render_create_picture_value_list_t.clipyorigin */ 858 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clipyorigin; 859 xcb_block_len += sizeof(int32_t); 860 xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); 861 xcb_parts_idx++; 862 xcb_align_to = ALIGNOF(int32_t); 863 } 864 if(value_mask & XCB_RENDER_CP_CLIP_MASK) { 865 /* xcb_render_create_picture_value_list_t.clipmask */ 866 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clipmask; 867 xcb_block_len += sizeof(xcb_pixmap_t); 868 xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t); 869 xcb_parts_idx++; 870 xcb_align_to = ALIGNOF(xcb_pixmap_t); 871 } 872 if(value_mask & XCB_RENDER_CP_GRAPHICS_EXPOSURE) { 873 /* xcb_render_create_picture_value_list_t.graphicsexposure */ 874 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->graphicsexposure; 875 xcb_block_len += sizeof(uint32_t); 876 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); 877 xcb_parts_idx++; 878 xcb_align_to = ALIGNOF(uint32_t); 879 } 880 if(value_mask & XCB_RENDER_CP_SUBWINDOW_MODE) { 881 /* xcb_render_create_picture_value_list_t.subwindowmode */ 882 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->subwindowmode; 883 xcb_block_len += sizeof(uint32_t); 884 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); 885 xcb_parts_idx++; 886 xcb_align_to = ALIGNOF(uint32_t); 887 } 888 if(value_mask & XCB_RENDER_CP_POLY_EDGE) { 889 /* xcb_render_create_picture_value_list_t.polyedge */ 890 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->polyedge; 891 xcb_block_len += sizeof(uint32_t); 892 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); 893 xcb_parts_idx++; 894 xcb_align_to = ALIGNOF(uint32_t); 895 } 896 if(value_mask & XCB_RENDER_CP_POLY_MODE) { 897 /* xcb_render_create_picture_value_list_t.polymode */ 898 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->polymode; 899 xcb_block_len += sizeof(uint32_t); 900 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); 901 xcb_parts_idx++; 902 xcb_align_to = ALIGNOF(uint32_t); 903 } 904 if(value_mask & XCB_RENDER_CP_DITHER) { 905 /* xcb_render_create_picture_value_list_t.dither */ 906 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->dither; 907 xcb_block_len += sizeof(xcb_atom_t); 908 xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); 909 xcb_parts_idx++; 910 xcb_align_to = ALIGNOF(xcb_atom_t); 911 } 912 if(value_mask & XCB_RENDER_CP_COMPONENT_ALPHA) { 913 /* xcb_render_create_picture_value_list_t.componentalpha */ 914 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->componentalpha; 915 xcb_block_len += sizeof(uint32_t); 916 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); 917 xcb_parts_idx++; 918 xcb_align_to = ALIGNOF(uint32_t); 919 } 920 /* insert padding */ 921 xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1); 922 xcb_buffer_len += xcb_block_len + xcb_pad; 923 if (0 != xcb_pad) { 924 xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; 925 xcb_parts[xcb_parts_idx].iov_len = xcb_pad; 926 xcb_parts_idx++; 927 xcb_pad = 0; 928 } 929 xcb_block_len = 0; 930 xcb_padding_offset = 0; 931 932 if (NULL == xcb_out) { 933 /* allocate memory */ 934 xcb_out = malloc(xcb_buffer_len); 935 *_buffer = xcb_out; 936 } 937 938 xcb_tmp = xcb_out; 939 for(i=0; i<xcb_parts_idx; i++) { 940 if (0 != xcb_parts[i].iov_base && 0 != xcb_parts[i].iov_len) 941 memcpy(xcb_tmp, xcb_parts[i].iov_base, xcb_parts[i].iov_len); 942 if (0 != xcb_parts[i].iov_len) 943 xcb_tmp += xcb_parts[i].iov_len; 944 } 945 946 return xcb_buffer_len; 947 } 948 949 int 950 xcb_render_create_picture_value_list_unpack (const void *_buffer, 951 uint32_t value_mask, 952 xcb_render_create_picture_value_list_t *_aux) 953 { 954 char *xcb_tmp = (char *)_buffer; 955 unsigned int xcb_buffer_len = 0; 956 unsigned int xcb_block_len = 0; 957 unsigned int xcb_pad = 0; 958 unsigned int xcb_align_to = 0; 959 unsigned int xcb_padding_offset = 0; 960 961 962 if(value_mask & XCB_RENDER_CP_REPEAT) { 963 /* xcb_render_create_picture_value_list_t.repeat */ 964 _aux->repeat = *(uint32_t *)xcb_tmp; 965 xcb_block_len += sizeof(uint32_t); 966 xcb_tmp += sizeof(uint32_t); 967 xcb_align_to = ALIGNOF(uint32_t); 968 } 969 if(value_mask & XCB_RENDER_CP_ALPHA_MAP) { 970 /* xcb_render_create_picture_value_list_t.alphamap */ 971 _aux->alphamap = *(xcb_render_picture_t *)xcb_tmp; 972 xcb_block_len += sizeof(xcb_render_picture_t); 973 xcb_tmp += sizeof(xcb_render_picture_t); 974 xcb_align_to = ALIGNOF(xcb_render_picture_t); 975 } 976 if(value_mask & XCB_RENDER_CP_ALPHA_X_ORIGIN) { 977 /* xcb_render_create_picture_value_list_t.alphaxorigin */ 978 _aux->alphaxorigin = *(int32_t *)xcb_tmp; 979 xcb_block_len += sizeof(int32_t); 980 xcb_tmp += sizeof(int32_t); 981 xcb_align_to = ALIGNOF(int32_t); 982 } 983 if(value_mask & XCB_RENDER_CP_ALPHA_Y_ORIGIN) { 984 /* xcb_render_create_picture_value_list_t.alphayorigin */ 985 _aux->alphayorigin = *(int32_t *)xcb_tmp; 986 xcb_block_len += sizeof(int32_t); 987 xcb_tmp += sizeof(int32_t); 988 xcb_align_to = ALIGNOF(int32_t); 989 } 990 if(value_mask & XCB_RENDER_CP_CLIP_X_ORIGIN) { 991 /* xcb_render_create_picture_value_list_t.clipxorigin */ 992 _aux->clipxorigin = *(int32_t *)xcb_tmp; 993 xcb_block_len += sizeof(int32_t); 994 xcb_tmp += sizeof(int32_t); 995 xcb_align_to = ALIGNOF(int32_t); 996 } 997 if(value_mask & XCB_RENDER_CP_CLIP_Y_ORIGIN) { 998 /* xcb_render_create_picture_value_list_t.clipyorigin */ 999 _aux->clipyorigin = *(int32_t *)xcb_tmp; 1000 xcb_block_len += sizeof(int32_t); 1001 xcb_tmp += sizeof(int32_t); 1002 xcb_align_to = ALIGNOF(int32_t); 1003 } 1004 if(value_mask & XCB_RENDER_CP_CLIP_MASK) { 1005 /* xcb_render_create_picture_value_list_t.clipmask */ 1006 _aux->clipmask = *(xcb_pixmap_t *)xcb_tmp; 1007 xcb_block_len += sizeof(xcb_pixmap_t); 1008 xcb_tmp += sizeof(xcb_pixmap_t); 1009 xcb_align_to = ALIGNOF(xcb_pixmap_t); 1010 } 1011 if(value_mask & XCB_RENDER_CP_GRAPHICS_EXPOSURE) { 1012 /* xcb_render_create_picture_value_list_t.graphicsexposure */ 1013 _aux->graphicsexposure = *(uint32_t *)xcb_tmp; 1014 xcb_block_len += sizeof(uint32_t); 1015 xcb_tmp += sizeof(uint32_t); 1016 xcb_align_to = ALIGNOF(uint32_t); 1017 } 1018 if(value_mask & XCB_RENDER_CP_SUBWINDOW_MODE) { 1019 /* xcb_render_create_picture_value_list_t.subwindowmode */ 1020 _aux->subwindowmode = *(uint32_t *)xcb_tmp; 1021 xcb_block_len += sizeof(uint32_t); 1022 xcb_tmp += sizeof(uint32_t); 1023 xcb_align_to = ALIGNOF(uint32_t); 1024 } 1025 if(value_mask & XCB_RENDER_CP_POLY_EDGE) { 1026 /* xcb_render_create_picture_value_list_t.polyedge */ 1027 _aux->polyedge = *(uint32_t *)xcb_tmp; 1028 xcb_block_len += sizeof(uint32_t); 1029 xcb_tmp += sizeof(uint32_t); 1030 xcb_align_to = ALIGNOF(uint32_t); 1031 } 1032 if(value_mask & XCB_RENDER_CP_POLY_MODE) { 1033 /* xcb_render_create_picture_value_list_t.polymode */ 1034 _aux->polymode = *(uint32_t *)xcb_tmp; 1035 xcb_block_len += sizeof(uint32_t); 1036 xcb_tmp += sizeof(uint32_t); 1037 xcb_align_to = ALIGNOF(uint32_t); 1038 } 1039 if(value_mask & XCB_RENDER_CP_DITHER) { 1040 /* xcb_render_create_picture_value_list_t.dither */ 1041 _aux->dither = *(xcb_atom_t *)xcb_tmp; 1042 xcb_block_len += sizeof(xcb_atom_t); 1043 xcb_tmp += sizeof(xcb_atom_t); 1044 xcb_align_to = ALIGNOF(xcb_atom_t); 1045 } 1046 if(value_mask & XCB_RENDER_CP_COMPONENT_ALPHA) { 1047 /* xcb_render_create_picture_value_list_t.componentalpha */ 1048 _aux->componentalpha = *(uint32_t *)xcb_tmp; 1049 xcb_block_len += sizeof(uint32_t); 1050 xcb_tmp += sizeof(uint32_t); 1051 xcb_align_to = ALIGNOF(uint32_t); 1052 } 1053 /* insert padding */ 1054 xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1); 1055 xcb_buffer_len += xcb_block_len + xcb_pad; 1056 if (0 != xcb_pad) { 1057 xcb_tmp += xcb_pad; 1058 xcb_pad = 0; 1059 } 1060 xcb_block_len = 0; 1061 xcb_padding_offset = 0; 1062 1063 return xcb_buffer_len; 1064 } 1065 1066 int 1067 xcb_render_create_picture_value_list_sizeof (const void *_buffer, 1068 uint32_t value_mask) 1069 { 1070 xcb_render_create_picture_value_list_t _aux; 1071 return xcb_render_create_picture_value_list_unpack(_buffer, value_mask, &_aux); 1072 } 1073 1074 int 1075 xcb_render_create_picture_sizeof (const void *_buffer) 1076 { 1077 char *xcb_tmp = (char *)_buffer; 1078 const xcb_render_create_picture_request_t *_aux = (xcb_render_create_picture_request_t *)_buffer; 1079 unsigned int xcb_buffer_len = 0; 1080 unsigned int xcb_block_len = 0; 1081 unsigned int xcb_pad = 0; 1082 unsigned int xcb_align_to = 0; 1083 1084 1085 xcb_block_len += sizeof(xcb_render_create_picture_request_t); 1086 xcb_tmp += xcb_block_len; 1087 xcb_buffer_len += xcb_block_len; 1088 xcb_block_len = 0; 1089 /* value_list */ 1090 xcb_block_len += xcb_render_create_picture_value_list_sizeof(xcb_tmp, _aux->value_mask); 1091 xcb_tmp += xcb_block_len; 1092 xcb_align_to = ALIGNOF(char); 1093 /* insert padding */ 1094 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 1095 xcb_buffer_len += xcb_block_len + xcb_pad; 1096 if (0 != xcb_pad) { 1097 xcb_tmp += xcb_pad; 1098 xcb_pad = 0; 1099 } 1100 xcb_block_len = 0; 1101 1102 return xcb_buffer_len; 1103 } 1104 1105 xcb_void_cookie_t 1106 xcb_render_create_picture_checked (xcb_connection_t *c, 1107 xcb_render_picture_t pid, 1108 xcb_drawable_t drawable, 1109 xcb_render_pictformat_t format, 1110 uint32_t value_mask, 1111 const void *value_list) 1112 { 1113 static const xcb_protocol_request_t xcb_req = { 1114 .count = 3, 1115 .ext = &xcb_render_id, 1116 .opcode = XCB_RENDER_CREATE_PICTURE, 1117 .isvoid = 1 1118 }; 1119 1120 struct iovec xcb_parts[5]; 1121 xcb_void_cookie_t xcb_ret; 1122 xcb_render_create_picture_request_t xcb_out; 1123 1124 xcb_out.pid = pid; 1125 xcb_out.drawable = drawable; 1126 xcb_out.format = format; 1127 xcb_out.value_mask = value_mask; 1128 1129 xcb_parts[2].iov_base = (char *) &xcb_out; 1130 xcb_parts[2].iov_len = sizeof(xcb_out); 1131 xcb_parts[3].iov_base = 0; 1132 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1133 /* xcb_render_create_picture_value_list_t value_list */ 1134 xcb_parts[4].iov_base = (char *) value_list; 1135 xcb_parts[4].iov_len = 1136 xcb_render_create_picture_value_list_sizeof (value_list, value_mask); 1137 1138 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1139 return xcb_ret; 1140 } 1141 1142 xcb_void_cookie_t 1143 xcb_render_create_picture (xcb_connection_t *c, 1144 xcb_render_picture_t pid, 1145 xcb_drawable_t drawable, 1146 xcb_render_pictformat_t format, 1147 uint32_t value_mask, 1148 const void *value_list) 1149 { 1150 static const xcb_protocol_request_t xcb_req = { 1151 .count = 3, 1152 .ext = &xcb_render_id, 1153 .opcode = XCB_RENDER_CREATE_PICTURE, 1154 .isvoid = 1 1155 }; 1156 1157 struct iovec xcb_parts[5]; 1158 xcb_void_cookie_t xcb_ret; 1159 xcb_render_create_picture_request_t xcb_out; 1160 1161 xcb_out.pid = pid; 1162 xcb_out.drawable = drawable; 1163 xcb_out.format = format; 1164 xcb_out.value_mask = value_mask; 1165 1166 xcb_parts[2].iov_base = (char *) &xcb_out; 1167 xcb_parts[2].iov_len = sizeof(xcb_out); 1168 xcb_parts[3].iov_base = 0; 1169 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1170 /* xcb_render_create_picture_value_list_t value_list */ 1171 xcb_parts[4].iov_base = (char *) value_list; 1172 xcb_parts[4].iov_len = 1173 xcb_render_create_picture_value_list_sizeof (value_list, value_mask); 1174 1175 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1176 return xcb_ret; 1177 } 1178 1179 xcb_void_cookie_t 1180 xcb_render_create_picture_aux_checked (xcb_connection_t *c, 1181 xcb_render_picture_t pid, 1182 xcb_drawable_t drawable, 1183 xcb_render_pictformat_t format, 1184 uint32_t value_mask, 1185 const xcb_render_create_picture_value_list_t *value_list) 1186 { 1187 static const xcb_protocol_request_t xcb_req = { 1188 .count = 3, 1189 .ext = &xcb_render_id, 1190 .opcode = XCB_RENDER_CREATE_PICTURE, 1191 .isvoid = 1 1192 }; 1193 1194 struct iovec xcb_parts[5]; 1195 xcb_void_cookie_t xcb_ret; 1196 xcb_render_create_picture_request_t xcb_out; 1197 void *xcb_aux0 = 0; 1198 1199 xcb_out.pid = pid; 1200 xcb_out.drawable = drawable; 1201 xcb_out.format = format; 1202 xcb_out.value_mask = value_mask; 1203 1204 xcb_parts[2].iov_base = (char *) &xcb_out; 1205 xcb_parts[2].iov_len = sizeof(xcb_out); 1206 xcb_parts[3].iov_base = 0; 1207 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1208 /* xcb_render_create_picture_value_list_t value_list */ 1209 xcb_parts[4].iov_len = 1210 xcb_render_create_picture_value_list_serialize (&xcb_aux0, value_mask, value_list); 1211 xcb_parts[4].iov_base = xcb_aux0; 1212 1213 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1214 free(xcb_aux0); 1215 return xcb_ret; 1216 } 1217 1218 xcb_void_cookie_t 1219 xcb_render_create_picture_aux (xcb_connection_t *c, 1220 xcb_render_picture_t pid, 1221 xcb_drawable_t drawable, 1222 xcb_render_pictformat_t format, 1223 uint32_t value_mask, 1224 const xcb_render_create_picture_value_list_t *value_list) 1225 { 1226 static const xcb_protocol_request_t xcb_req = { 1227 .count = 3, 1228 .ext = &xcb_render_id, 1229 .opcode = XCB_RENDER_CREATE_PICTURE, 1230 .isvoid = 1 1231 }; 1232 1233 struct iovec xcb_parts[5]; 1234 xcb_void_cookie_t xcb_ret; 1235 xcb_render_create_picture_request_t xcb_out; 1236 void *xcb_aux0 = 0; 1237 1238 xcb_out.pid = pid; 1239 xcb_out.drawable = drawable; 1240 xcb_out.format = format; 1241 xcb_out.value_mask = value_mask; 1242 1243 xcb_parts[2].iov_base = (char *) &xcb_out; 1244 xcb_parts[2].iov_len = sizeof(xcb_out); 1245 xcb_parts[3].iov_base = 0; 1246 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1247 /* xcb_render_create_picture_value_list_t value_list */ 1248 xcb_parts[4].iov_len = 1249 xcb_render_create_picture_value_list_serialize (&xcb_aux0, value_mask, value_list); 1250 xcb_parts[4].iov_base = xcb_aux0; 1251 1252 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1253 free(xcb_aux0); 1254 return xcb_ret; 1255 } 1256 1257 void * 1258 xcb_render_create_picture_value_list (const xcb_render_create_picture_request_t *R) 1259 { 1260 return (void *) (R + 1); 1261 } 1262 1263 int 1264 xcb_render_change_picture_value_list_serialize (void **_buffer, 1265 uint32_t value_mask, 1266 const xcb_render_change_picture_value_list_t *_aux) 1267 { 1268 char *xcb_out = *_buffer; 1269 unsigned int xcb_buffer_len = 0; 1270 unsigned int xcb_align_to = 0; 1271 unsigned int xcb_padding_offset = 0; 1272 1273 unsigned int xcb_pad = 0; 1274 char xcb_pad0[3] = {0, 0, 0}; 1275 struct iovec xcb_parts[14]; 1276 unsigned int xcb_parts_idx = 0; 1277 unsigned int xcb_block_len = 0; 1278 unsigned int i; 1279 char *xcb_tmp; 1280 1281 if(value_mask & XCB_RENDER_CP_REPEAT) { 1282 /* xcb_render_change_picture_value_list_t.repeat */ 1283 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->repeat; 1284 xcb_block_len += sizeof(uint32_t); 1285 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); 1286 xcb_parts_idx++; 1287 xcb_align_to = ALIGNOF(uint32_t); 1288 } 1289 if(value_mask & XCB_RENDER_CP_ALPHA_MAP) { 1290 /* xcb_render_change_picture_value_list_t.alphamap */ 1291 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->alphamap; 1292 xcb_block_len += sizeof(xcb_render_picture_t); 1293 xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_render_picture_t); 1294 xcb_parts_idx++; 1295 xcb_align_to = ALIGNOF(xcb_render_picture_t); 1296 } 1297 if(value_mask & XCB_RENDER_CP_ALPHA_X_ORIGIN) { 1298 /* xcb_render_change_picture_value_list_t.alphaxorigin */ 1299 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->alphaxorigin; 1300 xcb_block_len += sizeof(int32_t); 1301 xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); 1302 xcb_parts_idx++; 1303 xcb_align_to = ALIGNOF(int32_t); 1304 } 1305 if(value_mask & XCB_RENDER_CP_ALPHA_Y_ORIGIN) { 1306 /* xcb_render_change_picture_value_list_t.alphayorigin */ 1307 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->alphayorigin; 1308 xcb_block_len += sizeof(int32_t); 1309 xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); 1310 xcb_parts_idx++; 1311 xcb_align_to = ALIGNOF(int32_t); 1312 } 1313 if(value_mask & XCB_RENDER_CP_CLIP_X_ORIGIN) { 1314 /* xcb_render_change_picture_value_list_t.clipxorigin */ 1315 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clipxorigin; 1316 xcb_block_len += sizeof(int32_t); 1317 xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); 1318 xcb_parts_idx++; 1319 xcb_align_to = ALIGNOF(int32_t); 1320 } 1321 if(value_mask & XCB_RENDER_CP_CLIP_Y_ORIGIN) { 1322 /* xcb_render_change_picture_value_list_t.clipyorigin */ 1323 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clipyorigin; 1324 xcb_block_len += sizeof(int32_t); 1325 xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); 1326 xcb_parts_idx++; 1327 xcb_align_to = ALIGNOF(int32_t); 1328 } 1329 if(value_mask & XCB_RENDER_CP_CLIP_MASK) { 1330 /* xcb_render_change_picture_value_list_t.clipmask */ 1331 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clipmask; 1332 xcb_block_len += sizeof(xcb_pixmap_t); 1333 xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t); 1334 xcb_parts_idx++; 1335 xcb_align_to = ALIGNOF(xcb_pixmap_t); 1336 } 1337 if(value_mask & XCB_RENDER_CP_GRAPHICS_EXPOSURE) { 1338 /* xcb_render_change_picture_value_list_t.graphicsexposure */ 1339 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->graphicsexposure; 1340 xcb_block_len += sizeof(uint32_t); 1341 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); 1342 xcb_parts_idx++; 1343 xcb_align_to = ALIGNOF(uint32_t); 1344 } 1345 if(value_mask & XCB_RENDER_CP_SUBWINDOW_MODE) { 1346 /* xcb_render_change_picture_value_list_t.subwindowmode */ 1347 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->subwindowmode; 1348 xcb_block_len += sizeof(uint32_t); 1349 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); 1350 xcb_parts_idx++; 1351 xcb_align_to = ALIGNOF(uint32_t); 1352 } 1353 if(value_mask & XCB_RENDER_CP_POLY_EDGE) { 1354 /* xcb_render_change_picture_value_list_t.polyedge */ 1355 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->polyedge; 1356 xcb_block_len += sizeof(uint32_t); 1357 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); 1358 xcb_parts_idx++; 1359 xcb_align_to = ALIGNOF(uint32_t); 1360 } 1361 if(value_mask & XCB_RENDER_CP_POLY_MODE) { 1362 /* xcb_render_change_picture_value_list_t.polymode */ 1363 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->polymode; 1364 xcb_block_len += sizeof(uint32_t); 1365 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); 1366 xcb_parts_idx++; 1367 xcb_align_to = ALIGNOF(uint32_t); 1368 } 1369 if(value_mask & XCB_RENDER_CP_DITHER) { 1370 /* xcb_render_change_picture_value_list_t.dither */ 1371 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->dither; 1372 xcb_block_len += sizeof(xcb_atom_t); 1373 xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); 1374 xcb_parts_idx++; 1375 xcb_align_to = ALIGNOF(xcb_atom_t); 1376 } 1377 if(value_mask & XCB_RENDER_CP_COMPONENT_ALPHA) { 1378 /* xcb_render_change_picture_value_list_t.componentalpha */ 1379 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->componentalpha; 1380 xcb_block_len += sizeof(uint32_t); 1381 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); 1382 xcb_parts_idx++; 1383 xcb_align_to = ALIGNOF(uint32_t); 1384 } 1385 /* insert padding */ 1386 xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1); 1387 xcb_buffer_len += xcb_block_len + xcb_pad; 1388 if (0 != xcb_pad) { 1389 xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; 1390 xcb_parts[xcb_parts_idx].iov_len = xcb_pad; 1391 xcb_parts_idx++; 1392 xcb_pad = 0; 1393 } 1394 xcb_block_len = 0; 1395 xcb_padding_offset = 0; 1396 1397 if (NULL == xcb_out) { 1398 /* allocate memory */ 1399 xcb_out = malloc(xcb_buffer_len); 1400 *_buffer = xcb_out; 1401 } 1402 1403 xcb_tmp = xcb_out; 1404 for(i=0; i<xcb_parts_idx; i++) { 1405 if (0 != xcb_parts[i].iov_base && 0 != xcb_parts[i].iov_len) 1406 memcpy(xcb_tmp, xcb_parts[i].iov_base, xcb_parts[i].iov_len); 1407 if (0 != xcb_parts[i].iov_len) 1408 xcb_tmp += xcb_parts[i].iov_len; 1409 } 1410 1411 return xcb_buffer_len; 1412 } 1413 1414 int 1415 xcb_render_change_picture_value_list_unpack (const void *_buffer, 1416 uint32_t value_mask, 1417 xcb_render_change_picture_value_list_t *_aux) 1418 { 1419 char *xcb_tmp = (char *)_buffer; 1420 unsigned int xcb_buffer_len = 0; 1421 unsigned int xcb_block_len = 0; 1422 unsigned int xcb_pad = 0; 1423 unsigned int xcb_align_to = 0; 1424 unsigned int xcb_padding_offset = 0; 1425 1426 1427 if(value_mask & XCB_RENDER_CP_REPEAT) { 1428 /* xcb_render_change_picture_value_list_t.repeat */ 1429 _aux->repeat = *(uint32_t *)xcb_tmp; 1430 xcb_block_len += sizeof(uint32_t); 1431 xcb_tmp += sizeof(uint32_t); 1432 xcb_align_to = ALIGNOF(uint32_t); 1433 } 1434 if(value_mask & XCB_RENDER_CP_ALPHA_MAP) { 1435 /* xcb_render_change_picture_value_list_t.alphamap */ 1436 _aux->alphamap = *(xcb_render_picture_t *)xcb_tmp; 1437 xcb_block_len += sizeof(xcb_render_picture_t); 1438 xcb_tmp += sizeof(xcb_render_picture_t); 1439 xcb_align_to = ALIGNOF(xcb_render_picture_t); 1440 } 1441 if(value_mask & XCB_RENDER_CP_ALPHA_X_ORIGIN) { 1442 /* xcb_render_change_picture_value_list_t.alphaxorigin */ 1443 _aux->alphaxorigin = *(int32_t *)xcb_tmp; 1444 xcb_block_len += sizeof(int32_t); 1445 xcb_tmp += sizeof(int32_t); 1446 xcb_align_to = ALIGNOF(int32_t); 1447 } 1448 if(value_mask & XCB_RENDER_CP_ALPHA_Y_ORIGIN) { 1449 /* xcb_render_change_picture_value_list_t.alphayorigin */ 1450 _aux->alphayorigin = *(int32_t *)xcb_tmp; 1451 xcb_block_len += sizeof(int32_t); 1452 xcb_tmp += sizeof(int32_t); 1453 xcb_align_to = ALIGNOF(int32_t); 1454 } 1455 if(value_mask & XCB_RENDER_CP_CLIP_X_ORIGIN) { 1456 /* xcb_render_change_picture_value_list_t.clipxorigin */ 1457 _aux->clipxorigin = *(int32_t *)xcb_tmp; 1458 xcb_block_len += sizeof(int32_t); 1459 xcb_tmp += sizeof(int32_t); 1460 xcb_align_to = ALIGNOF(int32_t); 1461 } 1462 if(value_mask & XCB_RENDER_CP_CLIP_Y_ORIGIN) { 1463 /* xcb_render_change_picture_value_list_t.clipyorigin */ 1464 _aux->clipyorigin = *(int32_t *)xcb_tmp; 1465 xcb_block_len += sizeof(int32_t); 1466 xcb_tmp += sizeof(int32_t); 1467 xcb_align_to = ALIGNOF(int32_t); 1468 } 1469 if(value_mask & XCB_RENDER_CP_CLIP_MASK) { 1470 /* xcb_render_change_picture_value_list_t.clipmask */ 1471 _aux->clipmask = *(xcb_pixmap_t *)xcb_tmp; 1472 xcb_block_len += sizeof(xcb_pixmap_t); 1473 xcb_tmp += sizeof(xcb_pixmap_t); 1474 xcb_align_to = ALIGNOF(xcb_pixmap_t); 1475 } 1476 if(value_mask & XCB_RENDER_CP_GRAPHICS_EXPOSURE) { 1477 /* xcb_render_change_picture_value_list_t.graphicsexposure */ 1478 _aux->graphicsexposure = *(uint32_t *)xcb_tmp; 1479 xcb_block_len += sizeof(uint32_t); 1480 xcb_tmp += sizeof(uint32_t); 1481 xcb_align_to = ALIGNOF(uint32_t); 1482 } 1483 if(value_mask & XCB_RENDER_CP_SUBWINDOW_MODE) { 1484 /* xcb_render_change_picture_value_list_t.subwindowmode */ 1485 _aux->subwindowmode = *(uint32_t *)xcb_tmp; 1486 xcb_block_len += sizeof(uint32_t); 1487 xcb_tmp += sizeof(uint32_t); 1488 xcb_align_to = ALIGNOF(uint32_t); 1489 } 1490 if(value_mask & XCB_RENDER_CP_POLY_EDGE) { 1491 /* xcb_render_change_picture_value_list_t.polyedge */ 1492 _aux->polyedge = *(uint32_t *)xcb_tmp; 1493 xcb_block_len += sizeof(uint32_t); 1494 xcb_tmp += sizeof(uint32_t); 1495 xcb_align_to = ALIGNOF(uint32_t); 1496 } 1497 if(value_mask & XCB_RENDER_CP_POLY_MODE) { 1498 /* xcb_render_change_picture_value_list_t.polymode */ 1499 _aux->polymode = *(uint32_t *)xcb_tmp; 1500 xcb_block_len += sizeof(uint32_t); 1501 xcb_tmp += sizeof(uint32_t); 1502 xcb_align_to = ALIGNOF(uint32_t); 1503 } 1504 if(value_mask & XCB_RENDER_CP_DITHER) { 1505 /* xcb_render_change_picture_value_list_t.dither */ 1506 _aux->dither = *(xcb_atom_t *)xcb_tmp; 1507 xcb_block_len += sizeof(xcb_atom_t); 1508 xcb_tmp += sizeof(xcb_atom_t); 1509 xcb_align_to = ALIGNOF(xcb_atom_t); 1510 } 1511 if(value_mask & XCB_RENDER_CP_COMPONENT_ALPHA) { 1512 /* xcb_render_change_picture_value_list_t.componentalpha */ 1513 _aux->componentalpha = *(uint32_t *)xcb_tmp; 1514 xcb_block_len += sizeof(uint32_t); 1515 xcb_tmp += sizeof(uint32_t); 1516 xcb_align_to = ALIGNOF(uint32_t); 1517 } 1518 /* insert padding */ 1519 xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1); 1520 xcb_buffer_len += xcb_block_len + xcb_pad; 1521 if (0 != xcb_pad) { 1522 xcb_tmp += xcb_pad; 1523 xcb_pad = 0; 1524 } 1525 xcb_block_len = 0; 1526 xcb_padding_offset = 0; 1527 1528 return xcb_buffer_len; 1529 } 1530 1531 int 1532 xcb_render_change_picture_value_list_sizeof (const void *_buffer, 1533 uint32_t value_mask) 1534 { 1535 xcb_render_change_picture_value_list_t _aux; 1536 return xcb_render_change_picture_value_list_unpack(_buffer, value_mask, &_aux); 1537 } 1538 1539 int 1540 xcb_render_change_picture_sizeof (const void *_buffer) 1541 { 1542 char *xcb_tmp = (char *)_buffer; 1543 const xcb_render_change_picture_request_t *_aux = (xcb_render_change_picture_request_t *)_buffer; 1544 unsigned int xcb_buffer_len = 0; 1545 unsigned int xcb_block_len = 0; 1546 unsigned int xcb_pad = 0; 1547 unsigned int xcb_align_to = 0; 1548 1549 1550 xcb_block_len += sizeof(xcb_render_change_picture_request_t); 1551 xcb_tmp += xcb_block_len; 1552 xcb_buffer_len += xcb_block_len; 1553 xcb_block_len = 0; 1554 /* value_list */ 1555 xcb_block_len += xcb_render_change_picture_value_list_sizeof(xcb_tmp, _aux->value_mask); 1556 xcb_tmp += xcb_block_len; 1557 xcb_align_to = ALIGNOF(char); 1558 /* insert padding */ 1559 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 1560 xcb_buffer_len += xcb_block_len + xcb_pad; 1561 if (0 != xcb_pad) { 1562 xcb_tmp += xcb_pad; 1563 xcb_pad = 0; 1564 } 1565 xcb_block_len = 0; 1566 1567 return xcb_buffer_len; 1568 } 1569 1570 xcb_void_cookie_t 1571 xcb_render_change_picture_checked (xcb_connection_t *c, 1572 xcb_render_picture_t picture, 1573 uint32_t value_mask, 1574 const void *value_list) 1575 { 1576 static const xcb_protocol_request_t xcb_req = { 1577 .count = 3, 1578 .ext = &xcb_render_id, 1579 .opcode = XCB_RENDER_CHANGE_PICTURE, 1580 .isvoid = 1 1581 }; 1582 1583 struct iovec xcb_parts[5]; 1584 xcb_void_cookie_t xcb_ret; 1585 xcb_render_change_picture_request_t xcb_out; 1586 1587 xcb_out.picture = picture; 1588 xcb_out.value_mask = value_mask; 1589 1590 xcb_parts[2].iov_base = (char *) &xcb_out; 1591 xcb_parts[2].iov_len = sizeof(xcb_out); 1592 xcb_parts[3].iov_base = 0; 1593 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1594 /* xcb_render_change_picture_value_list_t value_list */ 1595 xcb_parts[4].iov_base = (char *) value_list; 1596 xcb_parts[4].iov_len = 1597 xcb_render_change_picture_value_list_sizeof (value_list, value_mask); 1598 1599 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1600 return xcb_ret; 1601 } 1602 1603 xcb_void_cookie_t 1604 xcb_render_change_picture (xcb_connection_t *c, 1605 xcb_render_picture_t picture, 1606 uint32_t value_mask, 1607 const void *value_list) 1608 { 1609 static const xcb_protocol_request_t xcb_req = { 1610 .count = 3, 1611 .ext = &xcb_render_id, 1612 .opcode = XCB_RENDER_CHANGE_PICTURE, 1613 .isvoid = 1 1614 }; 1615 1616 struct iovec xcb_parts[5]; 1617 xcb_void_cookie_t xcb_ret; 1618 xcb_render_change_picture_request_t xcb_out; 1619 1620 xcb_out.picture = picture; 1621 xcb_out.value_mask = value_mask; 1622 1623 xcb_parts[2].iov_base = (char *) &xcb_out; 1624 xcb_parts[2].iov_len = sizeof(xcb_out); 1625 xcb_parts[3].iov_base = 0; 1626 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1627 /* xcb_render_change_picture_value_list_t value_list */ 1628 xcb_parts[4].iov_base = (char *) value_list; 1629 xcb_parts[4].iov_len = 1630 xcb_render_change_picture_value_list_sizeof (value_list, value_mask); 1631 1632 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1633 return xcb_ret; 1634 } 1635 1636 xcb_void_cookie_t 1637 xcb_render_change_picture_aux_checked (xcb_connection_t *c, 1638 xcb_render_picture_t picture, 1639 uint32_t value_mask, 1640 const xcb_render_change_picture_value_list_t *value_list) 1641 { 1642 static const xcb_protocol_request_t xcb_req = { 1643 .count = 3, 1644 .ext = &xcb_render_id, 1645 .opcode = XCB_RENDER_CHANGE_PICTURE, 1646 .isvoid = 1 1647 }; 1648 1649 struct iovec xcb_parts[5]; 1650 xcb_void_cookie_t xcb_ret; 1651 xcb_render_change_picture_request_t xcb_out; 1652 void *xcb_aux0 = 0; 1653 1654 xcb_out.picture = picture; 1655 xcb_out.value_mask = value_mask; 1656 1657 xcb_parts[2].iov_base = (char *) &xcb_out; 1658 xcb_parts[2].iov_len = sizeof(xcb_out); 1659 xcb_parts[3].iov_base = 0; 1660 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1661 /* xcb_render_change_picture_value_list_t value_list */ 1662 xcb_parts[4].iov_len = 1663 xcb_render_change_picture_value_list_serialize (&xcb_aux0, value_mask, value_list); 1664 xcb_parts[4].iov_base = xcb_aux0; 1665 1666 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1667 free(xcb_aux0); 1668 return xcb_ret; 1669 } 1670 1671 xcb_void_cookie_t 1672 xcb_render_change_picture_aux (xcb_connection_t *c, 1673 xcb_render_picture_t picture, 1674 uint32_t value_mask, 1675 const xcb_render_change_picture_value_list_t *value_list) 1676 { 1677 static const xcb_protocol_request_t xcb_req = { 1678 .count = 3, 1679 .ext = &xcb_render_id, 1680 .opcode = XCB_RENDER_CHANGE_PICTURE, 1681 .isvoid = 1 1682 }; 1683 1684 struct iovec xcb_parts[5]; 1685 xcb_void_cookie_t xcb_ret; 1686 xcb_render_change_picture_request_t xcb_out; 1687 void *xcb_aux0 = 0; 1688 1689 xcb_out.picture = picture; 1690 xcb_out.value_mask = value_mask; 1691 1692 xcb_parts[2].iov_base = (char *) &xcb_out; 1693 xcb_parts[2].iov_len = sizeof(xcb_out); 1694 xcb_parts[3].iov_base = 0; 1695 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1696 /* xcb_render_change_picture_value_list_t value_list */ 1697 xcb_parts[4].iov_len = 1698 xcb_render_change_picture_value_list_serialize (&xcb_aux0, value_mask, value_list); 1699 xcb_parts[4].iov_base = xcb_aux0; 1700 1701 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1702 free(xcb_aux0); 1703 return xcb_ret; 1704 } 1705 1706 void * 1707 xcb_render_change_picture_value_list (const xcb_render_change_picture_request_t *R) 1708 { 1709 return (void *) (R + 1); 1710 } 1711 1712 int 1713 xcb_render_set_picture_clip_rectangles_sizeof (const void *_buffer, 1714 uint32_t rectangles_len) 1715 { 1716 char *xcb_tmp = (char *)_buffer; 1717 unsigned int xcb_buffer_len = 0; 1718 unsigned int xcb_block_len = 0; 1719 unsigned int xcb_pad = 0; 1720 unsigned int xcb_align_to = 0; 1721 1722 1723 xcb_block_len += sizeof(xcb_render_set_picture_clip_rectangles_request_t); 1724 xcb_tmp += xcb_block_len; 1725 xcb_buffer_len += xcb_block_len; 1726 xcb_block_len = 0; 1727 /* rectangles */ 1728 xcb_block_len += rectangles_len * sizeof(xcb_rectangle_t); 1729 xcb_tmp += xcb_block_len; 1730 xcb_align_to = ALIGNOF(xcb_rectangle_t); 1731 /* insert padding */ 1732 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 1733 xcb_buffer_len += xcb_block_len + xcb_pad; 1734 if (0 != xcb_pad) { 1735 xcb_tmp += xcb_pad; 1736 xcb_pad = 0; 1737 } 1738 xcb_block_len = 0; 1739 1740 return xcb_buffer_len; 1741 } 1742 1743 xcb_void_cookie_t 1744 xcb_render_set_picture_clip_rectangles_checked (xcb_connection_t *c, 1745 xcb_render_picture_t picture, 1746 int16_t clip_x_origin, 1747 int16_t clip_y_origin, 1748 uint32_t rectangles_len, 1749 const xcb_rectangle_t *rectangles) 1750 { 1751 static const xcb_protocol_request_t xcb_req = { 1752 .count = 4, 1753 .ext = &xcb_render_id, 1754 .opcode = XCB_RENDER_SET_PICTURE_CLIP_RECTANGLES, 1755 .isvoid = 1 1756 }; 1757 1758 struct iovec xcb_parts[6]; 1759 xcb_void_cookie_t xcb_ret; 1760 xcb_render_set_picture_clip_rectangles_request_t xcb_out; 1761 1762 xcb_out.picture = picture; 1763 xcb_out.clip_x_origin = clip_x_origin; 1764 xcb_out.clip_y_origin = clip_y_origin; 1765 1766 xcb_parts[2].iov_base = (char *) &xcb_out; 1767 xcb_parts[2].iov_len = sizeof(xcb_out); 1768 xcb_parts[3].iov_base = 0; 1769 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1770 /* xcb_rectangle_t rectangles */ 1771 xcb_parts[4].iov_base = (char *) rectangles; 1772 xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t); 1773 xcb_parts[5].iov_base = 0; 1774 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 1775 1776 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1777 return xcb_ret; 1778 } 1779 1780 xcb_void_cookie_t 1781 xcb_render_set_picture_clip_rectangles (xcb_connection_t *c, 1782 xcb_render_picture_t picture, 1783 int16_t clip_x_origin, 1784 int16_t clip_y_origin, 1785 uint32_t rectangles_len, 1786 const xcb_rectangle_t *rectangles) 1787 { 1788 static const xcb_protocol_request_t xcb_req = { 1789 .count = 4, 1790 .ext = &xcb_render_id, 1791 .opcode = XCB_RENDER_SET_PICTURE_CLIP_RECTANGLES, 1792 .isvoid = 1 1793 }; 1794 1795 struct iovec xcb_parts[6]; 1796 xcb_void_cookie_t xcb_ret; 1797 xcb_render_set_picture_clip_rectangles_request_t xcb_out; 1798 1799 xcb_out.picture = picture; 1800 xcb_out.clip_x_origin = clip_x_origin; 1801 xcb_out.clip_y_origin = clip_y_origin; 1802 1803 xcb_parts[2].iov_base = (char *) &xcb_out; 1804 xcb_parts[2].iov_len = sizeof(xcb_out); 1805 xcb_parts[3].iov_base = 0; 1806 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1807 /* xcb_rectangle_t rectangles */ 1808 xcb_parts[4].iov_base = (char *) rectangles; 1809 xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t); 1810 xcb_parts[5].iov_base = 0; 1811 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 1812 1813 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1814 return xcb_ret; 1815 } 1816 1817 xcb_rectangle_t * 1818 xcb_render_set_picture_clip_rectangles_rectangles (const xcb_render_set_picture_clip_rectangles_request_t *R) 1819 { 1820 return (xcb_rectangle_t *) (R + 1); 1821 } 1822 1823 int 1824 xcb_render_set_picture_clip_rectangles_rectangles_length (const xcb_render_set_picture_clip_rectangles_request_t *R) 1825 { 1826 return (((R->length * 4) - sizeof(xcb_render_set_picture_clip_rectangles_request_t))/sizeof(xcb_rectangle_t)); 1827 } 1828 1829 xcb_rectangle_iterator_t 1830 xcb_render_set_picture_clip_rectangles_rectangles_iterator (const xcb_render_set_picture_clip_rectangles_request_t *R) 1831 { 1832 xcb_rectangle_iterator_t i; 1833 i.data = (xcb_rectangle_t *) (R + 1); 1834 i.rem = (((R->length * 4) - sizeof(xcb_render_set_picture_clip_rectangles_request_t))/sizeof(xcb_rectangle_t)); 1835 i.index = (char *) i.data - (char *) R; 1836 return i; 1837 } 1838 1839 xcb_void_cookie_t 1840 xcb_render_free_picture_checked (xcb_connection_t *c, 1841 xcb_render_picture_t picture) 1842 { 1843 static const xcb_protocol_request_t xcb_req = { 1844 .count = 2, 1845 .ext = &xcb_render_id, 1846 .opcode = XCB_RENDER_FREE_PICTURE, 1847 .isvoid = 1 1848 }; 1849 1850 struct iovec xcb_parts[4]; 1851 xcb_void_cookie_t xcb_ret; 1852 xcb_render_free_picture_request_t xcb_out; 1853 1854 xcb_out.picture = picture; 1855 1856 xcb_parts[2].iov_base = (char *) &xcb_out; 1857 xcb_parts[2].iov_len = sizeof(xcb_out); 1858 xcb_parts[3].iov_base = 0; 1859 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1860 1861 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1862 return xcb_ret; 1863 } 1864 1865 xcb_void_cookie_t 1866 xcb_render_free_picture (xcb_connection_t *c, 1867 xcb_render_picture_t picture) 1868 { 1869 static const xcb_protocol_request_t xcb_req = { 1870 .count = 2, 1871 .ext = &xcb_render_id, 1872 .opcode = XCB_RENDER_FREE_PICTURE, 1873 .isvoid = 1 1874 }; 1875 1876 struct iovec xcb_parts[4]; 1877 xcb_void_cookie_t xcb_ret; 1878 xcb_render_free_picture_request_t xcb_out; 1879 1880 xcb_out.picture = picture; 1881 1882 xcb_parts[2].iov_base = (char *) &xcb_out; 1883 xcb_parts[2].iov_len = sizeof(xcb_out); 1884 xcb_parts[3].iov_base = 0; 1885 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1886 1887 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1888 return xcb_ret; 1889 } 1890 1891 xcb_void_cookie_t 1892 xcb_render_composite_checked (xcb_connection_t *c, 1893 uint8_t op, 1894 xcb_render_picture_t src, 1895 xcb_render_picture_t mask, 1896 xcb_render_picture_t dst, 1897 int16_t src_x, 1898 int16_t src_y, 1899 int16_t mask_x, 1900 int16_t mask_y, 1901 int16_t dst_x, 1902 int16_t dst_y, 1903 uint16_t width, 1904 uint16_t height) 1905 { 1906 static const xcb_protocol_request_t xcb_req = { 1907 .count = 2, 1908 .ext = &xcb_render_id, 1909 .opcode = XCB_RENDER_COMPOSITE, 1910 .isvoid = 1 1911 }; 1912 1913 struct iovec xcb_parts[4]; 1914 xcb_void_cookie_t xcb_ret; 1915 xcb_render_composite_request_t xcb_out; 1916 1917 xcb_out.op = op; 1918 memset(xcb_out.pad0, 0, 3); 1919 xcb_out.src = src; 1920 xcb_out.mask = mask; 1921 xcb_out.dst = dst; 1922 xcb_out.src_x = src_x; 1923 xcb_out.src_y = src_y; 1924 xcb_out.mask_x = mask_x; 1925 xcb_out.mask_y = mask_y; 1926 xcb_out.dst_x = dst_x; 1927 xcb_out.dst_y = dst_y; 1928 xcb_out.width = width; 1929 xcb_out.height = height; 1930 1931 xcb_parts[2].iov_base = (char *) &xcb_out; 1932 xcb_parts[2].iov_len = sizeof(xcb_out); 1933 xcb_parts[3].iov_base = 0; 1934 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1935 1936 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1937 return xcb_ret; 1938 } 1939 1940 xcb_void_cookie_t 1941 xcb_render_composite (xcb_connection_t *c, 1942 uint8_t op, 1943 xcb_render_picture_t src, 1944 xcb_render_picture_t mask, 1945 xcb_render_picture_t dst, 1946 int16_t src_x, 1947 int16_t src_y, 1948 int16_t mask_x, 1949 int16_t mask_y, 1950 int16_t dst_x, 1951 int16_t dst_y, 1952 uint16_t width, 1953 uint16_t height) 1954 { 1955 static const xcb_protocol_request_t xcb_req = { 1956 .count = 2, 1957 .ext = &xcb_render_id, 1958 .opcode = XCB_RENDER_COMPOSITE, 1959 .isvoid = 1 1960 }; 1961 1962 struct iovec xcb_parts[4]; 1963 xcb_void_cookie_t xcb_ret; 1964 xcb_render_composite_request_t xcb_out; 1965 1966 xcb_out.op = op; 1967 memset(xcb_out.pad0, 0, 3); 1968 xcb_out.src = src; 1969 xcb_out.mask = mask; 1970 xcb_out.dst = dst; 1971 xcb_out.src_x = src_x; 1972 xcb_out.src_y = src_y; 1973 xcb_out.mask_x = mask_x; 1974 xcb_out.mask_y = mask_y; 1975 xcb_out.dst_x = dst_x; 1976 xcb_out.dst_y = dst_y; 1977 xcb_out.width = width; 1978 xcb_out.height = height; 1979 1980 xcb_parts[2].iov_base = (char *) &xcb_out; 1981 xcb_parts[2].iov_len = sizeof(xcb_out); 1982 xcb_parts[3].iov_base = 0; 1983 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1984 1985 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1986 return xcb_ret; 1987 } 1988 1989 int 1990 xcb_render_trapezoids_sizeof (const void *_buffer, 1991 uint32_t traps_len) 1992 { 1993 char *xcb_tmp = (char *)_buffer; 1994 unsigned int xcb_buffer_len = 0; 1995 unsigned int xcb_block_len = 0; 1996 unsigned int xcb_pad = 0; 1997 unsigned int xcb_align_to = 0; 1998 1999 2000 xcb_block_len += sizeof(xcb_render_trapezoids_request_t); 2001 xcb_tmp += xcb_block_len; 2002 xcb_buffer_len += xcb_block_len; 2003 xcb_block_len = 0; 2004 /* traps */ 2005 xcb_block_len += traps_len * sizeof(xcb_render_trapezoid_t); 2006 xcb_tmp += xcb_block_len; 2007 xcb_align_to = ALIGNOF(xcb_render_trapezoid_t); 2008 /* insert padding */ 2009 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2010 xcb_buffer_len += xcb_block_len + xcb_pad; 2011 if (0 != xcb_pad) { 2012 xcb_tmp += xcb_pad; 2013 xcb_pad = 0; 2014 } 2015 xcb_block_len = 0; 2016 2017 return xcb_buffer_len; 2018 } 2019 2020 xcb_void_cookie_t 2021 xcb_render_trapezoids_checked (xcb_connection_t *c, 2022 uint8_t op, 2023 xcb_render_picture_t src, 2024 xcb_render_picture_t dst, 2025 xcb_render_pictformat_t mask_format, 2026 int16_t src_x, 2027 int16_t src_y, 2028 uint32_t traps_len, 2029 const xcb_render_trapezoid_t *traps) 2030 { 2031 static const xcb_protocol_request_t xcb_req = { 2032 .count = 4, 2033 .ext = &xcb_render_id, 2034 .opcode = XCB_RENDER_TRAPEZOIDS, 2035 .isvoid = 1 2036 }; 2037 2038 struct iovec xcb_parts[6]; 2039 xcb_void_cookie_t xcb_ret; 2040 xcb_render_trapezoids_request_t xcb_out; 2041 2042 xcb_out.op = op; 2043 memset(xcb_out.pad0, 0, 3); 2044 xcb_out.src = src; 2045 xcb_out.dst = dst; 2046 xcb_out.mask_format = mask_format; 2047 xcb_out.src_x = src_x; 2048 xcb_out.src_y = src_y; 2049 2050 xcb_parts[2].iov_base = (char *) &xcb_out; 2051 xcb_parts[2].iov_len = sizeof(xcb_out); 2052 xcb_parts[3].iov_base = 0; 2053 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2054 /* xcb_render_trapezoid_t traps */ 2055 xcb_parts[4].iov_base = (char *) traps; 2056 xcb_parts[4].iov_len = traps_len * sizeof(xcb_render_trapezoid_t); 2057 xcb_parts[5].iov_base = 0; 2058 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2059 2060 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2061 return xcb_ret; 2062 } 2063 2064 xcb_void_cookie_t 2065 xcb_render_trapezoids (xcb_connection_t *c, 2066 uint8_t op, 2067 xcb_render_picture_t src, 2068 xcb_render_picture_t dst, 2069 xcb_render_pictformat_t mask_format, 2070 int16_t src_x, 2071 int16_t src_y, 2072 uint32_t traps_len, 2073 const xcb_render_trapezoid_t *traps) 2074 { 2075 static const xcb_protocol_request_t xcb_req = { 2076 .count = 4, 2077 .ext = &xcb_render_id, 2078 .opcode = XCB_RENDER_TRAPEZOIDS, 2079 .isvoid = 1 2080 }; 2081 2082 struct iovec xcb_parts[6]; 2083 xcb_void_cookie_t xcb_ret; 2084 xcb_render_trapezoids_request_t xcb_out; 2085 2086 xcb_out.op = op; 2087 memset(xcb_out.pad0, 0, 3); 2088 xcb_out.src = src; 2089 xcb_out.dst = dst; 2090 xcb_out.mask_format = mask_format; 2091 xcb_out.src_x = src_x; 2092 xcb_out.src_y = src_y; 2093 2094 xcb_parts[2].iov_base = (char *) &xcb_out; 2095 xcb_parts[2].iov_len = sizeof(xcb_out); 2096 xcb_parts[3].iov_base = 0; 2097 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2098 /* xcb_render_trapezoid_t traps */ 2099 xcb_parts[4].iov_base = (char *) traps; 2100 xcb_parts[4].iov_len = traps_len * sizeof(xcb_render_trapezoid_t); 2101 xcb_parts[5].iov_base = 0; 2102 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2103 2104 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2105 return xcb_ret; 2106 } 2107 2108 xcb_render_trapezoid_t * 2109 xcb_render_trapezoids_traps (const xcb_render_trapezoids_request_t *R) 2110 { 2111 return (xcb_render_trapezoid_t *) (R + 1); 2112 } 2113 2114 int 2115 xcb_render_trapezoids_traps_length (const xcb_render_trapezoids_request_t *R) 2116 { 2117 return (((R->length * 4) - sizeof(xcb_render_trapezoids_request_t))/sizeof(xcb_render_trapezoid_t)); 2118 } 2119 2120 xcb_render_trapezoid_iterator_t 2121 xcb_render_trapezoids_traps_iterator (const xcb_render_trapezoids_request_t *R) 2122 { 2123 xcb_render_trapezoid_iterator_t i; 2124 i.data = (xcb_render_trapezoid_t *) (R + 1); 2125 i.rem = (((R->length * 4) - sizeof(xcb_render_trapezoids_request_t))/sizeof(xcb_render_trapezoid_t)); 2126 i.index = (char *) i.data - (char *) R; 2127 return i; 2128 } 2129 2130 int 2131 xcb_render_triangles_sizeof (const void *_buffer, 2132 uint32_t triangles_len) 2133 { 2134 char *xcb_tmp = (char *)_buffer; 2135 unsigned int xcb_buffer_len = 0; 2136 unsigned int xcb_block_len = 0; 2137 unsigned int xcb_pad = 0; 2138 unsigned int xcb_align_to = 0; 2139 2140 2141 xcb_block_len += sizeof(xcb_render_triangles_request_t); 2142 xcb_tmp += xcb_block_len; 2143 xcb_buffer_len += xcb_block_len; 2144 xcb_block_len = 0; 2145 /* triangles */ 2146 xcb_block_len += triangles_len * sizeof(xcb_render_triangle_t); 2147 xcb_tmp += xcb_block_len; 2148 xcb_align_to = ALIGNOF(xcb_render_triangle_t); 2149 /* insert padding */ 2150 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2151 xcb_buffer_len += xcb_block_len + xcb_pad; 2152 if (0 != xcb_pad) { 2153 xcb_tmp += xcb_pad; 2154 xcb_pad = 0; 2155 } 2156 xcb_block_len = 0; 2157 2158 return xcb_buffer_len; 2159 } 2160 2161 xcb_void_cookie_t 2162 xcb_render_triangles_checked (xcb_connection_t *c, 2163 uint8_t op, 2164 xcb_render_picture_t src, 2165 xcb_render_picture_t dst, 2166 xcb_render_pictformat_t mask_format, 2167 int16_t src_x, 2168 int16_t src_y, 2169 uint32_t triangles_len, 2170 const xcb_render_triangle_t *triangles) 2171 { 2172 static const xcb_protocol_request_t xcb_req = { 2173 .count = 4, 2174 .ext = &xcb_render_id, 2175 .opcode = XCB_RENDER_TRIANGLES, 2176 .isvoid = 1 2177 }; 2178 2179 struct iovec xcb_parts[6]; 2180 xcb_void_cookie_t xcb_ret; 2181 xcb_render_triangles_request_t xcb_out; 2182 2183 xcb_out.op = op; 2184 memset(xcb_out.pad0, 0, 3); 2185 xcb_out.src = src; 2186 xcb_out.dst = dst; 2187 xcb_out.mask_format = mask_format; 2188 xcb_out.src_x = src_x; 2189 xcb_out.src_y = src_y; 2190 2191 xcb_parts[2].iov_base = (char *) &xcb_out; 2192 xcb_parts[2].iov_len = sizeof(xcb_out); 2193 xcb_parts[3].iov_base = 0; 2194 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2195 /* xcb_render_triangle_t triangles */ 2196 xcb_parts[4].iov_base = (char *) triangles; 2197 xcb_parts[4].iov_len = triangles_len * sizeof(xcb_render_triangle_t); 2198 xcb_parts[5].iov_base = 0; 2199 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2200 2201 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2202 return xcb_ret; 2203 } 2204 2205 xcb_void_cookie_t 2206 xcb_render_triangles (xcb_connection_t *c, 2207 uint8_t op, 2208 xcb_render_picture_t src, 2209 xcb_render_picture_t dst, 2210 xcb_render_pictformat_t mask_format, 2211 int16_t src_x, 2212 int16_t src_y, 2213 uint32_t triangles_len, 2214 const xcb_render_triangle_t *triangles) 2215 { 2216 static const xcb_protocol_request_t xcb_req = { 2217 .count = 4, 2218 .ext = &xcb_render_id, 2219 .opcode = XCB_RENDER_TRIANGLES, 2220 .isvoid = 1 2221 }; 2222 2223 struct iovec xcb_parts[6]; 2224 xcb_void_cookie_t xcb_ret; 2225 xcb_render_triangles_request_t xcb_out; 2226 2227 xcb_out.op = op; 2228 memset(xcb_out.pad0, 0, 3); 2229 xcb_out.src = src; 2230 xcb_out.dst = dst; 2231 xcb_out.mask_format = mask_format; 2232 xcb_out.src_x = src_x; 2233 xcb_out.src_y = src_y; 2234 2235 xcb_parts[2].iov_base = (char *) &xcb_out; 2236 xcb_parts[2].iov_len = sizeof(xcb_out); 2237 xcb_parts[3].iov_base = 0; 2238 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2239 /* xcb_render_triangle_t triangles */ 2240 xcb_parts[4].iov_base = (char *) triangles; 2241 xcb_parts[4].iov_len = triangles_len * sizeof(xcb_render_triangle_t); 2242 xcb_parts[5].iov_base = 0; 2243 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2244 2245 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2246 return xcb_ret; 2247 } 2248 2249 xcb_render_triangle_t * 2250 xcb_render_triangles_triangles (const xcb_render_triangles_request_t *R) 2251 { 2252 return (xcb_render_triangle_t *) (R + 1); 2253 } 2254 2255 int 2256 xcb_render_triangles_triangles_length (const xcb_render_triangles_request_t *R) 2257 { 2258 return (((R->length * 4) - sizeof(xcb_render_triangles_request_t))/sizeof(xcb_render_triangle_t)); 2259 } 2260 2261 xcb_render_triangle_iterator_t 2262 xcb_render_triangles_triangles_iterator (const xcb_render_triangles_request_t *R) 2263 { 2264 xcb_render_triangle_iterator_t i; 2265 i.data = (xcb_render_triangle_t *) (R + 1); 2266 i.rem = (((R->length * 4) - sizeof(xcb_render_triangles_request_t))/sizeof(xcb_render_triangle_t)); 2267 i.index = (char *) i.data - (char *) R; 2268 return i; 2269 } 2270 2271 int 2272 xcb_render_tri_strip_sizeof (const void *_buffer, 2273 uint32_t points_len) 2274 { 2275 char *xcb_tmp = (char *)_buffer; 2276 unsigned int xcb_buffer_len = 0; 2277 unsigned int xcb_block_len = 0; 2278 unsigned int xcb_pad = 0; 2279 unsigned int xcb_align_to = 0; 2280 2281 2282 xcb_block_len += sizeof(xcb_render_tri_strip_request_t); 2283 xcb_tmp += xcb_block_len; 2284 xcb_buffer_len += xcb_block_len; 2285 xcb_block_len = 0; 2286 /* points */ 2287 xcb_block_len += points_len * sizeof(xcb_render_pointfix_t); 2288 xcb_tmp += xcb_block_len; 2289 xcb_align_to = ALIGNOF(xcb_render_pointfix_t); 2290 /* insert padding */ 2291 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2292 xcb_buffer_len += xcb_block_len + xcb_pad; 2293 if (0 != xcb_pad) { 2294 xcb_tmp += xcb_pad; 2295 xcb_pad = 0; 2296 } 2297 xcb_block_len = 0; 2298 2299 return xcb_buffer_len; 2300 } 2301 2302 xcb_void_cookie_t 2303 xcb_render_tri_strip_checked (xcb_connection_t *c, 2304 uint8_t op, 2305 xcb_render_picture_t src, 2306 xcb_render_picture_t dst, 2307 xcb_render_pictformat_t mask_format, 2308 int16_t src_x, 2309 int16_t src_y, 2310 uint32_t points_len, 2311 const xcb_render_pointfix_t *points) 2312 { 2313 static const xcb_protocol_request_t xcb_req = { 2314 .count = 4, 2315 .ext = &xcb_render_id, 2316 .opcode = XCB_RENDER_TRI_STRIP, 2317 .isvoid = 1 2318 }; 2319 2320 struct iovec xcb_parts[6]; 2321 xcb_void_cookie_t xcb_ret; 2322 xcb_render_tri_strip_request_t xcb_out; 2323 2324 xcb_out.op = op; 2325 memset(xcb_out.pad0, 0, 3); 2326 xcb_out.src = src; 2327 xcb_out.dst = dst; 2328 xcb_out.mask_format = mask_format; 2329 xcb_out.src_x = src_x; 2330 xcb_out.src_y = src_y; 2331 2332 xcb_parts[2].iov_base = (char *) &xcb_out; 2333 xcb_parts[2].iov_len = sizeof(xcb_out); 2334 xcb_parts[3].iov_base = 0; 2335 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2336 /* xcb_render_pointfix_t points */ 2337 xcb_parts[4].iov_base = (char *) points; 2338 xcb_parts[4].iov_len = points_len * sizeof(xcb_render_pointfix_t); 2339 xcb_parts[5].iov_base = 0; 2340 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2341 2342 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2343 return xcb_ret; 2344 } 2345 2346 xcb_void_cookie_t 2347 xcb_render_tri_strip (xcb_connection_t *c, 2348 uint8_t op, 2349 xcb_render_picture_t src, 2350 xcb_render_picture_t dst, 2351 xcb_render_pictformat_t mask_format, 2352 int16_t src_x, 2353 int16_t src_y, 2354 uint32_t points_len, 2355 const xcb_render_pointfix_t *points) 2356 { 2357 static const xcb_protocol_request_t xcb_req = { 2358 .count = 4, 2359 .ext = &xcb_render_id, 2360 .opcode = XCB_RENDER_TRI_STRIP, 2361 .isvoid = 1 2362 }; 2363 2364 struct iovec xcb_parts[6]; 2365 xcb_void_cookie_t xcb_ret; 2366 xcb_render_tri_strip_request_t xcb_out; 2367 2368 xcb_out.op = op; 2369 memset(xcb_out.pad0, 0, 3); 2370 xcb_out.src = src; 2371 xcb_out.dst = dst; 2372 xcb_out.mask_format = mask_format; 2373 xcb_out.src_x = src_x; 2374 xcb_out.src_y = src_y; 2375 2376 xcb_parts[2].iov_base = (char *) &xcb_out; 2377 xcb_parts[2].iov_len = sizeof(xcb_out); 2378 xcb_parts[3].iov_base = 0; 2379 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2380 /* xcb_render_pointfix_t points */ 2381 xcb_parts[4].iov_base = (char *) points; 2382 xcb_parts[4].iov_len = points_len * sizeof(xcb_render_pointfix_t); 2383 xcb_parts[5].iov_base = 0; 2384 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2385 2386 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2387 return xcb_ret; 2388 } 2389 2390 xcb_render_pointfix_t * 2391 xcb_render_tri_strip_points (const xcb_render_tri_strip_request_t *R) 2392 { 2393 return (xcb_render_pointfix_t *) (R + 1); 2394 } 2395 2396 int 2397 xcb_render_tri_strip_points_length (const xcb_render_tri_strip_request_t *R) 2398 { 2399 return (((R->length * 4) - sizeof(xcb_render_tri_strip_request_t))/sizeof(xcb_render_pointfix_t)); 2400 } 2401 2402 xcb_render_pointfix_iterator_t 2403 xcb_render_tri_strip_points_iterator (const xcb_render_tri_strip_request_t *R) 2404 { 2405 xcb_render_pointfix_iterator_t i; 2406 i.data = (xcb_render_pointfix_t *) (R + 1); 2407 i.rem = (((R->length * 4) - sizeof(xcb_render_tri_strip_request_t))/sizeof(xcb_render_pointfix_t)); 2408 i.index = (char *) i.data - (char *) R; 2409 return i; 2410 } 2411 2412 int 2413 xcb_render_tri_fan_sizeof (const void *_buffer, 2414 uint32_t points_len) 2415 { 2416 char *xcb_tmp = (char *)_buffer; 2417 unsigned int xcb_buffer_len = 0; 2418 unsigned int xcb_block_len = 0; 2419 unsigned int xcb_pad = 0; 2420 unsigned int xcb_align_to = 0; 2421 2422 2423 xcb_block_len += sizeof(xcb_render_tri_fan_request_t); 2424 xcb_tmp += xcb_block_len; 2425 xcb_buffer_len += xcb_block_len; 2426 xcb_block_len = 0; 2427 /* points */ 2428 xcb_block_len += points_len * sizeof(xcb_render_pointfix_t); 2429 xcb_tmp += xcb_block_len; 2430 xcb_align_to = ALIGNOF(xcb_render_pointfix_t); 2431 /* insert padding */ 2432 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2433 xcb_buffer_len += xcb_block_len + xcb_pad; 2434 if (0 != xcb_pad) { 2435 xcb_tmp += xcb_pad; 2436 xcb_pad = 0; 2437 } 2438 xcb_block_len = 0; 2439 2440 return xcb_buffer_len; 2441 } 2442 2443 xcb_void_cookie_t 2444 xcb_render_tri_fan_checked (xcb_connection_t *c, 2445 uint8_t op, 2446 xcb_render_picture_t src, 2447 xcb_render_picture_t dst, 2448 xcb_render_pictformat_t mask_format, 2449 int16_t src_x, 2450 int16_t src_y, 2451 uint32_t points_len, 2452 const xcb_render_pointfix_t *points) 2453 { 2454 static const xcb_protocol_request_t xcb_req = { 2455 .count = 4, 2456 .ext = &xcb_render_id, 2457 .opcode = XCB_RENDER_TRI_FAN, 2458 .isvoid = 1 2459 }; 2460 2461 struct iovec xcb_parts[6]; 2462 xcb_void_cookie_t xcb_ret; 2463 xcb_render_tri_fan_request_t xcb_out; 2464 2465 xcb_out.op = op; 2466 memset(xcb_out.pad0, 0, 3); 2467 xcb_out.src = src; 2468 xcb_out.dst = dst; 2469 xcb_out.mask_format = mask_format; 2470 xcb_out.src_x = src_x; 2471 xcb_out.src_y = src_y; 2472 2473 xcb_parts[2].iov_base = (char *) &xcb_out; 2474 xcb_parts[2].iov_len = sizeof(xcb_out); 2475 xcb_parts[3].iov_base = 0; 2476 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2477 /* xcb_render_pointfix_t points */ 2478 xcb_parts[4].iov_base = (char *) points; 2479 xcb_parts[4].iov_len = points_len * sizeof(xcb_render_pointfix_t); 2480 xcb_parts[5].iov_base = 0; 2481 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2482 2483 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2484 return xcb_ret; 2485 } 2486 2487 xcb_void_cookie_t 2488 xcb_render_tri_fan (xcb_connection_t *c, 2489 uint8_t op, 2490 xcb_render_picture_t src, 2491 xcb_render_picture_t dst, 2492 xcb_render_pictformat_t mask_format, 2493 int16_t src_x, 2494 int16_t src_y, 2495 uint32_t points_len, 2496 const xcb_render_pointfix_t *points) 2497 { 2498 static const xcb_protocol_request_t xcb_req = { 2499 .count = 4, 2500 .ext = &xcb_render_id, 2501 .opcode = XCB_RENDER_TRI_FAN, 2502 .isvoid = 1 2503 }; 2504 2505 struct iovec xcb_parts[6]; 2506 xcb_void_cookie_t xcb_ret; 2507 xcb_render_tri_fan_request_t xcb_out; 2508 2509 xcb_out.op = op; 2510 memset(xcb_out.pad0, 0, 3); 2511 xcb_out.src = src; 2512 xcb_out.dst = dst; 2513 xcb_out.mask_format = mask_format; 2514 xcb_out.src_x = src_x; 2515 xcb_out.src_y = src_y; 2516 2517 xcb_parts[2].iov_base = (char *) &xcb_out; 2518 xcb_parts[2].iov_len = sizeof(xcb_out); 2519 xcb_parts[3].iov_base = 0; 2520 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2521 /* xcb_render_pointfix_t points */ 2522 xcb_parts[4].iov_base = (char *) points; 2523 xcb_parts[4].iov_len = points_len * sizeof(xcb_render_pointfix_t); 2524 xcb_parts[5].iov_base = 0; 2525 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2526 2527 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2528 return xcb_ret; 2529 } 2530 2531 xcb_render_pointfix_t * 2532 xcb_render_tri_fan_points (const xcb_render_tri_fan_request_t *R) 2533 { 2534 return (xcb_render_pointfix_t *) (R + 1); 2535 } 2536 2537 int 2538 xcb_render_tri_fan_points_length (const xcb_render_tri_fan_request_t *R) 2539 { 2540 return (((R->length * 4) - sizeof(xcb_render_tri_fan_request_t))/sizeof(xcb_render_pointfix_t)); 2541 } 2542 2543 xcb_render_pointfix_iterator_t 2544 xcb_render_tri_fan_points_iterator (const xcb_render_tri_fan_request_t *R) 2545 { 2546 xcb_render_pointfix_iterator_t i; 2547 i.data = (xcb_render_pointfix_t *) (R + 1); 2548 i.rem = (((R->length * 4) - sizeof(xcb_render_tri_fan_request_t))/sizeof(xcb_render_pointfix_t)); 2549 i.index = (char *) i.data - (char *) R; 2550 return i; 2551 } 2552 2553 xcb_void_cookie_t 2554 xcb_render_create_glyph_set_checked (xcb_connection_t *c, 2555 xcb_render_glyphset_t gsid, 2556 xcb_render_pictformat_t format) 2557 { 2558 static const xcb_protocol_request_t xcb_req = { 2559 .count = 2, 2560 .ext = &xcb_render_id, 2561 .opcode = XCB_RENDER_CREATE_GLYPH_SET, 2562 .isvoid = 1 2563 }; 2564 2565 struct iovec xcb_parts[4]; 2566 xcb_void_cookie_t xcb_ret; 2567 xcb_render_create_glyph_set_request_t xcb_out; 2568 2569 xcb_out.gsid = gsid; 2570 xcb_out.format = format; 2571 2572 xcb_parts[2].iov_base = (char *) &xcb_out; 2573 xcb_parts[2].iov_len = sizeof(xcb_out); 2574 xcb_parts[3].iov_base = 0; 2575 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2576 2577 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2578 return xcb_ret; 2579 } 2580 2581 xcb_void_cookie_t 2582 xcb_render_create_glyph_set (xcb_connection_t *c, 2583 xcb_render_glyphset_t gsid, 2584 xcb_render_pictformat_t format) 2585 { 2586 static const xcb_protocol_request_t xcb_req = { 2587 .count = 2, 2588 .ext = &xcb_render_id, 2589 .opcode = XCB_RENDER_CREATE_GLYPH_SET, 2590 .isvoid = 1 2591 }; 2592 2593 struct iovec xcb_parts[4]; 2594 xcb_void_cookie_t xcb_ret; 2595 xcb_render_create_glyph_set_request_t xcb_out; 2596 2597 xcb_out.gsid = gsid; 2598 xcb_out.format = format; 2599 2600 xcb_parts[2].iov_base = (char *) &xcb_out; 2601 xcb_parts[2].iov_len = sizeof(xcb_out); 2602 xcb_parts[3].iov_base = 0; 2603 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2604 2605 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2606 return xcb_ret; 2607 } 2608 2609 xcb_void_cookie_t 2610 xcb_render_reference_glyph_set_checked (xcb_connection_t *c, 2611 xcb_render_glyphset_t gsid, 2612 xcb_render_glyphset_t existing) 2613 { 2614 static const xcb_protocol_request_t xcb_req = { 2615 .count = 2, 2616 .ext = &xcb_render_id, 2617 .opcode = XCB_RENDER_REFERENCE_GLYPH_SET, 2618 .isvoid = 1 2619 }; 2620 2621 struct iovec xcb_parts[4]; 2622 xcb_void_cookie_t xcb_ret; 2623 xcb_render_reference_glyph_set_request_t xcb_out; 2624 2625 xcb_out.gsid = gsid; 2626 xcb_out.existing = existing; 2627 2628 xcb_parts[2].iov_base = (char *) &xcb_out; 2629 xcb_parts[2].iov_len = sizeof(xcb_out); 2630 xcb_parts[3].iov_base = 0; 2631 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2632 2633 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2634 return xcb_ret; 2635 } 2636 2637 xcb_void_cookie_t 2638 xcb_render_reference_glyph_set (xcb_connection_t *c, 2639 xcb_render_glyphset_t gsid, 2640 xcb_render_glyphset_t existing) 2641 { 2642 static const xcb_protocol_request_t xcb_req = { 2643 .count = 2, 2644 .ext = &xcb_render_id, 2645 .opcode = XCB_RENDER_REFERENCE_GLYPH_SET, 2646 .isvoid = 1 2647 }; 2648 2649 struct iovec xcb_parts[4]; 2650 xcb_void_cookie_t xcb_ret; 2651 xcb_render_reference_glyph_set_request_t xcb_out; 2652 2653 xcb_out.gsid = gsid; 2654 xcb_out.existing = existing; 2655 2656 xcb_parts[2].iov_base = (char *) &xcb_out; 2657 xcb_parts[2].iov_len = sizeof(xcb_out); 2658 xcb_parts[3].iov_base = 0; 2659 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2660 2661 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2662 return xcb_ret; 2663 } 2664 2665 xcb_void_cookie_t 2666 xcb_render_free_glyph_set_checked (xcb_connection_t *c, 2667 xcb_render_glyphset_t glyphset) 2668 { 2669 static const xcb_protocol_request_t xcb_req = { 2670 .count = 2, 2671 .ext = &xcb_render_id, 2672 .opcode = XCB_RENDER_FREE_GLYPH_SET, 2673 .isvoid = 1 2674 }; 2675 2676 struct iovec xcb_parts[4]; 2677 xcb_void_cookie_t xcb_ret; 2678 xcb_render_free_glyph_set_request_t xcb_out; 2679 2680 xcb_out.glyphset = glyphset; 2681 2682 xcb_parts[2].iov_base = (char *) &xcb_out; 2683 xcb_parts[2].iov_len = sizeof(xcb_out); 2684 xcb_parts[3].iov_base = 0; 2685 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2686 2687 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2688 return xcb_ret; 2689 } 2690 2691 xcb_void_cookie_t 2692 xcb_render_free_glyph_set (xcb_connection_t *c, 2693 xcb_render_glyphset_t glyphset) 2694 { 2695 static const xcb_protocol_request_t xcb_req = { 2696 .count = 2, 2697 .ext = &xcb_render_id, 2698 .opcode = XCB_RENDER_FREE_GLYPH_SET, 2699 .isvoid = 1 2700 }; 2701 2702 struct iovec xcb_parts[4]; 2703 xcb_void_cookie_t xcb_ret; 2704 xcb_render_free_glyph_set_request_t xcb_out; 2705 2706 xcb_out.glyphset = glyphset; 2707 2708 xcb_parts[2].iov_base = (char *) &xcb_out; 2709 xcb_parts[2].iov_len = sizeof(xcb_out); 2710 xcb_parts[3].iov_base = 0; 2711 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2712 2713 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2714 return xcb_ret; 2715 } 2716 2717 int 2718 xcb_render_add_glyphs_sizeof (const void *_buffer, 2719 uint32_t data_len) 2720 { 2721 char *xcb_tmp = (char *)_buffer; 2722 const xcb_render_add_glyphs_request_t *_aux = (xcb_render_add_glyphs_request_t *)_buffer; 2723 unsigned int xcb_buffer_len = 0; 2724 unsigned int xcb_block_len = 0; 2725 unsigned int xcb_pad = 0; 2726 unsigned int xcb_align_to = 0; 2727 2728 2729 xcb_block_len += sizeof(xcb_render_add_glyphs_request_t); 2730 xcb_tmp += xcb_block_len; 2731 xcb_buffer_len += xcb_block_len; 2732 xcb_block_len = 0; 2733 /* glyphids */ 2734 xcb_block_len += _aux->glyphs_len * sizeof(uint32_t); 2735 xcb_tmp += xcb_block_len; 2736 xcb_align_to = ALIGNOF(uint32_t); 2737 /* insert padding */ 2738 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2739 xcb_buffer_len += xcb_block_len + xcb_pad; 2740 if (0 != xcb_pad) { 2741 xcb_tmp += xcb_pad; 2742 xcb_pad = 0; 2743 } 2744 xcb_block_len = 0; 2745 /* glyphs */ 2746 xcb_block_len += _aux->glyphs_len * sizeof(xcb_render_glyphinfo_t); 2747 xcb_tmp += xcb_block_len; 2748 xcb_align_to = ALIGNOF(xcb_render_glyphinfo_t); 2749 /* insert padding */ 2750 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2751 xcb_buffer_len += xcb_block_len + xcb_pad; 2752 if (0 != xcb_pad) { 2753 xcb_tmp += xcb_pad; 2754 xcb_pad = 0; 2755 } 2756 xcb_block_len = 0; 2757 /* data */ 2758 xcb_block_len += data_len * sizeof(uint8_t); 2759 xcb_tmp += xcb_block_len; 2760 xcb_align_to = ALIGNOF(uint8_t); 2761 /* insert padding */ 2762 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2763 xcb_buffer_len += xcb_block_len + xcb_pad; 2764 if (0 != xcb_pad) { 2765 xcb_tmp += xcb_pad; 2766 xcb_pad = 0; 2767 } 2768 xcb_block_len = 0; 2769 2770 return xcb_buffer_len; 2771 } 2772 2773 xcb_void_cookie_t 2774 xcb_render_add_glyphs_checked (xcb_connection_t *c, 2775 xcb_render_glyphset_t glyphset, 2776 uint32_t glyphs_len, 2777 const uint32_t *glyphids, 2778 const xcb_render_glyphinfo_t *glyphs, 2779 uint32_t data_len, 2780 const uint8_t *data) 2781 { 2782 static const xcb_protocol_request_t xcb_req = { 2783 .count = 8, 2784 .ext = &xcb_render_id, 2785 .opcode = XCB_RENDER_ADD_GLYPHS, 2786 .isvoid = 1 2787 }; 2788 2789 struct iovec xcb_parts[10]; 2790 xcb_void_cookie_t xcb_ret; 2791 xcb_render_add_glyphs_request_t xcb_out; 2792 2793 xcb_out.glyphset = glyphset; 2794 xcb_out.glyphs_len = glyphs_len; 2795 2796 xcb_parts[2].iov_base = (char *) &xcb_out; 2797 xcb_parts[2].iov_len = sizeof(xcb_out); 2798 xcb_parts[3].iov_base = 0; 2799 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2800 /* uint32_t glyphids */ 2801 xcb_parts[4].iov_base = (char *) glyphids; 2802 xcb_parts[4].iov_len = glyphs_len * sizeof(uint32_t); 2803 xcb_parts[5].iov_base = 0; 2804 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2805 /* xcb_render_glyphinfo_t glyphs */ 2806 xcb_parts[6].iov_base = (char *) glyphs; 2807 xcb_parts[6].iov_len = glyphs_len * sizeof(xcb_render_glyphinfo_t); 2808 xcb_parts[7].iov_base = 0; 2809 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; 2810 /* uint8_t data */ 2811 xcb_parts[8].iov_base = (char *) data; 2812 xcb_parts[8].iov_len = data_len * sizeof(uint8_t); 2813 xcb_parts[9].iov_base = 0; 2814 xcb_parts[9].iov_len = -xcb_parts[8].iov_len & 3; 2815 2816 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2817 return xcb_ret; 2818 } 2819 2820 xcb_void_cookie_t 2821 xcb_render_add_glyphs (xcb_connection_t *c, 2822 xcb_render_glyphset_t glyphset, 2823 uint32_t glyphs_len, 2824 const uint32_t *glyphids, 2825 const xcb_render_glyphinfo_t *glyphs, 2826 uint32_t data_len, 2827 const uint8_t *data) 2828 { 2829 static const xcb_protocol_request_t xcb_req = { 2830 .count = 8, 2831 .ext = &xcb_render_id, 2832 .opcode = XCB_RENDER_ADD_GLYPHS, 2833 .isvoid = 1 2834 }; 2835 2836 struct iovec xcb_parts[10]; 2837 xcb_void_cookie_t xcb_ret; 2838 xcb_render_add_glyphs_request_t xcb_out; 2839 2840 xcb_out.glyphset = glyphset; 2841 xcb_out.glyphs_len = glyphs_len; 2842 2843 xcb_parts[2].iov_base = (char *) &xcb_out; 2844 xcb_parts[2].iov_len = sizeof(xcb_out); 2845 xcb_parts[3].iov_base = 0; 2846 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2847 /* uint32_t glyphids */ 2848 xcb_parts[4].iov_base = (char *) glyphids; 2849 xcb_parts[4].iov_len = glyphs_len * sizeof(uint32_t); 2850 xcb_parts[5].iov_base = 0; 2851 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2852 /* xcb_render_glyphinfo_t glyphs */ 2853 xcb_parts[6].iov_base = (char *) glyphs; 2854 xcb_parts[6].iov_len = glyphs_len * sizeof(xcb_render_glyphinfo_t); 2855 xcb_parts[7].iov_base = 0; 2856 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; 2857 /* uint8_t data */ 2858 xcb_parts[8].iov_base = (char *) data; 2859 xcb_parts[8].iov_len = data_len * sizeof(uint8_t); 2860 xcb_parts[9].iov_base = 0; 2861 xcb_parts[9].iov_len = -xcb_parts[8].iov_len & 3; 2862 2863 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 2864 return xcb_ret; 2865 } 2866 2867 uint32_t * 2868 xcb_render_add_glyphs_glyphids (const xcb_render_add_glyphs_request_t *R) 2869 { 2870 return (uint32_t *) (R + 1); 2871 } 2872 2873 int 2874 xcb_render_add_glyphs_glyphids_length (const xcb_render_add_glyphs_request_t *R) 2875 { 2876 return R->glyphs_len; 2877 } 2878 2879 xcb_generic_iterator_t 2880 xcb_render_add_glyphs_glyphids_end (const xcb_render_add_glyphs_request_t *R) 2881 { 2882 xcb_generic_iterator_t i; 2883 i.data = ((uint32_t *) (R + 1)) + (R->glyphs_len); 2884 i.rem = 0; 2885 i.index = (char *) i.data - (char *) R; 2886 return i; 2887 } 2888 2889 xcb_render_glyphinfo_t * 2890 xcb_render_add_glyphs_glyphs (const xcb_render_add_glyphs_request_t *R) 2891 { 2892 xcb_generic_iterator_t prev = xcb_render_add_glyphs_glyphids_end(R); 2893 return (xcb_render_glyphinfo_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_glyphinfo_t, prev.index) + 0); 2894 } 2895 2896 int 2897 xcb_render_add_glyphs_glyphs_length (const xcb_render_add_glyphs_request_t *R) 2898 { 2899 return R->glyphs_len; 2900 } 2901 2902 xcb_render_glyphinfo_iterator_t 2903 xcb_render_add_glyphs_glyphs_iterator (const xcb_render_add_glyphs_request_t *R) 2904 { 2905 xcb_render_glyphinfo_iterator_t i; 2906 xcb_generic_iterator_t prev = xcb_render_add_glyphs_glyphids_end(R); 2907 i.data = (xcb_render_glyphinfo_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_glyphinfo_t, prev.index)); 2908 i.rem = R->glyphs_len; 2909 i.index = (char *) i.data - (char *) R; 2910 return i; 2911 } 2912 2913 uint8_t * 2914 xcb_render_add_glyphs_data (const xcb_render_add_glyphs_request_t *R) 2915 { 2916 xcb_generic_iterator_t prev = xcb_render_glyphinfo_end(xcb_render_add_glyphs_glyphs_iterator(R)); 2917 return (uint8_t *) ((char *) prev.data + XCB_TYPE_PAD(uint8_t, prev.index) + 0); 2918 } 2919 2920 int 2921 xcb_render_add_glyphs_data_length (const xcb_render_add_glyphs_request_t *R) 2922 { 2923 return ((((char*)R) + R->length * 4) - (char*)(xcb_render_add_glyphs_data(R))) / sizeof(uint8_t); 2924 } 2925 2926 xcb_generic_iterator_t 2927 xcb_render_add_glyphs_data_end (const xcb_render_add_glyphs_request_t *R) 2928 { 2929 xcb_generic_iterator_t i; 2930 xcb_generic_iterator_t prev = xcb_render_glyphinfo_end(xcb_render_add_glyphs_glyphs_iterator(R)); 2931 i.data = ((uint8_t *) ((char*) prev.data + XCB_TYPE_PAD(uint8_t, prev.index))) + (((((char*)R) + R->length * 4) - (char*)(xcb_render_add_glyphs_data(R))) / sizeof(uint8_t)); 2932 i.rem = 0; 2933 i.index = (char *) i.data - (char *) R; 2934 return i; 2935 } 2936 2937 int 2938 xcb_render_free_glyphs_sizeof (const void *_buffer, 2939 uint32_t glyphs_len) 2940 { 2941 char *xcb_tmp = (char *)_buffer; 2942 unsigned int xcb_buffer_len = 0; 2943 unsigned int xcb_block_len = 0; 2944 unsigned int xcb_pad = 0; 2945 unsigned int xcb_align_to = 0; 2946 2947 2948 xcb_block_len += sizeof(xcb_render_free_glyphs_request_t); 2949 xcb_tmp += xcb_block_len; 2950 xcb_buffer_len += xcb_block_len; 2951 xcb_block_len = 0; 2952 /* glyphs */ 2953 xcb_block_len += glyphs_len * sizeof(xcb_render_glyph_t); 2954 xcb_tmp += xcb_block_len; 2955 xcb_align_to = ALIGNOF(xcb_render_glyph_t); 2956 /* insert padding */ 2957 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 2958 xcb_buffer_len += xcb_block_len + xcb_pad; 2959 if (0 != xcb_pad) { 2960 xcb_tmp += xcb_pad; 2961 xcb_pad = 0; 2962 } 2963 xcb_block_len = 0; 2964 2965 return xcb_buffer_len; 2966 } 2967 2968 xcb_void_cookie_t 2969 xcb_render_free_glyphs_checked (xcb_connection_t *c, 2970 xcb_render_glyphset_t glyphset, 2971 uint32_t glyphs_len, 2972 const xcb_render_glyph_t *glyphs) 2973 { 2974 static const xcb_protocol_request_t xcb_req = { 2975 .count = 4, 2976 .ext = &xcb_render_id, 2977 .opcode = XCB_RENDER_FREE_GLYPHS, 2978 .isvoid = 1 2979 }; 2980 2981 struct iovec xcb_parts[6]; 2982 xcb_void_cookie_t xcb_ret; 2983 xcb_render_free_glyphs_request_t xcb_out; 2984 2985 xcb_out.glyphset = glyphset; 2986 2987 xcb_parts[2].iov_base = (char *) &xcb_out; 2988 xcb_parts[2].iov_len = sizeof(xcb_out); 2989 xcb_parts[3].iov_base = 0; 2990 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 2991 /* xcb_render_glyph_t glyphs */ 2992 xcb_parts[4].iov_base = (char *) glyphs; 2993 xcb_parts[4].iov_len = glyphs_len * sizeof(xcb_render_glyph_t); 2994 xcb_parts[5].iov_base = 0; 2995 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 2996 2997 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 2998 return xcb_ret; 2999 } 3000 3001 xcb_void_cookie_t 3002 xcb_render_free_glyphs (xcb_connection_t *c, 3003 xcb_render_glyphset_t glyphset, 3004 uint32_t glyphs_len, 3005 const xcb_render_glyph_t *glyphs) 3006 { 3007 static const xcb_protocol_request_t xcb_req = { 3008 .count = 4, 3009 .ext = &xcb_render_id, 3010 .opcode = XCB_RENDER_FREE_GLYPHS, 3011 .isvoid = 1 3012 }; 3013 3014 struct iovec xcb_parts[6]; 3015 xcb_void_cookie_t xcb_ret; 3016 xcb_render_free_glyphs_request_t xcb_out; 3017 3018 xcb_out.glyphset = glyphset; 3019 3020 xcb_parts[2].iov_base = (char *) &xcb_out; 3021 xcb_parts[2].iov_len = sizeof(xcb_out); 3022 xcb_parts[3].iov_base = 0; 3023 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3024 /* xcb_render_glyph_t glyphs */ 3025 xcb_parts[4].iov_base = (char *) glyphs; 3026 xcb_parts[4].iov_len = glyphs_len * sizeof(xcb_render_glyph_t); 3027 xcb_parts[5].iov_base = 0; 3028 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 3029 3030 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 3031 return xcb_ret; 3032 } 3033 3034 xcb_render_glyph_t * 3035 xcb_render_free_glyphs_glyphs (const xcb_render_free_glyphs_request_t *R) 3036 { 3037 return (xcb_render_glyph_t *) (R + 1); 3038 } 3039 3040 int 3041 xcb_render_free_glyphs_glyphs_length (const xcb_render_free_glyphs_request_t *R) 3042 { 3043 return (((R->length * 4) - sizeof(xcb_render_free_glyphs_request_t))/sizeof(xcb_render_glyph_t)); 3044 } 3045 3046 xcb_generic_iterator_t 3047 xcb_render_free_glyphs_glyphs_end (const xcb_render_free_glyphs_request_t *R) 3048 { 3049 xcb_generic_iterator_t i; 3050 i.data = ((xcb_render_glyph_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_render_free_glyphs_request_t))/sizeof(xcb_render_glyph_t))); 3051 i.rem = 0; 3052 i.index = (char *) i.data - (char *) R; 3053 return i; 3054 } 3055 3056 int 3057 xcb_render_composite_glyphs_8_sizeof (const void *_buffer, 3058 uint32_t glyphcmds_len) 3059 { 3060 char *xcb_tmp = (char *)_buffer; 3061 unsigned int xcb_buffer_len = 0; 3062 unsigned int xcb_block_len = 0; 3063 unsigned int xcb_pad = 0; 3064 unsigned int xcb_align_to = 0; 3065 3066 3067 xcb_block_len += sizeof(xcb_render_composite_glyphs_8_request_t); 3068 xcb_tmp += xcb_block_len; 3069 xcb_buffer_len += xcb_block_len; 3070 xcb_block_len = 0; 3071 /* glyphcmds */ 3072 xcb_block_len += glyphcmds_len * sizeof(uint8_t); 3073 xcb_tmp += xcb_block_len; 3074 xcb_align_to = ALIGNOF(uint8_t); 3075 /* insert padding */ 3076 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3077 xcb_buffer_len += xcb_block_len + xcb_pad; 3078 if (0 != xcb_pad) { 3079 xcb_tmp += xcb_pad; 3080 xcb_pad = 0; 3081 } 3082 xcb_block_len = 0; 3083 3084 return xcb_buffer_len; 3085 } 3086 3087 xcb_void_cookie_t 3088 xcb_render_composite_glyphs_8_checked (xcb_connection_t *c, 3089 uint8_t op, 3090 xcb_render_picture_t src, 3091 xcb_render_picture_t dst, 3092 xcb_render_pictformat_t mask_format, 3093 xcb_render_glyphset_t glyphset, 3094 int16_t src_x, 3095 int16_t src_y, 3096 uint32_t glyphcmds_len, 3097 const uint8_t *glyphcmds) 3098 { 3099 static const xcb_protocol_request_t xcb_req = { 3100 .count = 4, 3101 .ext = &xcb_render_id, 3102 .opcode = XCB_RENDER_COMPOSITE_GLYPHS_8, 3103 .isvoid = 1 3104 }; 3105 3106 struct iovec xcb_parts[6]; 3107 xcb_void_cookie_t xcb_ret; 3108 xcb_render_composite_glyphs_8_request_t xcb_out; 3109 3110 xcb_out.op = op; 3111 memset(xcb_out.pad0, 0, 3); 3112 xcb_out.src = src; 3113 xcb_out.dst = dst; 3114 xcb_out.mask_format = mask_format; 3115 xcb_out.glyphset = glyphset; 3116 xcb_out.src_x = src_x; 3117 xcb_out.src_y = src_y; 3118 3119 xcb_parts[2].iov_base = (char *) &xcb_out; 3120 xcb_parts[2].iov_len = sizeof(xcb_out); 3121 xcb_parts[3].iov_base = 0; 3122 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3123 /* uint8_t glyphcmds */ 3124 xcb_parts[4].iov_base = (char *) glyphcmds; 3125 xcb_parts[4].iov_len = glyphcmds_len * sizeof(uint8_t); 3126 xcb_parts[5].iov_base = 0; 3127 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 3128 3129 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 3130 return xcb_ret; 3131 } 3132 3133 xcb_void_cookie_t 3134 xcb_render_composite_glyphs_8 (xcb_connection_t *c, 3135 uint8_t op, 3136 xcb_render_picture_t src, 3137 xcb_render_picture_t dst, 3138 xcb_render_pictformat_t mask_format, 3139 xcb_render_glyphset_t glyphset, 3140 int16_t src_x, 3141 int16_t src_y, 3142 uint32_t glyphcmds_len, 3143 const uint8_t *glyphcmds) 3144 { 3145 static const xcb_protocol_request_t xcb_req = { 3146 .count = 4, 3147 .ext = &xcb_render_id, 3148 .opcode = XCB_RENDER_COMPOSITE_GLYPHS_8, 3149 .isvoid = 1 3150 }; 3151 3152 struct iovec xcb_parts[6]; 3153 xcb_void_cookie_t xcb_ret; 3154 xcb_render_composite_glyphs_8_request_t xcb_out; 3155 3156 xcb_out.op = op; 3157 memset(xcb_out.pad0, 0, 3); 3158 xcb_out.src = src; 3159 xcb_out.dst = dst; 3160 xcb_out.mask_format = mask_format; 3161 xcb_out.glyphset = glyphset; 3162 xcb_out.src_x = src_x; 3163 xcb_out.src_y = src_y; 3164 3165 xcb_parts[2].iov_base = (char *) &xcb_out; 3166 xcb_parts[2].iov_len = sizeof(xcb_out); 3167 xcb_parts[3].iov_base = 0; 3168 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3169 /* uint8_t glyphcmds */ 3170 xcb_parts[4].iov_base = (char *) glyphcmds; 3171 xcb_parts[4].iov_len = glyphcmds_len * sizeof(uint8_t); 3172 xcb_parts[5].iov_base = 0; 3173 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 3174 3175 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 3176 return xcb_ret; 3177 } 3178 3179 uint8_t * 3180 xcb_render_composite_glyphs_8_glyphcmds (const xcb_render_composite_glyphs_8_request_t *R) 3181 { 3182 return (uint8_t *) (R + 1); 3183 } 3184 3185 int 3186 xcb_render_composite_glyphs_8_glyphcmds_length (const xcb_render_composite_glyphs_8_request_t *R) 3187 { 3188 return (((R->length * 4) - sizeof(xcb_render_composite_glyphs_8_request_t))/sizeof(uint8_t)); 3189 } 3190 3191 xcb_generic_iterator_t 3192 xcb_render_composite_glyphs_8_glyphcmds_end (const xcb_render_composite_glyphs_8_request_t *R) 3193 { 3194 xcb_generic_iterator_t i; 3195 i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_render_composite_glyphs_8_request_t))/sizeof(uint8_t))); 3196 i.rem = 0; 3197 i.index = (char *) i.data - (char *) R; 3198 return i; 3199 } 3200 3201 int 3202 xcb_render_composite_glyphs_16_sizeof (const void *_buffer, 3203 uint32_t glyphcmds_len) 3204 { 3205 char *xcb_tmp = (char *)_buffer; 3206 unsigned int xcb_buffer_len = 0; 3207 unsigned int xcb_block_len = 0; 3208 unsigned int xcb_pad = 0; 3209 unsigned int xcb_align_to = 0; 3210 3211 3212 xcb_block_len += sizeof(xcb_render_composite_glyphs_16_request_t); 3213 xcb_tmp += xcb_block_len; 3214 xcb_buffer_len += xcb_block_len; 3215 xcb_block_len = 0; 3216 /* glyphcmds */ 3217 xcb_block_len += glyphcmds_len * sizeof(uint8_t); 3218 xcb_tmp += xcb_block_len; 3219 xcb_align_to = ALIGNOF(uint8_t); 3220 /* insert padding */ 3221 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3222 xcb_buffer_len += xcb_block_len + xcb_pad; 3223 if (0 != xcb_pad) { 3224 xcb_tmp += xcb_pad; 3225 xcb_pad = 0; 3226 } 3227 xcb_block_len = 0; 3228 3229 return xcb_buffer_len; 3230 } 3231 3232 xcb_void_cookie_t 3233 xcb_render_composite_glyphs_16_checked (xcb_connection_t *c, 3234 uint8_t op, 3235 xcb_render_picture_t src, 3236 xcb_render_picture_t dst, 3237 xcb_render_pictformat_t mask_format, 3238 xcb_render_glyphset_t glyphset, 3239 int16_t src_x, 3240 int16_t src_y, 3241 uint32_t glyphcmds_len, 3242 const uint8_t *glyphcmds) 3243 { 3244 static const xcb_protocol_request_t xcb_req = { 3245 .count = 4, 3246 .ext = &xcb_render_id, 3247 .opcode = XCB_RENDER_COMPOSITE_GLYPHS_16, 3248 .isvoid = 1 3249 }; 3250 3251 struct iovec xcb_parts[6]; 3252 xcb_void_cookie_t xcb_ret; 3253 xcb_render_composite_glyphs_16_request_t xcb_out; 3254 3255 xcb_out.op = op; 3256 memset(xcb_out.pad0, 0, 3); 3257 xcb_out.src = src; 3258 xcb_out.dst = dst; 3259 xcb_out.mask_format = mask_format; 3260 xcb_out.glyphset = glyphset; 3261 xcb_out.src_x = src_x; 3262 xcb_out.src_y = src_y; 3263 3264 xcb_parts[2].iov_base = (char *) &xcb_out; 3265 xcb_parts[2].iov_len = sizeof(xcb_out); 3266 xcb_parts[3].iov_base = 0; 3267 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3268 /* uint8_t glyphcmds */ 3269 xcb_parts[4].iov_base = (char *) glyphcmds; 3270 xcb_parts[4].iov_len = glyphcmds_len * sizeof(uint8_t); 3271 xcb_parts[5].iov_base = 0; 3272 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 3273 3274 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 3275 return xcb_ret; 3276 } 3277 3278 xcb_void_cookie_t 3279 xcb_render_composite_glyphs_16 (xcb_connection_t *c, 3280 uint8_t op, 3281 xcb_render_picture_t src, 3282 xcb_render_picture_t dst, 3283 xcb_render_pictformat_t mask_format, 3284 xcb_render_glyphset_t glyphset, 3285 int16_t src_x, 3286 int16_t src_y, 3287 uint32_t glyphcmds_len, 3288 const uint8_t *glyphcmds) 3289 { 3290 static const xcb_protocol_request_t xcb_req = { 3291 .count = 4, 3292 .ext = &xcb_render_id, 3293 .opcode = XCB_RENDER_COMPOSITE_GLYPHS_16, 3294 .isvoid = 1 3295 }; 3296 3297 struct iovec xcb_parts[6]; 3298 xcb_void_cookie_t xcb_ret; 3299 xcb_render_composite_glyphs_16_request_t xcb_out; 3300 3301 xcb_out.op = op; 3302 memset(xcb_out.pad0, 0, 3); 3303 xcb_out.src = src; 3304 xcb_out.dst = dst; 3305 xcb_out.mask_format = mask_format; 3306 xcb_out.glyphset = glyphset; 3307 xcb_out.src_x = src_x; 3308 xcb_out.src_y = src_y; 3309 3310 xcb_parts[2].iov_base = (char *) &xcb_out; 3311 xcb_parts[2].iov_len = sizeof(xcb_out); 3312 xcb_parts[3].iov_base = 0; 3313 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3314 /* uint8_t glyphcmds */ 3315 xcb_parts[4].iov_base = (char *) glyphcmds; 3316 xcb_parts[4].iov_len = glyphcmds_len * sizeof(uint8_t); 3317 xcb_parts[5].iov_base = 0; 3318 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 3319 3320 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 3321 return xcb_ret; 3322 } 3323 3324 uint8_t * 3325 xcb_render_composite_glyphs_16_glyphcmds (const xcb_render_composite_glyphs_16_request_t *R) 3326 { 3327 return (uint8_t *) (R + 1); 3328 } 3329 3330 int 3331 xcb_render_composite_glyphs_16_glyphcmds_length (const xcb_render_composite_glyphs_16_request_t *R) 3332 { 3333 return (((R->length * 4) - sizeof(xcb_render_composite_glyphs_16_request_t))/sizeof(uint8_t)); 3334 } 3335 3336 xcb_generic_iterator_t 3337 xcb_render_composite_glyphs_16_glyphcmds_end (const xcb_render_composite_glyphs_16_request_t *R) 3338 { 3339 xcb_generic_iterator_t i; 3340 i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_render_composite_glyphs_16_request_t))/sizeof(uint8_t))); 3341 i.rem = 0; 3342 i.index = (char *) i.data - (char *) R; 3343 return i; 3344 } 3345 3346 int 3347 xcb_render_composite_glyphs_32_sizeof (const void *_buffer, 3348 uint32_t glyphcmds_len) 3349 { 3350 char *xcb_tmp = (char *)_buffer; 3351 unsigned int xcb_buffer_len = 0; 3352 unsigned int xcb_block_len = 0; 3353 unsigned int xcb_pad = 0; 3354 unsigned int xcb_align_to = 0; 3355 3356 3357 xcb_block_len += sizeof(xcb_render_composite_glyphs_32_request_t); 3358 xcb_tmp += xcb_block_len; 3359 xcb_buffer_len += xcb_block_len; 3360 xcb_block_len = 0; 3361 /* glyphcmds */ 3362 xcb_block_len += glyphcmds_len * sizeof(uint8_t); 3363 xcb_tmp += xcb_block_len; 3364 xcb_align_to = ALIGNOF(uint8_t); 3365 /* insert padding */ 3366 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3367 xcb_buffer_len += xcb_block_len + xcb_pad; 3368 if (0 != xcb_pad) { 3369 xcb_tmp += xcb_pad; 3370 xcb_pad = 0; 3371 } 3372 xcb_block_len = 0; 3373 3374 return xcb_buffer_len; 3375 } 3376 3377 xcb_void_cookie_t 3378 xcb_render_composite_glyphs_32_checked (xcb_connection_t *c, 3379 uint8_t op, 3380 xcb_render_picture_t src, 3381 xcb_render_picture_t dst, 3382 xcb_render_pictformat_t mask_format, 3383 xcb_render_glyphset_t glyphset, 3384 int16_t src_x, 3385 int16_t src_y, 3386 uint32_t glyphcmds_len, 3387 const uint8_t *glyphcmds) 3388 { 3389 static const xcb_protocol_request_t xcb_req = { 3390 .count = 4, 3391 .ext = &xcb_render_id, 3392 .opcode = XCB_RENDER_COMPOSITE_GLYPHS_32, 3393 .isvoid = 1 3394 }; 3395 3396 struct iovec xcb_parts[6]; 3397 xcb_void_cookie_t xcb_ret; 3398 xcb_render_composite_glyphs_32_request_t xcb_out; 3399 3400 xcb_out.op = op; 3401 memset(xcb_out.pad0, 0, 3); 3402 xcb_out.src = src; 3403 xcb_out.dst = dst; 3404 xcb_out.mask_format = mask_format; 3405 xcb_out.glyphset = glyphset; 3406 xcb_out.src_x = src_x; 3407 xcb_out.src_y = src_y; 3408 3409 xcb_parts[2].iov_base = (char *) &xcb_out; 3410 xcb_parts[2].iov_len = sizeof(xcb_out); 3411 xcb_parts[3].iov_base = 0; 3412 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3413 /* uint8_t glyphcmds */ 3414 xcb_parts[4].iov_base = (char *) glyphcmds; 3415 xcb_parts[4].iov_len = glyphcmds_len * sizeof(uint8_t); 3416 xcb_parts[5].iov_base = 0; 3417 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 3418 3419 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 3420 return xcb_ret; 3421 } 3422 3423 xcb_void_cookie_t 3424 xcb_render_composite_glyphs_32 (xcb_connection_t *c, 3425 uint8_t op, 3426 xcb_render_picture_t src, 3427 xcb_render_picture_t dst, 3428 xcb_render_pictformat_t mask_format, 3429 xcb_render_glyphset_t glyphset, 3430 int16_t src_x, 3431 int16_t src_y, 3432 uint32_t glyphcmds_len, 3433 const uint8_t *glyphcmds) 3434 { 3435 static const xcb_protocol_request_t xcb_req = { 3436 .count = 4, 3437 .ext = &xcb_render_id, 3438 .opcode = XCB_RENDER_COMPOSITE_GLYPHS_32, 3439 .isvoid = 1 3440 }; 3441 3442 struct iovec xcb_parts[6]; 3443 xcb_void_cookie_t xcb_ret; 3444 xcb_render_composite_glyphs_32_request_t xcb_out; 3445 3446 xcb_out.op = op; 3447 memset(xcb_out.pad0, 0, 3); 3448 xcb_out.src = src; 3449 xcb_out.dst = dst; 3450 xcb_out.mask_format = mask_format; 3451 xcb_out.glyphset = glyphset; 3452 xcb_out.src_x = src_x; 3453 xcb_out.src_y = src_y; 3454 3455 xcb_parts[2].iov_base = (char *) &xcb_out; 3456 xcb_parts[2].iov_len = sizeof(xcb_out); 3457 xcb_parts[3].iov_base = 0; 3458 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3459 /* uint8_t glyphcmds */ 3460 xcb_parts[4].iov_base = (char *) glyphcmds; 3461 xcb_parts[4].iov_len = glyphcmds_len * sizeof(uint8_t); 3462 xcb_parts[5].iov_base = 0; 3463 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 3464 3465 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 3466 return xcb_ret; 3467 } 3468 3469 uint8_t * 3470 xcb_render_composite_glyphs_32_glyphcmds (const xcb_render_composite_glyphs_32_request_t *R) 3471 { 3472 return (uint8_t *) (R + 1); 3473 } 3474 3475 int 3476 xcb_render_composite_glyphs_32_glyphcmds_length (const xcb_render_composite_glyphs_32_request_t *R) 3477 { 3478 return (((R->length * 4) - sizeof(xcb_render_composite_glyphs_32_request_t))/sizeof(uint8_t)); 3479 } 3480 3481 xcb_generic_iterator_t 3482 xcb_render_composite_glyphs_32_glyphcmds_end (const xcb_render_composite_glyphs_32_request_t *R) 3483 { 3484 xcb_generic_iterator_t i; 3485 i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_render_composite_glyphs_32_request_t))/sizeof(uint8_t))); 3486 i.rem = 0; 3487 i.index = (char *) i.data - (char *) R; 3488 return i; 3489 } 3490 3491 int 3492 xcb_render_fill_rectangles_sizeof (const void *_buffer, 3493 uint32_t rects_len) 3494 { 3495 char *xcb_tmp = (char *)_buffer; 3496 unsigned int xcb_buffer_len = 0; 3497 unsigned int xcb_block_len = 0; 3498 unsigned int xcb_pad = 0; 3499 unsigned int xcb_align_to = 0; 3500 3501 3502 xcb_block_len += sizeof(xcb_render_fill_rectangles_request_t); 3503 xcb_tmp += xcb_block_len; 3504 xcb_buffer_len += xcb_block_len; 3505 xcb_block_len = 0; 3506 /* rects */ 3507 xcb_block_len += rects_len * sizeof(xcb_rectangle_t); 3508 xcb_tmp += xcb_block_len; 3509 xcb_align_to = ALIGNOF(xcb_rectangle_t); 3510 /* insert padding */ 3511 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3512 xcb_buffer_len += xcb_block_len + xcb_pad; 3513 if (0 != xcb_pad) { 3514 xcb_tmp += xcb_pad; 3515 xcb_pad = 0; 3516 } 3517 xcb_block_len = 0; 3518 3519 return xcb_buffer_len; 3520 } 3521 3522 xcb_void_cookie_t 3523 xcb_render_fill_rectangles_checked (xcb_connection_t *c, 3524 uint8_t op, 3525 xcb_render_picture_t dst, 3526 xcb_render_color_t color, 3527 uint32_t rects_len, 3528 const xcb_rectangle_t *rects) 3529 { 3530 static const xcb_protocol_request_t xcb_req = { 3531 .count = 4, 3532 .ext = &xcb_render_id, 3533 .opcode = XCB_RENDER_FILL_RECTANGLES, 3534 .isvoid = 1 3535 }; 3536 3537 struct iovec xcb_parts[6]; 3538 xcb_void_cookie_t xcb_ret; 3539 xcb_render_fill_rectangles_request_t xcb_out; 3540 3541 xcb_out.op = op; 3542 memset(xcb_out.pad0, 0, 3); 3543 xcb_out.dst = dst; 3544 xcb_out.color = color; 3545 3546 xcb_parts[2].iov_base = (char *) &xcb_out; 3547 xcb_parts[2].iov_len = sizeof(xcb_out); 3548 xcb_parts[3].iov_base = 0; 3549 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3550 /* xcb_rectangle_t rects */ 3551 xcb_parts[4].iov_base = (char *) rects; 3552 xcb_parts[4].iov_len = rects_len * sizeof(xcb_rectangle_t); 3553 xcb_parts[5].iov_base = 0; 3554 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 3555 3556 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 3557 return xcb_ret; 3558 } 3559 3560 xcb_void_cookie_t 3561 xcb_render_fill_rectangles (xcb_connection_t *c, 3562 uint8_t op, 3563 xcb_render_picture_t dst, 3564 xcb_render_color_t color, 3565 uint32_t rects_len, 3566 const xcb_rectangle_t *rects) 3567 { 3568 static const xcb_protocol_request_t xcb_req = { 3569 .count = 4, 3570 .ext = &xcb_render_id, 3571 .opcode = XCB_RENDER_FILL_RECTANGLES, 3572 .isvoid = 1 3573 }; 3574 3575 struct iovec xcb_parts[6]; 3576 xcb_void_cookie_t xcb_ret; 3577 xcb_render_fill_rectangles_request_t xcb_out; 3578 3579 xcb_out.op = op; 3580 memset(xcb_out.pad0, 0, 3); 3581 xcb_out.dst = dst; 3582 xcb_out.color = color; 3583 3584 xcb_parts[2].iov_base = (char *) &xcb_out; 3585 xcb_parts[2].iov_len = sizeof(xcb_out); 3586 xcb_parts[3].iov_base = 0; 3587 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3588 /* xcb_rectangle_t rects */ 3589 xcb_parts[4].iov_base = (char *) rects; 3590 xcb_parts[4].iov_len = rects_len * sizeof(xcb_rectangle_t); 3591 xcb_parts[5].iov_base = 0; 3592 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 3593 3594 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 3595 return xcb_ret; 3596 } 3597 3598 xcb_rectangle_t * 3599 xcb_render_fill_rectangles_rects (const xcb_render_fill_rectangles_request_t *R) 3600 { 3601 return (xcb_rectangle_t *) (R + 1); 3602 } 3603 3604 int 3605 xcb_render_fill_rectangles_rects_length (const xcb_render_fill_rectangles_request_t *R) 3606 { 3607 return (((R->length * 4) - sizeof(xcb_render_fill_rectangles_request_t))/sizeof(xcb_rectangle_t)); 3608 } 3609 3610 xcb_rectangle_iterator_t 3611 xcb_render_fill_rectangles_rects_iterator (const xcb_render_fill_rectangles_request_t *R) 3612 { 3613 xcb_rectangle_iterator_t i; 3614 i.data = (xcb_rectangle_t *) (R + 1); 3615 i.rem = (((R->length * 4) - sizeof(xcb_render_fill_rectangles_request_t))/sizeof(xcb_rectangle_t)); 3616 i.index = (char *) i.data - (char *) R; 3617 return i; 3618 } 3619 3620 xcb_void_cookie_t 3621 xcb_render_create_cursor_checked (xcb_connection_t *c, 3622 xcb_cursor_t cid, 3623 xcb_render_picture_t source, 3624 uint16_t x, 3625 uint16_t y) 3626 { 3627 static const xcb_protocol_request_t xcb_req = { 3628 .count = 2, 3629 .ext = &xcb_render_id, 3630 .opcode = XCB_RENDER_CREATE_CURSOR, 3631 .isvoid = 1 3632 }; 3633 3634 struct iovec xcb_parts[4]; 3635 xcb_void_cookie_t xcb_ret; 3636 xcb_render_create_cursor_request_t xcb_out; 3637 3638 xcb_out.cid = cid; 3639 xcb_out.source = source; 3640 xcb_out.x = x; 3641 xcb_out.y = y; 3642 3643 xcb_parts[2].iov_base = (char *) &xcb_out; 3644 xcb_parts[2].iov_len = sizeof(xcb_out); 3645 xcb_parts[3].iov_base = 0; 3646 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3647 3648 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 3649 return xcb_ret; 3650 } 3651 3652 xcb_void_cookie_t 3653 xcb_render_create_cursor (xcb_connection_t *c, 3654 xcb_cursor_t cid, 3655 xcb_render_picture_t source, 3656 uint16_t x, 3657 uint16_t y) 3658 { 3659 static const xcb_protocol_request_t xcb_req = { 3660 .count = 2, 3661 .ext = &xcb_render_id, 3662 .opcode = XCB_RENDER_CREATE_CURSOR, 3663 .isvoid = 1 3664 }; 3665 3666 struct iovec xcb_parts[4]; 3667 xcb_void_cookie_t xcb_ret; 3668 xcb_render_create_cursor_request_t xcb_out; 3669 3670 xcb_out.cid = cid; 3671 xcb_out.source = source; 3672 xcb_out.x = x; 3673 xcb_out.y = y; 3674 3675 xcb_parts[2].iov_base = (char *) &xcb_out; 3676 xcb_parts[2].iov_len = sizeof(xcb_out); 3677 xcb_parts[3].iov_base = 0; 3678 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3679 3680 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 3681 return xcb_ret; 3682 } 3683 3684 void 3685 xcb_render_transform_next (xcb_render_transform_iterator_t *i) 3686 { 3687 --i->rem; 3688 ++i->data; 3689 i->index += sizeof(xcb_render_transform_t); 3690 } 3691 3692 xcb_generic_iterator_t 3693 xcb_render_transform_end (xcb_render_transform_iterator_t i) 3694 { 3695 xcb_generic_iterator_t ret; 3696 ret.data = i.data + i.rem; 3697 ret.index = i.index + ((char *) ret.data - (char *) i.data); 3698 ret.rem = 0; 3699 return ret; 3700 } 3701 3702 xcb_void_cookie_t 3703 xcb_render_set_picture_transform_checked (xcb_connection_t *c, 3704 xcb_render_picture_t picture, 3705 xcb_render_transform_t transform) 3706 { 3707 static const xcb_protocol_request_t xcb_req = { 3708 .count = 2, 3709 .ext = &xcb_render_id, 3710 .opcode = XCB_RENDER_SET_PICTURE_TRANSFORM, 3711 .isvoid = 1 3712 }; 3713 3714 struct iovec xcb_parts[4]; 3715 xcb_void_cookie_t xcb_ret; 3716 xcb_render_set_picture_transform_request_t xcb_out; 3717 3718 xcb_out.picture = picture; 3719 xcb_out.transform = transform; 3720 3721 xcb_parts[2].iov_base = (char *) &xcb_out; 3722 xcb_parts[2].iov_len = sizeof(xcb_out); 3723 xcb_parts[3].iov_base = 0; 3724 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3725 3726 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 3727 return xcb_ret; 3728 } 3729 3730 xcb_void_cookie_t 3731 xcb_render_set_picture_transform (xcb_connection_t *c, 3732 xcb_render_picture_t picture, 3733 xcb_render_transform_t transform) 3734 { 3735 static const xcb_protocol_request_t xcb_req = { 3736 .count = 2, 3737 .ext = &xcb_render_id, 3738 .opcode = XCB_RENDER_SET_PICTURE_TRANSFORM, 3739 .isvoid = 1 3740 }; 3741 3742 struct iovec xcb_parts[4]; 3743 xcb_void_cookie_t xcb_ret; 3744 xcb_render_set_picture_transform_request_t xcb_out; 3745 3746 xcb_out.picture = picture; 3747 xcb_out.transform = transform; 3748 3749 xcb_parts[2].iov_base = (char *) &xcb_out; 3750 xcb_parts[2].iov_len = sizeof(xcb_out); 3751 xcb_parts[3].iov_base = 0; 3752 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3753 3754 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 3755 return xcb_ret; 3756 } 3757 3758 int 3759 xcb_render_query_filters_sizeof (const void *_buffer) 3760 { 3761 char *xcb_tmp = (char *)_buffer; 3762 const xcb_render_query_filters_reply_t *_aux = (xcb_render_query_filters_reply_t *)_buffer; 3763 unsigned int xcb_buffer_len = 0; 3764 unsigned int xcb_block_len = 0; 3765 unsigned int xcb_pad = 0; 3766 unsigned int xcb_align_to = 0; 3767 3768 unsigned int i; 3769 unsigned int xcb_tmp_len; 3770 3771 xcb_block_len += sizeof(xcb_render_query_filters_reply_t); 3772 xcb_tmp += xcb_block_len; 3773 xcb_buffer_len += xcb_block_len; 3774 xcb_block_len = 0; 3775 /* aliases */ 3776 xcb_block_len += _aux->num_aliases * sizeof(uint16_t); 3777 xcb_tmp += xcb_block_len; 3778 xcb_align_to = ALIGNOF(uint16_t); 3779 /* insert padding */ 3780 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3781 xcb_buffer_len += xcb_block_len + xcb_pad; 3782 if (0 != xcb_pad) { 3783 xcb_tmp += xcb_pad; 3784 xcb_pad = 0; 3785 } 3786 xcb_block_len = 0; 3787 /* filters */ 3788 for(i=0; i<_aux->num_filters; i++) { 3789 xcb_tmp_len = xcb_str_sizeof(xcb_tmp); 3790 xcb_block_len += xcb_tmp_len; 3791 xcb_tmp += xcb_tmp_len; 3792 } 3793 xcb_align_to = ALIGNOF(xcb_str_t); 3794 /* insert padding */ 3795 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3796 xcb_buffer_len += xcb_block_len + xcb_pad; 3797 if (0 != xcb_pad) { 3798 xcb_tmp += xcb_pad; 3799 xcb_pad = 0; 3800 } 3801 xcb_block_len = 0; 3802 3803 return xcb_buffer_len; 3804 } 3805 3806 xcb_render_query_filters_cookie_t 3807 xcb_render_query_filters (xcb_connection_t *c, 3808 xcb_drawable_t drawable) 3809 { 3810 static const xcb_protocol_request_t xcb_req = { 3811 .count = 2, 3812 .ext = &xcb_render_id, 3813 .opcode = XCB_RENDER_QUERY_FILTERS, 3814 .isvoid = 0 3815 }; 3816 3817 struct iovec xcb_parts[4]; 3818 xcb_render_query_filters_cookie_t xcb_ret; 3819 xcb_render_query_filters_request_t xcb_out; 3820 3821 xcb_out.drawable = drawable; 3822 3823 xcb_parts[2].iov_base = (char *) &xcb_out; 3824 xcb_parts[2].iov_len = sizeof(xcb_out); 3825 xcb_parts[3].iov_base = 0; 3826 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3827 3828 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 3829 return xcb_ret; 3830 } 3831 3832 xcb_render_query_filters_cookie_t 3833 xcb_render_query_filters_unchecked (xcb_connection_t *c, 3834 xcb_drawable_t drawable) 3835 { 3836 static const xcb_protocol_request_t xcb_req = { 3837 .count = 2, 3838 .ext = &xcb_render_id, 3839 .opcode = XCB_RENDER_QUERY_FILTERS, 3840 .isvoid = 0 3841 }; 3842 3843 struct iovec xcb_parts[4]; 3844 xcb_render_query_filters_cookie_t xcb_ret; 3845 xcb_render_query_filters_request_t xcb_out; 3846 3847 xcb_out.drawable = drawable; 3848 3849 xcb_parts[2].iov_base = (char *) &xcb_out; 3850 xcb_parts[2].iov_len = sizeof(xcb_out); 3851 xcb_parts[3].iov_base = 0; 3852 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3853 3854 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 3855 return xcb_ret; 3856 } 3857 3858 uint16_t * 3859 xcb_render_query_filters_aliases (const xcb_render_query_filters_reply_t *R) 3860 { 3861 return (uint16_t *) (R + 1); 3862 } 3863 3864 int 3865 xcb_render_query_filters_aliases_length (const xcb_render_query_filters_reply_t *R) 3866 { 3867 return R->num_aliases; 3868 } 3869 3870 xcb_generic_iterator_t 3871 xcb_render_query_filters_aliases_end (const xcb_render_query_filters_reply_t *R) 3872 { 3873 xcb_generic_iterator_t i; 3874 i.data = ((uint16_t *) (R + 1)) + (R->num_aliases); 3875 i.rem = 0; 3876 i.index = (char *) i.data - (char *) R; 3877 return i; 3878 } 3879 3880 int 3881 xcb_render_query_filters_filters_length (const xcb_render_query_filters_reply_t *R) 3882 { 3883 return R->num_filters; 3884 } 3885 3886 xcb_str_iterator_t 3887 xcb_render_query_filters_filters_iterator (const xcb_render_query_filters_reply_t *R) 3888 { 3889 xcb_str_iterator_t i; 3890 xcb_generic_iterator_t prev = xcb_render_query_filters_aliases_end(R); 3891 i.data = (xcb_str_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_str_t, prev.index)); 3892 i.rem = R->num_filters; 3893 i.index = (char *) i.data - (char *) R; 3894 return i; 3895 } 3896 3897 xcb_render_query_filters_reply_t * 3898 xcb_render_query_filters_reply (xcb_connection_t *c, 3899 xcb_render_query_filters_cookie_t cookie /**< */, 3900 xcb_generic_error_t **e) 3901 { 3902 return (xcb_render_query_filters_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 3903 } 3904 3905 int 3906 xcb_render_set_picture_filter_sizeof (const void *_buffer, 3907 uint32_t values_len) 3908 { 3909 char *xcb_tmp = (char *)_buffer; 3910 const xcb_render_set_picture_filter_request_t *_aux = (xcb_render_set_picture_filter_request_t *)_buffer; 3911 unsigned int xcb_buffer_len = 0; 3912 unsigned int xcb_block_len = 0; 3913 unsigned int xcb_pad = 0; 3914 unsigned int xcb_align_to = 0; 3915 3916 3917 xcb_block_len += sizeof(xcb_render_set_picture_filter_request_t); 3918 xcb_tmp += xcb_block_len; 3919 xcb_buffer_len += xcb_block_len; 3920 xcb_block_len = 0; 3921 /* filter */ 3922 xcb_block_len += _aux->filter_len * sizeof(char); 3923 xcb_tmp += xcb_block_len; 3924 xcb_align_to = ALIGNOF(char); 3925 xcb_align_to = 4; 3926 /* insert padding */ 3927 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3928 xcb_buffer_len += xcb_block_len + xcb_pad; 3929 if (0 != xcb_pad) { 3930 xcb_tmp += xcb_pad; 3931 xcb_pad = 0; 3932 } 3933 xcb_block_len = 0; 3934 /* insert padding */ 3935 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3936 xcb_buffer_len += xcb_block_len + xcb_pad; 3937 if (0 != xcb_pad) { 3938 xcb_tmp += xcb_pad; 3939 xcb_pad = 0; 3940 } 3941 xcb_block_len = 0; 3942 /* values */ 3943 xcb_block_len += values_len * sizeof(xcb_render_fixed_t); 3944 xcb_tmp += xcb_block_len; 3945 xcb_align_to = ALIGNOF(xcb_render_fixed_t); 3946 /* insert padding */ 3947 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 3948 xcb_buffer_len += xcb_block_len + xcb_pad; 3949 if (0 != xcb_pad) { 3950 xcb_tmp += xcb_pad; 3951 xcb_pad = 0; 3952 } 3953 xcb_block_len = 0; 3954 3955 return xcb_buffer_len; 3956 } 3957 3958 xcb_void_cookie_t 3959 xcb_render_set_picture_filter_checked (xcb_connection_t *c, 3960 xcb_render_picture_t picture, 3961 uint16_t filter_len, 3962 const char *filter, 3963 uint32_t values_len, 3964 const xcb_render_fixed_t *values) 3965 { 3966 static const xcb_protocol_request_t xcb_req = { 3967 .count = 6, 3968 .ext = &xcb_render_id, 3969 .opcode = XCB_RENDER_SET_PICTURE_FILTER, 3970 .isvoid = 1 3971 }; 3972 3973 struct iovec xcb_parts[8]; 3974 xcb_void_cookie_t xcb_ret; 3975 xcb_render_set_picture_filter_request_t xcb_out; 3976 3977 xcb_out.picture = picture; 3978 xcb_out.filter_len = filter_len; 3979 memset(xcb_out.pad0, 0, 2); 3980 3981 xcb_parts[2].iov_base = (char *) &xcb_out; 3982 xcb_parts[2].iov_len = sizeof(xcb_out); 3983 xcb_parts[3].iov_base = 0; 3984 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 3985 /* char filter */ 3986 xcb_parts[4].iov_base = (char *) filter; 3987 xcb_parts[4].iov_len = filter_len * sizeof(char); 3988 xcb_parts[5].iov_base = 0; 3989 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 3990 /* xcb_render_fixed_t values */ 3991 xcb_parts[6].iov_base = (char *) values; 3992 xcb_parts[6].iov_len = values_len * sizeof(xcb_render_fixed_t); 3993 xcb_parts[7].iov_base = 0; 3994 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; 3995 3996 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 3997 return xcb_ret; 3998 } 3999 4000 xcb_void_cookie_t 4001 xcb_render_set_picture_filter (xcb_connection_t *c, 4002 xcb_render_picture_t picture, 4003 uint16_t filter_len, 4004 const char *filter, 4005 uint32_t values_len, 4006 const xcb_render_fixed_t *values) 4007 { 4008 static const xcb_protocol_request_t xcb_req = { 4009 .count = 6, 4010 .ext = &xcb_render_id, 4011 .opcode = XCB_RENDER_SET_PICTURE_FILTER, 4012 .isvoid = 1 4013 }; 4014 4015 struct iovec xcb_parts[8]; 4016 xcb_void_cookie_t xcb_ret; 4017 xcb_render_set_picture_filter_request_t xcb_out; 4018 4019 xcb_out.picture = picture; 4020 xcb_out.filter_len = filter_len; 4021 memset(xcb_out.pad0, 0, 2); 4022 4023 xcb_parts[2].iov_base = (char *) &xcb_out; 4024 xcb_parts[2].iov_len = sizeof(xcb_out); 4025 xcb_parts[3].iov_base = 0; 4026 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4027 /* char filter */ 4028 xcb_parts[4].iov_base = (char *) filter; 4029 xcb_parts[4].iov_len = filter_len * sizeof(char); 4030 xcb_parts[5].iov_base = 0; 4031 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 4032 /* xcb_render_fixed_t values */ 4033 xcb_parts[6].iov_base = (char *) values; 4034 xcb_parts[6].iov_len = values_len * sizeof(xcb_render_fixed_t); 4035 xcb_parts[7].iov_base = 0; 4036 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; 4037 4038 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 4039 return xcb_ret; 4040 } 4041 4042 char * 4043 xcb_render_set_picture_filter_filter (const xcb_render_set_picture_filter_request_t *R) 4044 { 4045 return (char *) (R + 1); 4046 } 4047 4048 int 4049 xcb_render_set_picture_filter_filter_length (const xcb_render_set_picture_filter_request_t *R) 4050 { 4051 return R->filter_len; 4052 } 4053 4054 xcb_generic_iterator_t 4055 xcb_render_set_picture_filter_filter_end (const xcb_render_set_picture_filter_request_t *R) 4056 { 4057 xcb_generic_iterator_t i; 4058 i.data = ((char *) (R + 1)) + (R->filter_len); 4059 i.rem = 0; 4060 i.index = (char *) i.data - (char *) R; 4061 return i; 4062 } 4063 4064 xcb_render_fixed_t * 4065 xcb_render_set_picture_filter_values (const xcb_render_set_picture_filter_request_t *R) 4066 { 4067 xcb_generic_iterator_t prev = xcb_render_set_picture_filter_filter_end(R); 4068 return (xcb_render_fixed_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); 4069 } 4070 4071 int 4072 xcb_render_set_picture_filter_values_length (const xcb_render_set_picture_filter_request_t *R) 4073 { 4074 return ((((char*)R) + R->length * 4) - (char*)(xcb_render_set_picture_filter_values(R))) / sizeof(xcb_render_fixed_t); 4075 } 4076 4077 xcb_generic_iterator_t 4078 xcb_render_set_picture_filter_values_end (const xcb_render_set_picture_filter_request_t *R) 4079 { 4080 xcb_generic_iterator_t i; 4081 xcb_generic_iterator_t prev = xcb_render_set_picture_filter_filter_end(R); 4082 i.data = ((xcb_render_fixed_t *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (((((char*)R) + R->length * 4) - (char*)(xcb_render_set_picture_filter_values(R))) / sizeof(xcb_render_fixed_t)); 4083 i.rem = 0; 4084 i.index = (char *) i.data - (char *) R; 4085 return i; 4086 } 4087 4088 void 4089 xcb_render_animcursorelt_next (xcb_render_animcursorelt_iterator_t *i) 4090 { 4091 --i->rem; 4092 ++i->data; 4093 i->index += sizeof(xcb_render_animcursorelt_t); 4094 } 4095 4096 xcb_generic_iterator_t 4097 xcb_render_animcursorelt_end (xcb_render_animcursorelt_iterator_t i) 4098 { 4099 xcb_generic_iterator_t ret; 4100 ret.data = i.data + i.rem; 4101 ret.index = i.index + ((char *) ret.data - (char *) i.data); 4102 ret.rem = 0; 4103 return ret; 4104 } 4105 4106 int 4107 xcb_render_create_anim_cursor_sizeof (const void *_buffer, 4108 uint32_t cursors_len) 4109 { 4110 char *xcb_tmp = (char *)_buffer; 4111 unsigned int xcb_buffer_len = 0; 4112 unsigned int xcb_block_len = 0; 4113 unsigned int xcb_pad = 0; 4114 unsigned int xcb_align_to = 0; 4115 4116 4117 xcb_block_len += sizeof(xcb_render_create_anim_cursor_request_t); 4118 xcb_tmp += xcb_block_len; 4119 xcb_buffer_len += xcb_block_len; 4120 xcb_block_len = 0; 4121 /* cursors */ 4122 xcb_block_len += cursors_len * sizeof(xcb_render_animcursorelt_t); 4123 xcb_tmp += xcb_block_len; 4124 xcb_align_to = ALIGNOF(xcb_render_animcursorelt_t); 4125 /* insert padding */ 4126 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 4127 xcb_buffer_len += xcb_block_len + xcb_pad; 4128 if (0 != xcb_pad) { 4129 xcb_tmp += xcb_pad; 4130 xcb_pad = 0; 4131 } 4132 xcb_block_len = 0; 4133 4134 return xcb_buffer_len; 4135 } 4136 4137 xcb_void_cookie_t 4138 xcb_render_create_anim_cursor_checked (xcb_connection_t *c, 4139 xcb_cursor_t cid, 4140 uint32_t cursors_len, 4141 const xcb_render_animcursorelt_t *cursors) 4142 { 4143 static const xcb_protocol_request_t xcb_req = { 4144 .count = 4, 4145 .ext = &xcb_render_id, 4146 .opcode = XCB_RENDER_CREATE_ANIM_CURSOR, 4147 .isvoid = 1 4148 }; 4149 4150 struct iovec xcb_parts[6]; 4151 xcb_void_cookie_t xcb_ret; 4152 xcb_render_create_anim_cursor_request_t xcb_out; 4153 4154 xcb_out.cid = cid; 4155 4156 xcb_parts[2].iov_base = (char *) &xcb_out; 4157 xcb_parts[2].iov_len = sizeof(xcb_out); 4158 xcb_parts[3].iov_base = 0; 4159 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4160 /* xcb_render_animcursorelt_t cursors */ 4161 xcb_parts[4].iov_base = (char *) cursors; 4162 xcb_parts[4].iov_len = cursors_len * sizeof(xcb_render_animcursorelt_t); 4163 xcb_parts[5].iov_base = 0; 4164 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 4165 4166 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 4167 return xcb_ret; 4168 } 4169 4170 xcb_void_cookie_t 4171 xcb_render_create_anim_cursor (xcb_connection_t *c, 4172 xcb_cursor_t cid, 4173 uint32_t cursors_len, 4174 const xcb_render_animcursorelt_t *cursors) 4175 { 4176 static const xcb_protocol_request_t xcb_req = { 4177 .count = 4, 4178 .ext = &xcb_render_id, 4179 .opcode = XCB_RENDER_CREATE_ANIM_CURSOR, 4180 .isvoid = 1 4181 }; 4182 4183 struct iovec xcb_parts[6]; 4184 xcb_void_cookie_t xcb_ret; 4185 xcb_render_create_anim_cursor_request_t xcb_out; 4186 4187 xcb_out.cid = cid; 4188 4189 xcb_parts[2].iov_base = (char *) &xcb_out; 4190 xcb_parts[2].iov_len = sizeof(xcb_out); 4191 xcb_parts[3].iov_base = 0; 4192 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4193 /* xcb_render_animcursorelt_t cursors */ 4194 xcb_parts[4].iov_base = (char *) cursors; 4195 xcb_parts[4].iov_len = cursors_len * sizeof(xcb_render_animcursorelt_t); 4196 xcb_parts[5].iov_base = 0; 4197 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 4198 4199 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 4200 return xcb_ret; 4201 } 4202 4203 xcb_render_animcursorelt_t * 4204 xcb_render_create_anim_cursor_cursors (const xcb_render_create_anim_cursor_request_t *R) 4205 { 4206 return (xcb_render_animcursorelt_t *) (R + 1); 4207 } 4208 4209 int 4210 xcb_render_create_anim_cursor_cursors_length (const xcb_render_create_anim_cursor_request_t *R) 4211 { 4212 return (((R->length * 4) - sizeof(xcb_render_create_anim_cursor_request_t))/sizeof(xcb_render_animcursorelt_t)); 4213 } 4214 4215 xcb_render_animcursorelt_iterator_t 4216 xcb_render_create_anim_cursor_cursors_iterator (const xcb_render_create_anim_cursor_request_t *R) 4217 { 4218 xcb_render_animcursorelt_iterator_t i; 4219 i.data = (xcb_render_animcursorelt_t *) (R + 1); 4220 i.rem = (((R->length * 4) - sizeof(xcb_render_create_anim_cursor_request_t))/sizeof(xcb_render_animcursorelt_t)); 4221 i.index = (char *) i.data - (char *) R; 4222 return i; 4223 } 4224 4225 void 4226 xcb_render_spanfix_next (xcb_render_spanfix_iterator_t *i) 4227 { 4228 --i->rem; 4229 ++i->data; 4230 i->index += sizeof(xcb_render_spanfix_t); 4231 } 4232 4233 xcb_generic_iterator_t 4234 xcb_render_spanfix_end (xcb_render_spanfix_iterator_t i) 4235 { 4236 xcb_generic_iterator_t ret; 4237 ret.data = i.data + i.rem; 4238 ret.index = i.index + ((char *) ret.data - (char *) i.data); 4239 ret.rem = 0; 4240 return ret; 4241 } 4242 4243 void 4244 xcb_render_trap_next (xcb_render_trap_iterator_t *i) 4245 { 4246 --i->rem; 4247 ++i->data; 4248 i->index += sizeof(xcb_render_trap_t); 4249 } 4250 4251 xcb_generic_iterator_t 4252 xcb_render_trap_end (xcb_render_trap_iterator_t i) 4253 { 4254 xcb_generic_iterator_t ret; 4255 ret.data = i.data + i.rem; 4256 ret.index = i.index + ((char *) ret.data - (char *) i.data); 4257 ret.rem = 0; 4258 return ret; 4259 } 4260 4261 int 4262 xcb_render_add_traps_sizeof (const void *_buffer, 4263 uint32_t traps_len) 4264 { 4265 char *xcb_tmp = (char *)_buffer; 4266 unsigned int xcb_buffer_len = 0; 4267 unsigned int xcb_block_len = 0; 4268 unsigned int xcb_pad = 0; 4269 unsigned int xcb_align_to = 0; 4270 4271 4272 xcb_block_len += sizeof(xcb_render_add_traps_request_t); 4273 xcb_tmp += xcb_block_len; 4274 xcb_buffer_len += xcb_block_len; 4275 xcb_block_len = 0; 4276 /* traps */ 4277 xcb_block_len += traps_len * sizeof(xcb_render_trap_t); 4278 xcb_tmp += xcb_block_len; 4279 xcb_align_to = ALIGNOF(xcb_render_trap_t); 4280 /* insert padding */ 4281 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 4282 xcb_buffer_len += xcb_block_len + xcb_pad; 4283 if (0 != xcb_pad) { 4284 xcb_tmp += xcb_pad; 4285 xcb_pad = 0; 4286 } 4287 xcb_block_len = 0; 4288 4289 return xcb_buffer_len; 4290 } 4291 4292 xcb_void_cookie_t 4293 xcb_render_add_traps_checked (xcb_connection_t *c, 4294 xcb_render_picture_t picture, 4295 int16_t x_off, 4296 int16_t y_off, 4297 uint32_t traps_len, 4298 const xcb_render_trap_t *traps) 4299 { 4300 static const xcb_protocol_request_t xcb_req = { 4301 .count = 4, 4302 .ext = &xcb_render_id, 4303 .opcode = XCB_RENDER_ADD_TRAPS, 4304 .isvoid = 1 4305 }; 4306 4307 struct iovec xcb_parts[6]; 4308 xcb_void_cookie_t xcb_ret; 4309 xcb_render_add_traps_request_t xcb_out; 4310 4311 xcb_out.picture = picture; 4312 xcb_out.x_off = x_off; 4313 xcb_out.y_off = y_off; 4314 4315 xcb_parts[2].iov_base = (char *) &xcb_out; 4316 xcb_parts[2].iov_len = sizeof(xcb_out); 4317 xcb_parts[3].iov_base = 0; 4318 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4319 /* xcb_render_trap_t traps */ 4320 xcb_parts[4].iov_base = (char *) traps; 4321 xcb_parts[4].iov_len = traps_len * sizeof(xcb_render_trap_t); 4322 xcb_parts[5].iov_base = 0; 4323 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 4324 4325 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 4326 return xcb_ret; 4327 } 4328 4329 xcb_void_cookie_t 4330 xcb_render_add_traps (xcb_connection_t *c, 4331 xcb_render_picture_t picture, 4332 int16_t x_off, 4333 int16_t y_off, 4334 uint32_t traps_len, 4335 const xcb_render_trap_t *traps) 4336 { 4337 static const xcb_protocol_request_t xcb_req = { 4338 .count = 4, 4339 .ext = &xcb_render_id, 4340 .opcode = XCB_RENDER_ADD_TRAPS, 4341 .isvoid = 1 4342 }; 4343 4344 struct iovec xcb_parts[6]; 4345 xcb_void_cookie_t xcb_ret; 4346 xcb_render_add_traps_request_t xcb_out; 4347 4348 xcb_out.picture = picture; 4349 xcb_out.x_off = x_off; 4350 xcb_out.y_off = y_off; 4351 4352 xcb_parts[2].iov_base = (char *) &xcb_out; 4353 xcb_parts[2].iov_len = sizeof(xcb_out); 4354 xcb_parts[3].iov_base = 0; 4355 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4356 /* xcb_render_trap_t traps */ 4357 xcb_parts[4].iov_base = (char *) traps; 4358 xcb_parts[4].iov_len = traps_len * sizeof(xcb_render_trap_t); 4359 xcb_parts[5].iov_base = 0; 4360 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 4361 4362 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 4363 return xcb_ret; 4364 } 4365 4366 xcb_render_trap_t * 4367 xcb_render_add_traps_traps (const xcb_render_add_traps_request_t *R) 4368 { 4369 return (xcb_render_trap_t *) (R + 1); 4370 } 4371 4372 int 4373 xcb_render_add_traps_traps_length (const xcb_render_add_traps_request_t *R) 4374 { 4375 return (((R->length * 4) - sizeof(xcb_render_add_traps_request_t))/sizeof(xcb_render_trap_t)); 4376 } 4377 4378 xcb_render_trap_iterator_t 4379 xcb_render_add_traps_traps_iterator (const xcb_render_add_traps_request_t *R) 4380 { 4381 xcb_render_trap_iterator_t i; 4382 i.data = (xcb_render_trap_t *) (R + 1); 4383 i.rem = (((R->length * 4) - sizeof(xcb_render_add_traps_request_t))/sizeof(xcb_render_trap_t)); 4384 i.index = (char *) i.data - (char *) R; 4385 return i; 4386 } 4387 4388 xcb_void_cookie_t 4389 xcb_render_create_solid_fill_checked (xcb_connection_t *c, 4390 xcb_render_picture_t picture, 4391 xcb_render_color_t color) 4392 { 4393 static const xcb_protocol_request_t xcb_req = { 4394 .count = 2, 4395 .ext = &xcb_render_id, 4396 .opcode = XCB_RENDER_CREATE_SOLID_FILL, 4397 .isvoid = 1 4398 }; 4399 4400 struct iovec xcb_parts[4]; 4401 xcb_void_cookie_t xcb_ret; 4402 xcb_render_create_solid_fill_request_t xcb_out; 4403 4404 xcb_out.picture = picture; 4405 xcb_out.color = color; 4406 4407 xcb_parts[2].iov_base = (char *) &xcb_out; 4408 xcb_parts[2].iov_len = sizeof(xcb_out); 4409 xcb_parts[3].iov_base = 0; 4410 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4411 4412 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 4413 return xcb_ret; 4414 } 4415 4416 xcb_void_cookie_t 4417 xcb_render_create_solid_fill (xcb_connection_t *c, 4418 xcb_render_picture_t picture, 4419 xcb_render_color_t color) 4420 { 4421 static const xcb_protocol_request_t xcb_req = { 4422 .count = 2, 4423 .ext = &xcb_render_id, 4424 .opcode = XCB_RENDER_CREATE_SOLID_FILL, 4425 .isvoid = 1 4426 }; 4427 4428 struct iovec xcb_parts[4]; 4429 xcb_void_cookie_t xcb_ret; 4430 xcb_render_create_solid_fill_request_t xcb_out; 4431 4432 xcb_out.picture = picture; 4433 xcb_out.color = color; 4434 4435 xcb_parts[2].iov_base = (char *) &xcb_out; 4436 xcb_parts[2].iov_len = sizeof(xcb_out); 4437 xcb_parts[3].iov_base = 0; 4438 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4439 4440 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 4441 return xcb_ret; 4442 } 4443 4444 int 4445 xcb_render_create_linear_gradient_sizeof (const void *_buffer) 4446 { 4447 char *xcb_tmp = (char *)_buffer; 4448 const xcb_render_create_linear_gradient_request_t *_aux = (xcb_render_create_linear_gradient_request_t *)_buffer; 4449 unsigned int xcb_buffer_len = 0; 4450 unsigned int xcb_block_len = 0; 4451 unsigned int xcb_pad = 0; 4452 unsigned int xcb_align_to = 0; 4453 4454 4455 xcb_block_len += sizeof(xcb_render_create_linear_gradient_request_t); 4456 xcb_tmp += xcb_block_len; 4457 xcb_buffer_len += xcb_block_len; 4458 xcb_block_len = 0; 4459 /* stops */ 4460 xcb_block_len += _aux->num_stops * sizeof(xcb_render_fixed_t); 4461 xcb_tmp += xcb_block_len; 4462 xcb_align_to = ALIGNOF(xcb_render_fixed_t); 4463 /* insert padding */ 4464 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 4465 xcb_buffer_len += xcb_block_len + xcb_pad; 4466 if (0 != xcb_pad) { 4467 xcb_tmp += xcb_pad; 4468 xcb_pad = 0; 4469 } 4470 xcb_block_len = 0; 4471 /* colors */ 4472 xcb_block_len += _aux->num_stops * sizeof(xcb_render_color_t); 4473 xcb_tmp += xcb_block_len; 4474 xcb_align_to = ALIGNOF(xcb_render_color_t); 4475 /* insert padding */ 4476 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 4477 xcb_buffer_len += xcb_block_len + xcb_pad; 4478 if (0 != xcb_pad) { 4479 xcb_tmp += xcb_pad; 4480 xcb_pad = 0; 4481 } 4482 xcb_block_len = 0; 4483 4484 return xcb_buffer_len; 4485 } 4486 4487 xcb_void_cookie_t 4488 xcb_render_create_linear_gradient_checked (xcb_connection_t *c, 4489 xcb_render_picture_t picture, 4490 xcb_render_pointfix_t p1, 4491 xcb_render_pointfix_t p2, 4492 uint32_t num_stops, 4493 const xcb_render_fixed_t *stops, 4494 const xcb_render_color_t *colors) 4495 { 4496 static const xcb_protocol_request_t xcb_req = { 4497 .count = 6, 4498 .ext = &xcb_render_id, 4499 .opcode = XCB_RENDER_CREATE_LINEAR_GRADIENT, 4500 .isvoid = 1 4501 }; 4502 4503 struct iovec xcb_parts[8]; 4504 xcb_void_cookie_t xcb_ret; 4505 xcb_render_create_linear_gradient_request_t xcb_out; 4506 4507 xcb_out.picture = picture; 4508 xcb_out.p1 = p1; 4509 xcb_out.p2 = p2; 4510 xcb_out.num_stops = num_stops; 4511 4512 xcb_parts[2].iov_base = (char *) &xcb_out; 4513 xcb_parts[2].iov_len = sizeof(xcb_out); 4514 xcb_parts[3].iov_base = 0; 4515 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4516 /* xcb_render_fixed_t stops */ 4517 xcb_parts[4].iov_base = (char *) stops; 4518 xcb_parts[4].iov_len = num_stops * sizeof(xcb_render_fixed_t); 4519 xcb_parts[5].iov_base = 0; 4520 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 4521 /* xcb_render_color_t colors */ 4522 xcb_parts[6].iov_base = (char *) colors; 4523 xcb_parts[6].iov_len = num_stops * sizeof(xcb_render_color_t); 4524 xcb_parts[7].iov_base = 0; 4525 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; 4526 4527 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 4528 return xcb_ret; 4529 } 4530 4531 xcb_void_cookie_t 4532 xcb_render_create_linear_gradient (xcb_connection_t *c, 4533 xcb_render_picture_t picture, 4534 xcb_render_pointfix_t p1, 4535 xcb_render_pointfix_t p2, 4536 uint32_t num_stops, 4537 const xcb_render_fixed_t *stops, 4538 const xcb_render_color_t *colors) 4539 { 4540 static const xcb_protocol_request_t xcb_req = { 4541 .count = 6, 4542 .ext = &xcb_render_id, 4543 .opcode = XCB_RENDER_CREATE_LINEAR_GRADIENT, 4544 .isvoid = 1 4545 }; 4546 4547 struct iovec xcb_parts[8]; 4548 xcb_void_cookie_t xcb_ret; 4549 xcb_render_create_linear_gradient_request_t xcb_out; 4550 4551 xcb_out.picture = picture; 4552 xcb_out.p1 = p1; 4553 xcb_out.p2 = p2; 4554 xcb_out.num_stops = num_stops; 4555 4556 xcb_parts[2].iov_base = (char *) &xcb_out; 4557 xcb_parts[2].iov_len = sizeof(xcb_out); 4558 xcb_parts[3].iov_base = 0; 4559 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4560 /* xcb_render_fixed_t stops */ 4561 xcb_parts[4].iov_base = (char *) stops; 4562 xcb_parts[4].iov_len = num_stops * sizeof(xcb_render_fixed_t); 4563 xcb_parts[5].iov_base = 0; 4564 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 4565 /* xcb_render_color_t colors */ 4566 xcb_parts[6].iov_base = (char *) colors; 4567 xcb_parts[6].iov_len = num_stops * sizeof(xcb_render_color_t); 4568 xcb_parts[7].iov_base = 0; 4569 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; 4570 4571 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 4572 return xcb_ret; 4573 } 4574 4575 xcb_render_fixed_t * 4576 xcb_render_create_linear_gradient_stops (const xcb_render_create_linear_gradient_request_t *R) 4577 { 4578 return (xcb_render_fixed_t *) (R + 1); 4579 } 4580 4581 int 4582 xcb_render_create_linear_gradient_stops_length (const xcb_render_create_linear_gradient_request_t *R) 4583 { 4584 return R->num_stops; 4585 } 4586 4587 xcb_generic_iterator_t 4588 xcb_render_create_linear_gradient_stops_end (const xcb_render_create_linear_gradient_request_t *R) 4589 { 4590 xcb_generic_iterator_t i; 4591 i.data = ((xcb_render_fixed_t *) (R + 1)) + (R->num_stops); 4592 i.rem = 0; 4593 i.index = (char *) i.data - (char *) R; 4594 return i; 4595 } 4596 4597 xcb_render_color_t * 4598 xcb_render_create_linear_gradient_colors (const xcb_render_create_linear_gradient_request_t *R) 4599 { 4600 xcb_generic_iterator_t prev = xcb_render_create_linear_gradient_stops_end(R); 4601 return (xcb_render_color_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_color_t, prev.index) + 0); 4602 } 4603 4604 int 4605 xcb_render_create_linear_gradient_colors_length (const xcb_render_create_linear_gradient_request_t *R) 4606 { 4607 return R->num_stops; 4608 } 4609 4610 xcb_render_color_iterator_t 4611 xcb_render_create_linear_gradient_colors_iterator (const xcb_render_create_linear_gradient_request_t *R) 4612 { 4613 xcb_render_color_iterator_t i; 4614 xcb_generic_iterator_t prev = xcb_render_create_linear_gradient_stops_end(R); 4615 i.data = (xcb_render_color_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_color_t, prev.index)); 4616 i.rem = R->num_stops; 4617 i.index = (char *) i.data - (char *) R; 4618 return i; 4619 } 4620 4621 int 4622 xcb_render_create_radial_gradient_sizeof (const void *_buffer) 4623 { 4624 char *xcb_tmp = (char *)_buffer; 4625 const xcb_render_create_radial_gradient_request_t *_aux = (xcb_render_create_radial_gradient_request_t *)_buffer; 4626 unsigned int xcb_buffer_len = 0; 4627 unsigned int xcb_block_len = 0; 4628 unsigned int xcb_pad = 0; 4629 unsigned int xcb_align_to = 0; 4630 4631 4632 xcb_block_len += sizeof(xcb_render_create_radial_gradient_request_t); 4633 xcb_tmp += xcb_block_len; 4634 xcb_buffer_len += xcb_block_len; 4635 xcb_block_len = 0; 4636 /* stops */ 4637 xcb_block_len += _aux->num_stops * sizeof(xcb_render_fixed_t); 4638 xcb_tmp += xcb_block_len; 4639 xcb_align_to = ALIGNOF(xcb_render_fixed_t); 4640 /* insert padding */ 4641 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 4642 xcb_buffer_len += xcb_block_len + xcb_pad; 4643 if (0 != xcb_pad) { 4644 xcb_tmp += xcb_pad; 4645 xcb_pad = 0; 4646 } 4647 xcb_block_len = 0; 4648 /* colors */ 4649 xcb_block_len += _aux->num_stops * sizeof(xcb_render_color_t); 4650 xcb_tmp += xcb_block_len; 4651 xcb_align_to = ALIGNOF(xcb_render_color_t); 4652 /* insert padding */ 4653 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 4654 xcb_buffer_len += xcb_block_len + xcb_pad; 4655 if (0 != xcb_pad) { 4656 xcb_tmp += xcb_pad; 4657 xcb_pad = 0; 4658 } 4659 xcb_block_len = 0; 4660 4661 return xcb_buffer_len; 4662 } 4663 4664 xcb_void_cookie_t 4665 xcb_render_create_radial_gradient_checked (xcb_connection_t *c, 4666 xcb_render_picture_t picture, 4667 xcb_render_pointfix_t inner, 4668 xcb_render_pointfix_t outer, 4669 xcb_render_fixed_t inner_radius, 4670 xcb_render_fixed_t outer_radius, 4671 uint32_t num_stops, 4672 const xcb_render_fixed_t *stops, 4673 const xcb_render_color_t *colors) 4674 { 4675 static const xcb_protocol_request_t xcb_req = { 4676 .count = 6, 4677 .ext = &xcb_render_id, 4678 .opcode = XCB_RENDER_CREATE_RADIAL_GRADIENT, 4679 .isvoid = 1 4680 }; 4681 4682 struct iovec xcb_parts[8]; 4683 xcb_void_cookie_t xcb_ret; 4684 xcb_render_create_radial_gradient_request_t xcb_out; 4685 4686 xcb_out.picture = picture; 4687 xcb_out.inner = inner; 4688 xcb_out.outer = outer; 4689 xcb_out.inner_radius = inner_radius; 4690 xcb_out.outer_radius = outer_radius; 4691 xcb_out.num_stops = num_stops; 4692 4693 xcb_parts[2].iov_base = (char *) &xcb_out; 4694 xcb_parts[2].iov_len = sizeof(xcb_out); 4695 xcb_parts[3].iov_base = 0; 4696 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4697 /* xcb_render_fixed_t stops */ 4698 xcb_parts[4].iov_base = (char *) stops; 4699 xcb_parts[4].iov_len = num_stops * sizeof(xcb_render_fixed_t); 4700 xcb_parts[5].iov_base = 0; 4701 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 4702 /* xcb_render_color_t colors */ 4703 xcb_parts[6].iov_base = (char *) colors; 4704 xcb_parts[6].iov_len = num_stops * sizeof(xcb_render_color_t); 4705 xcb_parts[7].iov_base = 0; 4706 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; 4707 4708 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 4709 return xcb_ret; 4710 } 4711 4712 xcb_void_cookie_t 4713 xcb_render_create_radial_gradient (xcb_connection_t *c, 4714 xcb_render_picture_t picture, 4715 xcb_render_pointfix_t inner, 4716 xcb_render_pointfix_t outer, 4717 xcb_render_fixed_t inner_radius, 4718 xcb_render_fixed_t outer_radius, 4719 uint32_t num_stops, 4720 const xcb_render_fixed_t *stops, 4721 const xcb_render_color_t *colors) 4722 { 4723 static const xcb_protocol_request_t xcb_req = { 4724 .count = 6, 4725 .ext = &xcb_render_id, 4726 .opcode = XCB_RENDER_CREATE_RADIAL_GRADIENT, 4727 .isvoid = 1 4728 }; 4729 4730 struct iovec xcb_parts[8]; 4731 xcb_void_cookie_t xcb_ret; 4732 xcb_render_create_radial_gradient_request_t xcb_out; 4733 4734 xcb_out.picture = picture; 4735 xcb_out.inner = inner; 4736 xcb_out.outer = outer; 4737 xcb_out.inner_radius = inner_radius; 4738 xcb_out.outer_radius = outer_radius; 4739 xcb_out.num_stops = num_stops; 4740 4741 xcb_parts[2].iov_base = (char *) &xcb_out; 4742 xcb_parts[2].iov_len = sizeof(xcb_out); 4743 xcb_parts[3].iov_base = 0; 4744 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4745 /* xcb_render_fixed_t stops */ 4746 xcb_parts[4].iov_base = (char *) stops; 4747 xcb_parts[4].iov_len = num_stops * sizeof(xcb_render_fixed_t); 4748 xcb_parts[5].iov_base = 0; 4749 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 4750 /* xcb_render_color_t colors */ 4751 xcb_parts[6].iov_base = (char *) colors; 4752 xcb_parts[6].iov_len = num_stops * sizeof(xcb_render_color_t); 4753 xcb_parts[7].iov_base = 0; 4754 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; 4755 4756 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 4757 return xcb_ret; 4758 } 4759 4760 xcb_render_fixed_t * 4761 xcb_render_create_radial_gradient_stops (const xcb_render_create_radial_gradient_request_t *R) 4762 { 4763 return (xcb_render_fixed_t *) (R + 1); 4764 } 4765 4766 int 4767 xcb_render_create_radial_gradient_stops_length (const xcb_render_create_radial_gradient_request_t *R) 4768 { 4769 return R->num_stops; 4770 } 4771 4772 xcb_generic_iterator_t 4773 xcb_render_create_radial_gradient_stops_end (const xcb_render_create_radial_gradient_request_t *R) 4774 { 4775 xcb_generic_iterator_t i; 4776 i.data = ((xcb_render_fixed_t *) (R + 1)) + (R->num_stops); 4777 i.rem = 0; 4778 i.index = (char *) i.data - (char *) R; 4779 return i; 4780 } 4781 4782 xcb_render_color_t * 4783 xcb_render_create_radial_gradient_colors (const xcb_render_create_radial_gradient_request_t *R) 4784 { 4785 xcb_generic_iterator_t prev = xcb_render_create_radial_gradient_stops_end(R); 4786 return (xcb_render_color_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_color_t, prev.index) + 0); 4787 } 4788 4789 int 4790 xcb_render_create_radial_gradient_colors_length (const xcb_render_create_radial_gradient_request_t *R) 4791 { 4792 return R->num_stops; 4793 } 4794 4795 xcb_render_color_iterator_t 4796 xcb_render_create_radial_gradient_colors_iterator (const xcb_render_create_radial_gradient_request_t *R) 4797 { 4798 xcb_render_color_iterator_t i; 4799 xcb_generic_iterator_t prev = xcb_render_create_radial_gradient_stops_end(R); 4800 i.data = (xcb_render_color_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_color_t, prev.index)); 4801 i.rem = R->num_stops; 4802 i.index = (char *) i.data - (char *) R; 4803 return i; 4804 } 4805 4806 int 4807 xcb_render_create_conical_gradient_sizeof (const void *_buffer) 4808 { 4809 char *xcb_tmp = (char *)_buffer; 4810 const xcb_render_create_conical_gradient_request_t *_aux = (xcb_render_create_conical_gradient_request_t *)_buffer; 4811 unsigned int xcb_buffer_len = 0; 4812 unsigned int xcb_block_len = 0; 4813 unsigned int xcb_pad = 0; 4814 unsigned int xcb_align_to = 0; 4815 4816 4817 xcb_block_len += sizeof(xcb_render_create_conical_gradient_request_t); 4818 xcb_tmp += xcb_block_len; 4819 xcb_buffer_len += xcb_block_len; 4820 xcb_block_len = 0; 4821 /* stops */ 4822 xcb_block_len += _aux->num_stops * sizeof(xcb_render_fixed_t); 4823 xcb_tmp += xcb_block_len; 4824 xcb_align_to = ALIGNOF(xcb_render_fixed_t); 4825 /* insert padding */ 4826 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 4827 xcb_buffer_len += xcb_block_len + xcb_pad; 4828 if (0 != xcb_pad) { 4829 xcb_tmp += xcb_pad; 4830 xcb_pad = 0; 4831 } 4832 xcb_block_len = 0; 4833 /* colors */ 4834 xcb_block_len += _aux->num_stops * sizeof(xcb_render_color_t); 4835 xcb_tmp += xcb_block_len; 4836 xcb_align_to = ALIGNOF(xcb_render_color_t); 4837 /* insert padding */ 4838 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 4839 xcb_buffer_len += xcb_block_len + xcb_pad; 4840 if (0 != xcb_pad) { 4841 xcb_tmp += xcb_pad; 4842 xcb_pad = 0; 4843 } 4844 xcb_block_len = 0; 4845 4846 return xcb_buffer_len; 4847 } 4848 4849 xcb_void_cookie_t 4850 xcb_render_create_conical_gradient_checked (xcb_connection_t *c, 4851 xcb_render_picture_t picture, 4852 xcb_render_pointfix_t center, 4853 xcb_render_fixed_t angle, 4854 uint32_t num_stops, 4855 const xcb_render_fixed_t *stops, 4856 const xcb_render_color_t *colors) 4857 { 4858 static const xcb_protocol_request_t xcb_req = { 4859 .count = 6, 4860 .ext = &xcb_render_id, 4861 .opcode = XCB_RENDER_CREATE_CONICAL_GRADIENT, 4862 .isvoid = 1 4863 }; 4864 4865 struct iovec xcb_parts[8]; 4866 xcb_void_cookie_t xcb_ret; 4867 xcb_render_create_conical_gradient_request_t xcb_out; 4868 4869 xcb_out.picture = picture; 4870 xcb_out.center = center; 4871 xcb_out.angle = angle; 4872 xcb_out.num_stops = num_stops; 4873 4874 xcb_parts[2].iov_base = (char *) &xcb_out; 4875 xcb_parts[2].iov_len = sizeof(xcb_out); 4876 xcb_parts[3].iov_base = 0; 4877 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4878 /* xcb_render_fixed_t stops */ 4879 xcb_parts[4].iov_base = (char *) stops; 4880 xcb_parts[4].iov_len = num_stops * sizeof(xcb_render_fixed_t); 4881 xcb_parts[5].iov_base = 0; 4882 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 4883 /* xcb_render_color_t colors */ 4884 xcb_parts[6].iov_base = (char *) colors; 4885 xcb_parts[6].iov_len = num_stops * sizeof(xcb_render_color_t); 4886 xcb_parts[7].iov_base = 0; 4887 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; 4888 4889 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 4890 return xcb_ret; 4891 } 4892 4893 xcb_void_cookie_t 4894 xcb_render_create_conical_gradient (xcb_connection_t *c, 4895 xcb_render_picture_t picture, 4896 xcb_render_pointfix_t center, 4897 xcb_render_fixed_t angle, 4898 uint32_t num_stops, 4899 const xcb_render_fixed_t *stops, 4900 const xcb_render_color_t *colors) 4901 { 4902 static const xcb_protocol_request_t xcb_req = { 4903 .count = 6, 4904 .ext = &xcb_render_id, 4905 .opcode = XCB_RENDER_CREATE_CONICAL_GRADIENT, 4906 .isvoid = 1 4907 }; 4908 4909 struct iovec xcb_parts[8]; 4910 xcb_void_cookie_t xcb_ret; 4911 xcb_render_create_conical_gradient_request_t xcb_out; 4912 4913 xcb_out.picture = picture; 4914 xcb_out.center = center; 4915 xcb_out.angle = angle; 4916 xcb_out.num_stops = num_stops; 4917 4918 xcb_parts[2].iov_base = (char *) &xcb_out; 4919 xcb_parts[2].iov_len = sizeof(xcb_out); 4920 xcb_parts[3].iov_base = 0; 4921 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 4922 /* xcb_render_fixed_t stops */ 4923 xcb_parts[4].iov_base = (char *) stops; 4924 xcb_parts[4].iov_len = num_stops * sizeof(xcb_render_fixed_t); 4925 xcb_parts[5].iov_base = 0; 4926 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 4927 /* xcb_render_color_t colors */ 4928 xcb_parts[6].iov_base = (char *) colors; 4929 xcb_parts[6].iov_len = num_stops * sizeof(xcb_render_color_t); 4930 xcb_parts[7].iov_base = 0; 4931 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; 4932 4933 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 4934 return xcb_ret; 4935 } 4936 4937 xcb_render_fixed_t * 4938 xcb_render_create_conical_gradient_stops (const xcb_render_create_conical_gradient_request_t *R) 4939 { 4940 return (xcb_render_fixed_t *) (R + 1); 4941 } 4942 4943 int 4944 xcb_render_create_conical_gradient_stops_length (const xcb_render_create_conical_gradient_request_t *R) 4945 { 4946 return R->num_stops; 4947 } 4948 4949 xcb_generic_iterator_t 4950 xcb_render_create_conical_gradient_stops_end (const xcb_render_create_conical_gradient_request_t *R) 4951 { 4952 xcb_generic_iterator_t i; 4953 i.data = ((xcb_render_fixed_t *) (R + 1)) + (R->num_stops); 4954 i.rem = 0; 4955 i.index = (char *) i.data - (char *) R; 4956 return i; 4957 } 4958 4959 xcb_render_color_t * 4960 xcb_render_create_conical_gradient_colors (const xcb_render_create_conical_gradient_request_t *R) 4961 { 4962 xcb_generic_iterator_t prev = xcb_render_create_conical_gradient_stops_end(R); 4963 return (xcb_render_color_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_color_t, prev.index) + 0); 4964 } 4965 4966 int 4967 xcb_render_create_conical_gradient_colors_length (const xcb_render_create_conical_gradient_request_t *R) 4968 { 4969 return R->num_stops; 4970 } 4971 4972 xcb_render_color_iterator_t 4973 xcb_render_create_conical_gradient_colors_iterator (const xcb_render_create_conical_gradient_request_t *R) 4974 { 4975 xcb_render_color_iterator_t i; 4976 xcb_generic_iterator_t prev = xcb_render_create_conical_gradient_stops_end(R); 4977 i.data = (xcb_render_color_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_color_t, prev.index)); 4978 i.rem = R->num_stops; 4979 i.index = (char *) i.data - (char *) R; 4980 return i; 4981 } 4982 4983