[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - 3 commits - include/vcl vcl/source

Caolán McNamara caolanm at redhat.com
Wed Jun 17 03:13:21 PDT 2015


 include/vcl/outdev.hxx               |    2 ++
 vcl/source/outdev/bitmap.cxx         |   26 ++++++++++++++++++++++++++
 vcl/source/outdev/curvedshapes.cxx   |    9 +++++++++
 vcl/source/outdev/gradient.cxx       |   27 +++++++++++++++++++++++++--
 vcl/source/outdev/hatch.cxx          |   12 +++++++++---
 vcl/source/outdev/line.cxx           |    5 ++++-
 vcl/source/outdev/mask.cxx           |    9 +++++++++
 vcl/source/outdev/nativecontrols.cxx |    2 ++
 vcl/source/outdev/pixel.cxx          |    6 ++++++
 vcl/source/outdev/polygon.cxx        |    7 ++++++-
 vcl/source/outdev/polyline.cxx       |    8 +++++++-
 vcl/source/outdev/rect.cxx           |   11 ++++++++++-
 vcl/source/outdev/text.cxx           |    9 ++++++++-
 vcl/source/outdev/textline.cxx       |    5 ++++-
 vcl/source/outdev/transparent.cxx    |   14 ++++++++++++--
 vcl/source/outdev/wallpaper.cxx      |   11 +++++++++++
 vcl/source/window/window.cxx         |    3 +--
 17 files changed, 151 insertions(+), 15 deletions(-)

New commits:
commit 4cc6ad5c27afce072859150333ce6b962a036383
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 31 20:28:06 2015 +0100

    masses of coverity FORWARD_NULL warnings from copied assert
    
    Change-Id: I8f698bbcf4d53a4477cc0ee0c3f2c7f08e521f8a

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index b00f2d3..1754058 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -613,6 +613,8 @@ protected:
 
     SAL_DLLPRIVATE void         drawOutDevDirect ( const OutputDevice* pSrcDev, SalTwoRect& rPosAry );
 
+    SAL_DLLPRIVATE void         assert_if_double_buffered_window() const;
+
 private:
 
     // not implemented; to detect misuses of DrawOutDev(...OutputDevice&);
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index f59e441..718cef9 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -36,7 +36,7 @@
 
 void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     const Size aSizePix( rBitmap.GetSizePixel() );
     DrawBitmap( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmap, MetaActionType::BMP );
@@ -44,7 +44,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap )
 
 void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     DrawBitmap( rDestPt, rDestSize, Point(), rBitmap.GetSizePixel(), rBitmap, MetaActionType::BMPSCALE );
 }
@@ -54,7 +54,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize,
                                    const Point& rSrcPtPixel, const Size& rSrcSizePixel,
                                    const Bitmap& rBitmap, const MetaActionType nAction )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( ImplIsRecordLayout() )
         return;
@@ -236,7 +236,7 @@ Bitmap OutputDevice::GetDownsampledBitmap( const Size& rDstSz,
 void OutputDevice::DrawBitmapEx( const Point& rDestPt,
                                  const BitmapEx& rBitmapEx )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( ImplIsRecordLayout() )
         return;
@@ -255,7 +255,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt,
 void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
                                  const BitmapEx& rBitmapEx )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( ImplIsRecordLayout() )
         return;
@@ -275,7 +275,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
                                  const Point& rSrcPtPixel, const Size& rSrcSizePixel,
                                  const BitmapEx& rBitmapEx, const MetaActionType nAction )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( ImplIsRecordLayout() )
         return;
@@ -492,7 +492,7 @@ void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize
                                      const Point& rSrcPtPixel, const Size& rSrcSizePixel,
                                      BitmapEx& rBitmapEx )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if (rBitmapEx.IsAlpha())
     {
@@ -622,7 +622,7 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& rBmp, const AlphaMask& r
                                     const Point& rDestPt, const Size& rDestSize,
                                     const Point& rSrcPtPixel, const Size& rSrcSizePixel )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     Point     aOutPt(LogicToPixel(rDestPt));
     Size      aOutSz(LogicToPixel(rDestSize));
@@ -918,7 +918,7 @@ private:
 
 void OutputDevice::DrawDeviceAlphaBitmapSlowPath(const Bitmap& rBitmap, const AlphaMask& rAlpha, Rectangle aDstRect, Rectangle aBmpRect, Size& aOutSize, Point& aOutPoint)
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     VirtualDevice* pOldVDev = mpAlphaVDev;
 
@@ -1036,7 +1036,7 @@ bool OutputDevice::DrawTransformBitmapExDirect(
         const basegfx::B2DHomMatrix& aFullTransform,
         const BitmapEx& rBitmapEx)
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     bool bDone = false;
 
@@ -1157,7 +1157,7 @@ void OutputDevice::DrawTransformedBitmapEx(
     const basegfx::B2DHomMatrix& rTransformation,
     const BitmapEx& rBitmapEx)
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( ImplIsRecordLayout() )
         return;
@@ -1330,7 +1330,7 @@ namespace
 
 void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, DrawImageFlags nStyle )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     DrawImage( rPos, Size(), rImage, nStyle );
 }
@@ -1338,7 +1338,7 @@ void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, DrawImageF
 void OutputDevice::DrawImage( const Point& rPos, const Size& rSize,
                               const Image& rImage, DrawImageFlags nStyle )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     bool bIsSizeValid = rSize.getWidth() != 0 && rSize.getHeight() != 0;
 
diff --git a/vcl/source/outdev/curvedshapes.cxx b/vcl/source/outdev/curvedshapes.cxx
index db8f7d6..0190a4d 100644
--- a/vcl/source/outdev/curvedshapes.cxx
+++ b/vcl/source/outdev/curvedshapes.cxx
@@ -25,7 +25,7 @@
 
 void OutputDevice::DrawEllipse( const Rectangle& rRect )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaEllipseAction( rRect ) );
