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

Method resize

systemvm/agent/noVNC/core/display.js:189–221  ·  view source on GitHub ↗
(width, height)

Source from the content-addressed store, hash-verified

187 }
188
189 resize(width, height) {
190 this._prevDrawStyle = "";
191
192 this._fbWidth = width;
193 this._fbHeight = height;
194
195 const canvas = this._backbuffer;
196 if (canvas.width !== width || canvas.height !== height) {
197
198 // We have to save the canvas data since changing the size will clear it
199 let saveImg = null;
200 if (canvas.width > 0 && canvas.height > 0) {
201 saveImg = this._drawCtx.getImageData(0, 0, canvas.width, canvas.height);
202 }
203
204 if (canvas.width !== width) {
205 canvas.width = width;
206 }
207 if (canvas.height !== height) {
208 canvas.height = height;
209 }
210
211 if (saveImg) {
212 this._drawCtx.putImageData(saveImg, 0, 0);
213 }
214 }
215
216 // Readjust the viewport as it may be incorrectly sized
217 // and positioned
218 const vp = this._viewportLoc;
219 this.viewportChangeSize(vp.w, vp.h);
220 this.viewportChangePos(0, 0);
221 }
222
223 getImageData() {
224 return this._drawCtx.getImageData(0, 0, this.width, this.height);

Callers

nothing calls this directly

Calls 3

viewportChangeSizeMethod · 0.95
viewportChangePosMethod · 0.95
getImageDataMethod · 0.45

Tested by

no test coverage detected