[ooo-build-commit] patches/dev300 patches/emf+

Radek Doulík rodo at kemper.freedesktop.org
Fri Sep 11 02:00:59 PDT 2009


 patches/dev300/apply                 |    3 
 patches/emf+/emf+-driver-string.diff |  208 +++++++++++++++++++++++++++++++++++
 2 files changed, 211 insertions(+)

New commits:
commit 094d002b68ccb685255d4d6563b8101d10574de5
Author: Radek Doulik <rodo at rychlik.lounovice>
Date:   Thu Sep 10 17:57:44 2009 +0200

    added fix for n#519715
    
    * patches/dev300/apply:
    * patches/emf+/emf+-driver-string.diff:
    
    implements draw driver string action and font object

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 32fc6c8..458eb79 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3317,3 +3317,6 @@ build-fix-linux.diff
 # the changes in this patch should be integrated into existing patches or
 # the underlying problem these patches avoid should be fixex --noelp
 build-fix-win32.diff
+
+[ EMFPlus ]
+emf+-driver-string.diff, n#519715, rodo
diff --git a/patches/emf+/emf+-driver-string.diff b/patches/emf+/emf+-driver-string.diff
new file mode 100644
index 0000000..295ab75
--- /dev/null
+++ b/patches/emf+/emf+-driver-string.diff
@@ -0,0 +1,208 @@
+diff --git build/ooo310-m16/cppcanvas/source/mtfrenderer/emfplus.cxx build/ooo310-m16/cppcanvas/source/mtfrenderer/emfplus.cxx
+index a35dbef..3194009 100644
+--- cppcanvas/source/mtfrenderer/emfplus.cxx
++++ cppcanvas/source/mtfrenderer/emfplus.cxx
+@@ -12,6 +12,7 @@
+ #include <basegfx/polygon/b2dpolypolygon.hxx>
+ #include <basegfx/polygon/b2dpolypolygontools.hxx>
+ #include <vcl/canvastools.hxx>
++#include <rtl/ustring.hxx>
+ 
+ #include <com/sun/star/rendering/XCanvas.hpp>
+ #include <com/sun/star/rendering/TexturingMode.hpp>
+@@ -21,6 +22,7 @@
+ #include <implrenderer.hxx>
+ #include <outdevstate.hxx>
+ #include <polypolyaction.hxx>
++#include <textaction.hxx>
+ 
+ #define EmfPlusRecordTypeHeader 16385
+ #define EmfPlusRecordTypeEndOfFile 16386
+@@ -700,6 +702,39 @@ namespace cppcanvas
+             }
+         };
+ 
++        struct EMFPFont : public EMFPObject
++        {
++            sal_uInt32 version;
++	    float emSize;
++	    sal_uInt32 sizeUnit;
++	    sal_Int32 fontFlags;
++	    rtl::OUString family;
++
++            void Read (SvMemoryStream &s)
++            {
++                sal_uInt32 header;
++		sal_uInt32 reserved;
++		sal_uInt32 length;
++
++                s >> header >> emSize >> sizeUnit >> fontFlags >> reserved >> length;
++
++		OSL_ASSERT( ( header >> 12 ) == 0xdbc01 );
++
++                EMFP_DEBUG (printf ("EMF+\tfont\nEMF+\theader: 0x%08x version: 0x%08x size: %f unit: 0x%08x\n", header >> 12, header & 0x1fff, emSize, sizeUnit));
++                EMFP_DEBUG (printf ("EMF+\tflags: 0x%08x reserved: 0x%08x length: 0x%08x\n", fontFlags, reserved, length));
++
++		if( length > 0 && length < 0x4000 ) {
++		    sal_Unicode chars[ length ];
++
++		    for( int i = 0; i < length; i++ )
++			s >> chars[ i ];
++
++		    family = ::rtl::OUString( chars, length );
++		    EMFP_DEBUG (printf ("EMF+\tfamily: %s\n", rtl::OUStringToOString( family, RTL_TEXTENCODING_UTF8).getStr()));
++		}
++            }
++        };
++
+         void ImplRenderer::ReadRectangle (SvStream& s, float& x, float& y, float &width, float& height, sal_uInt32 flags)
+         {
+             if (flags & 0x4000) {
+@@ -796,10 +831,22 @@ namespace cppcanvas
+             return ::basegfx::B2DRange (x, y, x + w, y + h);
+         }
+ 
++#define COLOR(x) \
++	::vcl::unotools::colorToDoubleSequence( ::Color (0xff - (x >> 24), \
++							 (x >> 16) & 0xff, \
++							 (x >> 8) & 0xff, \
++							 x & 0xff),	\
++						rCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace());
++#define SET_FILL_COLOR(x) \
++	rState.fillColor = COLOR(x);
++#define SET_LINE_COLOR(x) \
++	rState.lineColor = COLOR(x);
++#define SET_TEXT_COLOR(x) \
++	rState.textColor = COLOR(x);
++
+         void ImplRenderer::EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms,
+                                                 OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor)
+         {
+-            sal_uInt8 transparency;
+             ::basegfx::B2DPolyPolygon localPolygon (polygon);
+ 
+             EMFP_DEBUG (printf ("EMF+\tfill polygon\n"));
+@@ -811,15 +858,9 @@ namespace cppcanvas
+             if (isColor) {
+                 EMFP_DEBUG (printf ("EMF+\t\tcolor fill\n"));
+ 
+-                transparency = 0xff - (brushIndexOrColor >> 24);
+-
+                 rState.isFillColorSet = true;
+                 rState.isLineColorSet = false;
+-                rState.fillColor = ::vcl::unotools::colorToDoubleSequence( ::Color (transparency,
+-                                                                                    (brushIndexOrColor >> 16) & 0xff,
+-                                                                                    (brushIndexOrColor >> 8) & 0xff,
+-                                                                                    brushIndexOrColor & 0xff),
+- 																			rCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace());
++		SET_FILL_COLOR(brushIndexOrColor);
+ 
+                 pPolyAction = ActionSharedPtr ( internal::PolyPolyActionFactory::createPolyPolyAction( localPolygon, rParms.mrCanvas, rState ) );
+ 
+@@ -1053,6 +1094,14 @@ namespace cppcanvas
+ 
+                     break;
+                 }
++            case EmfPlusObjectTypeFont:
++                {
++                    EMFPFont *font;
++                    aObjects [index] = font = new EMFPFont ();
++                    font->Read (rObjectStream);
++
++                    break;
++                }
+             default:
+                 EMFP_DEBUG (printf ("EMF+\tObject unhandled flags: 0x%04x\n", flags & 0xff00));
+                 break;
+@@ -1411,10 +1460,89 @@ namespace cppcanvas
+                         EMFP_DEBUG (printf ("EMF+\tTODO\n"));
+                     break;
+                 }
+-                case EmfPlusRecordTypeDrawDriverString:
++	        case EmfPlusRecordTypeDrawDriverString: {
+                     EMFP_DEBUG (printf ("EMF+ DrawDriverString, flags: 0x%04x\n", flags));
+-                    EMFP_DEBUG (printf ("EMF+\tTODO\n"));
++		    sal_uInt32 brushIndexOrColor;
++		    sal_uInt32 optionFlags;
++		    sal_uInt32 hasMatrix;
++		    sal_uInt32 glyphsCount;
++
++		    rMF >> brushIndexOrColor >> optionFlags >> hasMatrix >> glyphsCount;
++
++		    EMFP_DEBUG (printf ("EMF+\t%s: 0x%08x\n", (flags & 0x8000) ? "color" : "brush index", brushIndexOrColor));
++		    EMFP_DEBUG (printf ("EMF+\toption flags: 0x%08x\n", optionFlags));
++		    EMFP_DEBUG (printf ("EMF+\thas matrix: %d\n", hasMatrix));
++		    EMFP_DEBUG (printf ("EMF+\tglyphs: %d\n", glyphsCount));
++
++		    if( ( optionFlags & 1 ) && glyphsCount > 0 ) {
++			sal_uInt16 chars[ glyphsCount ];
++			float charsPosX[ glyphsCount ];
++			float charsPosY[ glyphsCount ];
++
++			for( int i=0; i<glyphsCount; i++) {
++			    rMF >> chars[i];
++			    EMFP_DEBUG (printf ("EMF+\tglyph[%d]: 0x%04x\n",
++			    i, chars[i]));
++			}
++			for( int i=0; i<glyphsCount; i++) {
++			    rMF >> charsPosX[i] >> charsPosY[i];
++			    EMFP_DEBUG (printf ("EMF+\tglyphPosition[%d]: %f, %f\n", i, charsPosX[i], charsPosY[i]));
++			}
++
++			XForm transform;
++			if( hasMatrix ) {
++			    rMF >> transform;
++			    EMFP_DEBUG (printf ("EMF+\tmatrix:: %f, %f, %f, %f, %f, %f\n", transform.eM11, transform.eM12, transform.eM21, transform.eM22, transform.eDx, transform.eDy));
++			}
++
++			// create and add the text action
++			XubString text( chars, glyphsCount );
++
++                        EMFPFont *font = (EMFPFont*) aObjects[ flags & 0xff ];
++
++			rendering::FontRequest aFontRequest;
++			aFontRequest.FontDescription.FamilyName = font->family;
++			aFontRequest.CellSize = (rState.mapModeTransform*MapSize( font->emSize, 0 )).getX();
++			rState.xFont = rFactoryParms.mrCanvas->getUNOCanvas()->createFont( aFontRequest,
++											   uno::Sequence< beans::PropertyValue >(),
++											   geometry::Matrix2D() );
++			if( flags & 0x8000 )
++ 			    SET_TEXT_COLOR(brushIndexOrColor);
++
++			ActionSharedPtr pTextAction( 
++			    TextActionFactory::createTextAction(
++				::vcl::unotools::pointFromB2DPoint ( Map( charsPosX[0], charsPosY[0] ) ),
++				::Size(),
++				::Color(),
++				::Size(),
++				::Color(),
++				text,
++				0,
++				glyphsCount,
++				NULL,
++				rFactoryParms.mrVDev,
++				rFactoryParms.mrCanvas,
++				rState,
++				rFactoryParms.mrParms,
++				false ) );
++
++			if( pTextAction )
++			{
++			    EMFP_DEBUG (printf ("EMF+\t\tadd text action\n"));
++
++			    maActions.push_back(
++				MtfAction(
++				    pTextAction,
++				    rFactoryParms.mrCurrActionIndex ) );
++                
++			    rFactoryParms.mrCurrActionIndex += pTextAction->getActionCount()-1;
++			}
++		    } else {
++			EMFP_DEBUG (printf ("EMF+\tTODO: fonts (non-unicode glyphs chars)\n"));
++		    }
++
+                     break;
++		}
+                 default:
+                     EMFP_DEBUG (printf ("EMF+ unhandled record type: %d\n", type));
+                     EMFP_DEBUG (printf ("EMF+\tTODO\n"));


More information about the ooo-build-commit mailing list