From 48a591de7ece464c14729c93216f6aa8a09ddaac Mon Sep 17 00:00:00 2001 From: jbb01 <32650546+jbb01@users.noreply.github.com> Date: Tue, 6 Aug 2024 17:39:09 +0200 Subject: [PATCH] fix length of IDAT chunk --- docs/cornell.png | Bin 1728585 -> 1728585 bytes docs/cornell_smoke.png | Bin 451823 -> 451823 bytes docs/diagramm.png | Bin 2444917 -> 2444917 bytes docs/simple.png | Bin 902498 -> 902498 bytes docs/squares.png | Bin 634703 -> 634703 bytes .../raytracing/render/ImageFormat.java | 4 +++- 6 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/cornell.png b/docs/cornell.png index 0df23162fb23bfbc06befc2f861b78cfb070f250..6623084eb724b6b2fc530ec36e0841686e20b1d1 100644 GIT binary patch delta 92 zcmV~$I~Ia4006-k6j4!$d<3ks_p;3~EVkz|_O!W`GiA?Z&sz%div+3UAV;a?B#oTq dB3EhUCU<#ACsCf#%OImn@{(B=S%19K=MUC#7^eUL delta 92 zcmV~$u@!hnI+0Y7Fp#fuOC}_{{h#%7^?sP diff --git a/docs/cornell_smoke.png b/docs/cornell_smoke.png index 2078917d382f7c7e5946966d022a7000c2d1f916..ef02b85f680aa6e366aed1b09d54af354e28feed 100644 GIT binary patch delta 32 ocmaEVQu_T#=?N-~+Zt6{RT*1VnOaquTUA+FRav*HvYmPY0Mi}|rvLx| delta 32 ocmaEVQu_T#=?N-~yBbwnRT*1VnOaquTUA+FRav*HvYmPY0MmL4s{jB1 diff --git a/docs/diagramm.png b/docs/diagramm.png index 76290c11a37625bf8761ccc43239fad561c6a7ee..29e0a575b9eb07c8c4d7b97f6baaef2af28b7f73 100644 GIT binary patch delta 127 zcmWN=xeD9ICT6r@Y2>&w+qK`&{ePuTA_V{d delta 127 zcmWN=xeD9ICT6r@Y2>&w+qK`&{ePz)A_)Kh diff --git a/docs/simple.png b/docs/simple.png index 16e9e7c7c1569b8f1f549f0ab7ad447f13d23d34..9f3091fb0c78c9d0f078d50f52c8685590ae5308 100644 GIT binary patch delta 53 zcmaFVW&Wtke1Zz2W}|AWDr2iEQ>!X-t13&YDr>7MTdOL2t13sUDrc)ISF0*_t18b{ IRbJbp0JiuJ`Tzg` delta 53 zcmaFVW&Wtke1Zz2Zlh|eDr2iEQ>!X-t13&YDr>7MTdOL2t13sUDrc)ISF0*_t18b{ IRbJbp0Jo?P{r~^~ diff --git a/docs/squares.png b/docs/squares.png index 890dcb4ce0d702bbafeddc2cd1e1360a4ebbc205..9e87af090e4ba775daa08159def030be96c580f4 100644 GIT binary patch delta 41 xcmX?qPwo6YwFxSWVvVY;s*J6wOs%TSt*R`os;sT5Y^|#7t*RVbRXMfR0{|s{3`hU~ delta 41 xcmX?qPwo6YwFxSWQjMyus*J6wOs%TSt*R`os;sT5Y^|#7t*RVbRXMfR0{|ud3`_t3 diff --git a/src/main/java/eu/jonahbauer/raytracing/render/ImageFormat.java b/src/main/java/eu/jonahbauer/raytracing/render/ImageFormat.java index c486dbb..caba497 100644 --- a/src/main/java/eu/jonahbauer/raytracing/render/ImageFormat.java +++ b/src/main/java/eu/jonahbauer/raytracing/render/ImageFormat.java @@ -1,6 +1,7 @@ package eu.jonahbauer.raytracing.render; import eu.jonahbauer.raytracing.render.canvas.Canvas; +import eu.jonahbauer.raytracing.render.canvas.Image; import org.jetbrains.annotations.NotNull; import java.io.*; @@ -10,6 +11,7 @@ import java.nio.file.Path; import java.util.zip.CRC32; import java.util.zip.CheckedOutputStream; import java.util.zip.DeflaterOutputStream; +import java.util.zip.InflaterInputStream; public enum ImageFormat { PPM { @@ -93,7 +95,7 @@ public enum ImageFormat { } var bytes = baos.toByteArray(); - data.writeInt(bytes.length); + data.writeInt(bytes.length - 4); // don't include type in length data.write(bytes); data.writeInt((int) crc.getChecksum().getValue()); }