[Libreoffice-commits] core.git: sw/source vcl/inc vcl/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Apr 23 17:22:48 UTC 2018
sw/source/filter/html/htmlgrin.cxx | 10 ----------
vcl/inc/impgraph.hxx | 3 +++
vcl/source/gdi/graph.cxx | 2 +-
vcl/source/gdi/impgraph.cxx | 14 ++++++++++++++
4 files changed, 18 insertions(+), 11 deletions(-)
New commits:
commit 5a729407e858ee5ed5b621a6fcc0a4f104c9a017
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Apr 23 17:21:47 2018 +0200
vcl: avoid swap in when Graphic::GetSizePixel() is called
It's easier to fix this centrally in vcl, rather than not calling
GetSizePixel() in each and every import filter.
Change-Id: Ie0a788b8a5b886ebc2fedf0dc052deb4149b9364
Reviewed-on: https://gerrit.libreoffice.org/53333
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index cb25a316277f..0a9050f3475a 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -482,18 +482,8 @@ IMAGE_SETEVENT:
{
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
aGraphic = rFilter.ImportUnloadedGraphic(*pStream);
- if (aGraphic)
- {
sGrfNm.clear();
- if (!bHeightProvided || !bWidthProvided)
- {
- Size aPrefSize = aGraphic.GetPrefSize();
- nWidth = aPrefSize.getWidth();
- nHeight = aPrefSize.getHeight();
- }
- }
-
if (!sGrfNm.isEmpty())
{
if (ERRCODE_NONE == rFilter.ImportGraphic(aGraphic, "", *pStream))
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 660fdfce81cd..cff173b9a3fb 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -27,6 +27,7 @@ struct ImpSwapInfo
{
MapMode maPrefMapMode;
Size maPrefSize;
+ Size maSizePixel;
bool mbIsAnimated;
bool mbIsEPS;
@@ -155,6 +156,8 @@ private:
Animation ImplGetAnimation() const;
const GDIMetaFile& ImplGetGDIMetaFile() const;
+ Size ImplGetSizePixel() const;
+
Size ImplGetPrefSize() const;
void ImplSetPrefSize( const Size& rPrefSize );
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 9ba35ddd7366..2533a75e47c4 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -438,7 +438,7 @@ Size Graphic::GetSizePixel( const OutputDevice* pRefDevice ) const
Size aRet;
if( GraphicType::Bitmap == mxImpGraphic->ImplGetType() )
- aRet = mxImpGraphic->ImplGetBitmapEx(GraphicConversionParameters()).GetSizePixel();
+ aRet = mxImpGraphic->ImplGetSizePixel();
else
aRet = ( pRefDevice ? pRefDevice : Application::GetDefaultDevice() )->LogicToPixel( GetPrefSize(), GetPrefMapMode() );
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 1a9cca6ce0da..2b263bcab354 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -537,6 +537,8 @@ void ImpGraphic::ImplSetPrepared()
maSwapInfo.maPrefSize = aDescriptor.GetSizePixel();
maSwapInfo.maPrefMapMode = MapMode(MapUnit::MapPixel);
}
+
+ maSwapInfo.maSizePixel = aDescriptor.GetSizePixel();
}
maSwapInfo.mnAnimationLoopCount = 0;
maSwapInfo.mbIsAnimated = false;
@@ -868,6 +870,18 @@ const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
return maMetaFile;
}
+Size ImpGraphic::ImplGetSizePixel() const
+{
+ Size aSize;
+
+ if (ImplIsSwapOut())
+ aSize = maSwapInfo.maSizePixel;
+ else
+ aSize = ImplGetBitmapEx(GraphicConversionParameters()).GetSizePixel();
+
+ return aSize;
+}
+
Size ImpGraphic::ImplGetPrefSize() const
{
Size aSize;
More information about the Libreoffice-commits
mailing list