Skip to content

Commit

Permalink
Made public
Browse files Browse the repository at this point in the history
  • Loading branch information
JrMasterModelBuilder committed Sep 24, 2023
1 parent 1c50cfc commit 8de04e1
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/icon/ico.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class IconIco extends Icon {
if (raw && png !== false) {
const ihdr = pngIhdr(data);
const isPng =
png || !this._sizeRequiresLegacyBitmap(ihdr.width, ihdr.height);
png || !this.sizeRequiresLegacyBitmap(ihdr.width, ihdr.height);
if (isPng) {
this.entries.push({
width: ihdr.width,
Expand All @@ -81,7 +81,7 @@ export class IconIco extends Icon {
const isPng =
png ||
(png === null &&
!this._sizeRequiresLegacyBitmap(
!this.sizeRequiresLegacyBitmap(
imageData.width,
imageData.height
));
Expand Down Expand Up @@ -119,6 +119,17 @@ export class IconIco extends Icon {
return Buffer.concat([dir, ...dirs, ...imgs], size);
}

/**
* Check if height requires legacy bitmap for compatiblity.
*
* @param width Image width.
* @param height Image height.
* @returns Returns true if requires legacy bitmap.
*/
public sizeRequiresLegacyBitmap(width: number, height: number) {
return width < 64 || height < 64;
}

/**
* Encode icon directory header.
*
Expand Down Expand Up @@ -238,15 +249,4 @@ export class IconIco extends Icon {
}
return encoded;
}

/**
* Check if height requires legacy bitmap for compatiblity.
*
* @param width Image width.
* @param height Image height.
* @returns Returns true if requires legacy bitmap.
*/
protected _sizeRequiresLegacyBitmap(width: number, height: number) {
return width < 64 || height < 64;
}
}

0 comments on commit 8de04e1

Please sign in to comment.