@@ -73,7 +73,7 @@ void OutputDevice::DrawEllipse( const Rectangle& rRect )
 void OutputDevice::DrawArc( const Rectangle& rRect,
                             const Point& rStartPt, const Point& rEndPt )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaArcAction( rRect, rStartPt, rEndPt ) );
@@ -117,7 +117,7 @@ void OutputDevice::DrawArc( const Rectangle& rRect,
 void OutputDevice::DrawPie( const Rectangle& rRect,
                             const Point& rStartPt, const Point& rEndPt )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaPieAction( rRect, rStartPt, rEndPt ) );
@@ -168,7 +168,7 @@ void OutputDevice::DrawPie( const Rectangle& rRect,
 void OutputDevice::DrawChord( const Rectangle& rRect,
                               const Point& rStartPt, const Point& rEndPt )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaChordAction( rRect, rStartPt, rEndPt ) );
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index ca0e949..41c2455 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -32,7 +32,7 @@
 void OutputDevice::DrawGradient( const Rectangle& rRect,
                                  const Gradient& rGradient )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     // Convert rectangle to a tools::PolyPolygon by first converting to a Polygon
     Polygon aPolygon ( rRect );
@@ -44,7 +44,7 @@ void OutputDevice::DrawGradient( const Rectangle& rRect,
 void OutputDevice::DrawGradient( const tools::PolyPolygon& rPolyPoly,
                                  const Gradient& rGradient )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( mnDrawMode & DrawModeFlags::NoGradient )
         return;     // nothing to draw!
@@ -172,7 +172,7 @@ void OutputDevice::ClipAndDrawGradientMetafile ( const Gradient &rGradient, cons
 void OutputDevice::DrawGradientToMetafile ( const tools::PolyPolygon& rPolyPoly,
                                             const Gradient& rGradient )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( !mpMetaFile )
         return;
@@ -260,7 +260,7 @@ void OutputDevice::DrawLinearGradient( const Rectangle& rRect,
                                        const Gradient& rGradient,
                                        const tools::PolyPolygon* pClixPolyPoly )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     // get BoundRect of rotated rectangle
     Rectangle aRect;
@@ -438,11 +438,19 @@ void OutputDevice::DrawLinearGradient( const Rectangle& rRect,
     }
 }
 
+void OutputDevice::assert_if_double_buffered_window() const
+{
+#ifndef NDEBUG
+    const vcl::Window *pWindow = dynamic_cast<const vcl::Window*>(this);
+    assert(!pWindow || !pWindow->SupportsDoubleBuffering());
+#endif
+}
+
 void OutputDevice::DrawComplexGradient( const Rectangle& rRect,
                                         const Gradient& rGradient,
                                         const tools::PolyPolygon* pClixPolyPoly )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     // Determine if we output via Polygon or PolyPolygon
     // For all rasteroperations other then Overpaint always use PolyPolygon,
@@ -608,7 +616,7 @@ void OutputDevice::DrawComplexGradient( const Rectangle& rRect,
 void OutputDevice::DrawLinearGradientToMetafile( const Rectangle& rRect,
                                                  const Gradient& rGradient )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     // get BoundRect of rotated rectangle
     Rectangle aRect;
@@ -788,7 +796,7 @@ void OutputDevice::DrawLinearGradientToMetafile( const Rectangle& rRect,
 void OutputDevice::DrawComplexGradientToMetafile( const Rectangle& rRect,
                                                   const Gradient& rGradient )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     // Determine if we output via Polygon or PolyPolygon
     // For all rasteroperations other then Overpaint always use PolyPolygon,
diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx
index a33fae3..1ccdcc7 100644
--- a/vcl/source/outdev/hatch.cxx
+++ b/vcl/source/outdev/hatch.cxx
@@ -44,7 +44,7 @@ extern "C" int SAL_CALL HatchCmpFnc( const void* p1, const void* p2 )
 
 void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     Hatch aHatch( rHatch );
 
@@ -139,7 +139,7 @@ void OutputDevice::AddHatchActions( const tools::PolyPolygon& rPolyPoly, const H
 
 void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch, bool bMtf )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if(rPolyPoly.Count())
     {
@@ -322,7 +322,7 @@ void OutputDevice::CalcHatchValues( const Rectangle& rRect, long nDist, sal_uInt
 void OutputDevice::DrawHatchLine( const Line& rLine, const tools::PolyPolygon& rPolyPoly,
                                       Point* pPtBuffer, bool bMtf )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     double  fX, fY;
     long    nAdd, nPCounter = 0;
diff --git a/vcl/source/outdev/line.cxx b/vcl/source/outdev/line.cxx
index f37280f..f8eba4a 100644
--- a/vcl/source/outdev/line.cxx
+++ b/vcl/source/outdev/line.cxx
@@ -35,7 +35,7 @@
 void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt,
                              const LineInfo& rLineInfo )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( rLineInfo.IsDefault() )
     {
@@ -89,7 +89,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt,
 
 void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaLineAction( rStartPt, rEndPt ) );
diff --git a/vcl/source/outdev/mask.cxx b/vcl/source/outdev/mask.cxx
index 29737a1..facbb9a 100644
--- a/vcl/source/outdev/mask.cxx
+++ b/vcl/source/outdev/mask.cxx
@@ -34,7 +34,7 @@ extern const sal_uLong nVCLLut[ 256 ];
 void OutputDevice::DrawMask( const Point& rDestPt,
                              const Bitmap& rBitmap, const Color& rMaskColor )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     const Size aSizePix( rBitmap.GetSizePixel() );
     DrawMask( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmap, rMaskColor, MetaActionType::MASK );
@@ -43,7 +43,7 @@ void OutputDevice::DrawMask( const Point& rDestPt,
 void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
                              const Bitmap& rBitmap, const Color& rMaskColor )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     DrawMask( rDestPt, rDestSize, Point(), rBitmap.GetSizePixel(), rBitmap, rMaskColor, MetaActionType::MASKSCALE );
 }
@@ -53,7 +53,7 @@ void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
                              const Bitmap& rBitmap, const Color& rMaskColor,
                              const MetaActionType nAction )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( ImplIsRecordLayout() )
         return;
@@ -108,7 +108,7 @@ void OutputDevice::DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
                               const Point& rDestPt, const Size& rDestSize,
                               const Point& rSrcPtPixel, const Size& rSrcSizePixel )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     const ImpBitmap* pImpBmp = rMask.ImplGetImpBitmap();
     if ( pImpBmp )
diff --git a/vcl/source/outdev/nativecontrols.cxx b/vcl/source/outdev/nativecontrols.cxx
index 6e9279c..0711021 100644
--- a/vcl/source/outdev/nativecontrols.cxx
+++ b/vcl/source/outdev/nativecontrols.cxx
@@ -273,7 +273,7 @@ bool OutputDevice::DrawNativeControl( ControlType nType,
                             const ImplControlValue& aValue,
                             const OUString& aCaption )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( !EnableNativeWidget( *this ) )
         return false;
diff --git a/vcl/source/outdev/pixel.cxx b/vcl/source/outdev/pixel.cxx
index c4f6528..8310a72 100644
--- a/vcl/source/outdev/pixel.cxx
+++ b/vcl/source/outdev/pixel.cxx
@@ -57,7 +57,7 @@ Color OutputDevice::GetPixel( const Point& rPt ) const
 
 void OutputDevice::DrawPixel( const Point& rPt )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaPointAction( rPt ) );
