diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2018-04-09 12:43:55 +0200 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2018-04-09 15:16:14 +0200 |
commit | 5f1534363461804977ec97580b96b227d9d2cdf0 (patch) | |
tree | d7b2acc80a406c8f092316d21f6a2eee1feb8326 /drawinglayer | |
parent | 79383148bb31bee0c8fae941f6cc0fdd605fb2ea (diff) |
EMF+ Fix variable types according to specification
Change-Id: I03b949abbe53a4f34bba72a23f941ebea443f737
Reviewed-on: https://gerrit.libreoffice.org/52627
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/tools/emfphelperdata.cxx | 29 | ||||
-rw-r--r-- | drawinglayer/source/tools/emfphelperdata.hxx | 54 | ||||
-rw-r--r-- | drawinglayer/source/tools/emfpimage.cxx | 31 | ||||
-rw-r--r-- | drawinglayer/source/tools/emfpimage.hxx | 10 |
4 files changed, 27 insertions, 97 deletions
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 0afabe77302d..3118e6cd8e56 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -96,13 +96,6 @@ namespace emfplushelper return ""; } - typedef enum - { - ImageDataTypeUnknown = 0x00000000, - ImageDataTypeBitmap = 0x00000001, - ImageDataTypeMetafile = 0x00000002 - } ImageDataType; - EMFPObject::~EMFPObject() { } @@ -1145,10 +1138,10 @@ namespace emfplushelper case EmfPlusRecordTypeDrawImage: case EmfPlusRecordTypeDrawImagePoints: { - sal_uInt32 attrIndex; + sal_uInt32 imageAttributesId; sal_Int32 sourceUnit; - rMS.ReadUInt32(attrIndex).ReadInt32(sourceUnit); - SAL_INFO("drawinglayer", "EMF+ " << (type == EmfPlusRecordTypeDrawImagePoints ? "DrawImagePoints" : "DrawImage") << "attributes index: " << attrIndex << "source unit: " << sourceUnit); + rMS.ReadUInt32(imageAttributesId).ReadInt32(sourceUnit); + SAL_INFO("drawinglayer", "EMF+ " << (type == EmfPlusRecordTypeDrawImagePoints ? "DrawImagePoints" : "DrawImage") << " image attributes Id: " << imageAttributesId << " source unit: " << sourceUnit); SAL_INFO("drawinglayer", "EMF+\tTODO: use image attributes"); // For DrawImage and DrawImagePoints, source unit of measurement type must be 1 pixel @@ -1164,8 +1157,8 @@ namespace emfplushelper if (type == EmfPlusRecordTypeDrawImagePoints) { - sal_Int32 aCount; - rMS.ReadInt32(aCount); + sal_uInt32 aCount; + rMS.ReadUInt32(aCount); // Number of points used by DrawImagePoints. Exactly 3 points must be specified. if(aCount == 3) @@ -1176,15 +1169,15 @@ namespace emfplushelper ReadPoint(rMS, x2, y2, flags); ReadPoint(rMS, x3, y3, flags); - SAL_INFO("drawinglayer", "EMF+ destination points: " << x1 << "," << y1 << " " << x2 << "," << y2 << " " << x3 << "," << y3); - SAL_INFO("drawinglayer", "EMF+ destination rectangle: " << x1 << "," << y1 << " " << x2 - x1 << "x" << y3 - y1); + SAL_INFO("drawinglayer", "EMF+\t destination points: " << x1 << "," << y1 << " " << x2 << "," << y2 << " " << x3 << "," << y3); + SAL_INFO("drawinglayer", "EMF+\t destination rectangle: " << x1 << "," << y1 << " " << x2 - x1 << "x" << y3 - y1); aDstPoint = Map(x1, y1); aDstSize = MapSize(x2 - x1, y3 - y1); } else { - SAL_WARN("drawinglayer", "EMF+ DrawImagePoints Wrong EMF+ file. Expected 3 points, received: "<< aCount); + SAL_WARN("drawinglayer", "EMF+\t DrawImagePoints Wrong EMF+ file. Expected 3 points, received: "<< aCount); break; } } @@ -1192,7 +1185,7 @@ namespace emfplushelper { float dx, dy, dw, dh; ReadRectangle(rMS, dx, dy, dw, dh, bool(flags & 0x4000)); - SAL_INFO("drawinglayer", "EMF+ destination rectangle: " << dx << "," << dy << " " << dw << "x" << dh); + SAL_INFO("drawinglayer", "EMF+\t destination rectangle: " << dx << "," << dy << " " << dw << "x" << dh); aDstPoint = Map(dx, dy); aDstSize = MapSize(dw, dh); } @@ -1209,7 +1202,7 @@ namespace emfplushelper BitmapEx aBmp(image.graphic.GetBitmapEx()); aBmp.Crop(aSource); Size aSize(aBmp.GetSizePixel()); - SAL_INFO("drawinglayer", "EMF+ bitmap size: " << aSize.Width() << "x" << aSize.Height()); + SAL_INFO("drawinglayer", "EMF+\t bitmap size: " << aSize.Width() << "x" << aSize.Height()); if (aSize.Width() > 0 && aSize.Height() > 0) { mrTargetHolders.Current().append( @@ -1217,7 +1210,7 @@ namespace emfplushelper } else { - SAL_INFO("drawinglayer", "EMF+ warning: empty bitmap"); + SAL_INFO("drawinglayer", "EMF+\t warning: empty bitmap"); } } else if (image.type == ImageDataTypeMetafile) diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx index ba58686088f9..7d85631eacc7 100644 --- a/drawinglayer/source/tools/emfphelperdata.hxx +++ b/drawinglayer/source/tools/emfphelperdata.hxx @@ -132,58 +132,6 @@ namespace emfplushelper virtual ~EMFPObject(); }; -// struct OutDevState -// { -// OutDevState(); -// -// ::basegfx::B2DPolyPolygon clip; -// ::tools::Rectangle clipRect; -// css::uno::Reference< css::rendering::XPolyPolygon2D > xClipPoly; -// -// css::uno::Sequence< double > lineColor; -// css::uno::Sequence< double > fillColor; -// css::uno::Sequence< double > textColor; -// css::uno::Sequence< double > textFillColor; -// css::uno::Sequence< double > textLineColor; -// -// /** Current font. -// -// @attention Beware, this member can be NULL, and -// nevertheless text output is generated. -// */ -// css::uno::Reference< css::rendering::XCanvasFont > xFont; -// ::basegfx::B2DHomMatrix transform; -// ::basegfx::B2DHomMatrix mapModeTransform; -// double fontRotation; -// -// FontEmphasisMark textEmphasisMarkStyle; -// PushFlags pushFlags; -// sal_Int8 textDirection; -// sal_Int8 textAlignment; -// FontRelief textReliefStyle; -// sal_Int8 textOverlineStyle; -// sal_Int8 textUnderlineStyle; -// sal_Int8 textStrikeoutStyle; -// TextAlign textReferencePoint; -// -// bool isTextOutlineModeSet; -// bool isTextEffectShadowSet; -// bool isTextWordUnderlineSet; -// -// bool isLineColorSet; -// bool isFillColorSet; -// bool isTextFillColorSet; -// bool isTextLineColorSet; -// }; - -// typedef struct -// { -// basegfx::B2DHomMatrix maWorldTransform; -// OutDevState aDevState; -// } EmfPlusGraphicState; -// -// typedef std::map<int, EmfPlusGraphicState> GraphicStateMap; - typedef std::map<int, wmfemfhelper::PropertyHolder> GraphicStateMap; struct EmfPlusHelperData @@ -264,6 +212,6 @@ namespace emfplushelper }; } -#endif // INCLUDED_CPPCANVAS_SOURCE_MTFRENDERER_EMFPBRUSH_HXX +#endif // INCLUDED_DRAWINGLAYER_SOURCE_TOOLS_EMFPHELPERDATA_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/source/tools/emfpimage.cxx b/drawinglayer/source/tools/emfpimage.cxx index a8d87cb15a48..f5a5f6b2a44d 100644 --- a/drawinglayer/source/tools/emfpimage.cxx +++ b/drawinglayer/source/tools/emfpimage.cxx @@ -16,25 +16,6 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#include <com/sun/star/rendering/PathCapType.hpp> -#include <com/sun/star/rendering/PathJoinType.hpp> -#include <com/sun/star/rendering/TexturingMode.hpp> -#include <com/sun/star/rendering/XCanvas.hpp> -#include <basegfx/utils/canvastools.hxx> -#include <basegfx/utils/gradienttools.hxx> -#include <basegfx/utils/tools.hxx> -#include <basegfx/numeric/ftools.hxx> -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/vector/b2dsize.hxx> -#include <basegfx/range/b2drange.hxx> -#include <basegfx/range/b2drectangle.hxx> -#include <basegfx/polygon/b2dlinegeometry.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/polygon/b2dpolygontools.hxx> -#include <basegfx/polygon/b2dpolypolygon.hxx> -#include <basegfx/polygon/b2dpolypolygontools.hxx> -#include <vcl/canvastools.hxx> #include <vcl/graphicfilter.hxx> #include "emfpimage.hxx" @@ -46,11 +27,11 @@ namespace emfplushelper s.ReadUInt32(header).ReadUInt32(type); SAL_INFO("drawinglayer", "EMF+\timage\nEMF+\theader: 0x" << std::hex << header << " type: " << type << std::dec); - if (1 == type) + if (ImageDataTypeBitmap == type) { // bitmap - s.ReadInt32(width).ReadInt32(height).ReadInt32(stride).ReadInt32(pixelFormat).ReadUInt32(bitmapType); - SAL_INFO("drawinglayer", "EMF+\tbitmap width: " << width << " height: " << height << " stride: " << stride << " pixelFormat: 0x" << std::hex << pixelFormat << std::dec); + s.ReadInt32(width).ReadInt32(height).ReadInt32(stride).ReadUInt32(pixelFormat).ReadUInt32(bitmapType); + SAL_INFO("drawinglayer", "EMF+\tbitmap width: " << width << " height: " << height << " stride: " << stride << " pixelFormat: 0x" << std::hex << pixelFormat << " bitmapType: 0x" << bitmapType << std::dec); if ((bitmapType != 0) || (width == 0)) { @@ -60,11 +41,11 @@ namespace emfplushelper SAL_INFO("drawinglayer", "EMF+\tbitmap width: " << graphic.GetBitmap().GetSizePixel().Width() << " height: " << graphic.GetBitmap().GetSizePixel().Height()); } } - else if (2 == type) + else if (ImageDataTypeMetafile == type) { // metafile - sal_Int32 mfType, mfSize; - s.ReadInt32(mfType).ReadInt32(mfSize); + sal_uInt32 mfType, mfSize; + s.ReadUInt32(mfType).ReadUInt32(mfSize); if (bUseWholeStream) dataSize = s.remainingSize(); diff --git a/drawinglayer/source/tools/emfpimage.hxx b/drawinglayer/source/tools/emfpimage.hxx index 5208708f9d7a..ed656e2c33db 100644 --- a/drawinglayer/source/tools/emfpimage.hxx +++ b/drawinglayer/source/tools/emfpimage.hxx @@ -25,13 +25,21 @@ namespace emfplushelper { + + typedef enum + { + ImageDataTypeUnknown = 0x00000000, + ImageDataTypeBitmap = 0x00000001, + ImageDataTypeMetafile = 0x00000002 + } ImageDataType; + struct EMFPImage : public EMFPObject { sal_uInt32 type; sal_Int32 width; sal_Int32 height; sal_Int32 stride; - sal_Int32 pixelFormat; + sal_uInt32 pixelFormat; Graphic graphic; void Read(SvMemoryStream &s, sal_uInt32 dataSize, bool bUseWholeStream); |