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/BitmapEmbossGreyFilter.hxx>
36 #include <vcl/wall.hxx>
37 #include <vcl/image.hxx>
38 #include <vcl/gdimtf.hxx>
39 #include <vcl/metaact.hxx>
40 #include <vcl/bitmapex.hxx>
41 #include <vcl/gradient.hxx>
42 #include <vcl/lineinfo.hxx>
44 #include <rtl/bootstrap.hxx>
52 using namespace ::com::sun::star
;
57 class GrindApp
: public Application
60 virtual int Main() override
;
61 virtual void Exception( ExceptionCategory nCategory
) override
;
64 class TestWindow
: public Dialog
67 TestWindow() : Dialog( nullptr )
69 SetText( "OutDev grinding" );
70 SetSizePixel( Size( 1024, 1024 ) );
75 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
78 typedef std::function
<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
.emplace_back(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 tools::Rectangle
aRect(aPt1
,aPt2
);
100 const tools::Rectangle
aRect2(aPt3
,aPt4
);
101 const tools::Polygon
aPoly(aRect
);
102 const tools::Polygon
aPoly2(aRect2
);
103 tools::PolyPolygon
aPolyPoly(aPoly
);
104 aPolyPoly
.Insert( aPoly2
);
105 tools::Polygon
aPoly3(aPoly2
);
106 aPoly3
.Rotate( aPoly3
.GetBoundRect().Center(), 900 );
107 const LineInfo
aLineInfo(LineStyle::Solid
,5);
110 const OUString
aString("This is a test");
112 // unfortunately, VDevs have inaccessible copy constructors
113 static VirtualDevice aVDev
;
114 static VirtualDevice
aVDevBW(1);
116 const Size aVDevSize
;
117 aVDev
.SetOutputSizePixel(aVDevSize
);
118 aVDevBW
.SetOutputSizePixel(aVDevSize
);
120 const Bitmap
aBitmap( aVDev
.GetBitmap(aPt1
,aVDevSize
) );
121 const Bitmap
aBitmapBW( aVDevBW
.GetBitmap(aPt1
,aVDevSize
) );
122 const Bitmap
aBitmapAlien( aVDevSize
, 8 );
125 rtl::Bootstrap::set("BRAND_BASE_DIR", ".");
126 if (Application::LoadBrandBitmap ("intro", aIntro
))
127 Application::Abort( "Failed to load intro image, run inside program/" );
129 const Bitmap
aBitmap( aIntro
.GetBitmap() );
130 Bitmap
aBitmapBW( aBitmap
);
132 BitmapEx
aTmpBmpEx(aBitmapBW
);
133 BitmapFilter::Filter(aTmpBmpEx
, BitmapEmbossGreyFilter(0, 0));
134 aBitmapBW
= aTmpBmpEx
.GetBitmap();
136 Bitmap
aBitmapAlien( Size( 100, 100 ), 8 );
137 aBitmapAlien
.Erase( COL_RED
);
140 const BitmapEx
aBitmapEx( aBitmap
, aBitmapBW
);
142 const BitmapEx
aBitmapExBW( aBitmapBW
, aBitmapBW
);
144 const BitmapEx
aBitmapExAlien( aBitmapAlien
, aBitmapBW
);
145 (void)aBitmapExAlien
;
146 const BitmapEx
aBitmapExAlpha( aBitmap
, aBitmapAlien
);
147 (void)aBitmapExAlpha
;
148 const BitmapEx
aBitmapExAlphaAlien( aBitmapAlien
, aBitmapAlien
);
149 (void)aBitmapExAlphaAlien
;
151 #ifdef NEEDS_QUALITY_PARAMETER
152 const Image
aImage( aBitmapEx
);
154 const Gradient
aGradient(GradientStyle::Elliptical
,aBlackColor
,aWhiteColor
);
155 const Hatch
aHatch(HatchStyle::Triple
,aBlackColor
,4,450);
156 const Wallpaper
aWallpaper( aWhiteColor
);
159 aMtf
.AddAction( new MetaFillColorAction(COL_RED
,true) );
160 aMtf
.AddAction( new MetaRectAction(aRect
) );
162 #ifdef FIXME_NEEDS_LOVE
165 [&] (OutputDevice
* pDev
) {
166 return pDev
->DrawTextArray(aPt1
, aString
, (const sal_Int32
*)0, (sal_uInt16
)0, aString
.getLength());
170 /* void DrawPixel( const Point& rPt, const Color& rColor ); */
173 [aPt1
, aBlackColor
](OutputDevice
*pOutDev
) { return pOutDev
->DrawPixel(aPt1
, aBlackColor
); });
175 /* void DrawLine( const Point& rStartPt, const Point& rEndPt ); */
178 [aPt1
, aPt2
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawLine(aPt1
, aPt2
); });
180 /* void DrawLine( const Point& rStartPt, const Point& rEndPt,
181 const LineInfo& rLineInfo );
184 "DrawLine(LineInfo)",
185 [aPt1
, aPt2
, aLineInfo
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawLine(aPt1
, aPt2
, aLineInfo
); });
187 /* void DrawPolyLine( const Polygon& rPoly ); */
190 [aPoly
] (OutputDevice
*pOutDev
) {return pOutDev
->DrawPolyLine(aPoly
); });
192 /* void DrawPolyLine( const Polygon& rPoly,
193 const LineInfo& rLineInfo );
196 "DrawPolyLine(LineInfo)",
197 [aPoly
, aLineInfo
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawPolyLine(aPoly
, aLineInfo
); });
199 /* void DrawPolygon( const Polygon& rPoly ); */
202 [aPoly
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawPolygon(aPoly
); });
204 /* void DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly ); */
207 [aPolyPoly
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawPolyPolygon(aPolyPoly
); });
209 /* void DrawRect( const Rectangle& rRect ); */
212 [aRect
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawRect(aRect
); });
214 /* void DrawRect( const Rectangle& rRect,
215 sal_uLong nHorzRount, sal_uLong nVertRound );
218 "DrawRect(round corners)",
219 [aRect2
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawRect(aRect2
,4,4); });
221 /* void DrawEllipse( const Rectangle& rRect ); */
224 [aRect
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawEllipse(aRect
); });
226 /* void DrawArc( const Rectangle& rRect,
227 const Point& rStartPt, const Point& rEndPt );
231 [aRect
,aPt1
,aPt2
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawArc(aRect
,aPt1
,aPt2
); });
233 /* void DrawPie( const Rectangle& rRect,
234 const Point& rStartPt, const Point& rEndPt );
238 [aRect2
,aPt3
,aPt4
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawPie(aRect2
,aPt3
,aPt4
); });
240 /* void DrawChord( const Rectangle& rRect,
241 const Point& rStartPt, const Point& rEndPt );
245 [aRect2
,aPt3
,aPt4
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawChord(aRect2
,aPt3
,aPt4
); });
247 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
248 const Point& rSrcPt, const Size& rSrcSize );
252 [aRect
,aRect2
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawOutDev(aRect2
.TopLeft(), aRect2
.GetSize(),
253 aRect
.TopLeft(), aRect
.GetSize()); });
256 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
257 const Point& rSrcPt, const Size& rSrcSize,
258 const OutputDevice& rOutDev );
261 "DrawOutDev(foreign source)",
262 [&] (OutputDevice
* pDev
) {
263 return pDev
->DrawOutDev(aRect2
.TopLeft(), aRect2
.GetSize(),
264 aRect
.TopLeft(), aRect
.GetSize(), aVDevBW
);
267 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
268 const Point& rSrcPt, const Size& rSrcSize,
269 const OutputDevice& rOutDev );
272 "DrawOutDev(foreign source, scaled)",
273 [&] (OutputDevice
* pDev
) {
274 return pDev
->DrawOutDev(aRect2
.TopLeft(), aRect2
.GetSize(),
275 aRect
.TopLeft(), aRect
.GetSize(), aVDev
);
279 /* void CopyArea( const Point& rDestPt,
280 const Point& rSrcPt, const Size& rSrcSize,
281 sal_uInt16 nFlags = 0 );
285 [&] (OutputDevice
* pDev
) { return pDev
->CopyArea(aPt1
, aPt3
, aRect2
.GetSize()); } );
287 #ifdef NEEDS_QUALITY_PARAMETER
288 /* void DrawBitmap( const Point& rDestPt,
289 const Bitmap& rBitmap );
292 "DrawBitmap(alien source)",
293 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmap(aPt1
, aBitmapAlien
); });
295 /* void DrawBitmap( const Point& rDestPt,
296 const Bitmap& rBitmap );
300 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmap(aPt1
, aBitmap
); });
302 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
303 const Bitmap& rBitmap );
306 "DrawBitmap(scaled,alien source)",
307 [&] (OutputDevice
* pDev
) {
308 return pDev
->DrawBitmap(aPt1
, aRect
.GetSize(), aBitmapAlien
);
311 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
312 const Bitmap& rBitmap );
315 "DrawBitmap(scaled)",
316 [&] (OutputDevice
* pDev
) {
317 return pDev
->DrawBitmap(aPt1
, aRect
.GetSize(), aBitmap
);
321 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
322 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
323 const Bitmap& rBitmap );
326 "DrawBitmap(scaled subset,alien source)",
327 [&] (OutputDevice
* pDev
) {
328 return pDev
->DrawBitmap(aPt1
, aRect
.GetSize(), aPt3
,
329 aRect2
.GetSize(), aBitmapAlien
);
333 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
334 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
335 const Bitmap& rBitmap );
338 "DrawBitmap(scaled subset)",
339 [&] (OutputDevice
* pDev
) {
340 return pDev
->DrawBitmap(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmap
);
343 /* void DrawBitmapEx( const Point& rDestPt,
344 const BitmapEx& rBitmapEx );
347 "DrawBitmapEx(alien source)",
348 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmapEx(aPt1
, aBitmapExAlien
); });
350 /* void DrawBitmapEx( const Point& rDestPt,
351 const BitmapEx& rBitmapEx );
355 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmapEx(aPt1
, aBitmapEx
); });
357 /* void DrawBitmapEx( const Point& rDestPt,
358 const BitmapEx& rBitmapEx );
361 "DrawBitmapEx(alpha)",
362 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmapEx(aPt1
, aBitmapExAlpha
); });
364 /* void DrawBitmapEx( const Point& rDestPt,
365 const BitmapEx& rBitmapEx );
368 "DrawBitmapEx(alpha, alien source)",
369 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmapEx(aPt1
, aBitmapExAlphaAlien
); });
371 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
372 const BitmapEx& rBitmapEx );
375 "DrawBitmapEx(scaled,alien source)",
376 [&] (OutputDevice
* pDev
) {
377 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aBitmapExAlien
);
380 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
381 const BitmapEx& rBitmapEx );
384 "DrawBitmapEx(scaled)",
385 [&] (OutputDevice
* pDev
) {
386 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aBitmapEx
);
389 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
390 const BitmapEx& rBitmapEx );
393 "DrawBitmapEx(scaled alpha)",
394 [&] (OutputDevice
* pDev
) {
395 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aBitmapExAlpha
);
398 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
399 const BitmapEx& rBitmapEx );
402 "DrawBitmapEx(scaled alpha, alien source)",
403 [&] (OutputDevice
* pDev
) {
404 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aBitmapExAlphaAlien
);
407 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
408 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
409 const BitmapEx& rBitmapEx );
412 "DrawBitmapEx(scaled subset,alien source)",
413 [&] (OutputDevice
* pDev
) {
414 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmapExAlien
);
417 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
418 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
419 const BitmapEx& rBitmapEx );
422 "DrawBitmapEx(scaled subset)",
423 [&] (OutputDevice
* pDev
) {
424 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmapEx
);
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)",
433 [&] (OutputDevice
* pDev
) {
434 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmapExAlpha
);
437 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
438 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
439 const BitmapEx& rBitmapEx );
442 "DrawBitmapEx(scaled subset, alpha alien source)",
443 [&] (OutputDevice
* pDev
) {
444 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmapExAlphaAlien
);
447 /* void DrawMask( const Point& rDestPt,
448 const Bitmap& rBitmap, const Color& rMaskColor );
451 "DrawMask(alien source)",
452 [&] (OutputDevice
* pDev
) {
453 return pDev
->DrawMask(aPt1
, aBitmapAlien
, aBlackColor
);
456 /* void DrawMask( const Point& rDestPt,
457 const Bitmap& rBitmap, const Color& rMaskColor );
461 [&] (OutputDevice
* pDev
) {
462 return pDev
->DrawMask(aPt1
, aBitmap
, aBlackColor
);
465 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
466 const Bitmap& rBitmap, const Color& rMaskColor );
469 "DrawMask(scaled,alien source)",
470 [&] (OutputDevice
* pDev
) {
471 return pDev
->DrawMask(aPt1
, aRect
.GetSize(), aBitmapAlien
, aBlackColor
);
474 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
475 const Bitmap& rBitmap, const Color& rMaskColor );
479 [&] (OutputDevice
* pDev
) {
480 return pDev
->DrawMask(aPt1
, aRect
.GetSize(), aBitmap
, aBlackColor
);
483 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
484 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
485 const Bitmap& rBitmap, const Color& rMaskColor );
488 "DrawMask(scaled subset,alien source)",
489 [&] (OutputDevice
* pDev
) {
490 return pDev
->DrawMask(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(),
491 aBitmapAlien
, aBlackColor
);
494 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
495 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
496 const Bitmap& rBitmap, const Color& rMaskColor );
499 "DrawMask(scaled subset)",
500 [&] (OutputDevice
* pDev
) {
501 return pDev
->DrawMask(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmap
, aBlackColor
);
504 /* void DrawImage( const Point& rPos,
505 const Image& rImage, sal_uInt16 nStyle = 0 );
509 [&] (OutputDevice
* pDev
) {
510 return pDev
->DrawImage(aPt1
, aImage
, static_cast<sal_uInt16
>(0));
513 /* void DrawImage( const Point& rPos, const Size& rSize,
514 const Image& rImage, sal_uInt16 nStyle = 0 );
518 [&] (OutputDevice
* pDev
) {
519 return pDev
->DrawImage(aPt1
, aRect
.GetSize(), aImage
, static_cast<sal_uInt16
>(0)));
522 #endif // NEEDS_QUALITY_PARAMETER
524 /* void DrawGradient( const Rectangle& rRect, const Gradient& rGradient ); */
527 [&] (OutputDevice
* pDev
) {
528 return pDev
->DrawGradient(aRect
, aGradient
);
531 /* void DrawGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient ); */
533 "DrawGradient(polygon)",
534 [&] (OutputDevice
* pDev
) {
535 return pDev
->DrawGradient(aPoly3
, aGradient
);
538 /* void DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch ); */
541 [&] (OutputDevice
* pDev
) {
542 return pDev
->DrawHatch(aPoly3
, aHatch
);
545 /* void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper ); */
548 [&] (OutputDevice
* pDev
) {
549 return pDev
->DrawWallpaper(aRect2
, aWallpaper
);
552 #ifdef FIXME_HAVE_WAVE_NORMAL
553 /* void DrawWaveLine( const Point& rStartPos, const Point& rEndPos, sal_uInt16 nStyle ); */
556 [&] (OutputDevice
* pDev
) {
557 return pDev
->DrawWaveLine(aPt1
, aPt2
, (sal_uInt16
)WAVE_NORMAL
);
561 /* void DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags ); */
564 [&] (OutputDevice
* pDev
) {
565 return pDev
->DrawGrid(aRect
, Size(10,20), DrawGridFlags::HorzLines
|DrawGridFlags::VertLines
);
568 /* void DrawTransparent( const tools::PolyPolygon& rPolyPoly,
569 sal_uInt16 nTransparencePercent );
573 [&] (OutputDevice
* pDev
) {
574 return pDev
->DrawTransparent(aPoly3
, sal_uInt16(50));
577 /* void DrawTransparent( const GDIMetaFile& rMtf,
578 const Point& rPos, const Size& rSize,
579 const Gradient& rTransparenceGradient );
582 "DrawTransparent(metafile)",
583 [&] (OutputDevice
* pDev
) {
584 return pDev
->DrawTransparent(aMtf
, aPt1
, aRect
.GetSize(), aGradient
);
590 [] (OutputDevice
* pDev
) { return pDev
->Erase(); } );
594 void grindFunc( OutputDevice
& rTarget
,
595 functor_vector_type::const_iterator
const & iter
,
599 const sal_uInt32
nStartTime( osl_getGlobalTimer() );
601 for( sal_Int32 i
=0; i
<nTurns
; ++i
)
602 iter
->second(&rTarget
);
604 if( rTarget
.GetOutDevType() == OUTDEV_WINDOW
)
605 static_cast< vcl::Window
& >( rTarget
).Flush();
608 "Duration: %d ms (%d repetitions)\tOperation: %s\tSetup: %s\n",
609 static_cast<int>(osl_getGlobalTimer() - nStartTime
),
610 static_cast<int>(nTurns
),
615 /** Call OutputDevice render methods repeatedly, and output elapsed
618 void outDevGrind(vcl::RenderContext
& rTarget
)
620 sal_Int32 nTurns
= 100;
621 // TODO(F1): also profile pure complex clip setup times!
623 // State: fill/line color, draw mode, w/o clip, rect clip, complex clip
624 functor_vector_type aMethods
;
625 setupMethodStubs( aMethods
);
627 const tools::Rectangle
aClipRect(10,10,1000,1000);
628 const tools::Polygon
aPoly1( aClipRect
);
629 tools::Polygon
aPoly2( aClipRect
);
630 aPoly2
.Rotate(aClipRect
.Center(),450);
631 tools::PolyPolygon
aClipPoly(aPoly1
);
632 aClipPoly
.Insert(aPoly2
);
634 functor_vector_type::const_iterator iter
= aMethods
.begin();
635 const functor_vector_type::const_iterator end
= aMethods
.end();
638 rTarget
.SetLineColor( COL_BLACK
);
639 rTarget
.SetFillColor( COL_GREEN
);
640 rTarget
.SetRasterOp( RasterOp::OverPaint
);
641 rTarget
.SetClipRegion();
642 grindFunc( rTarget
, iter
, nTurns
, "w/o clip, w/o xor" );
644 rTarget
.SetLineColor( COL_BLACK
);
645 rTarget
.SetFillColor( COL_GREEN
);
646 rTarget
.SetRasterOp( RasterOp::OverPaint
);
647 rTarget
.SetClipRegion( vcl::Region( aClipRect
) );
648 grindFunc( rTarget
, iter
, nTurns
, "with rect clip, w/o xor" );
650 rTarget
.SetLineColor( COL_BLACK
);
651 rTarget
.SetFillColor( COL_GREEN
);
652 rTarget
.SetRasterOp( RasterOp::OverPaint
);
653 rTarget
.SetClipRegion( vcl::Region( aClipPoly
) );
654 grindFunc( rTarget
, iter
, nTurns
, "with complex clip, w/o xor" );
656 rTarget
.SetLineColor( COL_BLACK
);
657 rTarget
.SetFillColor( COL_GREEN
);
658 rTarget
.SetRasterOp( RasterOp::Xor
);
659 rTarget
.SetClipRegion();
660 grindFunc( rTarget
, iter
, nTurns
, "w/o clip, with xor" );
662 rTarget
.SetLineColor( COL_BLACK
);
663 rTarget
.SetFillColor( COL_GREEN
);
664 rTarget
.SetRasterOp( RasterOp::Xor
);
665 rTarget
.SetClipRegion( vcl::Region( aClipRect
) );
666 grindFunc( rTarget
, iter
, nTurns
, "with rect clip, with xor" );
668 rTarget
.SetLineColor( COL_BLACK
);
669 rTarget
.SetFillColor( COL_GREEN
);
670 rTarget
.SetRasterOp( RasterOp::Xor
);
671 rTarget
.SetClipRegion( vcl::Region( aClipPoly
) );
672 grindFunc( rTarget
, iter
, nTurns
, "with complex clip, with xor" );
678 void TestWindow::Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
&)
680 outDevGrind(rRenderContext
);
684 void GrindApp::Exception( ExceptionCategory nCategory
)
688 case ExceptionCategory::ResourceNotLoaded
:
689 Abort( "Error: could not load language resources.\nPlease check your installation.\n" );
697 ScopedVclPtrInstance
<TestWindow
> aWindow
;
711 for( sal_uInt16 i
= 0; i
< Application::GetCommandLineParamCount(); i
++ )
713 OUString aParam
= Application::GetCommandLineParam( i
);
715 if( aParam
== "--help" || aParam
== "-h" )
721 printf( "outdevgrind - Profile OutputDevice\n" );
725 tools::extendApplicationEnvironment();
727 uno::Reference
< uno::XComponentContext
> xContext
= cppu::defaultBootstrap_InitialComponentContext();
728 uno::Reference
< lang::XMultiServiceFactory
> xServiceManager( xContext
->getServiceManager(), uno::UNO_QUERY
);
730 if( !xServiceManager
.is() )
731 Application::Abort( "Failed to bootstrap" );
733 comphelper::setProcessServiceFactory( xServiceManager
);
742 catch (const css::uno::Exception
& e
)
744 SAL_WARN("vcl.app", "Fatal: " << e
);
747 catch (const std::exception
& e
)
749 SAL_WARN("vcl.app", "Fatal: " << e
.what());
756 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */