Lines Matching refs:chunk
573 chunk = self._chunks[chunk_idx]
574 chunk_pos_offset = self._file_pos - chunk.output_offset
575 chunk_pos_to_go = min(chunk.output_size - chunk_pos_offset, to_go)
577 if chunk.chunk_type == ImageChunk.TYPE_RAW:
578 self._image.seek(chunk.input_offset + chunk_pos_offset)
580 elif chunk.chunk_type == ImageChunk.TYPE_FILL:
581 all_data = chunk.fill_data*(chunk_pos_to_go // len(chunk.fill_data) + 2)
582 offset_mod = chunk_pos_offset % len(chunk.fill_data)
585 assert chunk.chunk_type == ImageChunk.TYPE_DONT_CARE
628 chunk = self._chunks[chunk_idx]
629 if chunk.output_offset != size:
633 num_to_keep = size - chunk.output_offset
635 if chunk.chunk_type == ImageChunk.TYPE_RAW:
636 truncate_at = (chunk.chunk_offset +
639 elif chunk.chunk_type == ImageChunk.TYPE_FILL:
640 truncate_at = (chunk.chunk_offset +
644 assert chunk.chunk_type == ImageChunk.TYPE_DONT_CARE
645 truncate_at = chunk.chunk_offset + struct.calcsize(ImageChunk.FORMAT)
649 self._image.seek(chunk.chunk_offset)
651 chunk.chunk_type,
655 chunk.output_size = num_to_keep
658 truncate_at = chunk.chunk_offset