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

Function PiuViewFillTextureAux

modules/piu/MC/piuView.c:755–816  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

753}
754
755void PiuViewFillTextureAux(PiuView* self, PiuTexture* texture, PocoColor color, uint8_t blend, PiuCoordinate x, PiuCoordinate y, PiuDimension w, PiuDimension h, PiuCoordinate sx, PiuCoordinate sy, PiuDimension sw, PiuDimension sh)
756{
757 Poco poco = (*self)->poco;
758 PiuFlags flags = (*texture)->flags;
759 PocoBitmap bits = (flags & piuTextureColor) ? &((*texture)->bits) : NULL;
760 PocoBitmap mask = (flags & piuTextureAlpha) ? &((*texture)->mask) : NULL;
761 if (mask) {
762 if (bits) {
763 PocoCoordinate xx, ww;
764 while (h >= sh) {
765 xx = x;
766 ww = w;
767 while (ww >= sw) {
768 PocoBitmapDrawMasked(poco, blend, bits, xx, y, sx, sy, sw, sh, mask, sx, sy);
769 xx += sw;
770 ww -= sw;
771 }
772 if (ww)
773 PocoBitmapDrawMasked(poco, blend, bits, xx, y, sx, sy, ww, sh, mask, sx, sy);
774 y += sh;
775 h -= sh;
776 }
777 if (h) {
778 while (w >= sw) {
779 PocoBitmapDrawMasked(poco, blend, bits, x, y, sx, sy, sw, h, mask, sx, sy);
780 x += sw;
781 w -= sw;
782 }
783 if (w)
784 PocoBitmapDrawMasked(poco, blend, bits, x, y, sx, sy, w, h, mask, sx, sy);
785 }
786 }
787 else {
788 PocoCoordinate xx, ww;
789 while (h >= sh) {
790 xx = x;
791 ww = w;
792 while (ww >= sw) {
793 PocoGrayBitmapDraw(poco, mask, color, blend, xx, y, sx, sy, sw, sh);
794 xx += sw;
795 ww -= sw;
796 }
797 if (ww)
798 PocoGrayBitmapDraw(poco, mask, color, blend, xx, y, sx, sy, ww, sh);
799 y += sh;
800 h -= sh;
801 }
802 if (h) {
803 while (w >= sw) {
804 PocoGrayBitmapDraw(poco, mask, color, blend, x, y, sx, sy, sw, h);
805 x += sw;
806 w -= sw;
807 }
808 if (w)
809 PocoGrayBitmapDraw(poco, mask, color, blend, x, y, sx, sy, w, h);
810 }
811 }
812 }

Callers 1

PiuViewFillTextureFunction · 0.85

Calls 3

PocoBitmapDrawMaskedFunction · 0.85
PocoGrayBitmapDrawFunction · 0.85
PocoBitmapPatternFunction · 0.85

Tested by

no test coverage detected