Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
linter still complaining
  • Loading branch information
jerch committed Mar 24, 2023
commit b9251993f00aa09528ad4891073f3a9c6c4a1d01
17 changes: 8 additions & 9 deletions src/IIPHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export class IIPHandler implements IOscHandler, IResetHandler {
let cond: number | boolean = true;
if (cond = success) {
if (cond = !this._dec.end()) {
//console.log(this._dec.data8.length);
this._metrics = imageType(this._dec.data8);
if (cond = this._metrics.mime !== 'unsupported') {
w = this._metrics.width;
Expand Down Expand Up @@ -123,7 +122,7 @@ export class IIPHandler implements IOscHandler, IResetHandler {
blob = new Blob([this._dec.data8], { type: this._metrics.mime });
}

//const blob = new Blob([this._dec.data8], { type: this._metrics.mime });
// const blob = new Blob([this._dec.data8], { type: this._metrics.mime });
this._dec.release();

const win = this._coreTerminal._core._coreBrowserService.window;
Expand All @@ -144,14 +143,14 @@ export class IIPHandler implements IOscHandler, IResetHandler {
// happens from corrupt data (onload never gets fired)
setTimeout(() => r(true), 1000);
});
} else {
const c1 = ImageRenderer.createCanvas(win, this._metrics.width, this._metrics.height);
c1.getContext('2d')?.putImageData(blob, 0, 0);
const c2 = ImageRenderer.createCanvas(win, w, h);
c2.getContext('2d')?.drawImage(c1, 0, 0, this._metrics.width, this._metrics.height, 0, 0, w, h);
this._storage.addImage(c2);
return true;
}
// qoi path
const c1 = ImageRenderer.createCanvas(win, this._metrics.width, this._metrics.height);
c1.getContext('2d')?.putImageData(blob, 0, 0);
const c2 = ImageRenderer.createCanvas(win, w, h);
c2.getContext('2d')?.drawImage(c1, 0, 0, this._metrics.width, this._metrics.height, 0, 0, w, h);
this._storage.addImage(c2);
return true;
}
return win.createImageBitmap(blob, { resizeWidth: w, resizeHeight: h })
.then(bm => {
Expand Down
2 changes: 1 addition & 1 deletion src/IIPMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function imageType(d: Uint8Array): IMetrics {
mime: 'image/qoi',
width: d[4] << 24 | d[5] << 16 | d[6] << 8 | d[7],
height: d[8] << 24 | d[9] << 16 | d[10] << 8 | d[11]
}
};
}
return UNSUPPORTED_TYPE;
}
Expand Down