summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/impgraph.hxx1
-rw-r--r--vcl/qa/cppunit/GraphicTest.cxx8
-rw-r--r--vcl/source/gdi/impgraph.cxx20
3 files changed, 24 insertions, 5 deletions
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 8b3cc14b7f2d..a65462a48819 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -38,6 +38,7 @@ struct ImpSwapInfo
bool mbIsAlpha;
sal_uInt32 mnAnimationLoopCount;
+ sal_Int32 mnPageIndex;
};
class OutputDevice;
diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx
index 6a70ba921942..3d6d0a79b1a9 100644
--- a/vcl/qa/cppunit/GraphicTest.cxx
+++ b/vcl/qa/cppunit/GraphicTest.cxx
@@ -335,10 +335,10 @@ void GraphicTest::testSwapping()
CPPUNIT_ASSERT_EQUAL(true, bool(xStream));
// Check size of the stream
- CPPUNIT_ASSERT_EQUAL(sal_uInt64(445), xStream->remainingSize());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(449), xStream->remainingSize());
std::vector<unsigned char> aHash = calculateHash(xStream);
- CPPUNIT_ASSERT_EQUAL(std::string("304f17d9c56e79b95f6c337dab88709d4f9b61f0"),
+ CPPUNIT_ASSERT_EQUAL(std::string("878281e583487b29ae09078e8040c01791c7649a"),
toHexString(aHash));
}
@@ -407,10 +407,10 @@ void GraphicTest::testSwappingVectorGraphic()
CPPUNIT_ASSERT_EQUAL(true, bool(xStream));
// Check size of the stream
- CPPUNIT_ASSERT_EQUAL(sal_uInt64(349), xStream->remainingSize());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(353), xStream->remainingSize());
std::vector<unsigned char> aHash = calculateHash(xStream);
- CPPUNIT_ASSERT_EQUAL(std::string("88b4c1c359e3cf7be005fbb46c93ffa6de9dcf4a"),
+ CPPUNIT_ASSERT_EQUAL(std::string("6ae83fc9c06ca253ada0b156d6e4700a4a028c34"),
toHexString(aHash));
}
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index c40a344ba1da..70609d0b31f8 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -385,6 +385,7 @@ void ImpGraphic::createSwapInfo()
maSwapInfo.mbIsTransparent = ImplIsTransparent();
maSwapInfo.mbIsAlpha = ImplIsAlpha();
maSwapInfo.mnAnimationLoopCount = ImplGetAnimationLoopCount();
+ maSwapInfo.mnPageIndex = getPageNumber();
}
void ImpGraphic::ImplClearGraphics()
@@ -442,6 +443,9 @@ void ImpGraphic::ImplSetPrepared(bool bAnimated, const Size* pSizeHint)
maSwapInfo.mnAnimationLoopCount = 0;
maSwapInfo.mbIsEPS = false;
maSwapInfo.mbIsAnimated = bAnimated;
+
+ if (maVectorGraphicData)
+ maSwapInfo.mnPageIndex = maVectorGraphicData->getPageIndex();
}
void ImpGraphic::ImplClear()
@@ -1137,6 +1141,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;
@@ -1155,6 +1160,11 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
TypeSerializer aSerializer(rIStm);
aSerializer.readSize(aSize);
ReadMapMode( rIStm, aMapMode );
+
+ if (aCompat.GetVersion() >= 2)
+ {
+ rIStm.ReadInt32(nPageIndex);
+ }
}
else
{
@@ -1253,6 +1263,8 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
{
ImplSetPrefMapMode( aMapMode );
ImplSetPrefSize( aSize );
+ if (maVectorGraphicData)
+ maVectorGraphicData->setPageIndex(nPageIndex);
}
}
else
@@ -1284,7 +1296,7 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
rOStm.WriteUInt32( GRAPHIC_FORMAT_50 );
// write new style header
- VersionCompat aCompat( rOStm, StreamMode::WRITE, 1 );
+ VersionCompat aCompat(rOStm, StreamMode::WRITE, 2);
rOStm.WriteInt32( static_cast<sal_Int32>(meType) );
@@ -1296,6 +1308,9 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
aSerializer.writeSize(aSize);
WriteMapMode( rOStm, aMapMode );
+
+ // Version 2
+ rOStm.WriteInt32(getPageNumber());
}
else
{
@@ -1602,6 +1617,9 @@ bool ImpGraphic::ImplExportNative( SvStream& rOStm ) const
sal_Int32 ImpGraphic::getPageNumber() const
{
+ if (isSwappedOut())
+ return maSwapInfo.mnPageIndex;
+
if (maVectorGraphicData)
return maVectorGraphicData->getPageIndex();
return -1;