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

Function xs_poco_begin

modules/commodetto/commodettoPocoCore.c:223–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223void xs_poco_begin(xsMachine *the)
224{
225 Poco poco = xsmcGetHostDataPoco(xsThis);
226 int argc = xsmcArgc;
227 PocoCoordinate x, y;
228 PocoDimension w, h;
229
230 if (1 == argc) {
231 xsSlot tmp;
232 xsmcGet(tmp, xsArg(0), xsID_x);
233 x = (PocoCoordinate)xsmcToInteger(tmp);
234
235 xsmcGet(tmp, xsArg(0), xsID_y);
236 y = (PocoCoordinate)xsmcToInteger(tmp);
237
238 xsmcGet(tmp, xsArg(0), xsID_w);
239 w = (PocoDimension)xsmcToInteger(tmp);
240
241 xsmcGet(tmp, xsArg(0), xsID_h);
242 h = (PocoDimension)xsmcToInteger(tmp);
243 }
244 else {
245 if (argc > 1)
246 x = (PocoCoordinate)xsmcToInteger(xsArg(0));
247 else
248 x = 0;
249
250 if (argc >= 2)
251 y = (PocoCoordinate)xsmcToInteger(xsArg(1));
252 else
253 y = 0;
254
255 if (argc >= 3)
256 w = (PocoDimension)xsmcToInteger(xsArg(2));
257 else
258 w = poco->width - x;
259
260 if (argc >= 4)
261 h = (PocoDimension)xsmcToInteger(xsArg(3));
262 else
263 h = poco->height - y;
264 }
265
266#if !kPocoFrameBuffer
267 PocoDrawingBegin(poco, x, y, w, h);
268#else
269 if (!(poco->flags & kPocoFlagFrameBuffer))
270 PocoDrawingBegin(poco, x, y, w, h);
271 else {
272 PocoPixel *pixels;
273 int16_t rowBytes;
274 PixelsOutDispatch pixelsOutDispatch = poco->outputRefcon ? *(PixelsOutDispatch *)poco->outputRefcon : NULL;
275#if MODDEF_ECMA419_DISPLAY
276 if (poco->displayHooks) {
277 int32_t rowBytesInt;
278 (((xsDisplayHostHooks)poco->displayHooks)->doBegin)(poco->outputRefcon, poco->x, poco->y, poco->w, poco->h, (void **)&pixels, &rowBytesInt, 0);
279 rowBytes = (int16_t)rowBytesInt;
280 }

Callers

nothing calls this directly

Calls 3

PocoDrawingBeginFunction · 0.85
CFELockCacheFunction · 0.70

Tested by

no test coverage detected