override fun postProcessChunk()

in plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/util/pngj/ChunkSeqReaderPng.kt [124:149]


    override fun postProcessChunk(chunkR: ChunkReader) {
        // PngHelperInternal.debug("postProcessChunk " + chunkR.getChunkRaw().id);
        super.postProcessChunk(chunkR)
        if (chunkR.chunkRaw.id == PngChunkIHDR.ID) {
            val ch = PngChunkIHDR(null)
            ch.parseFromRaw(chunkR.chunkRaw)
            imageInfo = ch.createImageInfo()
            curImgInfo = imageInfo
            if (ch.isInterlaced()) deinterlacer = Deinterlacer(curImgInfo!!)
            chunksList = ChunksList(imageInfo)
        }
        if (chunkR.mode == ChunkReader.ChunkReaderMode.BUFFER && countChunkTypeAsAncillary(chunkR.chunkRaw.id)) {
            bytesChunksLoaded += chunkR.chunkRaw.len.toLong()
        }
        if (chunkR.mode == ChunkReader.ChunkReaderMode.BUFFER || includeNonBufferedChunks) {
            try {
                val chunk: PngChunk = chunkFactory.createChunk(chunkR.chunkRaw, imageInfo)
                chunksList!!.appendReadChunk(chunk, currentChunkGroup)
            } catch (e: PngjException) {
                throw e
            }
        }
        if (isDone) {
            processEndPng()
        }
    }