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

Function PiuViewFillTexture

modules/piu/Pebble/piuView.c:240–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240void PiuViewFillTexture(PiuView* self, PiuTexture* texture, PiuCoordinate x, PiuCoordinate y, PiuDimension w, PiuDimension h, PiuCoordinate sx, PiuCoordinate sy, PiuDimension sw, PiuDimension sh)
241{
242 PiuDimension tw = (*texture)->width;
243 PiuDimension th = (*texture)->height;
244 if (sx < 0) {
245 if (w == sw) {
246 x -= sx;
247 w += sx;
248 }
249 sw += sx;
250 sx = 0;
251 }
252 if (sx + sw > tw) {
253 if (w == sw)
254 w = tw - sx;
255 sw = tw - sx;
256 }
257 if (sy < 0) {
258 if (h == sh) {
259 y -= sy;
260 h += sy;
261 }
262 sh += sy;
263 sy = 0;
264 }
265 if (sy + sh > th) {
266 if (h == sh)
267 h = th - sy;
268 sh = th - sy;
269 }
270 if ((w <= 0) || (h <= 0) || (sw <= 0) || (sh <= 0)) return;
271 PiuCoordinate xx, ww;
272 while (h >= sh) {
273 xx = x;
274 ww = w;
275 while (ww >= sw) {
276 PiuViewDrawTextureAux(self, texture, xx, y, sx, sy, sw, sh);
277 xx += sw;
278 ww -= sw;
279 }
280 if (ww)
281 PiuViewDrawTextureAux(self, texture, xx, y, sx, sy, ww, sh);
282 y += sh;
283 h -= sh;
284 }
285 if (h) {
286 while (w >= sw) {
287 PiuViewDrawTextureAux(self, texture, x, y, sx, sy, sw, h);
288 x += sw;
289 w -= sw;
290 }
291 if (w)
292 PiuViewDrawTextureAux(self, texture, x, y, sx, sy, w, h);
293 }
294}
295
296void PiuViewGetSize(PiuView* self, PiuDimension *width, PiuDimension *height)
297{

Callers

nothing calls this directly

Calls 1

PiuViewDrawTextureAuxFunction · 0.70

Tested by

no test coverage detected