MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PiuContainerUpdate

Function PiuContainerUpdate

modules/piu/All/piuContainer.c:429–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

427}
428
429void PiuContainerUpdate(void* it, PiuView* view, PiuRectangle area)
430{
431 PiuContainer* self = it;
432 if ((*self)->flags & piuVisible) {
433 PiuRectangle bounds = &((*self)->bounds);
434 PiuBoolean clip = ((*self)->flags & piuClip) ? 1 : 0;
435 PiuBoolean intersect;
436 PiuRectangleRecord intersection;
437 if (clip)
438 intersect = PiuRectangleIntersect(&intersection, bounds, area);
439 else
440 intersect = PiuRectangleIntersects(bounds, area);
441 if (!clip || intersect) {
442 PiuContent* content = (*self)->first;
443 PiuCoordinate x = bounds->x;
444 PiuCoordinate y = bounds->y;
445 PiuRectangle temporary;
446 PiuViewPushOrigin(view, x, y);
447 PiuRectangleOffset(area, -x, -y);
448 if (intersect)
449 (*(*self)->dispatch->draw)(self, view, area);
450 if (clip) {
451 PiuViewPushClip(view, 0, 0, bounds->width, bounds->height);
452 temporary = &intersection;
453 PiuRectangleOffset(temporary, -x, -y);
454 }
455 else
456 temporary = area;
457 while (content) {
458 (*(*content)->dispatch->update)(content, view, temporary);
459 content = (*content)->next;
460 }
461 if (clip)
462 PiuViewPopClip(view);
463 PiuRectangleOffset(area, x, y);
464 PiuViewPopOrigin(view);
465 }
466 }
467// if ((*self)->flags & piuVisible) {
468// PiuRectangle bounds = &((*self)->bounds);
469// if (PiuRectangleIntersects(bounds, area)) {
470// PiuCoordinate x = bounds->x;
471// PiuCoordinate y = bounds->y;
472// PiuContent* content = (*self)->first;
473// PiuViewPushOrigin(view, x, y);
474// PiuRectangleOffset(area, -x, -y);
475// if ((*self)->flags & piuClip)
476// PiuViewPushClip(view, 0, 0, bounds->width, bounds->height);
477// (*(*self)->dispatch->draw)(self, view, area);
478// while (content) {
479// (*(*content)->dispatch->update)(content, view, area);
480// content = (*content)->next;
481// }
482// if ((*self)->flags & piuClip)
483// PiuViewPopClip(view);
484// PiuRectangleOffset(area, x, y);
485// PiuViewPopOrigin(view);
486// }

Callers

nothing calls this directly

Calls 7

PiuRectangleIntersectFunction · 0.85
PiuRectangleIntersectsFunction · 0.85
PiuRectangleOffsetFunction · 0.85
PiuViewPushOriginFunction · 0.50
PiuViewPushClipFunction · 0.50
PiuViewPopClipFunction · 0.50
PiuViewPopOriginFunction · 0.50

Tested by

no test coverage detected