diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-04-20 16:32:00 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-04-20 21:04:35 +0200 |
commit | edda1e5fc8113aa4744e32f97c96a3cc311485ca (patch) | |
tree | b6da5a4a637a9a3ae3ed9307fe59d6f1df80b197 /vcl/source/gdi/impgraph.cxx | |
parent | e9c52f55f0cc7155d6883e4d2abf14f1638b03b3 (diff) |
DOCX import: lazy-read images without external headers
So that similar to ODT, images are not loaded on file open, only when
the user scrolls there.
Notes:
1) GraphicDescriptor::ImpDetectJPG() would try to calculate the logic
size before the pixel size is available, so the logic size would be 0x0.
Also, ImpGraphic::ImplSetPrepared() would always work with a pixel map
mode. Any of these two would result in a failure of
testDMLShapeFillBitmapCrop in CppunitTest_sw_ooxmlexport6.
2) Lazy-loading seems to (at the moment) not recognize EMF files, so
don't lazy-load in case an external header is provided. This probably
has to be revisited, since the ODF import doesn't go via
GraphicProvider::queryGraphic().
Change-Id: I44754e659effebca8339715df114dbaadb9b5e9f
Reviewed-on: https://gerrit.libreoffice.org/53215
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'vcl/source/gdi/impgraph.cxx')
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 9cd9bbb11717..1a9cca6ce0da 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -523,8 +523,20 @@ void ImpGraphic::ImplSetPrepared() GraphicDescriptor aDescriptor(aMemoryStream, nullptr); if (aDescriptor.Detect(true)) { - maSwapInfo.maPrefSize = aDescriptor.GetSizePixel(); - maSwapInfo.maPrefMapMode = MapMode(MapUnit::MapPixel); + // If we have logic size, work with that, as later pixel -> logic + // conversion will work with the output device DPI, not the graphic + // DPI. + Size aLogSize = aDescriptor.GetSize_100TH_MM(); + if (aLogSize.getWidth() && aLogSize.getHeight()) + { + maSwapInfo.maPrefSize = aLogSize; + maSwapInfo.maPrefMapMode = MapMode(MapUnit::Map100thMM); + } + else + { + maSwapInfo.maPrefSize = aDescriptor.GetSizePixel(); + maSwapInfo.maPrefMapMode = MapMode(MapUnit::MapPixel); + } } maSwapInfo.mnAnimationLoopCount = 0; maSwapInfo.mbIsAnimated = false; |