@@ -87,7 +87,7 @@ void OutputDevice::DrawPixel( const Point& rPt )
 
 void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     Color aColor = ImplDrawModeToColor( rColor );
 
@@ -116,7 +116,7 @@ void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
 
 void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( !pColors )
     {
@@ -163,7 +163,7 @@ void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors )
 
 void OutputDevice::DrawPixel( const Polygon& rPts, const Color& rColor )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( rColor != COL_TRANSPARENT && ! ImplIsRecordLayout() )
     {
diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx
index c25025c..9b703a0 100644
--- a/vcl/source/outdev/polygon.cxx
+++ b/vcl/source/outdev/polygon.cxx
@@ -33,7 +33,7 @@
 
 void OutputDevice::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( mpMetaFile )
         mpMetaFile->AddAction( new MetaPolyPolygonAction( rPolyPoly ) );
@@ -131,7 +131,7 @@ void OutputDevice::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly )
 
 void OutputDevice::DrawPolygon( const basegfx::B2DPolygon& rB2DPolygon)
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     // AW: Do NOT paint empty polygons
     if(rB2DPolygon.count())
@@ -143,7 +143,7 @@ void OutputDevice::DrawPolygon( const basegfx::B2DPolygon& rB2DPolygon)
 
 void OutputDevice::DrawPolygon( const Polygon& rPoly )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( mpMetaFile )
         mpMetaFile->AddAction( new MetaPolygonAction( rPoly ) );
@@ -239,7 +239,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly )
 
 void OutputDevice::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rB2DPolyPoly )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( mpMetaFile )
         mpMetaFile->AddAction( new MetaPolyPolygonAction( tools::PolyPolygon( rB2DPolyPoly ) ) );
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index 236d2cd..3be82cf 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -31,7 +31,7 @@
 
 void OutputDevice::DrawPolyLine( const Polygon& rPoly )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( mpMetaFile )
         mpMetaFile->AddAction( new MetaPolyLineAction( rPoly ) );
@@ -101,7 +101,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly )
 
 void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( rLineInfo.IsDefault() )
     {
@@ -129,7 +129,7 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
                                  basegfx::B2DLineJoin eLineJoin,
                                  css::drawing::LineCap eLineCap)
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( mpMetaFile )
     {
@@ -275,7 +275,7 @@ bool OutputDevice::DrawPolyLineDirect( const basegfx::B2DPolygon& rB2DPolygon,
                                        css::drawing::LineCap eLineCap,
                                        bool bBypassAACheck )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     // AW: Do NOT paint empty PolyPolygons
     if(!rB2DPolygon.count())
diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx
index 4492352..a9ebc0a 100644
--- a/vcl/source/outdev/rect.cxx
+++ b/vcl/source/outdev/rect.cxx
@@ -29,7 +29,7 @@
 
 void OutputDevice::DrawRect( const Rectangle& rRect )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaRectAction( rRect ) );
@@ -68,7 +68,7 @@ void OutputDevice::DrawRect( const Rectangle& rRect )
 void OutputDevice::DrawRect( const Rectangle& rRect,
                              sal_uLong nHorzRound, sal_uLong nVertRound )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaRoundRectAction( rRect, nHorzRound, nVertRound ) );
@@ -128,7 +128,7 @@ void OutputDevice::DrawRect( const Rectangle& rRect,
 
 void OutputDevice::DrawCheckered(const Point& rPos, const Size& rSize, sal_uInt32 nLen, Color aStart, Color aEnd)
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     const sal_uInt32 nMaxX(rPos.X() + rSize.Width());
     const sal_uInt32 nMaxY(rPos.Y() + rSize.Height());
@@ -154,7 +154,7 @@ void OutputDevice::DrawCheckered(const Point& rPos, const Size& rSize, sal_uInt3
 
 void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, DrawGridFlags nFlags )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() );
     aDstRect.Intersection( rRect );
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 5c1749f..c43e718 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -838,7 +838,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr,
                              MetricVector* pVector, OUString* pDisplayText
                              )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if(nLen == 0x0FFFF)
     {
@@ -961,7 +961,7 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const OUString& rStr,
                                   const long* pDXAry,
                                   sal_Int32 nIndex, sal_Int32 nLen, SalLayoutFlags flags )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if(nLen == 0x0FFFF)
     {
@@ -1166,7 +1166,7 @@ void OutputDevice::DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
                                     const OUString& rStr,
                                     sal_Int32 nIndex, sal_Int32 nLen)
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if(nIndex < 0 || nIndex == 0x0FFFF || nLen == 0x0FFFF)
     {
@@ -1840,7 +1840,7 @@ void OutputDevice::DrawText( const Rectangle& rRect, const OUString& rOrigStr, D
                              MetricVector* pVector, OUString* pDisplayText,
                              vcl::ITextLayout* _pTextLayout )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if (mpOutDevData->mpRecordLayout)
     {
@@ -2148,7 +2148,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr,
                                  sal_Int32 nIndex, sal_Int32 nLen,
                                  DrawTextFlags nStyle, MetricVector* pVector, OUString* pDisplayText )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if(nLen == 0x0FFFF)
     {
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index 8e55eca..551e556 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -941,7 +941,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
                                  FontUnderline eOverline,
                                  bool bUnderlineAbove )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaTextLineAction( rPos, nWidth, eStrikeout, eUnderline, eOverline ) );
@@ -985,7 +985,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
 
 void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
         return;
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index 7d4e027..6827fc3 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -218,7 +218,7 @@ void OutputDevice::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask
 
 void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency)
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     // AW: Do NOT paint empty PolyPolygons
     if(!rB2DPolyPoly.count())
@@ -282,7 +282,7 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly,
 
 void OutputDevice::DrawInvisiblePolygon( const tools::PolyPolygon& rPolyPoly )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     // short circuit if the polygon border is invisible too
     if( !mbLineColor )
@@ -298,7 +298,7 @@ void OutputDevice::DrawInvisiblePolygon( const tools::PolyPolygon& rPolyPoly )
 bool OutputDevice::DrawTransparentNatively ( const tools::PolyPolygon& rPolyPoly,
                                              sal_uInt16 nTransparencePercent )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     bool bDrawn = false;
 
@@ -607,7 +607,7 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
 void OutputDevice::DrawTransparent( const tools::PolyPolygon& rPolyPoly,
                                     sal_uInt16 nTransparencePercent )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     // short circuit for drawing an opaque polygon
     if( (nTransparencePercent < 1) || (mnDrawMode & DrawModeFlags::NoTransparency) )
@@ -659,7 +659,7 @@ void OutputDevice::DrawTransparent( const tools::PolyPolygon& rPolyPoly,
 void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
                                     const Size& rSize, const Gradient& rTransparenceGradient )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     const Color aBlack( COL_BLACK );
 
diff --git a/vcl/source/outdev/wallpaper.cxx b/vcl/source/outdev/wallpaper.cxx
index c9f3c4c..367ecea 100644
--- a/vcl/source/outdev/wallpaper.cxx
+++ b/vcl/source/outdev/wallpaper.cxx
@@ -26,7 +26,7 @@
 void OutputDevice::DrawWallpaper( const Rectangle& rRect,
                                   const Wallpaper& rWallpaper )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaWallpaperAction( rRect, rWallpaper ) );
@@ -54,7 +54,7 @@ void OutputDevice::DrawWallpaper( long nX, long nY,
                                   long nWidth, long nHeight,
                                   const Wallpaper& rWallpaper )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     if( rWallpaper.IsBitmap() )
         DrawBitmapWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
@@ -68,7 +68,7 @@ void OutputDevice::DrawColorWallpaper( long nX, long nY,
                                        long nWidth, long nHeight,
                                        const Wallpaper& rWallpaper )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     // draw wallpaper without border
     Color aOldLineColor = GetLineColor();
@@ -107,7 +107,7 @@ void OutputDevice::DrawBitmapWallpaper( long nX, long nY,
                                             long nWidth, long nHeight,
                                             const Wallpaper& rWallpaper )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     BitmapEx aBmpEx;
     const BitmapEx* pCached = rWallpaper.ImplGetImpWallpaper()->ImplGetCachedBitmap();
@@ -345,7 +345,7 @@ void OutputDevice::DrawGradientWallpaper( long nX, long nY,
                                           long nWidth, long nHeight,
                                           const Wallpaper& rWallpaper )
 {
-    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+    assert_if_double_buffered_window();
 
     Rectangle aBound;
     GDIMetaFile* pOldMetaFile = mpMetaFile;
commit 97debe3f49970c5df92fefc20e8a7b43d31eaeae
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Sat May 23 18:52:00 2015 +0200

    rendercontext: Add asserts to easily catch the direct rendering cases.
    
    Change-Id: I5e05b08e30930740be0fdbb18169bf350e2eab9f

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index a924d5b..f59e441 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -24,6 +24,7 @@
 #include <vcl/outdev.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/image.hxx>
+#include <vcl/window.hxx>
 
 #include <bmpfast.hxx>
 #include <salgdi.hxx>
@@ -35,12 +36,16 @@
 
 void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     const Size aSizePix( rBitmap.GetSizePixel() );
     DrawBitmap( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmap, MetaActionType::BMP );
 }
 
 void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     DrawBitmap( rDestPt, rDestSize, Point(), rBitmap.GetSizePixel(), rBitmap, MetaActionType::BMPSCALE );
 }
 
@@ -49,6 +54,8 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize,
                                    const Point& rSrcPtPixel, const Size& rSrcSizePixel,
                                    const Bitmap& rBitmap, const MetaActionType nAction )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if( ImplIsRecordLayout() )
         return;
 
@@ -229,6 +236,8 @@ Bitmap OutputDevice::GetDownsampledBitmap( const Size& rDstSz,
 void OutputDevice::DrawBitmapEx( const Point& rDestPt,
                                  const BitmapEx& rBitmapEx )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if( ImplIsRecordLayout() )
         return;
 
@@ -246,6 +255,8 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt,
 void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
                                  const BitmapEx& rBitmapEx )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if( ImplIsRecordLayout() )
         return;
 
