Skip to content

DOCX: image decoded twice per export, and a row cell drops its alignment #531

Description

@DemchaAV

Two small ones in DocxSemanticBackend, both found while reviewing #525 and neither worth its
own change alone.

The image is decoded twice per export. writeImage calls
NodeDefinitionSupport.toImageData(node.imageData()) for the intrinsic size, and then
resolveImageDimensions calls it again internally. Only the metadata decode is cached:
ImageSourceCache.fromBytes does an Arrays.copyOf plus a SHA-256 over the whole array on
every call, so a 10 MB image costs two full copies and two hashes. A path-sourced image also
logs ImageData.create(Path)'s INFO line twice. The fix is an overload of
resolveImageDimensions that accepts an already-resolved ImageData.

A row cell loses its paragraph alignment. writeParagraph carries
para.setAlignment(toAlignment(node.align())); writeRowCellChild does not, so a centred
paragraph inside a row cell exports left-aligned. One line, and the asymmetry is not
deliberate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions