Rollback background blur and transparency due to high CPU/GPU usage (#1160)

This commit is contained in:
Aditya Chandel
2025-09-15 11:03:34 -06:00
committed by GitHub
parent 11935ae5a7
commit 1df21551f6
10 changed files with 49 additions and 422 deletions
@@ -5,7 +5,9 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -19,6 +21,9 @@ import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.imageio.ImageIO;
import java.awt.Color;
import static org.junit.jupiter.api.Assertions.*;
class CbxMetadataExtractorTest {
@@ -90,9 +95,9 @@ class CbxMetadataExtractorTest {
" </Pages>" +
"</ComicInfo>";
byte[] img1 = new byte[]{11};
byte[] img2 = new byte[]{22, 22}; // expect this one
byte[] img3 = new byte[]{33, 33, 33};
byte[] img1 = createTestImage(Color.RED);
byte[] img2 = createTestImage(Color.GREEN); // expect this one
byte[] img3 = createTestImage(Color.BLUE);
File cbz = createCbz("with_cover.cbz", new LinkedHashMap<>() {{
put("ComicInfo.xml", xml.getBytes(StandardCharsets.UTF_8));
@@ -108,9 +113,9 @@ class CbxMetadataExtractorTest {
@Test
void extractCover_fromCbz_fallbackAlphabeticalFirst() throws Exception {
// No ComicInfo.xml, images intentionally added in unsorted order
byte[] aPng = new byte[]{1,1}; // alphabetically first (A.png)
byte[] bJpg = new byte[]{2};
byte[] cJpeg = new byte[]{3,3,3};
byte[] aPng = createTestImage(Color.YELLOW); // alphabetically first (A.png)
byte[] bJpg = createTestImage(Color.MAGENTA);
byte[] cJpeg = createTestImage(Color.CYAN);
File cbz = createCbz("fallback.cbz", new LinkedHashMap<>() {{
put("z/pageC.jpeg", cJpeg);
@@ -150,4 +155,17 @@ class CbxMetadataExtractorTest {
}
return out.toFile();
}
private byte[] createTestImage(Color color) throws IOException {
BufferedImage image = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
image.setRGB(x, y, color.getRGB());
}
}
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
ImageIO.write(image, "jpg", baos);
return baos.toByteArray();
}
}
}