1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: outdevgrind.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_vcl.hxx"
35 #include <rtl/bootstrap.hxx>
36 #include <comphelper/processfactory.hxx>
37 #include <comphelper/regpathhelper.hxx>
38 #include <cppuhelper/servicefactory.hxx>
39 #include <cppuhelper/bootstrap.hxx>
40 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
41 #include <com/sun/star/lang/XInitialization.hpp>
42 #include <com/sun/star/registry/XSimpleRegistry.hpp>
44 #include <ucbhelper/contentbroker.hxx>
45 #include <ucbhelper/configurationkeys.hxx>
47 #include <vcl/svapp.hxx>
48 #include <vcl/dialog.hxx>
49 #include <vcl/outdev.hxx>
50 #include <vcl/virdev.hxx>
51 #include <vcl/hatch.hxx>
52 #include <vcl/bitmap.hxx>
53 #include <vcl/wall.hxx>
54 #include <vcl/image.hxx>
55 #include <vcl/gdimtf.hxx>
56 #include <vcl/metaact.hxx>
57 #include <vcl/bitmapex.hxx>
58 #include <vcl/gradient.hxx>
59 #include <vcl/lineinfo.hxx>
60 #include <tools/string.hxx>
64 #include <boost/function.hpp>
65 #include <boost/bind.hpp>
70 using namespace ::com::sun::star
;
76 class GrindApp
: public Application
80 virtual USHORT
Exception( USHORT nError
);
83 class TestWindow
: public Dialog
86 TestWindow() : Dialog( (Window
*) NULL
)
88 SetText( rtl::OUString::createFromAscii( "OutDev grinding" ) );
89 SetSizePixel( Size( 1024, 1024 ) );
94 virtual ~TestWindow() {}
95 virtual void Paint( const Rectangle
& rRect
);
98 //----------------------------------------------------------------------------------
100 typedef boost::function1
<void, OutputDevice
*> functor_type
;
101 typedef std::vector
< std::pair
<const char*,
102 functor_type
> > functor_vector_type
;
104 template< typename Functor
> void add( functor_vector_type
& res
,
106 const Functor
& func
)
108 res
.push_back( std::make_pair(pStr
,functor_type(func
)) );
111 void setupMethodStubs( functor_vector_type
& res
)
113 const Color
aWhiteColor( COL_WHITE
);
114 const Color
aBlackColor( COL_BLACK
);
116 const Point
aPt1(10,10);
117 const Point
aPt2(500,500);
118 const Point
aPt3(0,0);
119 const Point
aPt4(450,450);
121 const Rectangle
aRect(aPt1
,aPt2
);
122 const Rectangle
aRect2(aPt3
,aPt4
);
123 const Polygon
aPoly(aRect
);
124 const Polygon
aPoly2(aRect2
);
125 PolyPolygon
aPolyPoly(aPoly
);
126 aPolyPoly
.Insert( aPoly2
);
127 Polygon
aPoly3(aPoly2
);
128 aPoly3
.Rotate( aPoly3
.GetBoundRect().Center(),
131 const String
aString( ByteString("This is a test"),
132 RTL_TEXTENCODING_ASCII_US
);
133 const LineInfo
aLineInfo(LINE_SOLID
,5);
135 // unfortunately, VDevs have inaccessible copy constructors
136 static VirtualDevice aVDev
;
137 static VirtualDevice
aVDevBW(1);
139 const Size aVDevSize
;
140 aVDev
.SetOutputSizePixel(aVDevSize
);
141 aVDevBW
.SetOutputSizePixel(aVDevSize
);
143 const Bitmap
aBitmap( aVDev
.GetBitmap(aPt1
,aVDevSize
) );
144 const Bitmap
aBitmapBW( aVDevBW
.GetBitmap(aPt1
,aVDevSize
) );
145 const Bitmap
aBitmapAlien( aVDevSize
, 8 );
147 const BitmapEx
aBitmapEx( aBitmap
, aBitmapBW
);
148 const BitmapEx
aBitmapExBW( aBitmapBW
, aBitmapBW
);
149 const BitmapEx
aBitmapExAlien( aBitmapAlien
, aBitmapBW
);
150 const BitmapEx
aBitmapExAlpha( aBitmap
, aBitmapAlien
);
151 const BitmapEx
aBitmapExAlphaAlien( aBitmapAlien
, aBitmapAlien
);
153 const Image
aImage( aBitmapEx
);
154 const Gradient
aGradient(GRADIENT_ELLIPTICAL
,aBlackColor
,aWhiteColor
);
155 const Hatch
aHatch(HatchStyle_TRIPLE
,aBlackColor
,4,450);
156 const Wallpaper
aWallpaper( aWhiteColor
);
159 aMtf
.AddAction( new MetaFillColorAction(Color(COL_RED
),TRUE
) );
160 aMtf
.AddAction( new MetaRectAction(aRect
) );
162 /* void DrawText( const Point& rStartPt, const XubString& rStr,
163 xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
164 MetricVector* pVector = NULL, String* pDisplayText = NULL );
169 &OutputDevice::DrawText
,
171 aPt1
, aString
, (USHORT
)0, aString
.Len(), (MetricVector
*)0, (String
*)0 ));
173 /* void DrawTextArray( const Point& rStartPt, const XubString& rStr,
174 const sal_Int32* pDXAry = NULL,
175 xub_StrLen nIndex = 0,
176 xub_StrLen nLen = STRING_LEN );
181 &OutputDevice::DrawTextArray
,
183 aPt1
, aString
, (const sal_Int32
*)0, (USHORT
)0, aString
.Len() ));
185 /* void DrawPixel( const Point& rPt, const Color& rColor ); */
189 (void (OutputDevice::*)( const Point
&, const Color
& ))(
190 &OutputDevice::DrawPixel
),
192 aPt1
, aBlackColor
));
194 /* void DrawLine( const Point& rStartPt, const Point& rEndPt ); */
198 (void (OutputDevice::*)( const Point
&, const Point
& ))(
199 &OutputDevice::DrawLine
),
203 /* void DrawLine( const Point& rStartPt, const Point& rEndPt,
204 const LineInfo& rLineInfo );
207 "DrawLine(LineInfo)",
209 (void (OutputDevice::*)( const Point
&, const Point
&,const LineInfo
& ))(
210 &OutputDevice::DrawLine
),
212 aPt1
, aPt2
, aLineInfo
));
214 /* void DrawPolyLine( const Polygon& rPoly ); */
218 (void (OutputDevice::*)( const Polygon
& ))(
219 &OutputDevice::DrawPolyLine
),
223 /* void DrawPolyLine( const Polygon& rPoly,
224 const LineInfo& rLineInfo );
227 "DrawPolyLine(LineInfo)",
229 (void (OutputDevice::*)( const Polygon
&, const LineInfo
& ))(
230 &OutputDevice::DrawPolyLine
),
234 /* void DrawPolygon( const Polygon& rPoly ); */
238 (void (OutputDevice::*)( const Polygon
& ))
239 &OutputDevice::DrawPolygon
,
243 /* void DrawPolyPolygon( const PolyPolygon& rPolyPoly ); */
247 (void (OutputDevice::*)( const PolyPolygon
& ))
248 &OutputDevice::DrawPolyPolygon
,
252 /* void DrawRect( const Rectangle& rRect ); */
256 (void (OutputDevice::*)( const Rectangle
& ))(
257 &OutputDevice::DrawRect
),
261 /* void DrawRect( const Rectangle& rRect,
262 ULONG nHorzRount, ULONG nVertRound );
265 "DrawRect(round corners)",
267 (void (OutputDevice::*)( const Rectangle
&, ULONG nHorzRount
, ULONG nVertRound
))(
268 &OutputDevice::DrawRect
),
273 /* void DrawEllipse( const Rectangle& rRect ); */
277 &OutputDevice::DrawEllipse
,
281 /* void DrawArc( const Rectangle& rRect,
282 const Point& rStartPt, const Point& rEndPt );
287 &OutputDevice::DrawArc
,
291 /* void DrawPie( const Rectangle& rRect,
292 const Point& rStartPt, const Point& rEndPt );
297 &OutputDevice::DrawPie
,
301 /* void DrawChord( const Rectangle& rRect,
302 const Point& rStartPt, const Point& rEndPt );
307 &OutputDevice::DrawChord
,
311 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
312 const Point& rSrcPt, const Size& rSrcSize );
317 (void (OutputDevice::*)( const Point
&, const Size
&,
318 const Point
&, const Size
& ))(
319 &OutputDevice::DrawOutDev
),
321 aRect2
.TopLeft(), aRect2
.GetSize(),
322 aRect
.TopLeft(), aRect
.GetSize()));
324 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
325 const Point& rSrcPt, const Size& rSrcSize,
326 const OutputDevice& rOutDev );
329 "DrawOutDev(foreign source)",
331 (void (OutputDevice::*)( const Point
&, const Size
&,
332 const Point
&, const Size
&,
333 const OutputDevice
& ))(
334 &OutputDevice::DrawOutDev
),
336 aRect2
.TopLeft(), aRect2
.GetSize(),
337 aRect
.TopLeft(), aRect
.GetSize(),
338 boost::cref(aVDevBW
) ));
340 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
341 const Point& rSrcPt, const Size& rSrcSize,
342 const OutputDevice& rOutDev );
345 "DrawOutDev(foreign source, scaled)",
347 (void (OutputDevice::*)( const Point
&, const Size
&,
348 const Point
&, const Size
&,
349 const OutputDevice
& ))(
350 &OutputDevice::DrawOutDev
),
352 aRect2
.TopLeft(), aRect2
.GetSize(),
353 aRect
.TopLeft(), aRect
.GetSize(),
354 boost::cref(aVDev
) ));
356 /* void CopyArea( const Point& rDestPt,
357 const Point& rSrcPt, const Size& rSrcSize,
363 &OutputDevice::CopyArea
,
365 aPt1
,aPt3
,aRect2
.GetSize(),(USHORT
)0 ));
367 /* void DrawBitmap( const Point& rDestPt,
368 const Bitmap& rBitmap );
371 "DrawBitmap(alien source)",
373 (void (OutputDevice::*)( const Point
&,
375 &OutputDevice::DrawBitmap
),
377 aPt1
,aBitmapAlien
));
379 /* void DrawBitmap( const Point& rDestPt,
380 const Bitmap& rBitmap );
385 (void (OutputDevice::*)( const Point
&,
387 &OutputDevice::DrawBitmap
),
391 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
392 const Bitmap& rBitmap );
395 "DrawBitmap(scaled,alien source)",
397 (void (OutputDevice::*)( const Point
&,
400 &OutputDevice::DrawBitmap
),
402 aPt1
,aRect
.GetSize(),aBitmapAlien
));
404 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
405 const Bitmap& rBitmap );
408 "DrawBitmap(scaled)",
410 (void (OutputDevice::*)( const Point
&,
413 &OutputDevice::DrawBitmap
),
415 aPt1
,aRect
.GetSize(),aBitmap
));
417 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
418 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
419 const Bitmap& rBitmap );
422 "DrawBitmap(scaled subset,alien source)",
424 (void (OutputDevice::*)( const Point
&,
429 &OutputDevice::DrawBitmap
),
431 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmapAlien
));
433 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
434 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
435 const Bitmap& rBitmap );
438 "DrawBitmap(scaled subset)",
440 (void (OutputDevice::*)( const Point
&,
445 &OutputDevice::DrawBitmap
),
447 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmap
));
449 /* void DrawBitmapEx( const Point& rDestPt,
450 const BitmapEx& rBitmapEx );
453 "DrawBitmapEx(alien source)",
455 (void (OutputDevice::*)( const Point
&,
457 &OutputDevice::DrawBitmapEx
),
459 aPt1
,aBitmapExAlien
));
461 /* void DrawBitmapEx( const Point& rDestPt,
462 const BitmapEx& rBitmapEx );
467 (void (OutputDevice::*)( const Point
&,
469 &OutputDevice::DrawBitmapEx
),
473 /* void DrawBitmapEx( const Point& rDestPt,
474 const BitmapEx& rBitmapEx );
477 "DrawBitmapEx(alpha)",
479 (void (OutputDevice::*)( const Point
&,
481 &OutputDevice::DrawBitmapEx
),
483 aPt1
,aBitmapExAlpha
));
485 /* void DrawBitmapEx( const Point& rDestPt,
486 const BitmapEx& rBitmapEx );
489 "DrawBitmapEx(alpha, alien source)",
491 (void (OutputDevice::*)( const Point
&,
493 &OutputDevice::DrawBitmapEx
),
495 aPt1
,aBitmapExAlphaAlien
));
497 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
498 const BitmapEx& rBitmapEx );
501 "DrawBitmapEx(scaled,alien source)",
503 (void (OutputDevice::*)( const Point
&,
506 &OutputDevice::DrawBitmapEx
),
508 aPt1
,aRect
.GetSize(),aBitmapExAlien
));
510 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
511 const BitmapEx& rBitmapEx );
514 "DrawBitmapEx(scaled)",
516 (void (OutputDevice::*)( const Point
&,
519 &OutputDevice::DrawBitmapEx
),
521 aPt1
,aRect
.GetSize(),aBitmapEx
));
523 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
524 const BitmapEx& rBitmapEx );
527 "DrawBitmapEx(scaled alpha)",
529 (void (OutputDevice::*)( const Point
&,
532 &OutputDevice::DrawBitmapEx
),
534 aPt1
,aRect
.GetSize(),aBitmapExAlpha
));
536 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
537 const BitmapEx& rBitmapEx );
540 "DrawBitmapEx(scaled alpha, alien source)",
542 (void (OutputDevice::*)( const Point
&,
545 &OutputDevice::DrawBitmapEx
),
547 aPt1
,aRect
.GetSize(),aBitmapExAlphaAlien
));
549 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
550 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
551 const BitmapEx& rBitmapEx );
554 "DrawBitmapEx(scaled subset,alien source)",
556 (void (OutputDevice::*)( const Point
&,
561 &OutputDevice::DrawBitmapEx
),
563 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmapExAlien
));
565 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
566 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
567 const BitmapEx& rBitmapEx );
570 "DrawBitmapEx(scaled subset)",
572 (void (OutputDevice::*)( const Point
&,
577 &OutputDevice::DrawBitmapEx
),
579 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmapEx
));
581 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
582 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
583 const BitmapEx& rBitmapEx );
586 "DrawBitmapEx(scaled subset, alpha)",
588 (void (OutputDevice::*)( const Point
&,
593 &OutputDevice::DrawBitmapEx
),
595 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmapExAlpha
));
597 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
598 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
599 const BitmapEx& rBitmapEx );
602 "DrawBitmapEx(scaled subset, alpha alien source)",
604 (void (OutputDevice::*)( const Point
&,
609 &OutputDevice::DrawBitmapEx
),
611 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmapExAlphaAlien
));
613 /* void DrawMask( const Point& rDestPt,
614 const Bitmap& rBitmap, const Color& rMaskColor );
617 "DrawMask(alien source)",
619 (void (OutputDevice::*)( const Point
&,
622 &OutputDevice::DrawMask
),
624 aPt1
,aBitmapAlien
,aBlackColor
));
626 /* void DrawMask( const Point& rDestPt,
627 const Bitmap& rBitmap, const Color& rMaskColor );
632 (void (OutputDevice::*)( const Point
&,
635 &OutputDevice::DrawMask
),
637 aPt1
,aBitmap
,aBlackColor
));
639 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
640 const Bitmap& rBitmap, const Color& rMaskColor );
643 "DrawMask(scaled,alien source)",
645 (void (OutputDevice::*)( const Point
&,
649 &OutputDevice::DrawMask
),
651 aPt1
,aRect
.GetSize(),aBitmapAlien
, aBlackColor
));
653 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
654 const Bitmap& rBitmap, const Color& rMaskColor );
659 (void (OutputDevice::*)( const Point
&,
663 &OutputDevice::DrawMask
),
665 aPt1
,aRect
.GetSize(),aBitmap
,aBlackColor
));
667 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
668 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
669 const Bitmap& rBitmap, const Color& rMaskColor );
672 "DrawMask(scaled subset,alien source)",
674 (void (OutputDevice::*)( const Point
&,
680 &OutputDevice::DrawMask
),
682 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmapAlien
,aBlackColor
));
684 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
685 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
686 const Bitmap& rBitmap, const Color& rMaskColor );
689 "DrawMask(scaled subset)",
691 (void (OutputDevice::*)( const Point
&,
697 &OutputDevice::DrawMask
),
699 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmap
,aBlackColor
));
701 /* void DrawImage( const Point& rPos,
702 const Image& rImage, USHORT nStyle = 0 );
707 (void (OutputDevice::*)( const Point
&,
710 &OutputDevice::DrawImage
),
712 aPt1
,aImage
,(USHORT
)0 ));
714 /* void DrawImage( const Point& rPos, const Size& rSize,
715 const Image& rImage, USHORT nStyle = 0 );
720 (void (OutputDevice::*)( const Point
&,
724 &OutputDevice::DrawImage
),
726 aPt1
,aRect
.GetSize(),aImage
,(USHORT
)0 ));
728 /* void DrawGradient( const Rectangle& rRect, const Gradient& rGradient ); */
732 (void (OutputDevice::*)( const Rectangle
&, const Gradient
& ))(
733 &OutputDevice::DrawGradient
),
737 /* void DrawGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient ); */
739 "DrawGradient(polygon)",
741 (void (OutputDevice::*)( const PolyPolygon
&, const Gradient
& ))(
742 &OutputDevice::DrawGradient
),
746 /* void DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch ); */
750 &OutputDevice::DrawHatch
,
754 /* void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper ); */
758 &OutputDevice::DrawWallpaper
,
760 aRect2
,aWallpaper
));
762 /* void DrawWaveLine( const Point& rStartPos, const Point& rEndPos, USHORT nStyle ); */
766 &OutputDevice::DrawWaveLine
,
768 aPt1
,aPt2
,(USHORT
)WAVE_NORMAL
));
770 /* void DrawGrid( const Rectangle& rRect, const Size& rDist, ULONG nFlags ); */
774 &OutputDevice::DrawGrid
,
776 aRect
,Size(10,20),GRID_HORZLINES
|GRID_VERTLINES
));
778 /* void DrawTransparent( const PolyPolygon& rPolyPoly,
779 USHORT nTransparencePercent );
784 (void (OutputDevice::*)( const PolyPolygon
&, USHORT
))(
785 &OutputDevice::DrawTransparent
),
787 aPoly3
,(USHORT
)50 ));
789 /* void DrawTransparent( const GDIMetaFile& rMtf,
790 const Point& rPos, const Size& rSize,
791 const Gradient& rTransparenceGradient );
794 "DrawTransparent(metafile)",
796 (void (OutputDevice::*)( const GDIMetaFile
&,
800 &OutputDevice::DrawTransparent
),
802 aMtf
,aPt1
,aRect
.GetSize(),aGradient
));
808 &OutputDevice::Erase
,
813 //----------------------------------------------------------------------------------
815 void grindFunc( OutputDevice
& rTarget
,
816 functor_vector_type::const_iterator iter
,
820 const sal_uInt32
nStartTime( osl_getGlobalTimer() );
822 for( sal_Int32 i
=0; i
<nTurns
; ++i
)
823 iter
->second(&rTarget
);
825 if( rTarget
.GetOutDevType() == OUTDEV_WINDOW
)
826 static_cast<Window
&>(rTarget
).Sync();
829 "Duration: %d ms (%d repetitions)\tOperation: %s\tSetup: %s\n",
830 (int)(osl_getGlobalTimer() - nStartTime
),
836 //----------------------------------------------------------------------------------
838 /** Call OutputDevice render methods repeatedly, and output elapsed
841 void outDevGrind( OutputDevice
& rTarget
, sal_Int32 nTurns
=100 )
843 // TODO(F1): also profile pure complex clip setup times!
845 // State: fill/line color, draw mode, w/o clip, rect clip, complex clip
846 functor_vector_type aMethods
;
847 setupMethodStubs( aMethods
);
849 const Rectangle
aClipRect(10,10,1000,1000);
850 const Polygon
aPoly1( aClipRect
);
851 Polygon
aPoly2( aClipRect
);
852 aPoly2
.Rotate(aClipRect
.Center(),450);
853 PolyPolygon
aClipPoly(aPoly1
);
854 aClipPoly
.Insert(aPoly2
);
856 functor_vector_type::const_iterator iter
= aMethods
.begin();
857 const functor_vector_type::const_iterator end
= aMethods
.end();
860 rTarget
.SetLineColor( Color(COL_BLACK
) );
861 rTarget
.SetFillColor( Color(COL_GREEN
) );
862 rTarget
.SetRasterOp( ROP_OVERPAINT
);
863 rTarget
.SetClipRegion();
864 grindFunc( rTarget
, iter
, nTurns
, "w/o clip, w/o xor" );
866 rTarget
.SetLineColor( Color(COL_BLACK
) );
867 rTarget
.SetFillColor( Color(COL_GREEN
) );
868 rTarget
.SetRasterOp( ROP_OVERPAINT
);
869 rTarget
.SetClipRegion( aClipRect
);
870 grindFunc( rTarget
, iter
, nTurns
, "with rect clip, w/o xor" );
872 rTarget
.SetLineColor( Color(COL_BLACK
) );
873 rTarget
.SetFillColor( Color(COL_GREEN
) );
874 rTarget
.SetRasterOp( ROP_OVERPAINT
);
875 rTarget
.SetClipRegion( aClipPoly
);
876 grindFunc( rTarget
, iter
, nTurns
, "with complex clip, w/o xor" );
878 rTarget
.SetLineColor( Color(COL_BLACK
) );
879 rTarget
.SetFillColor( Color(COL_GREEN
) );
880 rTarget
.SetRasterOp( ROP_XOR
);
881 rTarget
.SetClipRegion();
882 grindFunc( rTarget
, iter
, nTurns
, "w/o clip, with xor" );
884 rTarget
.SetLineColor( Color(COL_BLACK
) );
885 rTarget
.SetFillColor( Color(COL_GREEN
) );
886 rTarget
.SetRasterOp( ROP_XOR
);
887 rTarget
.SetClipRegion( aClipRect
);
888 grindFunc( rTarget
, iter
, nTurns
, "with rect clip, with xor" );
890 rTarget
.SetLineColor( Color(COL_BLACK
) );
891 rTarget
.SetFillColor( Color(COL_GREEN
) );
892 rTarget
.SetRasterOp( ROP_XOR
);
893 rTarget
.SetClipRegion( aClipPoly
);
894 grindFunc( rTarget
, iter
, nTurns
, "with complex clip, with xor" );
900 //----------------------------------------------------------------------------------
902 void TestWindow::Paint( const Rectangle
& )
904 outDevGrind( *this );
908 USHORT
GrindApp::Exception( USHORT nError
)
910 switch( nError
& EXC_MAJORTYPE
)
912 case EXC_RSCNOTLOADED
:
913 Abort( String::CreateFromAscii(
914 "Error: could not load language resources.\nPlease check your installation.\n" ) );
920 void GrindApp::Main()
924 for( USHORT i
= 0; i
< GetCommandLineParamCount(); i
++ )
926 ::rtl::OUString aParam
= GetCommandLineParam( i
);
928 if( aParam
.equalsAscii( "--help" ) ||
929 aParam
.equalsAscii( "-h" ) )
935 printf( "outdevgrind - Profile OutputDevice\n" );
939 //-------------------------------------------------
940 // create the global service-manager
941 //-------------------------------------------------
942 uno::Reference
< lang::XMultiServiceFactory
> xFactory
;
945 uno::Reference
< uno::XComponentContext
> xCtx
= ::cppu::defaultBootstrap_InitialComponentContext();
946 xFactory
= uno::Reference
< lang::XMultiServiceFactory
>( xCtx
->getServiceManager(),
949 ::comphelper::setProcessServiceFactory( xFactory
);
951 catch( uno::Exception
& )
958 "Could not bootstrap UNO, installation must be in disorder. Exiting.\n" );
963 uno::Sequence
< uno::Any
> aArgs( 2 );
964 aArgs
[ 0 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL
);
965 aArgs
[ 1 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE
);
966 ::ucbhelper::ContentBroker::initialize( xFactory
, aArgs
);
972 ::ucbhelper::ContentBroker::deinitialize();