From cae43d7f6bd52859e32a84ba0c3d479902f00c1f Mon Sep 17 00:00:00 2001 From: Stefan Oltmann Date: Tue, 16 Jan 2024 21:15:01 +0100 Subject: [PATCH] Show more lines of non-IDAT png chunks --- app/src/commonMain/kotlin/HtmlGenerator.kt | 4 ++-- app/src/jvmTest/resources/photo_4_hex.html | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/commonMain/kotlin/HtmlGenerator.kt b/app/src/commonMain/kotlin/HtmlGenerator.kt index f9cb53e..422aaf9 100644 --- a/app/src/commonMain/kotlin/HtmlGenerator.kt +++ b/app/src/commonMain/kotlin/HtmlGenerator.kt @@ -322,8 +322,8 @@ private fun createPngSlices(bytes: ByteArray): List { range = dataOffset until crcOffset, label = chunk.chunkType.name + SPACE + "data" + SPACE + "[${chunk.length}" + SPACE + "bytes]", - /* Skip everything that is too long. */ - snipAfterLineCount = 1, + /* Basically skip IDAT, but show more of other types. */ + snipAfterLineCount = if (chunk.chunkType == PngChunkType.IDAT) 1 else 5, separatorLineType = SeparatorLineType.NONE ) ) diff --git a/app/src/jvmTest/resources/photo_4_hex.html b/app/src/jvmTest/resources/photo_4_hex.html index d377abc..3731073 100644 --- a/app/src/jvmTest/resources/photo_4_hex.html +++ b/app/src/jvmTest/resources/photo_4_hex.html @@ -109,7 +109,11 @@
00001037 | 00 00 90 39 69 54 58 74                          | ...9iTXt         | iTXt
00001045 | 58 4D 4C 3A 63 6F 6D 2E  61 64 6F 62 65 2E 78 6D | XML:com.adobe.xm | iTXt data [36921 bytes]
-00001060 |           [ ... snip 36889 bytes ... ]           |                  |
+00001061 | 70 00 00 00 00 00 3C 78  3A 78 6D 70 6D 65 74 61 | p.....<x:xmpmeta | 
+00001077 | 20 78 6D 6C 6E 73 3A 78  3D 22 61 64 6F 62 65 3A |  xmlns:x="adobe: | 
+00001093 | 6E 73 3A 6D 65 74 61 2F  22 20 78 3A 78 6D 70 74 | ns:meta/" x:xmpt | 
+00001109 | 6B 3D 22 58 4D 50 20 43  6F 72 65 20 36 2E 30 2E | k="XMP Core 6.0. | 
+00001124 |           [ ... snip 36825 bytes ... ]           |                  |
00037950 | 46 3E 0A 3C 2F 78 3A 78  6D 70 6D 65 74 61 3E 0A | F>.</x:xmpmeta>. | 
00037966 | F6 BE 8C 1B                                      | ....             | iTXt CRC