mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-18 00:55:54 +00:00
Use willReadFrequently to potentially improve skin parsing perf
This commit is contained in:
parent
415a06f80f
commit
6432753d20
3 changed files with 10 additions and 4 deletions
|
|
@ -1,6 +1,12 @@
|
|||
## Upcoming [UNRELEASED] (`webamp@next`)
|
||||
|
||||
_No changes yet._
|
||||
### Bug Fixes
|
||||
|
||||
- Fixed "Generate HTML Playlist" feature, which was accidentally broken in 2.0.0.
|
||||
|
||||
### Improvements
|
||||
|
||||
- Improve skin parsing performance and avoid Chrome console warning by adding `willReadFrequently` to canvas contexts.
|
||||
|
||||
## 2.0.1 [CURRENT]
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ async function genGenTextSprites(zip) {
|
|||
}
|
||||
|
||||
const canvas = document.createElement("canvas");
|
||||
const context = canvas.getContext("2d");
|
||||
const context = canvas.getContext("2d", { willReadFrequently: true });
|
||||
canvas.width = img.width;
|
||||
canvas.height = img.height;
|
||||
context.drawImage(img, 0, 0);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ export function getSpriteUrisFromImg(
|
|||
sprites: Sprite[]
|
||||
): { [spriteName: string]: string } {
|
||||
const canvas = document.createElement("canvas");
|
||||
const context = canvas.getContext("2d");
|
||||
const context = canvas.getContext("2d", { willReadFrequently: true });
|
||||
if (context == null) {
|
||||
throw new Error("Failed to get canvas context");
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ export async function getGenExColors(
|
|||
}
|
||||
|
||||
const canvas = document.createElement("canvas");
|
||||
const context = canvas.getContext("2d");
|
||||
const context = canvas.getContext("2d", { willReadFrequently: true });
|
||||
if (context == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue