| | 326 | |
| | 327 | static void ShadowTriangles(CARD8 op, |
| | 328 | PicturePtr pSrc, |
| | 329 | PicturePtr pDst, |
| | 330 | PictFormatPtr maskFormat, |
| | 331 | INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris) |
| | 332 | { |
| | 333 | ScreenPtr pScreen = pDst->pDrawable->pScreen; |
| | 334 | PictureScreenPtr ps = GetPictureScreen(pScreen); |
| | 335 | ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); |
| | 336 | BoxRec box; |
| | 337 | Bool boxNotEmpty = FALSE; |
| | 338 | if (pPriv->vtSema && pDst->pDrawable->type == DRAWABLE_WINDOW) { |
| | 339 | miTriangleBounds(ntris, tris, &box); |
| | 340 | if (BOX_NOT_EMPTY(box)) { |
| | 341 | int dx=RegionExtents(pDst->pCompositeClip)->x1; |
| | 342 | int dy=RegionExtents(pDst->pCompositeClip)->y1; |
| | 343 | box.x1+=dx; box.x2+=dx; |
| | 344 | box.y1+=dy; box.y2+=dy; |
| | 345 | if (pPriv->preRefresh) |
| | 346 | (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); |
| | 347 | boxNotEmpty = TRUE; |
| | 348 | } |
| | 349 | } |
| | 350 | ps->Triangles = pPriv->Triangles; |
| | 351 | (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntris, tris); |
| | 352 | ps->Triangles = ShadowTriangles; |
| | 353 | |
| | 354 | if (pPriv->postRefresh && boxNotEmpty) { |
| | 355 | (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); |
| | 356 | } |
| | 357 | } |
| | 358 | |
| | 359 | |
| | 360 | |
| | 361 | static void ShadowTrapezoids(CARD8 op, |
| | 362 | PicturePtr pSrc, |
| | 363 | PicturePtr pDst, |
| | 364 | PictFormatPtr maskFormat, |
| | 365 | INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps) |
| | 366 | { |
| | 367 | ScreenPtr pScreen = pDst->pDrawable->pScreen; |
| | 368 | PictureScreenPtr ps = GetPictureScreen(pScreen); |
| | 369 | ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); |
| | 370 | BoxRec box; |
| | 371 | Bool boxNotEmpty = FALSE; |
| | 372 | if (pPriv->vtSema && pDst->pDrawable->type == DRAWABLE_WINDOW) { |
| | 373 | miTrapezoidBounds(ntrap, traps, &box); |
| | 374 | if (BOX_NOT_EMPTY((box))) { |
| | 375 | int dx=RegionExtents(pDst->pCompositeClip)->x1; |
| | 376 | int dy=RegionExtents(pDst->pCompositeClip)->y1; |
| | 377 | box.x1+=dx; box.x2+=dx; |
| | 378 | box.y1+=dy; box.y2+=dy; |
| | 379 | if (pPriv->preRefresh) |
| | 380 | (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); |
| | 381 | boxNotEmpty = TRUE; |
| | 382 | } |
| | 383 | } |
| | 384 | ps->Trapezoids = pPriv->Trapezoids; |
| | 385 | (*ps->Trapezoids) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, traps); |
| | 386 | ps->Trapezoids = ShadowTrapezoids; |
| | 387 | |
| | 388 | if (pPriv->postRefresh && boxNotEmpty) { |
| | 389 | (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); |
| | 390 | } |
| | 391 | } |
| | 392 | |
| | 393 | static void |
| | 394 | ShadowAddTraps(PicturePtr pPicture, |
| | 395 | INT16 x_off, |
| | 396 | INT16 y_off, |
| | 397 | int ntrap, |
| | 398 | xTrap * traps) |
| | 399 | { |
| | 400 | ScreenPtr pScreen = pPicture->pDrawable->pScreen; |
| | 401 | PictureScreenPtr ps = GetPictureScreen(pScreen); |
| | 402 | ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); |
| | 403 | BoxRec box; |
| | 404 | Bool boxNotEmpty = FALSE; |
| | 405 | int i; |
| | 406 | int x, y; |
| | 407 | xTrap *t = traps; |
| | 408 | if (pPriv->vtSema && pPicture->pDrawable->type == DRAWABLE_WINDOW) { |
| | 409 | box.x1 = 32767; |
| | 410 | box.y1 = 32767; |
| | 411 | box.x2 = -32767; |
| | 412 | box.y2 = -32767; |
| | 413 | x = pPicture->pDrawable->x + x_off; |
| | 414 | y = pPicture->pDrawable->y + y_off; |
| | 415 | for (i = 0; i < ntrap; i++) { |
| | 416 | pixman_fixed_t l = min(t->top.l, t->bot.l); |
| | 417 | pixman_fixed_t r = max(t->top.r, t->bot.r); |
| | 418 | int x1 = x + pixman_fixed_to_int(l); |
| | 419 | int x2 = x + pixman_fixed_to_int(pixman_fixed_ceil(r)); |
| | 420 | int y1 = y + pixman_fixed_to_int(t->top.y); |
| | 421 | int y2 = y + pixman_fixed_to_int(pixman_fixed_ceil(t->bot.y)); |
| | 422 | |
| | 423 | if (x1 < box.x1) |
| | 424 | box.x1 = x1; |
| | 425 | if (x2 > box.x2) |
| | 426 | box.x2 = x2; |
| | 427 | if (y1 < box.y1) |
| | 428 | box.y1 = y1; |
| | 429 | if (y2 > box.y2) |
| | 430 | box.y2 = y2; |
| | 431 | } |
| | 432 | if (BOX_NOT_EMPTY(box)) { |
| | 433 | if (pPriv->preRefresh) |
| | 434 | (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); |
| | 435 | boxNotEmpty = TRUE; |
| | 436 | } |
| | 437 | } |
| | 438 | ps->AddTraps = pPriv->AddTraps; |
| | 439 | (*ps->AddTraps) (pPicture, x_off, y_off, ntrap, traps); |
| | 440 | ps->AddTraps = ShadowAddTraps; |
| | 441 | |
| | 442 | if (pPriv->postRefresh && boxNotEmpty) { |
| | 443 | (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); |
| | 444 | } |
| | 445 | } |
| | 446 | |
| | 447 | |
| | 448 | static void |
| | 449 | ShadowGlyphs(CARD8 op, |
| | 450 | PicturePtr pSrc, |
| | 451 | PicturePtr pDst, |
| | 452 | PictFormatPtr maskFormat, |
| | 453 | INT16 xSrc, |
| | 454 | INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs) |
| | 455 | { |
| | 456 | ScreenPtr pScreen = pDst->pDrawable->pScreen; |
| | 457 | ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); |
| | 458 | PictureScreenPtr ps = GetPictureScreen(pScreen); |
| | 459 | int x, y; |
| | 460 | int n; |
| | 461 | GlyphPtr glyph; |
| | 462 | BoxRec box; |
| | 463 | int x1, y1, x2, y2; |
| | 464 | Bool boxNotEmpty = FALSE; |
| | 465 | |
| | 466 | if (pPriv->vtSema && pDst->pDrawable->type == DRAWABLE_WINDOW) { |
| | 467 | int nlistTmp = nlist; |
| | 468 | GlyphListPtr listTmp = list; |
| | 469 | GlyphPtr *glyphsTmp = glyphs; |
| | 470 | |
| | 471 | box.x1 = 32767; |
| | 472 | box.y1 = 32767; |
| | 473 | box.x2 = -32767; |
| | 474 | box.y2 = -32767; |
| | 475 | x = pDst->pDrawable->x; |
| | 476 | y = pDst->pDrawable->y; |
| | 477 | while (nlistTmp--) { |
| | 478 | x += listTmp->xOff; |
| | 479 | y += listTmp->yOff; |
| | 480 | n = listTmp->len; |
| | 481 | while (n--) { |
| | 482 | glyph = *glyphsTmp++; |
| | 483 | x1 = x - glyph->info.x; |
| | 484 | y1 = y - glyph->info.y; |
| | 485 | x2 = x1 + glyph->info.width; |
| | 486 | y2 = y1 + glyph->info.height; |
| | 487 | if (x1 < box.x1) |
| | 488 | box.x1 = x1; |
| | 489 | if (y1 < box.y1) |
| | 490 | box.y1 = y1; |
| | 491 | if (x2 > box.x2) |
| | 492 | box.x2 = x2; |
| | 493 | if (y2 > box.y2) |
| | 494 | box.y2 = y2; |
| | 495 | x += glyph->info.xOff; |
| | 496 | y += glyph->info.yOff; |
| | 497 | } |
| | 498 | listTmp++; |
| | 499 | } |
| | 500 | |
| | 501 | |
| | 502 | |
| | 503 | if (BOX_NOT_EMPTY(box)) { |
| | 504 | if (pPriv->preRefresh) |
| | 505 | (*pPriv->preRefresh) (pPriv->pScrn, 1, &box); |
| | 506 | boxNotEmpty = TRUE; |
| | 507 | } |
| | 508 | } |
| | 509 | |
| | 510 | ps->Glyphs = pPriv->Glyphs; |
| | 511 | (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); |
| | 512 | ps->Glyphs = ShadowGlyphs; |
| | 513 | |
| | 514 | if (pPriv->postRefresh && boxNotEmpty) { |
| | 515 | (*pPriv->postRefresh) (pPriv->pScrn, 1, &box); |
| | 516 | } |
| | 517 | } |
| | 518 | |
| | 519 | |