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

Function PocoRectangleFill

modules/commodetto/commodettoPocoBlit.c:409–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407} ExternalRecord, *External;
408
409void PocoRectangleFill(Poco poco, PocoColor color, uint8_t blend, PocoCoordinate x, PocoCoordinate y, PocoDimension w, PocoDimension h)
410{
411 PocoCommand pc = poco->next;
412 PocoCoordinate xMax, yMax;
413
414 PocoReturnIfNoSpace(pc, sizeof(BlendDrawRecord)); // BlendDraw is worst case
415
416 rotateCoordinatesAndDimensions(poco->width, poco->height, x, y, w, h);
417
418 xMax = x + w;
419 yMax = y + h;
420
421 if (x < poco->x)
422 x = poco->x;
423
424 if (xMax > poco->xMax)
425 xMax = poco->xMax;
426
427 if (x >= xMax)
428 return;
429
430 w = xMax - x;
431
432 if (y < poco->y)
433 y = poco->y;
434
435 if (yMax > poco->yMax)
436 yMax = poco->yMax;
437
438 if (y >= yMax)
439 return;
440
441 h = yMax - y;
442
443 if (kPocoOpaque == blend) {
444 pc->command = kPocoCommandRectangleFill;
445 PocoCommandSetLength(pc, sizeof(ColorDrawRecord));
446#if kCommodettoBitmapFormat != kCommodettoBitmapCLUT16
447 ((ColorDraw)pc)->color = color;
448#else
449 ((ColorDraw)pc)->color = c_read8(poco->clut + 32 + color);
450#endif
451 }
452 else {
453 BlendDraw bd = (BlendDraw)pc;
454
455 if (0 == blend)
456 return;
457
458 bd->command = kPocoCommandRectangleBlend;
459 PocoCommandSetLength(bd, sizeof(BlendDrawRecord));
460#if kCommodettoBitmapFormat == kCommodettoBitmapRGB565BE
461 bd->color = commodetto_bswap16(color);
462#elif kCommodettoBitmapFormat != kCommodettoBitmapCLUT16
463 bd->color = color;
464#else
465 bd->color = c_read8(poco->clut + 32 + color);
466#endif

Callers 4

xs_poco_fillRectangleFunction · 0.85
xs_poco_blendRectangleFunction · 0.85
PiuViewFillColorFunction · 0.85
PiuQRCodeDrawAuxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected