summaryrefslogtreecommitdiff
path: root/drawinglayer/source/tools
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2018-04-15 02:00:16 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2018-04-17 23:40:24 +0200
commita2851d562cdfaf06e5f767030677846f3f129b1c (patch)
tree7bf90541012a3fa3a61cedf6e91f6ac7272e12ee /drawinglayer/source/tools
parentc42ed19c1dcde6e2c6210e6f8cc90ba8ba654de1 (diff)
tdf#117015 EMF+ Fix for displaying EMF+ files where GetDC is used
With EMF+ Only mode, still the EMF records could be used for displaying objects, by using Get Device Context (GetDC). Files identified as EMF+ Only can contain both EMF+ records and EMF records. All EMF+ records are used to render the image. The EMF records that are part of the drawing are those preceded by a Get Device Context record. Unfortunately after finishing EMF drawing, the clip region was not reset. As a result records after EMF record was not displayed. With this patch, the issue was fixed by resetting clip region. Change-Id: I998b14e7c3b56a7711ba6a7bec08ec2097e0dfce Reviewed-on: https://gerrit.libreoffice.org/52897 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'drawinglayer/source/tools')
-rw-r--r--drawinglayer/source/tools/emfphelperdata.cxx10
-rw-r--r--drawinglayer/source/tools/emfphelperdata.hxx1
2 files changed, 10 insertions, 1 deletions
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 3c9d10e62fd8..a7c455cfc1aa 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -745,7 +745,8 @@ namespace emfplushelper
mMFlags(0),
mMStream(),
mrTargetHolders(rTargetHolders),
- mrPropertyHolders(rPropertyHolders)
+ mrPropertyHolders(rPropertyHolders),
+ bIsGetDCProcessing(false)
{
rMS.ReadInt32(mnFrameLeft).ReadInt32(mnFrameTop).ReadInt32(mnFrameRight).ReadInt32(mnFrameBottom);
SAL_INFO("drawinglayer", "EMF+ picture frame: " << mnFrameLeft << "," << mnFrameTop << " - " << mnFrameRight << "," << mnFrameBottom);
@@ -838,6 +839,12 @@ namespace emfplushelper
SAL_INFO("drawinglayer", "EMF+ record size: " << size << " type: " << emfTypeToName(type) << " flags: " << flags << " data size: " << dataSize);
+ if (bIsGetDCProcessing)
+ {
+ SAL_INFO("drawinglayer", "EMF+ Resets the current clipping region for the world space to infinity.");
+ wmfemfhelper::HandleNewClipRegion(::basegfx::B2DPolyPolygon(), mrTargetHolders, mrPropertyHolders);
+ bIsGetDCProcessing = false;
+ }
if (type == EmfPlusRecordTypeObject && ((mbMultipart && (flags & 0x7fff) == (mMFlags & 0x7fff)) || (flags & 0x8000)))
{
if (!mbMultipart)
@@ -912,6 +919,7 @@ namespace emfplushelper
}
case EmfPlusRecordTypeGetDC:
{
+ bIsGetDCProcessing = true;
SAL_INFO("drawinglayer", "EMF+ GetDC");
SAL_INFO("drawinglayer", "EMF+\talready used in svtools wmf/emf filter parser");
break;
diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx
index e5402d1fe267..281a5f7ebbba 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -171,6 +171,7 @@ namespace emfplushelper
/// data holders
wmfemfhelper::TargetHolders& mrTargetHolders;
wmfemfhelper::PropertyHolders& mrPropertyHolders;
+ bool bIsGetDCProcessing;
// readers
void processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_uInt32 dataSize, bool bUseWholeStream = false);