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

Method fillArea

modules/drivers/it8951/it8951.js:180–201  ·  view source on GitHub ↗
(x, y, w, h, color)

Source from the content-addressed store, hash-verified

178 } while (true);
179 }
180 fillArea(x, y, w, h, color) {
181 if (w & 3)
182 throw new Error;
183
184 if ((color < 0) || (color > 15))
185 throw new Error;
186
187 this.setTargetMemoryAddress(this._tar_memaddr);
188 this.setArea(x, y, w, h);
189
190 const pixels = new Uint16Array(w >> 2);
191 pixels.fill(color | (color << 4) | (color << 8) | (color << 12));
192 const buffer = pixels.buffer, spi = this.spi;
193
194 this.select.write(0);
195 spi.write(Uint16Array.of(0))
196 while (h--)
197 spi.write(buffer);
198 this.select.write(1);
199
200 this.writeCommand(IT8951_TCON_LD_IMG_END);
201 }
202 updateArea(x, y, w, h, mode) {
203 if (UpdateMode.NONE === mode)
204 return;

Callers

nothing calls this directly

Calls 5

setAreaMethod · 0.95
writeCommandMethod · 0.95
fillMethod · 0.65
writeMethod · 0.65

Tested by

no test coverage detected