@@ -264,6 +275,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
                                  const Point& rSrcPtPixel, const Size& rSrcSizePixel,
                                  const BitmapEx& rBitmapEx, const MetaActionType nAction )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if( ImplIsRecordLayout() )
         return;
@@ -480,6 +492,8 @@ void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize
                                      const Point& rSrcPtPixel, const Size& rSrcSizePixel,
                                      BitmapEx& rBitmapEx )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if (rBitmapEx.IsAlpha())
     {
         DrawDeviceAlphaBitmap(rBitmapEx.GetBitmap(), rBitmapEx.GetAlpha(), rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel);
@@ -608,6 +622,8 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& rBmp, const AlphaMask& r
                                     const Point& rDestPt, const Size& rDestSize,
                                     const Point& rSrcPtPixel, const Size& rSrcSizePixel )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     Point     aOutPt(LogicToPixel(rDestPt));
     Size      aOutSz(LogicToPixel(rDestSize));
     Rectangle aDstRect(Point(), GetOutputSizePixel());
@@ -902,6 +918,8 @@ private:
 
 void OutputDevice::DrawDeviceAlphaBitmapSlowPath(const Bitmap& rBitmap, const AlphaMask& rAlpha, Rectangle aDstRect, Rectangle aBmpRect, Size& aOutSize, Point& aOutPoint)
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     VirtualDevice* pOldVDev = mpAlphaVDev;
 
     const bool  bHMirr = aOutSize.Width() < 0;
@@ -1018,6 +1036,8 @@ bool OutputDevice::DrawTransformBitmapExDirect(
         const basegfx::B2DHomMatrix& aFullTransform,
         const BitmapEx& rBitmapEx)
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     bool bDone = false;
 
     // try to paint directly
@@ -1137,6 +1157,8 @@ void OutputDevice::DrawTransformedBitmapEx(
     const basegfx::B2DHomMatrix& rTransformation,
     const BitmapEx& rBitmapEx)
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if( ImplIsRecordLayout() )
         return;
 
@@ -1308,12 +1330,16 @@ namespace
 
 void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, DrawImageFlags nStyle )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     DrawImage( rPos, Size(), rImage, nStyle );
 }
 
 void OutputDevice::DrawImage( const Point& rPos, const Size& rSize,
                               const Image& rImage, DrawImageFlags nStyle )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     bool bIsSizeValid = rSize.getWidth() != 0 && rSize.getHeight() != 0;
 
     if( rImage.mpImplData && !ImplIsRecordLayout() )
diff --git a/vcl/source/outdev/curvedshapes.cxx b/vcl/source/outdev/curvedshapes.cxx
index 92697ff..db8f7d6 100644
--- a/vcl/source/outdev/curvedshapes.cxx
+++ b/vcl/source/outdev/curvedshapes.cxx
@@ -19,11 +19,14 @@
 
 #include <vcl/outdev.hxx>
 #include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
 
 #include <salgdi.hxx>
 
 void OutputDevice::DrawEllipse( const Rectangle& rRect )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaEllipseAction( rRect ) );
 
@@ -70,6 +73,8 @@ void OutputDevice::DrawEllipse( const Rectangle& rRect )
 void OutputDevice::DrawArc( const Rectangle& rRect,
                             const Point& rStartPt, const Point& rEndPt )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaArcAction( rRect, rStartPt, rEndPt ) );
 
@@ -112,6 +117,8 @@ void OutputDevice::DrawArc( const Rectangle& rRect,
 void OutputDevice::DrawPie( const Rectangle& rRect,
                             const Point& rStartPt, const Point& rEndPt )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaPieAction( rRect, rStartPt, rEndPt ) );
 
@@ -161,6 +168,8 @@ void OutputDevice::DrawPie( const Rectangle& rRect,
 void OutputDevice::DrawChord( const Rectangle& rRect,
                               const Point& rStartPt, const Point& rEndPt )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaChordAction( rRect, rStartPt, rEndPt ) );
 
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index 981cfac..ca0e949 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -20,9 +20,10 @@
 #include <tools/poly.hxx>
 
 #include <vcl/gradient.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/outdev.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
 
 #include "salgdi.hxx"
 
@@ -31,6 +32,8 @@
 void OutputDevice::DrawGradient( const Rectangle& rRect,
                                  const Gradient& rGradient )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     // Convert rectangle to a tools::PolyPolygon by first converting to a Polygon
     Polygon aPolygon ( rRect );
     tools::PolyPolygon aPolyPoly ( aPolygon );
@@ -41,6 +44,8 @@ void OutputDevice::DrawGradient( const Rectangle& rRect,
 void OutputDevice::DrawGradient( const tools::PolyPolygon& rPolyPoly,
                                  const Gradient& rGradient )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if ( mnDrawMode & DrawModeFlags::NoGradient )
         return;     // nothing to draw!
 
@@ -167,6 +172,8 @@ void OutputDevice::ClipAndDrawGradientMetafile ( const Gradient &rGradient, cons
 void OutputDevice::DrawGradientToMetafile ( const tools::PolyPolygon& rPolyPoly,
                                             const Gradient& rGradient )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if ( !mpMetaFile )
         return;
 
@@ -253,6 +260,8 @@ void OutputDevice::DrawLinearGradient( const Rectangle& rRect,
                                        const Gradient& rGradient,
                                        const tools::PolyPolygon* pClixPolyPoly )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     // get BoundRect of rotated rectangle
     Rectangle aRect;
     Point     aCenter;
@@ -433,6 +442,8 @@ void OutputDevice::DrawComplexGradient( const Rectangle& rRect,
                                         const Gradient& rGradient,
                                         const tools::PolyPolygon* pClixPolyPoly )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     // Determine if we output via Polygon or PolyPolygon
     // For all rasteroperations other then Overpaint always use PolyPolygon,
     // as we will get wrong results if we output multiple times on top of each other.
@@ -597,6 +608,8 @@ void OutputDevice::DrawComplexGradient( const Rectangle& rRect,
 void OutputDevice::DrawLinearGradientToMetafile( const Rectangle& rRect,
                                                  const Gradient& rGradient )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     // get BoundRect of rotated rectangle
     Rectangle aRect;
     Point     aCenter;
@@ -775,6 +788,8 @@ void OutputDevice::DrawLinearGradientToMetafile( const Rectangle& rRect,
 void OutputDevice::DrawComplexGradientToMetafile( const Rectangle& rRect,
                                                   const Gradient& rGradient )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     // Determine if we output via Polygon or PolyPolygon
     // For all rasteroperations other then Overpaint always use PolyPolygon,
     // as we will get wrong results if we output multiple times on top of each other.
diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx
index 928c07f..a33fae3 100644
--- a/vcl/source/outdev/hatch.cxx
+++ b/vcl/source/outdev/hatch.cxx
@@ -19,11 +19,12 @@
 
 #include <tools/line.hxx>
 
-#include <vcl/salbtype.hxx>
 #include <vcl/hatch.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/outdev.hxx>
+#include <vcl/salbtype.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
 
 #include "../gdi/pdfwriter_impl.hxx"
 
@@ -43,6 +44,7 @@ extern "C" int SAL_CALL HatchCmpFnc( const void* p1, const void* p2 )
 
 void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     Hatch aHatch( rHatch );
 
@@ -137,6 +139,8 @@ void OutputDevice::AddHatchActions( const tools::PolyPolygon& rPolyPoly, const H
 
 void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch, bool bMtf )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if(rPolyPoly.Count())
     {
         // #i115630# DrawHatch does not work with beziers included in the polypolygon, take care of that
@@ -318,6 +322,8 @@ void OutputDevice::CalcHatchValues( const Rectangle& rRect, long nDist, sal_uInt
 void OutputDevice::DrawHatchLine( const Line& rLine, const tools::PolyPolygon& rPolyPoly,
                                       Point* pPtBuffer, bool bMtf )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     double  fX, fY;
     long    nAdd, nPCounter = 0;
 
diff --git a/vcl/source/outdev/line.cxx b/vcl/source/outdev/line.cxx
index 790c285..f37280f 100644
--- a/vcl/source/outdev/line.cxx
+++ b/vcl/source/outdev/line.cxx
@@ -19,8 +19,9 @@
 
 #include <numeric>
 
-#include <vcl/virdev.hxx>
 #include <vcl/outdev.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
 
 #include <salgdi.hxx>
 
@@ -34,6 +35,7 @@
 void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt,
                              const LineInfo& rLineInfo )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if ( rLineInfo.IsDefault() )
     {
@@ -87,6 +89,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt,
 
 void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaLineAction( rStartPt, rEndPt ) );
diff --git a/vcl/source/outdev/mask.cxx b/vcl/source/outdev/mask.cxx
index b61115e..29737a1 100644
--- a/vcl/source/outdev/mask.cxx
+++ b/vcl/source/outdev/mask.cxx
@@ -19,6 +19,7 @@
 
 #include <vcl/outdev.hxx>
 #include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
 
 #include <salgdi.hxx>
 #include <impbmp.hxx>
@@ -33,6 +34,8 @@ extern const sal_uLong nVCLLut[ 256 ];
 void OutputDevice::DrawMask( const Point& rDestPt,
                              const Bitmap& rBitmap, const Color& rMaskColor )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     const Size aSizePix( rBitmap.GetSizePixel() );
     DrawMask( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmap, rMaskColor, MetaActionType::MASK );
 }
@@ -40,6 +43,8 @@ void OutputDevice::DrawMask( const Point& rDestPt,
 void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
                              const Bitmap& rBitmap, const Color& rMaskColor )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     DrawMask( rDestPt, rDestSize, Point(), rBitmap.GetSizePixel(), rBitmap, rMaskColor, MetaActionType::MASKSCALE );
 }
 
@@ -48,6 +53,8 @@ void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
                              const Bitmap& rBitmap, const Color& rMaskColor,
                              const MetaActionType nAction )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if( ImplIsRecordLayout() )
         return;
 
@@ -101,6 +108,8 @@ void OutputDevice::DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
                               const Point& rDestPt, const Size& rDestSize,
                               const Point& rSrcPtPixel, const Size& rSrcSizePixel )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     const ImpBitmap* pImpBmp = rMask.ImplGetImpBitmap();
     if ( pImpBmp )
     {
diff --git a/vcl/source/outdev/nativecontrols.cxx b/vcl/source/outdev/nativecontrols.cxx
index 7011dfb..6e9279c 100644
--- a/vcl/source/outdev/nativecontrols.cxx
+++ b/vcl/source/outdev/nativecontrols.cxx
@@ -273,6 +273,8 @@ bool OutputDevice::DrawNativeControl( ControlType nType,
                             const ImplControlValue& aValue,
                             const OUString& aCaption )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if( !EnableNativeWidget( *this ) )
         return false;
 
diff --git a/vcl/source/outdev/pixel.cxx b/vcl/source/outdev/pixel.cxx
index aeb34e8..c4f6528 100644
--- a/vcl/source/outdev/pixel.cxx
+++ b/vcl/source/outdev/pixel.cxx
@@ -57,6 +57,7 @@ Color OutputDevice::GetPixel( const Point& rPt ) const
 
 void OutputDevice::DrawPixel( const Point& rPt )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaPointAction( rPt ) );
@@ -86,6 +87,7 @@ void OutputDevice::DrawPixel( const Point& rPt )
 
 void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     Color aColor = ImplDrawModeToColor( rColor );
 
@@ -114,6 +116,8 @@ void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
 
 void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if ( !pColors )
     {
         DrawPixel( rPts, GetLineColor() );
@@ -159,6 +163,8 @@ void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors )
 
 void OutputDevice::DrawPixel( const Polygon& rPts, const Color& rColor )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if( rColor != COL_TRANSPARENT && ! ImplIsRecordLayout() )
     {
         const sal_uInt16 nSize = rPts.GetSize();
diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx
index 9741ffa..c25025c 100644
--- a/vcl/source/outdev/polygon.cxx
+++ b/vcl/source/outdev/polygon.cxx
@@ -25,14 +25,15 @@
 #include <tools/poly.hxx>
 #include <vcl/outdev.hxx>
 #include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
 
 #include "salgdi.hxx"
 
-
 #define OUTDEV_POLYPOLY_STACKBUF        32
 
 void OutputDevice::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if( mpMetaFile )
         mpMetaFile->AddAction( new MetaPolyPolygonAction( rPolyPoly ) );
@@ -130,6 +131,8 @@ void OutputDevice::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly )
 
 void OutputDevice::DrawPolygon( const basegfx::B2DPolygon& rB2DPolygon)
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     // AW: Do NOT paint empty polygons
     if(rB2DPolygon.count())
     {
@@ -140,6 +143,7 @@ void OutputDevice::DrawPolygon( const basegfx::B2DPolygon& rB2DPolygon)
 
 void OutputDevice::DrawPolygon( const Polygon& rPoly )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if( mpMetaFile )
         mpMetaFile->AddAction( new MetaPolygonAction( rPoly ) );
@@ -235,6 +239,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly )
 
 void OutputDevice::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rB2DPolyPoly )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if( mpMetaFile )
         mpMetaFile->AddAction( new MetaPolyPolygonAction( tools::PolyPolygon( rB2DPolyPoly ) ) );
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index b304913..236d2cd 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -23,13 +23,15 @@
 #include <basegfx/polygon/b2dlinegeometry.hxx>
 
 #include <vcl/outdev.hxx>
-#include <vcl/virdev.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
 
 #include "salgdi.hxx"
 
 void OutputDevice::DrawPolyLine( const Polygon& rPoly )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if( mpMetaFile )
         mpMetaFile->AddAction( new MetaPolyLineAction( rPoly ) );
@@ -99,6 +101,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly )
 
 void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if ( rLineInfo.IsDefault() )
     {
@@ -126,6 +129,7 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
                                  basegfx::B2DLineJoin eLineJoin,
                                  css::drawing::LineCap eLineCap)
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if( mpMetaFile )
     {
@@ -271,6 +275,8 @@ bool OutputDevice::DrawPolyLineDirect( const basegfx::B2DPolygon& rB2DPolygon,
                                        css::drawing::LineCap eLineCap,
                                        bool bBypassAACheck )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     // AW: Do NOT paint empty PolyPolygons
     if(!rB2DPolygon.count())
         return true;
diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx
index ceb91cd..4492352 100644
--- a/vcl/source/outdev/rect.cxx
+++ b/vcl/source/outdev/rect.cxx
@@ -21,13 +21,16 @@
 #include <tools/poly.hxx>
 #include <tools/helpers.hxx>
 
-#include <vcl/virdev.hxx>
 #include <vcl/outdev.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
 
 #include "salgdi.hxx"
 
 void OutputDevice::DrawRect( const Rectangle& rRect )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaRectAction( rRect ) );
 
@@ -65,6 +68,8 @@ void OutputDevice::DrawRect( const Rectangle& rRect )
 void OutputDevice::DrawRect( const Rectangle& rRect,
                              sal_uLong nHorzRound, sal_uLong nVertRound )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaRoundRectAction( rRect, nHorzRound, nVertRound ) );
 
