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>
51 using namespace ::com::sun::star
;
56 class GrindApp
: public Application
59 virtual int Main() override
;
60 virtual void Exception( ExceptionCategory nCategory
) override
;
63 class TestWindow
: public Dialog
66 TestWindow() : Dialog( nullptr )
68 SetText( "OutDev grinding" );
69 SetSizePixel( Size( 1024, 1024 ) );
74 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
77 typedef std::function
<void (OutputDevice
*)> functor_type
;
78 typedef std::vector
< std::pair
<const char*,
79 functor_type
> > functor_vector_type
;
81 template< typename Functor
> void add( functor_vector_type
& res
,
85 res
.push_back( std::make_pair(pStr
,functor_type(func
)) );
88 void setupMethodStubs( functor_vector_type
& res
)
90 const Color
aWhiteColor( COL_WHITE
);
91 const Color
aBlackColor( COL_BLACK
);
93 const Point
aPt1(10,10);
94 const Point
aPt2(500,500);
95 const Point
aPt3(0,0);
96 const Point
aPt4(450,450);
98 const tools::Rectangle
aRect(aPt1
,aPt2
);
99 const tools::Rectangle
aRect2(aPt3
,aPt4
);
100 const tools::Polygon
aPoly(aRect
);
101 const tools::Polygon
aPoly2(aRect2
);
102 tools::PolyPolygon
aPolyPoly(aPoly
);
103 aPolyPoly
.Insert( aPoly2
);
104 tools::Polygon
aPoly3(aPoly2
);
105 aPoly3
.Rotate( aPoly3
.GetBoundRect().Center(), 900 );
106 const LineInfo
aLineInfo(LineStyle::Solid
,5);
109 const OUString
aString("This is a test");
111 // unfortunately, VDevs have inaccessible copy constructors
112 static VirtualDevice aVDev
;
113 static VirtualDevice
aVDevBW(1);
115 const Size aVDevSize
;
116 aVDev
.SetOutputSizePixel(aVDevSize
);
117 aVDevBW
.SetOutputSizePixel(aVDevSize
);
119 const Bitmap
aBitmap( aVDev
.GetBitmap(aPt1
,aVDevSize
) );
120 const Bitmap
aBitmapBW( aVDevBW
.GetBitmap(aPt1
,aVDevSize
) );
121 const Bitmap
aBitmapAlien( aVDevSize
, 8 );
124 rtl::Bootstrap::set("BRAND_BASE_DIR", ".");
125 if (Application::LoadBrandBitmap ("intro", aIntro
))
126 Application::Abort( "Failed to load intro image, run inside program/" );
128 const Bitmap
aBitmap( aIntro
.GetBitmap() );
129 Bitmap
aBitmapBW( aBitmap
);
130 aBitmapBW
.Filter( BmpFilter::EmbossGrey
);
131 Bitmap
aBitmapAlien( Size( 100, 100 ), 8 );
132 aBitmapAlien
.Erase( COL_RED
);
135 const BitmapEx
aBitmapEx( aBitmap
, aBitmapBW
);
136 const BitmapEx
aBitmapExBW( aBitmapBW
, aBitmapBW
);
137 const BitmapEx
aBitmapExAlien( aBitmapAlien
, aBitmapBW
);
138 const BitmapEx
aBitmapExAlpha( aBitmap
, aBitmapAlien
);
139 const BitmapEx
aBitmapExAlphaAlien( aBitmapAlien
, aBitmapAlien
);
141 #ifdef NEEDS_QUALITY_PARAMETER
142 const Image
aImage( aBitmapEx
);
144 const Gradient
aGradient(GradientStyle::Elliptical
,aBlackColor
,aWhiteColor
);
145 const Hatch
aHatch(HatchStyle::Triple
,aBlackColor
,4,450);
146 const Wallpaper
aWallpaper( aWhiteColor
);
149 aMtf
.AddAction( new MetaFillColorAction(Color(COL_RED
),true) );
150 aMtf
.AddAction( new MetaRectAction(aRect
) );
152 #ifdef FIXME_NEEDS_LOVE
155 [&] (OutputDevice
* pDev
) {
156 return pDev
->DrawTextArray(aPt1
, aString
, (const sal_Int32
*)0, (sal_uInt16
)0, aString
.getLength());
160 /* void DrawPixel( const Point& rPt, const Color& rColor ); */
163 [aPt1
, aBlackColor
](OutputDevice
*pOutDev
) { return pOutDev
->DrawPixel(aPt1
, aBlackColor
); });
165 /* void DrawLine( const Point& rStartPt, const Point& rEndPt ); */
168 [aPt1
, aPt2
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawLine(aPt1
, aPt2
); });
170 /* void DrawLine( const Point& rStartPt, const Point& rEndPt,
171 const LineInfo& rLineInfo );
174 "DrawLine(LineInfo)",
175 [aPt1
, aPt2
, aLineInfo
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawLine(aPt1
, aPt2
, aLineInfo
); });
177 /* void DrawPolyLine( const Polygon& rPoly ); */
180 [aPoly
] (OutputDevice
*pOutDev
) {return pOutDev
->DrawPolyLine(aPoly
); });
182 /* void DrawPolyLine( const Polygon& rPoly,
183 const LineInfo& rLineInfo );
186 "DrawPolyLine(LineInfo)",
187 [aPoly
, aLineInfo
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawPolyLine(aPoly
, aLineInfo
); });
189 /* void DrawPolygon( const Polygon& rPoly ); */
192 [aPoly
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawPolygon(aPoly
); });
194 /* void DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly ); */
197 [aPolyPoly
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawPolyPolygon(aPolyPoly
); });
199 /* void DrawRect( const Rectangle& rRect ); */
202 [aRect
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawRect(aRect
); });
204 /* void DrawRect( const Rectangle& rRect,
205 sal_uLong nHorzRount, sal_uLong nVertRound );
208 "DrawRect(round corners)",
209 [aRect2
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawRect(aRect2
,4,4); });
211 /* void DrawEllipse( const Rectangle& rRect ); */
214 [aRect
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawEllipse(aRect
); });
216 /* void DrawArc( const Rectangle& rRect,
217 const Point& rStartPt, const Point& rEndPt );
221 [aRect
,aPt1
,aPt2
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawArc(aRect
,aPt1
,aPt2
); });
223 /* void DrawPie( const Rectangle& rRect,
224 const Point& rStartPt, const Point& rEndPt );
228 [aRect2
,aPt3
,aPt4
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawPie(aRect2
,aPt3
,aPt4
); });
230 /* void DrawChord( const Rectangle& rRect,
231 const Point& rStartPt, const Point& rEndPt );
235 [aRect2
,aPt3
,aPt4
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawChord(aRect2
,aPt3
,aPt4
); });
237 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
238 const Point& rSrcPt, const Size& rSrcSize );
242 [aRect
,aRect2
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawOutDev(aRect2
.TopLeft(), aRect2
.GetSize(),
243 aRect
.TopLeft(), aRect
.GetSize()); });
246 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
247 const Point& rSrcPt, const Size& rSrcSize,
248 const OutputDevice& rOutDev );
251 "DrawOutDev(foreign source)",
252 [&] (OutputDevice
* pDev
) {
253 return pDev
->DrawOutDev(aRect2
.TopLeft(), aRect2
.GetSize(),
254 aRect
.TopLeft(), aRect
.GetSize(), aVDevBW
);
257 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
258 const Point& rSrcPt, const Size& rSrcSize,
259 const OutputDevice& rOutDev );
262 "DrawOutDev(foreign source, scaled)",
263 [&] (OutputDevice
* pDev
) {
264 return pDev
->DrawOutDev(aRect2
.TopLeft(), aRect2
.GetSize(),
265 aRect
.TopLeft(), aRect
.GetSize(), aVDev
);
269 /* void CopyArea( const Point& rDestPt,
270 const Point& rSrcPt, const Size& rSrcSize,
271 sal_uInt16 nFlags = 0 );
275 [&] (OutputDevice
* pDev
) { return pDev
->CopyArea(aPt1
, aPt3
, aRect2
.GetSize()); } );
277 #ifdef NEEDS_QUALITY_PARAMETER
278 /* void DrawBitmap( const Point& rDestPt,
279 const Bitmap& rBitmap );
282 "DrawBitmap(alien source)",
283 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmap(aPt1
, aBitmapAlien
); });
285 /* void DrawBitmap( const Point& rDestPt,
286 const Bitmap& rBitmap );
290 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmap(aPt1
, aBitmap
); });
292 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
293 const Bitmap& rBitmap );
296 "DrawBitmap(scaled,alien source)",
297 [&] (OutputDevice
* pDev
) {
298 return pDev
->DrawBitmap(aPt1
, aRect
.GetSize(), aBitmapAlien
);
301 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
302 const Bitmap& rBitmap );
305 "DrawBitmap(scaled)",
306 [&] (OutputDevice
* pDev
) {
307 return pDev
->DrawBitmap(aPt1
, aRect
.GetSize(), aBitmap
);
311 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
312 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
313 const Bitmap& rBitmap );
316 "DrawBitmap(scaled subset,alien source)",
317 [&] (OutputDevice
* pDev
) {
318 return pDev
->DrawBitmap(aPt1
, aRect
.GetSize(), aPt3
,
319 aRect2
.GetSize(), aBitmapAlien
);
323 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
324 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
325 const Bitmap& rBitmap );
328 "DrawBitmap(scaled subset)",
329 [&] (OutputDevice
* pDev
) {
330 return pDev
->DrawBitmap(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmap
);
333 /* void DrawBitmapEx( const Point& rDestPt,
334 const BitmapEx& rBitmapEx );
337 "DrawBitmapEx(alien source)",
338 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmapEx(aPt1
, aBitmapExAlien
); });
340 /* void DrawBitmapEx( const Point& rDestPt,
341 const BitmapEx& rBitmapEx );
345 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmapEx(aPt1
, aBitmapEx
); });
347 /* void DrawBitmapEx( const Point& rDestPt,
348 const BitmapEx& rBitmapEx );
351 "DrawBitmapEx(alpha)",
352 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmapEx(aPt1
, aBitmapExAlpha
); });
354 /* void DrawBitmapEx( const Point& rDestPt,
355 const BitmapEx& rBitmapEx );
358 "DrawBitmapEx(alpha, alien source)",
359 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmapEx(aPt1
, aBitmapExAlphaAlien
); });
361 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
362 const BitmapEx& rBitmapEx );
365 "DrawBitmapEx(scaled,alien source)",
366 [&] (OutputDevice
* pDev
) {
367 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aBitmapExAlien
);
370 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
371 const BitmapEx& rBitmapEx );
374 "DrawBitmapEx(scaled)",
375 [&] (OutputDevice
* pDev
) {
376 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aBitmapEx
);
379 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
380 const BitmapEx& rBitmapEx );
383 "DrawBitmapEx(scaled alpha)",
384 [&] (OutputDevice
* pDev
) {
385 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aBitmapExAlpha
);
388 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
389 const BitmapEx& rBitmapEx );
392 "DrawBitmapEx(scaled alpha, alien source)",
393 [&] (OutputDevice
* pDev
) {
394 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aBitmapExAlphaAlien
);
397 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
398 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
399 const BitmapEx& rBitmapEx );
402 "DrawBitmapEx(scaled subset,alien source)",
403 [&] (OutputDevice
* pDev
) {
404 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmapExAlien
);
407 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
408 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
409 const BitmapEx& rBitmapEx );
412 "DrawBitmapEx(scaled subset)",
413 [&] (OutputDevice
* pDev
) {
414 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmapEx
);
417 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
418 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
419 const BitmapEx& rBitmapEx );
422 "DrawBitmapEx(scaled subset, alpha)",
423 [&] (OutputDevice
* pDev
) {
424 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmapExAlpha
);
427 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
428 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
429 const BitmapEx& rBitmapEx );
432 "DrawBitmapEx(scaled subset, alpha alien source)",
433 [&] (OutputDevice
* pDev
) {
434 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmapExAlphaAlien
);
437 /* void DrawMask( const Point& rDestPt,
438 const Bitmap& rBitmap, const Color& rMaskColor );
441 "DrawMask(alien source)",
442 [&] (OutputDevice
* pDev
) {
443 return pDev
->DrawMask(aPt1
, aBitmapAlien
, aBlackColor
);
446 /* void DrawMask( const Point& rDestPt,
447 const Bitmap& rBitmap, const Color& rMaskColor );
451 [&] (OutputDevice
* pDev
) {
452 return pDev
->DrawMask(aPt1
, aBitmap
, aBlackColor
);
455 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
456 const Bitmap& rBitmap, const Color& rMaskColor );
459 "DrawMask(scaled,alien source)",
460 [&] (OutputDevice
* pDev
) {
461 return pDev
->DrawMask(aPt1
, aRect
.GetSize(), aBitmapAlien
, aBlackColor
);
464 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
465 const Bitmap& rBitmap, const Color& rMaskColor );
469 [&] (OutputDevice
* pDev
) {
470 return pDev
->DrawMask(aPt1
, aRect
.GetSize(), aBitmap
, aBlackColor
);
473 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
474 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
475 const Bitmap& rBitmap, const Color& rMaskColor );
478 "DrawMask(scaled subset,alien source)",
479 [&] (OutputDevice
* pDev
) {
480 return pDev
->DrawMask(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(),
481 aBitmapAlien
, aBlackColor
);
484 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
485 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
486 const Bitmap& rBitmap, const Color& rMaskColor );
489 "DrawMask(scaled subset)",
490 [&] (OutputDevice
* pDev
) {
491 return pDev
->DrawMask(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmap
, aBlackColor
);
494 /* void DrawImage( const Point& rPos,
495 const Image& rImage, sal_uInt16 nStyle = 0 );
499 [&] (OutputDevice
* pDev
) {
500 return pDev
->DrawImage(aPt1
, aImage
, static_cast<sal_uInt16
>(0));
503 /* void DrawImage( const Point& rPos, const Size& rSize,
504 const Image& rImage, sal_uInt16 nStyle = 0 );
508 [&] (OutputDevice
* pDev
) {
509 return pDev
->DrawImage(aPt1
, aRect
.GetSize(), aImage
, static_cast<sal_uInt16
>(0)));
512 #endif // NEEDS_QUALITY_PARAMETER
514 /* void DrawGradient( const Rectangle& rRect, const Gradient& rGradient ); */
517 [&] (OutputDevice
* pDev
) {
518 return pDev
->DrawGradient(aRect
, aGradient
);
521 /* void DrawGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient ); */
523 "DrawGradient(polygon)",
524 [&] (OutputDevice
* pDev
) {
525 return pDev
->DrawGradient(aPoly3
, aGradient
);
528 /* void DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch ); */
531 [&] (OutputDevice
* pDev
) {
532 return pDev
->DrawHatch(aPoly3
, aHatch
);
535 /* void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper ); */
538 [&] (OutputDevice
* pDev
) {
539 return pDev
->DrawWallpaper(aRect2
, aWallpaper
);
542 #ifdef FIXME_HAVE_WAVE_NORMAL
543 /* void DrawWaveLine( const Point& rStartPos, const Point& rEndPos, sal_uInt16 nStyle ); */
546 [&] (OutputDevice
* pDev
) {
547 return pDev
->DrawWaveLine(aPt1
, aPt2
, (sal_uInt16
)WAVE_NORMAL
);
551 /* void DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags ); */
554 [&] (OutputDevice
* pDev
) {
555 return pDev
->DrawGrid(aRect
, Size(10,20), DrawGridFlags::HorzLines
|DrawGridFlags::VertLines
);
558 /* void DrawTransparent( const tools::PolyPolygon& rPolyPoly,
559 sal_uInt16 nTransparencePercent );
563 [&] (OutputDevice
* pDev
) {
564 return pDev
->DrawTransparent(aPoly3
, (sal_uInt16
)50);
567 /* void DrawTransparent( const GDIMetaFile& rMtf,
568 const Point& rPos, const Size& rSize,
569 const Gradient& rTransparenceGradient );
572 "DrawTransparent(metafile)",
573 [&] (OutputDevice
* pDev
) {
574 return pDev
->DrawTransparent(aMtf
, aPt1
, aRect
.GetSize(), aGradient
);
580 [] (OutputDevice
* pDev
) { return pDev
->Erase(); } );
584 void grindFunc( OutputDevice
& rTarget
,
585 functor_vector_type::const_iterator
const & iter
,
589 const sal_uInt32
nStartTime( osl_getGlobalTimer() );
591 for( sal_Int32 i
=0; i
<nTurns
; ++i
)
592 iter
->second(&rTarget
);
594 if( rTarget
.GetOutDevType() == OUTDEV_WINDOW
)
595 static_cast< vcl::Window
& >( rTarget
).Flush();
598 "Duration: %d ms (%d repetitions)\tOperation: %s\tSetup: %s\n",
599 (int)(osl_getGlobalTimer() - nStartTime
),
605 /** Call OutputDevice render methods repeatedly, and output elapsed
608 void outDevGrind(vcl::RenderContext
& rTarget
)
610 sal_Int32 nTurns
= 100;
611 // TODO(F1): also profile pure complex clip setup times!
613 // State: fill/line color, draw mode, w/o clip, rect clip, complex clip
614 functor_vector_type aMethods
;
615 setupMethodStubs( aMethods
);
617 const tools::Rectangle
aClipRect(10,10,1000,1000);
618 const tools::Polygon
aPoly1( aClipRect
);
619 tools::Polygon
aPoly2( aClipRect
);
620 aPoly2
.Rotate(aClipRect
.Center(),450);
621 tools::PolyPolygon
aClipPoly(aPoly1
);
622 aClipPoly
.Insert(aPoly2
);
624 functor_vector_type::const_iterator iter
= aMethods
.begin();
625 const functor_vector_type::const_iterator end
= aMethods
.end();
628 rTarget
.SetLineColor( Color(COL_BLACK
) );
629 rTarget
.SetFillColor( Color(COL_GREEN
) );
630 rTarget
.SetRasterOp( RasterOp::OverPaint
);
631 rTarget
.SetClipRegion();
632 grindFunc( rTarget
, iter
, nTurns
, "w/o clip, w/o xor" );
634 rTarget
.SetLineColor( Color(COL_BLACK
) );
635 rTarget
.SetFillColor( Color(COL_GREEN
) );
636 rTarget
.SetRasterOp( RasterOp::OverPaint
);
637 rTarget
.SetClipRegion( vcl::Region( aClipRect
) );
638 grindFunc( rTarget
, iter
, nTurns
, "with rect clip, w/o xor" );
640 rTarget
.SetLineColor( Color(COL_BLACK
) );
641 rTarget
.SetFillColor( Color(COL_GREEN
) );
642 rTarget
.SetRasterOp( RasterOp::OverPaint
);
643 rTarget
.SetClipRegion( vcl::Region( aClipPoly
) );
644 grindFunc( rTarget
, iter
, nTurns
, "with complex clip, w/o xor" );
646 rTarget
.SetLineColor( Color(COL_BLACK
) );
647 rTarget
.SetFillColor( Color(COL_GREEN
) );
648 rTarget
.SetRasterOp( RasterOp::Xor
);
649 rTarget
.SetClipRegion();
650 grindFunc( rTarget
, iter
, nTurns
, "w/o clip, with xor" );
652 rTarget
.SetLineColor( Color(COL_BLACK
) );
653 rTarget
.SetFillColor( Color(COL_GREEN
) );
654 rTarget
.SetRasterOp( RasterOp::Xor
);
655 rTarget
.SetClipRegion( vcl::Region( aClipRect
) );
656 grindFunc( rTarget
, iter
, nTurns
, "with rect clip, with xor" );
658 rTarget
.SetLineColor( Color(COL_BLACK
) );
659 rTarget
.SetFillColor( Color(COL_GREEN
) );
660 rTarget
.SetRasterOp( RasterOp::Xor
);
661 rTarget
.SetClipRegion( vcl::Region( aClipPoly
) );
662 grindFunc( rTarget
, iter
, nTurns
, "with complex clip, with xor" );
668 void TestWindow::Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
&)
670 outDevGrind(rRenderContext
);
674 void GrindApp::Exception( ExceptionCategory nCategory
)
678 case ExceptionCategory::ResourceNotLoaded
:
679 Abort( "Error: could not load language resources.\nPlease check your installation.\n" );
687 ScopedVclPtrInstance
<TestWindow
> aWindow
;
701 for( sal_uInt16 i
= 0; i
< Application::GetCommandLineParamCount(); i
++ )
703 OUString aParam
= Application::GetCommandLineParam( i
);
705 if( aParam
== "--help" || aParam
== "-h" )
711 printf( "outdevgrind - Profile OutputDevice\n" );
715 tools::extendApplicationEnvironment();
717 uno::Reference
< uno::XComponentContext
> xContext
= cppu::defaultBootstrap_InitialComponentContext();
718 uno::Reference
< lang::XMultiServiceFactory
> xServiceManager( xContext
->getServiceManager(), uno::UNO_QUERY
);
720 if( !xServiceManager
.is() )
721 Application::Abort( "Failed to bootstrap" );
723 comphelper::setProcessServiceFactory( xServiceManager
);
732 catch (const css::uno::Exception
& e
)
734 SAL_WARN("vcl.app", "Fatal exception: " << e
.Message
);
737 catch (const std::exception
& e
)
739 SAL_WARN("vcl.app", "Fatal exception: " << e
.what());
746 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */