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

Function PocoBitmapPattern

modules/commodetto/commodettoPocoBlit.c:886–955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

884}
885
886void PocoBitmapPattern(Poco poco, PocoBitmap bits, PocoCoordinate x, PocoCoordinate y, PocoDimension w, PocoDimension h, PocoDimension sx, PocoDimension sy, PocoDimension sw, PocoDimension sh)
887{
888 PocoCoordinate xMax, yMax;
889 PocoCommand pc = poco->next;
890 PatternBits pb;
891
892 PocoReturnIfNoSpace(pc, sizeof(PatternBitsRecord));
893
894 rotateCoordinatesAndDimensions(poco->width, poco->height, x, y, w, h);
895#if (0 == kPocoRotation) || (180 == kPocoRotation)
896 rotateCoordinatesAndDimensions(bits->width, bits->height, sx, sy, sw, sh);
897#elif (90 == kPocoRotation) || (270 == kPocoRotation)
898 rotateCoordinatesAndDimensions(bits->height, bits->width, sx, sy, sw, sh);
899#endif
900
901 pc->command = kPocoCommandBitmapPattern;
902 PocoCommandSetLength(pc, sizeof(PatternBitsRecord));
903 pb = (PatternBits)pc;
904 pb->xOffset = 0;
905 pb->dy = 0;
906 pb->patternW = sw;
907 pb->patternH = sh;
908
909 xMax = x + w;
910 yMax = y + h;
911
912 if (x < poco->x) {
913 pb->xOffset = (poco->x - x) % sw;
914 x = poco->x;
915 }
916
917 if (xMax > poco->xMax)
918 xMax = poco->xMax;
919
920 if (x >= xMax)
921 return;
922
923 w = xMax - x;
924
925 if (y < poco->y) {
926 pb->dy = (poco->y - y) % sh;
927 y = poco->y;
928 }
929
930 if (yMax > poco->yMax)
931 yMax = poco->yMax;
932
933 if (y >= yMax)
934 return;
935
936 h = yMax - y;
937
938 pc->x = x, pc->y = y, pc->w = w, pc->h = h;
939
940#if 4 != kPocoPixelSize
941 pb->patternStart = ((PocoPixel *)bits->pixels) + (sy * bits->width) + (sx + pb->xOffset);
942 pb->pixels = pb->patternStart + (pb->dy * bits->width);
943 pb->rowBump = bits->width + pb->xOffset;

Callers 2

xs_poco_fillPatternFunction · 0.85
PiuViewFillTextureAuxFunction · 0.85

Calls 1

buildColorMapFunction · 0.85

Tested by

no test coverage detected