@@ -123,6 +128,8 @@ void OutputDevice::DrawRect( const Rectangle& rRect,
 
 void OutputDevice::DrawCheckered(const Point& rPos, const Size& rSize, sal_uInt32 nLen, Color aStart, Color aEnd)
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     const sal_uInt32 nMaxX(rPos.X() + rSize.Width());
     const sal_uInt32 nMaxY(rPos.Y() + rSize.Height());
 
@@ -147,6 +154,8 @@ void OutputDevice::DrawCheckered(const Point& rPos, const Size& rSize, sal_uInt3
 
 void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, DrawGridFlags nFlags )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() );
     aDstRect.Intersection( rRect );
 
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index cda2ba2..5c1749f 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -838,7 +838,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr,
                              MetricVector* pVector, OUString* pDisplayText
                              )
 {
-
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if(nLen == 0x0FFFF)
     {
@@ -961,6 +961,8 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const OUString& rStr,
                                   const long* pDXAry,
                                   sal_Int32 nIndex, sal_Int32 nLen, SalLayoutFlags flags )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if(nLen == 0x0FFFF)
     {
         SAL_INFO("sal.rtl.xub",
@@ -1164,6 +1166,8 @@ void OutputDevice::DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
                                     const OUString& rStr,
                                     sal_Int32 nIndex, sal_Int32 nLen)
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if(nIndex < 0 || nIndex == 0x0FFFF || nLen == 0x0FFFF)
     {
         SAL_INFO("sal.rtl.xub",
@@ -1836,6 +1840,8 @@ void OutputDevice::DrawText( const Rectangle& rRect, const OUString& rOrigStr, D
                              MetricVector* pVector, OUString* pDisplayText,
                              vcl::ITextLayout* _pTextLayout )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if (mpOutDevData->mpRecordLayout)
     {
         pVector = &mpOutDevData->mpRecordLayout->m_aUnicodeBoundRects;
@@ -2142,6 +2148,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr,
                                  sal_Int32 nIndex, sal_Int32 nLen,
                                  DrawTextFlags nStyle, MetricVector* pVector, OUString* pDisplayText )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if(nLen == 0x0FFFF)
     {
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index 9f3820f..8e55eca 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -19,8 +19,9 @@
 #include <sal/types.h>
 
 #include <vcl/outdev.hxx>
-#include <vcl/virdev.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
 
 #include <tools/helpers.hxx>
 
@@ -940,6 +941,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
                                  FontUnderline eOverline,
                                  bool bUnderlineAbove )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaTextLineAction( rPos, nWidth, eStrikeout, eUnderline, eOverline ) );
@@ -983,6 +985,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
 
 void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
         return;
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index f51bb64..7d4e027 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -21,10 +21,11 @@
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <boost/scoped_array.hpp>
 
-#include <vcl/outdev.hxx>
-#include <vcl/virdev.hxx>
 #include <vcl/bmpacc.hxx>
+#include <vcl/outdev.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
 
 #include "outdata.hxx"
 #include "salgdi.hxx"
@@ -217,6 +218,8 @@ void OutputDevice::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask
 
 void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency)
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     // AW: Do NOT paint empty PolyPolygons
     if(!rB2DPolyPoly.count())
         return;
@@ -279,6 +282,8 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly,
 
 void OutputDevice::DrawInvisiblePolygon( const tools::PolyPolygon& rPolyPoly )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     // short circuit if the polygon border is invisible too
     if( !mbLineColor )
         return;
@@ -293,6 +298,8 @@ void OutputDevice::DrawInvisiblePolygon( const tools::PolyPolygon& rPolyPoly )
 bool OutputDevice::DrawTransparentNatively ( const tools::PolyPolygon& rPolyPoly,
                                              sal_uInt16 nTransparencePercent )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     bool bDrawn = false;
 
     // debug helper:
@@ -600,6 +607,8 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
 void OutputDevice::DrawTransparent( const tools::PolyPolygon& rPolyPoly,
                                     sal_uInt16 nTransparencePercent )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     // short circuit for drawing an opaque polygon
     if( (nTransparencePercent < 1) || (mnDrawMode & DrawModeFlags::NoTransparency) )
     {
@@ -650,6 +659,7 @@ void OutputDevice::DrawTransparent( const tools::PolyPolygon& rPolyPoly,
 void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
                                     const Size& rSize, const Gradient& rTransparenceGradient )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
 
     const Color aBlack( COL_BLACK );
 
diff --git a/vcl/source/outdev/wallpaper.cxx b/vcl/source/outdev/wallpaper.cxx
index ba7928b..c9f3c4c 100644
--- a/vcl/source/outdev/wallpaper.cxx
+++ b/vcl/source/outdev/wallpaper.cxx
@@ -19,12 +19,15 @@
 
 #include <vcl/outdev.hxx>
 #include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
 
 #include <wall2.hxx>
 
 void OutputDevice::DrawWallpaper( const Rectangle& rRect,
                                   const Wallpaper& rWallpaper )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaWallpaperAction( rRect, rWallpaper ) );
 
@@ -51,6 +54,8 @@ void OutputDevice::DrawWallpaper( long nX, long nY,
                                   long nWidth, long nHeight,
                                   const Wallpaper& rWallpaper )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     if( rWallpaper.IsBitmap() )
         DrawBitmapWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
     else if( rWallpaper.IsGradient() )
@@ -63,6 +68,8 @@ void OutputDevice::DrawColorWallpaper( long nX, long nY,
                                        long nWidth, long nHeight,
                                        const Wallpaper& rWallpaper )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     // draw wallpaper without border
     Color aOldLineColor = GetLineColor();
     Color aOldFillColor = GetFillColor();
@@ -100,6 +107,8 @@ void OutputDevice::DrawBitmapWallpaper( long nX, long nY,
                                             long nWidth, long nHeight,
                                             const Wallpaper& rWallpaper )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     BitmapEx aBmpEx;
     const BitmapEx* pCached = rWallpaper.ImplGetImpWallpaper()->ImplGetCachedBitmap();
     Point aPos;
@@ -336,6 +345,8 @@ void OutputDevice::DrawGradientWallpaper( long nX, long nY,
                                           long nWidth, long nHeight,
                                           const Wallpaper& rWallpaper )
 {
+    assert(!dynamic_cast<vcl::Window*>(this) || !dynamic_cast<vcl::Window*>(this)->SupportsDoubleBuffering());
+
     Rectangle aBound;
     GDIMetaFile* pOldMetaFile = mpMetaFile;
     const bool bOldMap = mbMap;
commit 730a34230a1e491c404ed46dce82d46f63d404be
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Jun 3 20:21:05 2015 +0900

    make it possible to force enable double buffering for all widgets
    
    Change-Id: Ia0c8e9d8a22abaa2c06aea2a0f790dc34903ac37

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 045681e..58463b5 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -755,7 +755,7 @@ WindowImpl::WindowImpl( WindowType nType )
     mbFill                              = true;
     mbSecondary                         = false;
     mbNonHomogeneous                    = false;
-    mbDoubleBuffering                   = false; // when we are not sure, assume it cannot do double-buffering via RenderContext
+    mbDoubleBuffering                   = getenv("VCL_DOUBLEBUFFERING_FORCE_ENABLE"); // when we are not sure, assume it cannot do double-buffering via RenderContext
 }
 
 WindowImpl::~WindowImpl()
@@ -3112,7 +3112,6 @@ void Window::Scroll( long nHorzScroll, long nVertScroll, sal_uInt16 nFlags )
 void Window::Scroll( long nHorzScroll, long nVertScroll,
                      const Rectangle& rRect, sal_uInt16 nFlags )
 {
-
     OutputDevice *pOutDev = GetOutDev();
     Rectangle aRect = pOutDev->ImplLogicToDevicePixel( rRect );
     aRect.Intersection( Rectangle( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ) );


More information about the Libreoffice-commits mailing list