[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - include/vcl vcl/inc vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 1 07:25:07 UTC 2020
include/vcl/vectorgraphicdata.hxx | 5 +++++
vcl/inc/impgraph.hxx | 1 +
vcl/source/gdi/impgraph.cxx | 20 +++++++++++++++++++-
3 files changed, 25 insertions(+), 1 deletion(-)
New commits:
commit a492113452c64194d93c0e12b6a02558fac860dd
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Jul 29 20:57:40 2020 +0200
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Tue Sep 1 09:24:32 2020 +0200
vcl: save and load the page number when swapping the graphic
PDF vector graphic includes a page number, of the page that the
graphic is rendering. This however isn't remembered when swapping
out and back in the graphic, because the serialization format
doesn't include it.
This adds a version 2 of the serialization format, with an
additional page number (page index) attribute.
Also changes the GraphicTest to account for an additional 4 bytes
written and the change of the checksum.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100836
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit 28beaffba6a0ecaf351c84bed41443a6721d85b6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100883
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit d6b4a0a9a3fed1ba07125d7e9517f0a663fc4018)
Change-Id: Ic0fbfc4ad983f7880e06956da3b4664bd4b610d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101760
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/include/vcl/vectorgraphicdata.hxx b/include/vcl/vectorgraphicdata.hxx
index 75688d2b00a7..d37f313e941a 100644
--- a/include/vcl/vectorgraphicdata.hxx
+++ b/include/vcl/vectorgraphicdata.hxx
@@ -112,6 +112,11 @@ public:
sal_Int32 getPageIndex() const { return std::max(sal_Int32(0), mnPageIndex); }
+ void setPageIndex(sal_Int32 nPageIndex)
+ {
+ mnPageIndex = nPageIndex;
+ }
+
bool isPrimitiveSequenceCreated() const { return mbSequenceCreated; }
};
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 4b13463c949f..5ab71a1faaf4 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -35,6 +35,7 @@ struct ImpSwapInfo
bool mbIsAlpha;
sal_uInt32 mnAnimationLoopCount;
+ sal_Int32 mnPageIndex;
};
class OutputDevice;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 065bf3db4385..58985bc61d4e 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -449,6 +449,7 @@ void ImpGraphic::ImplCreateSwapInfo()
maSwapInfo.mbIsTransparent = ImplIsTransparent();
maSwapInfo.mbIsAlpha = ImplIsAlpha();
maSwapInfo.mnAnimationLoopCount = ImplGetAnimationLoopCount();
+ maSwapInfo.mnPageIndex = getPageNumber();
}
}
@@ -526,6 +527,9 @@ void ImpGraphic::ImplSetPrepared(bool bAnimated, Size* pSizeHint)
maSwapInfo.mbIsTransparent = false;
maSwapInfo.mbIsAlpha = false;
maSwapInfo.mbIsAnimated = bAnimated;
+
+ if (maVectorGraphicData)
+ maSwapInfo.mnPageIndex = maVectorGraphicData->getPageIndex();
}
void ImpGraphic::ImplClear()
@@ -1201,6 +1205,7 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
Size aSize;
sal_uInt32 nId;
sal_Int32 nType;
+ sal_Int32 nPageIndex = -1;
const SvStreamEndian nOldFormat = rIStm.GetEndian();
bool bRet = false;
@@ -1218,6 +1223,11 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
rIStm.ReadInt32( nLen );
ReadPair( rIStm, aSize );
ReadMapMode( rIStm, aMapMode );
+
+ if (pCompat->GetVersion() >= 2)
+ {
+ rIStm.ReadInt32(nPageIndex);
+ }
}
else
{
@@ -1316,6 +1326,8 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
{
ImplSetPrefMapMode( aMapMode );
ImplSetPrefSize( aSize );
+ if (maVectorGraphicData)
+ maVectorGraphicData->setPageIndex(nPageIndex);
}
}
else
@@ -1348,7 +1360,7 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
rOStm.WriteUInt32( GRAPHIC_FORMAT_50 );
// write new style header
- std::unique_ptr<VersionCompat> pCompat( new VersionCompat( rOStm, StreamMode::WRITE, 1 ) );
+ std::unique_ptr<VersionCompat> pCompat( new VersionCompat( rOStm, StreamMode::WRITE, 2 ) );
rOStm.WriteInt32( static_cast<sal_Int32>(meType) );
@@ -1358,6 +1370,9 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
WritePair( rOStm, aSize );
WriteMapMode( rOStm, aMapMode );
+
+ // Version 2
+ rOStm.WriteInt32(getPageNumber());
}
else
{
@@ -1701,6 +1716,9 @@ bool ImpGraphic::ImplExportNative( SvStream& rOStm ) const
sal_Int32 ImpGraphic::getPageNumber() const
{
+ if (ImplIsSwapOut())
+ return maSwapInfo.mnPageIndex;
+
if (maVectorGraphicData)
return maVectorGraphicData->getPageIndex();
return -1;
More information about the Libreoffice-commits
mailing list