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

Method begin

modules/drivers/it8951/it8951.js:373–408  ·  view source on GitHub ↗
(x, y, width, height)

Source from the content-addressed store, hash-verified

371 this.#filter = ("string" === typeof options.filter) ? Filter[options.filter] : options.filter;
372 }
373 begin(x, y, width, height) {
374 const epd = this.#epd, area = this.#area;
375
376 if ((x | width) & 3)
377 throw new Error;
378
379 if (this.#epd._rotation & 1) {
380 if ((y | height) & 3)
381 throw new Error;
382 }
383
384 if (area.continue) {
385 if (x < area.x) {
386 area.width += area.x - x;
387 area.x = x;
388 }
389 if ((x + width) > (area.x + area.width))
390 area.width = (x + width) - area.x;
391
392 if (y < area.y) {
393 area.height += area.y - y;
394 area.y = y;
395 }
396 if ((y + height) > (area.y + area.height))
397 area.height = (y + height) - area.y;
398 }
399 else
400 area.x = x, area.y = y, area.width = width, area.height = height;
401
402 epd.setArea(x, y, width, height);
403
404 epd.select.write(0);
405 epd.spi.write16(0);
406
407 this.#buffer.position = 0;
408 }
409 send(src, offset, byteLength) {
410 const filter = this.#filter, buffer = this.#buffer;
411 let position = buffer.position;

Callers

nothing calls this directly

Calls 3

write16Method · 0.80
writeMethod · 0.65
setAreaMethod · 0.45

Tested by

no test coverage detected