1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Improve decoding speed

This commit is contained in:
ferferga 2020-05-25 18:31:51 +02:00
parent d7fda69e9c
commit 7587469480
2 changed files with 7 additions and 5 deletions

View file

@ -39,8 +39,10 @@ import 'css!./style';
let blurhashstr = target.getAttribute('data-blurhash'); let blurhashstr = target.getAttribute('data-blurhash');
if (blurhash.isBlurhashValid(blurhashstr) && target.getElementsByClassName('blurhash-canvas').length === 0) { if (blurhash.isBlurhashValid(blurhashstr) && target.getElementsByClassName('blurhash-canvas').length === 0) {
console.log('Blurhashing item ' + target.parentElement.parentElement.parentElement.getAttribute('data-index') + ' with intersection ratio ' + entry.intersectionRatio); console.log('Blurhashing item ' + target.parentElement.parentElement.parentElement.getAttribute('data-index') + ' with intersection ratio ' + entry.intersectionRatio);
let width = target.offsetWidth; // let width = target.offsetWidth;
let height = target.offsetHeight; // let height = target.offsetHeight;
let width = 18;
let height = 18;
if (width && height) { if (width && height) {
let pixels; let pixels;
try { try {
@ -49,7 +51,6 @@ import 'css!./style';
console.log('Blurhash decode error: ' + err.toString()); console.log('Blurhash decode error: ' + err.toString());
return; return;
} }
let canvas = document.createElement('canvas'); let canvas = document.createElement('canvas');
canvas.width = width; canvas.width = width;
canvas.height = height; canvas.height = height;

View file

@ -7,11 +7,12 @@
} }
.blurhash-canvas { .blurhash-canvas {
align-items: stretch;
position: absolute; position: absolute;
top: 0; top: 0;
right: 0;
bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: -1000; z-index: 100;
} }