vcl/source/filter/GraphicNativeTransform.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
New commits: commit af3ba60b12a1bf8eaef742ef00e16f2f9cbb6539 Author: Mike Kaganski <[email protected]> AuthorDate: Wed Oct 1 14:02:55 2025 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Wed Oct 1 17:16:19 2025 +0200 Use BinaryDataContainer::getAsStream in GraphicNativeTransform::rotateJPEG Avoids allocating and copying potentially large chunk of memory Change-Id: I93500bbdb32e9c484df02cbec0961ec8fdda564c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191726 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx index 4413c767200e..5150932c1d2d 100644 --- a/vcl/source/filter/GraphicNativeTransform.cxx +++ b/vcl/source/filter/GraphicNativeTransform.cxx @@ -127,20 +127,18 @@ void GraphicNativeTransform::rotateJPEG(Degree10 aRotation) { GfxLink aLink = mrGraphic.GetGfxLink(); - SvMemoryStream aSourceStream; - aSourceStream.WriteBytes(aLink.GetData(), aLink.GetDataSize()); - aSourceStream.Seek(STREAM_SEEK_TO_BEGIN); + std::unique_ptr<SvStream> pSourceStream(aLink.getDataContainer().getAsStream()); exif::Orientation aOrientation = exif::TOP_LEFT; Exif exif; - if (exif.read(aSourceStream)) + if (exif.read(*pSourceStream)) { aOrientation = exif.getOrientation(); } SvMemoryStream aTargetStream; - JpegTransform transform(aSourceStream, aTargetStream); + JpegTransform transform(*pSourceStream, aTargetStream); transform.setRotate(aRotation); transform.perform();
