1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <tools/extendapplicationenvironment.hxx>
23 #include <cppuhelper/bootstrap.hxx>
24 #include <comphelper/processfactory.hxx>
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <vcl/svapp.hxx>
29 #include <vcl/window.hxx>
30 #include <vcl/dialog.hxx>
31 #include <vcl/outdev.hxx>
32 #include <vcl/virdev.hxx>
33 #include <vcl/hatch.hxx>
34 #include <vcl/bitmap.hxx>
35 #include <vcl/wall.hxx>
36 #include <vcl/image.hxx>
37 #include <vcl/gdimtf.hxx>
38 #include <vcl/metaact.hxx>
39 #include <vcl/bitmapex.hxx>
40 #include <vcl/gradient.hxx>
41 #include <vcl/lineinfo.hxx>
43 #include <rtl/bootstrap.hxx>
47 #include <boost/function.hpp>
48 #include <boost/bind.hpp>
52 using namespace ::com::sun::star
;
57 class GrindApp
: public Application
60 virtual int Main() SAL_OVERRIDE
;
61 virtual sal_uInt16
Exception( sal_uInt16 nError
) SAL_OVERRIDE
;
64 class TestWindow
: public Dialog
67 TestWindow() : Dialog( (vcl::Window
*) NULL
)
69 SetText( OUString("OutDev grinding") );
70 SetSizePixel( Size( 1024, 1024 ) );
75 virtual void Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
78 typedef boost::function1
<void, OutputDevice
*> functor_type
;
79 typedef std::vector
< std::pair
<const char*,
80 functor_type
> > functor_vector_type
;
82 template< typename Functor
> void add( functor_vector_type
& res
,
86 res
.push_back( std::make_pair(pStr
,functor_type(func
)) );
89 void setupMethodStubs( functor_vector_type
& res
)
91 const Color
aWhiteColor( COL_WHITE
);
92 const Color
aBlackColor( COL_BLACK
);
94 const Point
aPt1(10,10);
95 const Point
aPt2(500,500);
96 const Point
aPt3(0,0);
97 const Point
aPt4(450,450);
99 const Rectangle
aRect(aPt1
,aPt2
);
100 const Rectangle
aRect2(aPt3
,aPt4
);
101 const Polygon
aPoly(aRect
);
102 const Polygon
aPoly2(aRect2
);
103 tools::PolyPolygon
aPolyPoly(aPoly
);
104 aPolyPoly
.Insert( aPoly2
);
105 Polygon
aPoly3(aPoly2
);
106 aPoly3
.Rotate( aPoly3
.GetBoundRect().Center(),
109 const LineInfo
aLineInfo(LINE_SOLID
,5);
112 const OUString
aString("This is a test");
114 // unfortunately, VDevs have inaccessible copy constructors
115 static VirtualDevice aVDev
;
116 static VirtualDevice
aVDevBW(1);
118 const Size aVDevSize
;
119 aVDev
.SetOutputSizePixel(aVDevSize
);
120 aVDevBW
.SetOutputSizePixel(aVDevSize
);
122 const Bitmap
aBitmap( aVDev
.GetBitmap(aPt1
,aVDevSize
) );
123 const Bitmap
aBitmapBW( aVDevBW
.GetBitmap(aPt1
,aVDevSize
) );
124 const Bitmap
aBitmapAlien( aVDevSize
, 8 );
127 rtl::Bootstrap::set("BRAND_BASE_DIR", ".");
128 if (Application::LoadBrandBitmap ("intro", aIntro
))
129 Application::Abort( "Failed to load intro image, run inside program/" );
131 const Bitmap
aBitmap( aIntro
.GetBitmap() );
132 Bitmap
aBitmapBW( aBitmap
);
133 aBitmapBW
.Filter( BMP_FILTER_EMBOSS_GREY
);
134 Bitmap
aBitmapAlien( Size( 100, 100 ), 8 );
135 aBitmapAlien
.Erase( COL_RED
);
138 const BitmapEx
aBitmapEx( aBitmap
, aBitmapBW
);
139 const BitmapEx
aBitmapExBW( aBitmapBW
, aBitmapBW
);
140 const BitmapEx
aBitmapExAlien( aBitmapAlien
, aBitmapBW
);
141 const BitmapEx
aBitmapExAlpha( aBitmap
, aBitmapAlien
);
142 const BitmapEx
aBitmapExAlphaAlien( aBitmapAlien
, aBitmapAlien
);
144 const Image
aImage( aBitmapEx
);
145 const Gradient
aGradient(GradientStyle_ELLIPTICAL
,aBlackColor
,aWhiteColor
);
146 const Hatch
aHatch(HatchStyle_TRIPLE
,aBlackColor
,4,450);
147 const Wallpaper
aWallpaper( aWhiteColor
);
150 aMtf
.AddAction( new MetaFillColorAction(Color(COL_RED
),true) );
151 aMtf
.AddAction( new MetaRectAction(aRect
) );
153 #ifdef FIXME_NEEDS_LOVE
157 &OutputDevice::DrawTextArray
,
159 aPt1
, aString
, (const sal_Int32
*)0, (sal_uInt16
)0, aString
.getLength() ));
162 /* void DrawPixel( const Point& rPt, const Color& rColor ); */
166 (void (OutputDevice::*)( const Point
&, const Color
& ))(
167 &OutputDevice::DrawPixel
),
169 aPt1
, aBlackColor
));
171 /* void DrawLine( const Point& rStartPt, const Point& rEndPt ); */
175 (void (OutputDevice::*)( const Point
&, const Point
& ))(
176 &OutputDevice::DrawLine
),
180 /* void DrawLine( const Point& rStartPt, const Point& rEndPt,
181 const LineInfo& rLineInfo );
184 "DrawLine(LineInfo)",
186 (void (OutputDevice::*)( const Point
&, const Point
&,const LineInfo
& ))(
187 &OutputDevice::DrawLine
),
189 aPt1
, aPt2
, aLineInfo
));
191 /* void DrawPolyLine( const Polygon& rPoly ); */
195 (void (OutputDevice::*)( const Polygon
& ))(
196 &OutputDevice::DrawPolyLine
),
200 /* void DrawPolyLine( const Polygon& rPoly,
201 const LineInfo& rLineInfo );
204 "DrawPolyLine(LineInfo)",
206 (void (OutputDevice::*)( const Polygon
&, const LineInfo
& ))(
207 &OutputDevice::DrawPolyLine
),
211 /* void DrawPolygon( const Polygon& rPoly ); */
215 (void (OutputDevice::*)( const Polygon
& ))
216 &OutputDevice::DrawPolygon
,
220 /* void DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly ); */
224 (void (OutputDevice::*)( const tools::PolyPolygon
& ))
225 &OutputDevice::DrawPolyPolygon
,
229 /* void DrawRect( const Rectangle& rRect ); */
233 (void (OutputDevice::*)( const Rectangle
& ))(
234 &OutputDevice::DrawRect
),
238 /* void DrawRect( const Rectangle& rRect,
239 sal_uLong nHorzRount, sal_uLong nVertRound );
242 "DrawRect(round corners)",
244 (void (OutputDevice::*)( const Rectangle
&, sal_uLong nHorzRount
, sal_uLong nVertRound
))(
245 &OutputDevice::DrawRect
),
250 /* void DrawEllipse( const Rectangle& rRect ); */
254 &OutputDevice::DrawEllipse
,
258 /* void DrawArc( const Rectangle& rRect,
259 const Point& rStartPt, const Point& rEndPt );
264 &OutputDevice::DrawArc
,
268 /* void DrawPie( const Rectangle& rRect,
269 const Point& rStartPt, const Point& rEndPt );
274 &OutputDevice::DrawPie
,
278 /* void DrawChord( const Rectangle& rRect,
279 const Point& rStartPt, const Point& rEndPt );
284 &OutputDevice::DrawChord
,
288 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
289 const Point& rSrcPt, const Size& rSrcSize );
294 (void (OutputDevice::*)( const Point
&, const Size
&,
295 const Point
&, const Size
& ))(
296 &OutputDevice::DrawOutDev
),
298 aRect2
.TopLeft(), aRect2
.GetSize(),
299 aRect
.TopLeft(), aRect
.GetSize()));
302 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
303 const Point& rSrcPt, const Size& rSrcSize,
304 const OutputDevice& rOutDev );
307 "DrawOutDev(foreign source)",
309 (void (OutputDevice::*)( const Point
&, const Size
&,
310 const Point
&, const Size
&,
311 const OutputDevice
& ))(
312 &OutputDevice::DrawOutDev
),
314 aRect2
.TopLeft(), aRect2
.GetSize(),
315 aRect
.TopLeft(), aRect
.GetSize(),
316 boost::cref(aVDevBW
) ));
318 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
319 const Point& rSrcPt, const Size& rSrcSize,
320 const OutputDevice& rOutDev );
323 "DrawOutDev(foreign source, scaled)",
325 (void (OutputDevice::*)( const Point
&, const Size
&,
326 const Point
&, const Size
&,
327 const OutputDevice
& ))(
328 &OutputDevice::DrawOutDev
),
330 aRect2
.TopLeft(), aRect2
.GetSize(),
331 aRect
.TopLeft(), aRect
.GetSize(),
332 boost::cref(aVDev
) ));
335 /* void CopyArea( const Point& rDestPt,
336 const Point& rSrcPt, const Size& rSrcSize,
337 sal_uInt16 nFlags = 0 );
342 &OutputDevice::CopyArea
,
344 aPt1
, aPt3
, aRect2
.GetSize(), false ));
346 #ifdef NEEDS_QUALIY_PARAMTER
347 /* void DrawBitmap( const Point& rDestPt,
348 const Bitmap& rBitmap );
351 "DrawBitmap(alien source)",
353 (void (OutputDevice::*)( const Point
&,
355 &OutputDevice::DrawBitmap
),
357 aPt1
,aBitmapAlien
));
359 /* void DrawBitmap( const Point& rDestPt,
360 const Bitmap& rBitmap );
365 (void (OutputDevice::*)( const Point
&,
367 &OutputDevice::DrawBitmap
),
371 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
372 const Bitmap& rBitmap );
375 "DrawBitmap(scaled,alien source)",
377 (void (OutputDevice::*)( const Point
&,
380 &OutputDevice::DrawBitmap
),
382 aPt1
,aRect
.GetSize(),aBitmapAlien
));
384 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
385 const Bitmap& rBitmap );
388 "DrawBitmap(scaled)",
390 (void (OutputDevice::*)( const Point
&,
393 &OutputDevice::DrawBitmap
),
395 aPt1
,aRect
.GetSize(),aBitmap
));
398 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
399 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
400 const Bitmap& rBitmap );
403 "DrawBitmap(scaled subset,alien source)",
405 (void (OutputDevice::*)( const Point
&,
410 &OutputDevice::DrawBitmap
),
412 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmapAlien
));
415 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
416 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
417 const Bitmap& rBitmap );
420 "DrawBitmap(scaled subset)",
422 (void (OutputDevice::*)( const Point
&,
427 &OutputDevice::DrawBitmap
),
429 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmap
));
431 /* void DrawBitmapEx( const Point& rDestPt,
432 const BitmapEx& rBitmapEx );
435 "DrawBitmapEx(alien source)",
437 (void (OutputDevice::*)( const Point
&,
439 &OutputDevice::DrawBitmapEx
),
441 aPt1
,aBitmapExAlien
));
443 /* void DrawBitmapEx( const Point& rDestPt,
444 const BitmapEx& rBitmapEx );
449 (void (OutputDevice::*)( const Point
&,
451 &OutputDevice::DrawBitmapEx
),
455 /* void DrawBitmapEx( const Point& rDestPt,
456 const BitmapEx& rBitmapEx );
459 "DrawBitmapEx(alpha)",
461 (void (OutputDevice::*)( const Point
&,
463 &OutputDevice::DrawBitmapEx
),
465 aPt1
,aBitmapExAlpha
));
467 /* void DrawBitmapEx( const Point& rDestPt,
468 const BitmapEx& rBitmapEx );
471 "DrawBitmapEx(alpha, alien source)",
473 (void (OutputDevice::*)( const Point
&,
475 &OutputDevice::DrawBitmapEx
),
477 aPt1
,aBitmapExAlphaAlien
));
479 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
480 const BitmapEx& rBitmapEx );
483 "DrawBitmapEx(scaled,alien source)",
485 (void (OutputDevice::*)( const Point
&,
488 &OutputDevice::DrawBitmapEx
),
490 aPt1
,aRect
.GetSize(),aBitmapExAlien
));
492 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
493 const BitmapEx& rBitmapEx );
496 "DrawBitmapEx(scaled)",
498 (void (OutputDevice::*)( const Point
&,
501 &OutputDevice::DrawBitmapEx
),
503 aPt1
,aRect
.GetSize(),aBitmapEx
));
505 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
506 const BitmapEx& rBitmapEx );
509 "DrawBitmapEx(scaled alpha)",
511 (void (OutputDevice::*)( const Point
&,
514 &OutputDevice::DrawBitmapEx
),
516 aPt1
,aRect
.GetSize(),aBitmapExAlpha
));
518 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
519 const BitmapEx& rBitmapEx );
522 "DrawBitmapEx(scaled alpha, alien source)",
524 (void (OutputDevice::*)( const Point
&,
527 &OutputDevice::DrawBitmapEx
),
529 aPt1
,aRect
.GetSize(),aBitmapExAlphaAlien
));
531 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
532 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
533 const BitmapEx& rBitmapEx );
536 "DrawBitmapEx(scaled subset,alien source)",
538 (void (OutputDevice::*)( const Point
&,
543 &OutputDevice::DrawBitmapEx
),
545 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmapExAlien
));
547 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
548 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
549 const BitmapEx& rBitmapEx );
552 "DrawBitmapEx(scaled subset)",
554 (void (OutputDevice::*)( const Point
&,
559 &OutputDevice::DrawBitmapEx
),
561 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmapEx
));
563 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
564 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
565 const BitmapEx& rBitmapEx );
568 "DrawBitmapEx(scaled subset, alpha)",
570 (void (OutputDevice::*)( const Point
&,
575 &OutputDevice::DrawBitmapEx
),
577 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmapExAlpha
));
579 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
580 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
581 const BitmapEx& rBitmapEx );
584 "DrawBitmapEx(scaled subset, alpha alien source)",
586 (void (OutputDevice::*)( const Point
&,
591 &OutputDevice::DrawBitmapEx
),
593 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmapExAlphaAlien
));
595 /* void DrawMask( const Point& rDestPt,
596 const Bitmap& rBitmap, const Color& rMaskColor );
599 "DrawMask(alien source)",
601 (void (OutputDevice::*)( const Point
&,
604 &OutputDevice::DrawMask
),
606 aPt1
,aBitmapAlien
,aBlackColor
));
608 /* void DrawMask( const Point& rDestPt,
609 const Bitmap& rBitmap, const Color& rMaskColor );
614 (void (OutputDevice::*)( const Point
&,
617 &OutputDevice::DrawMask
),
619 aPt1
,aBitmap
,aBlackColor
));
621 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
622 const Bitmap& rBitmap, const Color& rMaskColor );
625 "DrawMask(scaled,alien source)",
627 (void (OutputDevice::*)( const Point
&,
631 &OutputDevice::DrawMask
),
633 aPt1
,aRect
.GetSize(),aBitmapAlien
, aBlackColor
));
635 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
636 const Bitmap& rBitmap, const Color& rMaskColor );
641 (void (OutputDevice::*)( const Point
&,
645 &OutputDevice::DrawMask
),
647 aPt1
,aRect
.GetSize(),aBitmap
,aBlackColor
));
649 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
650 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
651 const Bitmap& rBitmap, const Color& rMaskColor );
654 "DrawMask(scaled subset,alien source)",
656 (void (OutputDevice::*)( const Point
&,
662 &OutputDevice::DrawMask
),
664 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmapAlien
,aBlackColor
));
666 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
667 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
668 const Bitmap& rBitmap, const Color& rMaskColor );
671 "DrawMask(scaled subset)",
673 (void (OutputDevice::*)( const Point
&,
679 &OutputDevice::DrawMask
),
681 aPt1
,aRect
.GetSize(),aPt3
,aRect2
.GetSize(),aBitmap
,aBlackColor
));
683 /* void DrawImage( const Point& rPos,
684 const Image& rImage, sal_uInt16 nStyle = 0 );
689 (void (OutputDevice::*)( const Point
&,
691 sal_uInt16 nStyle
))(
692 &OutputDevice::DrawImage
),
694 aPt1
,aImage
,(sal_uInt16
)0 ));
696 /* void DrawImage( const Point& rPos, const Size& rSize,
697 const Image& rImage, sal_uInt16 nStyle = 0 );
702 (void (OutputDevice::*)( const Point
&,
705 sal_uInt16 nStyle
))(
706 &OutputDevice::DrawImage
),
708 aPt1
,aRect
.GetSize(),aImage
,(sal_uInt16
)0 ));
710 #endif // NEEDS_QUALITY_PARAMATER
712 /* void DrawGradient( const Rectangle& rRect, const Gradient& rGradient ); */
716 (void (OutputDevice::*)( const Rectangle
&, const Gradient
& ))(
717 &OutputDevice::DrawGradient
),
721 /* void DrawGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient ); */
723 "DrawGradient(polygon)",
725 (void (OutputDevice::*)( const tools::PolyPolygon
&, const Gradient
& ))(
726 &OutputDevice::DrawGradient
),
730 /* void DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch ); */
734 &OutputDevice::DrawHatch
,
738 /* void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper ); */
742 &OutputDevice::DrawWallpaper
,
744 aRect2
,aWallpaper
));
746 #ifdef FIXME_HAVE_WAVE_NORMAL
747 /* void DrawWaveLine( const Point& rStartPos, const Point& rEndPos, sal_uInt16 nStyle ); */
751 &OutputDevice::DrawWaveLine
,
753 aPt1
,aPt2
,(sal_uInt16
)WAVE_NORMAL
));
756 /* void DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags ); */
760 &OutputDevice::DrawGrid
,
762 aRect
,Size(10,20),DrawGridFlags::HorzLines
|DrawGridFlags::VertLines
));
764 /* void DrawTransparent( const tools::PolyPolygon& rPolyPoly,
765 sal_uInt16 nTransparencePercent );
770 (void (OutputDevice::*)( const tools::PolyPolygon
&, sal_uInt16
))(
771 &OutputDevice::DrawTransparent
),
773 aPoly3
,(sal_uInt16
)50 ));
775 /* void DrawTransparent( const GDIMetaFile& rMtf,
776 const Point& rPos, const Size& rSize,
777 const Gradient& rTransparenceGradient );
780 "DrawTransparent(metafile)",
782 (void (OutputDevice::*)( const GDIMetaFile
&,
786 &OutputDevice::DrawTransparent
),
788 aMtf
,aPt1
,aRect
.GetSize(),aGradient
));
794 &OutputDevice::Erase
,
799 void grindFunc( OutputDevice
& rTarget
,
800 functor_vector_type::const_iterator iter
,
804 const sal_uInt32
nStartTime( osl_getGlobalTimer() );
806 for( sal_Int32 i
=0; i
<nTurns
; ++i
)
807 iter
->second(&rTarget
);
809 if( rTarget
.GetOutDevType() == OUTDEV_WINDOW
)
810 static_cast< vcl::Window
& >( rTarget
).Sync();
813 "Duration: %d ms (%d repetitions)\tOperation: %s\tSetup: %s\n",
814 (int)(osl_getGlobalTimer() - nStartTime
),
820 /** Call OutputDevice render methods repeatedly, and output elapsed
823 void outDevGrind(vcl::RenderContext
& rTarget
, sal_Int32 nTurns
= 100)
825 // TODO(F1): also profile pure complex clip setup times!
827 // State: fill/line color, draw mode, w/o clip, rect clip, complex clip
828 functor_vector_type aMethods
;
829 setupMethodStubs( aMethods
);
831 const Rectangle
aClipRect(10,10,1000,1000);
832 const Polygon
aPoly1( aClipRect
);
833 Polygon
aPoly2( aClipRect
);
834 aPoly2
.Rotate(aClipRect
.Center(),450);
835 tools::PolyPolygon
aClipPoly(aPoly1
);
836 aClipPoly
.Insert(aPoly2
);
838 functor_vector_type::const_iterator iter
= aMethods
.begin();
839 const functor_vector_type::const_iterator end
= aMethods
.end();
842 rTarget
.SetLineColor( Color(COL_BLACK
) );
843 rTarget
.SetFillColor( Color(COL_GREEN
) );
844 rTarget
.SetRasterOp( ROP_OVERPAINT
);
845 rTarget
.SetClipRegion();
846 grindFunc( rTarget
, iter
, nTurns
, "w/o clip, w/o xor" );
848 rTarget
.SetLineColor( Color(COL_BLACK
) );
849 rTarget
.SetFillColor( Color(COL_GREEN
) );
850 rTarget
.SetRasterOp( ROP_OVERPAINT
);
851 rTarget
.SetClipRegion( vcl::Region( aClipRect
) );
852 grindFunc( rTarget
, iter
, nTurns
, "with rect clip, w/o xor" );
854 rTarget
.SetLineColor( Color(COL_BLACK
) );
855 rTarget
.SetFillColor( Color(COL_GREEN
) );
856 rTarget
.SetRasterOp( ROP_OVERPAINT
);
857 rTarget
.SetClipRegion( vcl::Region( aClipPoly
) );
858 grindFunc( rTarget
, iter
, nTurns
, "with complex clip, w/o xor" );
860 rTarget
.SetLineColor( Color(COL_BLACK
) );
861 rTarget
.SetFillColor( Color(COL_GREEN
) );
862 rTarget
.SetRasterOp( ROP_XOR
);
863 rTarget
.SetClipRegion();
864 grindFunc( rTarget
, iter
, nTurns
, "w/o clip, with xor" );
866 rTarget
.SetLineColor( Color(COL_BLACK
) );
867 rTarget
.SetFillColor( Color(COL_GREEN
) );
868 rTarget
.SetRasterOp( ROP_XOR
);
869 rTarget
.SetClipRegion( vcl::Region( aClipRect
) );
870 grindFunc( rTarget
, iter
, nTurns
, "with rect clip, with xor" );
872 rTarget
.SetLineColor( Color(COL_BLACK
) );
873 rTarget
.SetFillColor( Color(COL_GREEN
) );
874 rTarget
.SetRasterOp( ROP_XOR
);
875 rTarget
.SetClipRegion( vcl::Region( aClipPoly
) );
876 grindFunc( rTarget
, iter
, nTurns
, "with complex clip, with xor" );
882 void TestWindow::Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
&)
884 outDevGrind(rRenderContext
);
888 sal_uInt16
GrindApp::Exception( sal_uInt16 nError
)
890 switch( nError
& EXC_MAJORTYPE
)
892 case EXC_RSCNOTLOADED
:
893 Abort( "Error: could not load language resources.\nPlease check your installation.\n" );
901 ScopedVclPtrInstance
<TestWindow
> aWindow
;
915 for( sal_uInt16 i
= 0; i
< Application::GetCommandLineParamCount(); i
++ )
917 OUString aParam
= Application::GetCommandLineParam( i
);
919 if( aParam
== "--help" || aParam
== "-h" )
925 printf( "outdevgrind - Profile OutputDevice\n" );
929 tools::extendApplicationEnvironment();
931 uno::Reference
< uno::XComponentContext
> xContext
= cppu::defaultBootstrap_InitialComponentContext();
932 uno::Reference
< lang::XMultiServiceFactory
> xServiceManager( xContext
->getServiceManager(), uno::UNO_QUERY
);
934 if( !xServiceManager
.is() )
935 Application::Abort( "Failed to bootstrap" );
937 comphelper::setProcessServiceFactory( xServiceManager
);
946 catch (const css::uno::Exception
& e
)
948 SAL_WARN("vcl.app", "Fatal exception: " << e
.Message
);
951 catch (const std::exception
& e
)
953 SAL_WARN("vcl.app", "Fatal exception: " << e
.what());
960 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */