MCPcopy Create free account
hub / github.com/apache/cloudstack / blitImage

Method blitImage

systemvm/agent/noVNC/core/display.js:394–418  ·  view source on GitHub ↗
(x, y, width, height, arr, offset, fromQueue)

Source from the content-addressed store, hash-verified

392 }
393
394 blitImage(x, y, width, height, arr, offset, fromQueue) {
395 if (this._renderQ.length !== 0 && !fromQueue) {
396 // NB(directxman12): it's technically more performant here to use preallocated arrays,
397 // but it's a lot of extra work for not a lot of payoff -- if we're using the render queue,
398 // this probably isn't getting called *nearly* as much
399 const newArr = new Uint8Array(width * height * 4);
400 newArr.set(new Uint8Array(arr.buffer, 0, newArr.length));
401 this._renderQPush({
402 'type': 'blit',
403 'data': newArr,
404 'x': x,
405 'y': y,
406 'width': width,
407 'height': height,
408 });
409 } else {
410 // NB(directxman12): arr must be an Type Array view
411 let data = new Uint8ClampedArray(arr.buffer,
412 arr.byteOffset + offset,
413 width * height * 4);
414 let img = new ImageData(data, width, height);
415 this._drawCtx.putImageData(img, x, y);
416 this._damage(x, y, width, height);
417 }
418 }
419
420 drawImage(img, ...args) {
421 this._drawCtx.drawImage(img, ...args);

Callers 10

_scanRenderQMethod · 0.95
decodeRectMethod · 0.80
_finishTileMethod · 0.80
decodeRectMethod · 0.80
decodeRectMethod · 0.80
decodeRectMethod · 0.80
_copyFilterMethod · 0.80
_monoRectMethod · 0.80
_paletteRectMethod · 0.80
_gradientFilterMethod · 0.80

Calls 3

_renderQPushMethod · 0.95
_damageMethod · 0.95
setMethod · 0.65

Tested by

no test coverage detected