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 <sal/log.hxx>
22 #include <tools/diagnose_ex.h>
23 #include <tools/extendapplicationenvironment.hxx>
25 #include <cppuhelper/bootstrap.hxx>
26 #include <comphelper/processfactory.hxx>
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <vcl/svapp.hxx>
31 #include <vcl/window.hxx>
32 #include <vcl/dialog.hxx>
33 #include <vcl/outdev.hxx>
34 #include <vcl/virdev.hxx>
35 #include <vcl/hatch.hxx>
36 #include <vcl/bitmap.hxx>
37 #include <vcl/BitmapEmbossGreyFilter.hxx>
38 #include <vcl/wall.hxx>
39 #include <vcl/image.hxx>
40 #include <vcl/gdimtf.hxx>
41 #include <vcl/metaact.hxx>
42 #include <vcl/bitmapex.hxx>
43 #include <vcl/gradient.hxx>
44 #include <vcl/lineinfo.hxx>
46 #include <rtl/bootstrap.hxx>
54 using namespace ::com::sun::star
;
59 class GrindApp
: public Application
62 virtual int Main() override
;
63 virtual void Exception( ExceptionCategory nCategory
) override
;
66 class TestWindow
: public Dialog
69 TestWindow() : Dialog( nullptr )
71 SetText( "OutDev grinding" );
72 SetSizePixel( Size( 1024, 1024 ) );
77 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
80 typedef std::function
<void (OutputDevice
*)> functor_type
;
81 typedef std::vector
< std::pair
<const char*,
82 functor_type
> > functor_vector_type
;
84 template< typename Functor
> void add( functor_vector_type
& res
,
88 res
.emplace_back(pStr
,functor_type(func
) );
91 void setupMethodStubs( functor_vector_type
& res
)
93 const Color
aWhiteColor( COL_WHITE
);
94 const Color
aBlackColor( COL_BLACK
);
96 const Point
aPt1(10,10);
97 const Point
aPt2(500,500);
98 const Point
aPt3(0,0);
99 const Point
aPt4(450,450);
101 const tools::Rectangle
aRect(aPt1
,aPt2
);
102 const tools::Rectangle
aRect2(aPt3
,aPt4
);
103 const tools::Polygon
aPoly(aRect
);
104 const tools::Polygon
aPoly2(aRect2
);
105 tools::PolyPolygon
aPolyPoly(aPoly
);
106 aPolyPoly
.Insert( aPoly2
);
107 tools::Polygon
aPoly3(aPoly2
);
108 aPoly3
.Rotate( aPoly3
.GetBoundRect().Center(), 900 );
109 const LineInfo
aLineInfo(LineStyle::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
);
134 BitmapEx
aTmpBmpEx(aBitmapBW
);
135 BitmapFilter::Filter(aTmpBmpEx
, BitmapEmbossGreyFilter(0, 0));
136 aBitmapBW
= aTmpBmpEx
.GetBitmap();
138 Bitmap
aBitmapAlien( Size( 100, 100 ), 8 );
139 aBitmapAlien
.Erase( COL_RED
);
142 const BitmapEx
aBitmapEx( aBitmap
, aBitmapBW
);
144 const BitmapEx
aBitmapExBW( aBitmapBW
, aBitmapBW
);
146 const BitmapEx
aBitmapExAlien( aBitmapAlien
, aBitmapBW
);
147 (void)aBitmapExAlien
;
148 const BitmapEx
aBitmapExAlpha( aBitmap
, aBitmapAlien
);
149 (void)aBitmapExAlpha
;
150 const BitmapEx
aBitmapExAlphaAlien( aBitmapAlien
, aBitmapAlien
);
151 (void)aBitmapExAlphaAlien
;
153 #ifdef NEEDS_QUALITY_PARAMETER
154 const Image
aImage( aBitmapEx
);
156 const Gradient
aGradient(GradientStyle::Elliptical
,aBlackColor
,aWhiteColor
);
157 const Hatch
aHatch(HatchStyle::Triple
,aBlackColor
,4,450);
158 const Wallpaper
aWallpaper( aWhiteColor
);
161 aMtf
.AddAction( new MetaFillColorAction(COL_RED
,true) );
162 aMtf
.AddAction( new MetaRectAction(aRect
) );
164 #ifdef FIXME_NEEDS_LOVE
167 [&] (OutputDevice
* pDev
) {
168 return pDev
->DrawTextArray(aPt1
, aString
, (const sal_Int32
*)0, (sal_uInt16
)0, aString
.getLength());
172 /* void DrawPixel( const Point& rPt, const Color& rColor ); */
175 [aPt1
, aBlackColor
](OutputDevice
*pOutDev
) { return pOutDev
->DrawPixel(aPt1
, aBlackColor
); });
177 /* void DrawLine( const Point& rStartPt, const Point& rEndPt ); */
180 [aPt1
, aPt2
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawLine(aPt1
, aPt2
); });
182 /* void DrawLine( const Point& rStartPt, const Point& rEndPt,
183 const LineInfo& rLineInfo );
186 "DrawLine(LineInfo)",
187 [aPt1
, aPt2
, aLineInfo
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawLine(aPt1
, aPt2
, aLineInfo
); });
189 /* void DrawPolyLine( const Polygon& rPoly ); */
192 [aPoly
] (OutputDevice
*pOutDev
) {return pOutDev
->DrawPolyLine(aPoly
); });
194 /* void DrawPolyLine( const Polygon& rPoly,
195 const LineInfo& rLineInfo );
198 "DrawPolyLine(LineInfo)",
199 [aPoly
, aLineInfo
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawPolyLine(aPoly
, aLineInfo
); });
201 /* void DrawPolygon( const Polygon& rPoly ); */
204 [aPoly
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawPolygon(aPoly
); });
206 /* void DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly ); */
209 [aPolyPoly
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawPolyPolygon(aPolyPoly
); });
211 /* void DrawRect( const Rectangle& rRect ); */
214 [aRect
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawRect(aRect
); });
216 /* void DrawRect( const Rectangle& rRect,
217 sal_uLong nHorzRount, sal_uLong nVertRound );
220 "DrawRect(round corners)",
221 [aRect2
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawRect(aRect2
,4,4); });
223 /* void DrawEllipse( const Rectangle& rRect ); */
226 [aRect
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawEllipse(aRect
); });
228 /* void DrawArc( const Rectangle& rRect,
229 const Point& rStartPt, const Point& rEndPt );
233 [aRect
,aPt1
,aPt2
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawArc(aRect
,aPt1
,aPt2
); });
235 /* void DrawPie( const Rectangle& rRect,
236 const Point& rStartPt, const Point& rEndPt );
240 [aRect2
,aPt3
,aPt4
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawPie(aRect2
,aPt3
,aPt4
); });
242 /* void DrawChord( const Rectangle& rRect,
243 const Point& rStartPt, const Point& rEndPt );
247 [aRect2
,aPt3
,aPt4
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawChord(aRect2
,aPt3
,aPt4
); });
249 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
250 const Point& rSrcPt, const Size& rSrcSize );
254 [aRect
,aRect2
] (OutputDevice
*pOutDev
) { return pOutDev
->DrawOutDev(aRect2
.TopLeft(), aRect2
.GetSize(),
255 aRect
.TopLeft(), aRect
.GetSize()); });
258 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
259 const Point& rSrcPt, const Size& rSrcSize,
260 const OutputDevice& rOutDev );
263 "DrawOutDev(foreign source)",
264 [&] (OutputDevice
* pDev
) {
265 return pDev
->DrawOutDev(aRect2
.TopLeft(), aRect2
.GetSize(),
266 aRect
.TopLeft(), aRect
.GetSize(), aVDevBW
);
269 /* void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
270 const Point& rSrcPt, const Size& rSrcSize,
271 const OutputDevice& rOutDev );
274 "DrawOutDev(foreign source, scaled)",
275 [&] (OutputDevice
* pDev
) {
276 return pDev
->DrawOutDev(aRect2
.TopLeft(), aRect2
.GetSize(),
277 aRect
.TopLeft(), aRect
.GetSize(), aVDev
);
281 /* void CopyArea( const Point& rDestPt,
282 const Point& rSrcPt, const Size& rSrcSize,
283 sal_uInt16 nFlags = 0 );
287 [&] (OutputDevice
* pDev
) { return pDev
->CopyArea(aPt1
, aPt3
, aRect2
.GetSize()); } );
289 #ifdef NEEDS_QUALITY_PARAMETER
290 /* void DrawBitmap( const Point& rDestPt,
291 const Bitmap& rBitmap );
294 "DrawBitmap(alien source)",
295 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmap(aPt1
, aBitmapAlien
); });
297 /* void DrawBitmap( const Point& rDestPt,
298 const Bitmap& rBitmap );
302 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmap(aPt1
, aBitmap
); });
304 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
305 const Bitmap& rBitmap );
308 "DrawBitmap(scaled,alien source)",
309 [&] (OutputDevice
* pDev
) {
310 return pDev
->DrawBitmap(aPt1
, aRect
.GetSize(), aBitmapAlien
);
313 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
314 const Bitmap& rBitmap );
317 "DrawBitmap(scaled)",
318 [&] (OutputDevice
* pDev
) {
319 return pDev
->DrawBitmap(aPt1
, aRect
.GetSize(), aBitmap
);
323 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
324 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
325 const Bitmap& rBitmap );
328 "DrawBitmap(scaled subset,alien source)",
329 [&] (OutputDevice
* pDev
) {
330 return pDev
->DrawBitmap(aPt1
, aRect
.GetSize(), aPt3
,
331 aRect2
.GetSize(), aBitmapAlien
);
335 /* void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
336 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
337 const Bitmap& rBitmap );
340 "DrawBitmap(scaled subset)",
341 [&] (OutputDevice
* pDev
) {
342 return pDev
->DrawBitmap(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmap
);
345 /* void DrawBitmapEx( const Point& rDestPt,
346 const BitmapEx& rBitmapEx );
349 "DrawBitmapEx(alien source)",
350 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmapEx(aPt1
, aBitmapExAlien
); });
352 /* void DrawBitmapEx( const Point& rDestPt,
353 const BitmapEx& rBitmapEx );
357 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmapEx(aPt1
, aBitmapEx
); });
359 /* void DrawBitmapEx( const Point& rDestPt,
360 const BitmapEx& rBitmapEx );
363 "DrawBitmapEx(alpha)",
364 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmapEx(aPt1
, aBitmapExAlpha
); });
366 /* void DrawBitmapEx( const Point& rDestPt,
367 const BitmapEx& rBitmapEx );
370 "DrawBitmapEx(alpha, alien source)",
371 [&] (OutputDevice
* pDev
) { return pDev
->DrawBitmapEx(aPt1
, aBitmapExAlphaAlien
); });
373 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
374 const BitmapEx& rBitmapEx );
377 "DrawBitmapEx(scaled,alien source)",
378 [&] (OutputDevice
* pDev
) {
379 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aBitmapExAlien
);
382 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
383 const BitmapEx& rBitmapEx );
386 "DrawBitmapEx(scaled)",
387 [&] (OutputDevice
* pDev
) {
388 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aBitmapEx
);
391 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
392 const BitmapEx& rBitmapEx );
395 "DrawBitmapEx(scaled alpha)",
396 [&] (OutputDevice
* pDev
) {
397 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aBitmapExAlpha
);
400 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
401 const BitmapEx& rBitmapEx );
404 "DrawBitmapEx(scaled alpha, alien source)",
405 [&] (OutputDevice
* pDev
) {
406 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aBitmapExAlphaAlien
);
409 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
410 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
411 const BitmapEx& rBitmapEx );
414 "DrawBitmapEx(scaled subset,alien source)",
415 [&] (OutputDevice
* pDev
) {
416 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmapExAlien
);
419 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
420 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
421 const BitmapEx& rBitmapEx );
424 "DrawBitmapEx(scaled subset)",
425 [&] (OutputDevice
* pDev
) {
426 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmapEx
);
429 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
430 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
431 const BitmapEx& rBitmapEx );
434 "DrawBitmapEx(scaled subset, alpha)",
435 [&] (OutputDevice
* pDev
) {
436 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmapExAlpha
);
439 /* void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
440 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
441 const BitmapEx& rBitmapEx );
444 "DrawBitmapEx(scaled subset, alpha alien source)",
445 [&] (OutputDevice
* pDev
) {
446 return pDev
->DrawBitmapEx(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmapExAlphaAlien
);
449 /* void DrawMask( const Point& rDestPt,
450 const Bitmap& rBitmap, const Color& rMaskColor );
453 "DrawMask(alien source)",
454 [&] (OutputDevice
* pDev
) {
455 return pDev
->DrawMask(aPt1
, aBitmapAlien
, aBlackColor
);
458 /* void DrawMask( const Point& rDestPt,
459 const Bitmap& rBitmap, const Color& rMaskColor );
463 [&] (OutputDevice
* pDev
) {
464 return pDev
->DrawMask(aPt1
, aBitmap
, aBlackColor
);
467 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
468 const Bitmap& rBitmap, const Color& rMaskColor );
471 "DrawMask(scaled,alien source)",
472 [&] (OutputDevice
* pDev
) {
473 return pDev
->DrawMask(aPt1
, aRect
.GetSize(), aBitmapAlien
, aBlackColor
);
476 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
477 const Bitmap& rBitmap, const Color& rMaskColor );
481 [&] (OutputDevice
* pDev
) {
482 return pDev
->DrawMask(aPt1
, aRect
.GetSize(), aBitmap
, aBlackColor
);
485 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
486 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
487 const Bitmap& rBitmap, const Color& rMaskColor );
490 "DrawMask(scaled subset,alien source)",
491 [&] (OutputDevice
* pDev
) {
492 return pDev
->DrawMask(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(),
493 aBitmapAlien
, aBlackColor
);
496 /* void DrawMask( const Point& rDestPt, const Size& rDestSize,
497 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
498 const Bitmap& rBitmap, const Color& rMaskColor );
501 "DrawMask(scaled subset)",
502 [&] (OutputDevice
* pDev
) {
503 return pDev
->DrawMask(aPt1
, aRect
.GetSize(), aPt3
, aRect2
.GetSize(), aBitmap
, aBlackColor
);
506 /* void DrawImage( const Point& rPos,
507 const Image& rImage, sal_uInt16 nStyle = 0 );
511 [&] (OutputDevice
* pDev
) {
512 return pDev
->DrawImage(aPt1
, aImage
, static_cast<sal_uInt16
>(0));
515 /* void DrawImage( const Point& rPos, const Size& rSize,
516 const Image& rImage, sal_uInt16 nStyle = 0 );
520 [&] (OutputDevice
* pDev
) {
521 return pDev
->DrawImage(aPt1
, aRect
.GetSize(), aImage
, static_cast<sal_uInt16
>(0)));
524 #endif // NEEDS_QUALITY_PARAMETER
526 /* void DrawGradient( const Rectangle& rRect, const Gradient& rGradient ); */
529 [&] (OutputDevice
* pDev
) {
530 return pDev
->DrawGradient(aRect
, aGradient
);
533 /* void DrawGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient ); */
535 "DrawGradient(polygon)",
536 [&] (OutputDevice
* pDev
) {
537 return pDev
->DrawGradient(aPoly3
, aGradient
);
540 /* void DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch ); */
543 [&] (OutputDevice
* pDev
) {
544 return pDev
->DrawHatch(aPoly3
, aHatch
);
547 /* void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper ); */
550 [&] (OutputDevice
* pDev
) {
551 return pDev
->DrawWallpaper(aRect2
, aWallpaper
);
554 /* void DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags ); */
557 [&] (OutputDevice
* pDev
) {
558 return pDev
->DrawGrid(aRect
, Size(10,20), DrawGridFlags::HorzLines
|DrawGridFlags::VertLines
);
561 /* void DrawTransparent( const tools::PolyPolygon& rPolyPoly,
562 sal_uInt16 nTransparencePercent );
566 [&] (OutputDevice
* pDev
) {
567 return pDev
->DrawTransparent(aPoly3
, sal_uInt16(50));
570 /* void DrawTransparent( const GDIMetaFile& rMtf,
571 const Point& rPos, const Size& rSize,
572 const Gradient& rTransparenceGradient );
575 "DrawTransparent(metafile)",
576 [&] (OutputDevice
* pDev
) {
577 return pDev
->DrawTransparent(aMtf
, aPt1
, aRect
.GetSize(), aGradient
);
583 [] (OutputDevice
* pDev
) { return pDev
->Erase(); } );
587 void grindFunc( OutputDevice
& rTarget
,
588 functor_vector_type::const_iterator
const & iter
,
592 const sal_uInt32
nStartTime( osl_getGlobalTimer() );
594 for( sal_Int32 i
=0; i
<nTurns
; ++i
)
595 iter
->second(&rTarget
);
597 if( rTarget
.GetOutDevType() == OUTDEV_WINDOW
)
598 static_cast< vcl::Window
& >( rTarget
).Flush();
601 "Duration: %d ms (%d repetitions)\tOperation: %s\tSetup: %s\n",
602 static_cast<int>(osl_getGlobalTimer() - nStartTime
),
603 static_cast<int>(nTurns
),
608 /** Call OutputDevice render methods repeatedly, and output elapsed
611 void outDevGrind(vcl::RenderContext
& rTarget
)
613 sal_Int32 nTurns
= 100;
614 // TODO(F1): also profile pure complex clip setup times!
616 // State: fill/line color, draw mode, w/o clip, rect clip, complex clip
617 functor_vector_type aMethods
;
618 setupMethodStubs( aMethods
);
620 const tools::Rectangle
aClipRect(10,10,1000,1000);
621 const tools::Polygon
aPoly1( aClipRect
);
622 tools::Polygon
aPoly2( aClipRect
);
623 aPoly2
.Rotate(aClipRect
.Center(),450);
624 tools::PolyPolygon
aClipPoly(aPoly1
);
625 aClipPoly
.Insert(aPoly2
);
627 functor_vector_type::const_iterator iter
= aMethods
.begin();
628 const functor_vector_type::const_iterator end
= aMethods
.end();
631 rTarget
.SetLineColor( COL_BLACK
);
632 rTarget
.SetFillColor( COL_GREEN
);
633 rTarget
.SetRasterOp( RasterOp::OverPaint
);
634 rTarget
.SetClipRegion();
635 grindFunc( rTarget
, iter
, nTurns
, "w/o clip, w/o xor" );
637 rTarget
.SetLineColor( COL_BLACK
);
638 rTarget
.SetFillColor( COL_GREEN
);
639 rTarget
.SetRasterOp( RasterOp::OverPaint
);
640 rTarget
.SetClipRegion( vcl::Region( aClipRect
) );
641 grindFunc( rTarget
, iter
, nTurns
, "with rect clip, w/o xor" );
643 rTarget
.SetLineColor( COL_BLACK
);
644 rTarget
.SetFillColor( COL_GREEN
);
645 rTarget
.SetRasterOp( RasterOp::OverPaint
);
646 rTarget
.SetClipRegion( vcl::Region( aClipPoly
) );
647 grindFunc( rTarget
, iter
, nTurns
, "with complex clip, w/o xor" );
649 rTarget
.SetLineColor( COL_BLACK
);
650 rTarget
.SetFillColor( COL_GREEN
);
651 rTarget
.SetRasterOp( RasterOp::Xor
);
652 rTarget
.SetClipRegion();
653 grindFunc( rTarget
, iter
, nTurns
, "w/o clip, with xor" );
655 rTarget
.SetLineColor( COL_BLACK
);
656 rTarget
.SetFillColor( COL_GREEN
);
657 rTarget
.SetRasterOp( RasterOp::Xor
);
658 rTarget
.SetClipRegion( vcl::Region( aClipRect
) );
659 grindFunc( rTarget
, iter
, nTurns
, "with rect clip, with xor" );
661 rTarget
.SetLineColor( COL_BLACK
);
662 rTarget
.SetFillColor( COL_GREEN
);
663 rTarget
.SetRasterOp( RasterOp::Xor
);
664 rTarget
.SetClipRegion( vcl::Region( aClipPoly
) );
665 grindFunc( rTarget
, iter
, nTurns
, "with complex clip, with xor" );
671 void TestWindow::Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
&)
673 outDevGrind(rRenderContext
);
677 void GrindApp::Exception( ExceptionCategory nCategory
)
681 case ExceptionCategory::ResourceNotLoaded
:
682 Abort( "Error: could not load language resources.\nPlease check your installation.\n" );
690 ScopedVclPtrInstance
<TestWindow
> aWindow
;
704 for( sal_uInt16 i
= 0; i
< Application::GetCommandLineParamCount(); i
++ )
706 OUString aParam
= Application::GetCommandLineParam( i
);
708 if( aParam
== "--help" || aParam
== "-h" )
714 printf( "outdevgrind - Profile OutputDevice\n" );
718 tools::extendApplicationEnvironment();
720 uno::Reference
< uno::XComponentContext
> xContext
= cppu::defaultBootstrap_InitialComponentContext();
721 uno::Reference
< lang::XMultiServiceFactory
> xServiceManager( xContext
->getServiceManager(), uno::UNO_QUERY
);
723 if( !xServiceManager
.is() )
724 Application::Abort( "Failed to bootstrap" );
726 comphelper::setProcessServiceFactory( xServiceManager
);
735 catch (const css::uno::Exception
&)
737 TOOLS_WARN_EXCEPTION("vcl.app", "Fatal");
740 catch (const std::exception
& e
)
742 SAL_WARN("vcl.app", "Fatal: " << e
.what());
749 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */