| 400 | } |
| 401 | |
| 402 | void PiuScrollerUpdate(void* it, PiuView* view, PiuRectangle area) |
| 403 | { |
| 404 | PiuScroller* self = it; |
| 405 | if ((*self)->flags & piuVisible) { |
| 406 | PiuRectangle bounds = &((*self)->bounds); |
| 407 | PiuBoolean clip = ((*self)->flags & piuClip) ? 1 : 0; |
| 408 | PiuBoolean intersect; |
| 409 | PiuRectangleRecord intersection; |
| 410 | if (clip) |
| 411 | intersect = PiuRectangleIntersect(&intersection, bounds, area); |
| 412 | else |
| 413 | intersect = PiuRectangleIntersects(bounds, area); |
| 414 | if (!clip || intersect) { |
| 415 | PiuContent* content = (*self)->first; |
| 416 | PiuCoordinate x = bounds->x; |
| 417 | PiuCoordinate y = bounds->y; |
| 418 | PiuRectangle temporary; |
| 419 | PiuViewPushOrigin(view, x, y); |
| 420 | PiuRectangleOffset(area, -x, -y); |
| 421 | if (intersect) |
| 422 | (*(*self)->dispatch->draw)(self, view, area); |
| 423 | if (clip) { |
| 424 | PiuViewPushClip(view, 0, 0, bounds->width, bounds->height); |
| 425 | temporary = &intersection; |
| 426 | PiuRectangleOffset(temporary, -x, -y); |
| 427 | } |
| 428 | else |
| 429 | temporary = area; |
| 430 | if (content) { |
| 431 | (*(*content)->dispatch->update)(content, view, temporary); |
| 432 | if ((*self)->flags & piuLooping) { |
| 433 | PiuRectangle loop; |
| 434 | bounds = &((*self)->bounds); |
| 435 | loop = &((*content)->bounds); |
| 436 | if (loop->width > bounds->width) |
| 437 | loop->x += loop->width; |
| 438 | if (loop->height > bounds->height) |
| 439 | loop->y += loop->height; |
| 440 | (*(*content)->dispatch->update)(content, view, temporary); |
| 441 | bounds = &((*self)->bounds); |
| 442 | loop = &((*content)->bounds); |
| 443 | if (loop->width > bounds->width) |
| 444 | loop->x -= loop->width; |
| 445 | if (loop->height > bounds->height) |
| 446 | loop->y -= loop->height; |
| 447 | } |
| 448 | content = (*content)->next; |
| 449 | while (content) { |
| 450 | (*(*content)->dispatch->update)(content, view, temporary); |
| 451 | content = (*content)->next; |
| 452 | } |
| 453 | } |
| 454 | if (clip) |
| 455 | PiuViewPopClip(view); |
| 456 | PiuRectangleOffset(area, x, y); |
| 457 | PiuViewPopOrigin(view); |
| 458 | } |
| 459 | } |
nothing calls this directly
no test coverage detected