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

Function PiuViewCombineRegion

modules/piu/MC/piuView.c:287–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287void PiuViewCombineRegion(PiuView* self, PiuRegion* region, PiuCoordinate op)
288{
289 xsMachine* the = (*self)->the;
290 Poco poco = (*self)->poco;
291 PiuRegion* tmp;
292 if (poco->flags & kPocoFlagAdaptInvalid) {
293 PixelsOutDispatch pixelsOutDispatch = poco->outputRefcon ? *(PixelsOutDispatch *)poco->outputRefcon : NULL;
294 CommodettoRectangle cr = xsGetHostChunk(xsReference((*self)->rectangle));
295 PocoCoordinate *regionBegin0 = (*region)->data;
296 int offset = 5;
297 int size = *regionBegin0 - 2; // last span
298 PocoCoordinate *region0 = regionBegin0 + offset;
299 PocoCoordinate *regionLimit0 = regionBegin0 + size;
300 PiuRegionRecord rectangleRegionRecord;
301 PiuRegion rectangleRegion = &rectangleRegionRecord;
302 rectangleRegionRecord.reference = NULL;
303 rectangleRegionRecord.available = 11;
304 while (region0 < regionLimit0) {
305 PocoCoordinate top = *region0++;
306 PocoCoordinate segmentCount = *region0++;
307 PocoCoordinate bottom = *(region0 + segmentCount);
308 while (segmentCount) {
309 PocoCoordinate left = *region0++;
310 PocoCoordinate right = *region0++;
311 PocoCoordinate x, y;
312 PocoDimension w, h;
313 segmentCount -= 2;
314 offset = region0 - regionBegin0;
315 x = left;
316 y = top;
317 w = right - left;
318 h = bottom - top;
319 rotateCoordinatesAndDimensions(poco->width, poco->height, x, y, w, h);
320 cr->x = x;
321 cr->y = y;
322 cr->w = w;
323 cr->h = h;
324#if MODDEF_ECMA419_DISPLAY
325 if (poco->displayHooks) {
326 (((xsDisplayHostHooks)poco->displayHooks)->doAdaptInvalid)(poco->outputRefcon, cr);
327 }
328 else
329#endif
330 if (pixelsOutDispatch)
331 (pixelsOutDispatch->doAdaptInvalid)(poco->outputRefcon, cr);
332 else
333 xsCallFunction1((*self)->_adaptInvalid, xsReference((*self)->screen), xsReference((*self)->rectangle));
334 x = cr->x;
335 y = cr->y;
336 w = cr->w;
337 h = cr->h;
338 unrotateCoordinatesAndDimensions(poco->width, poco->height, x, y, w, h);
339 PiuRegionRectangle(&rectangleRegion, x, y, w, h);
340 tmp = (*self)->dirty;
341 (*self)->dirty = (*self)->swap;
342 (*self)->swap = tmp;
343 if (!PiuRegionCombine((*self)->dirty, (*self)->swap, &rectangleRegion, op)) {
344 xsErrorPrintf("dirty region overflowed");

Callers 2

PiuViewInvalidateRegionFunction · 0.85
PiuViewValidateRegionFunction · 0.85

Calls 2

PiuRegionRectangleFunction · 0.85
PiuRegionCombineFunction · 0.85

Tested by

no test coverage detected