include/vcl/salnativewidgets.hxx | 5 +++-- vcl/inc/opengl/x11/salvd.hxx | 1 + vcl/inc/unx/gtk/gtkgdi.hxx | 3 ++- vcl/inc/unx/salinst.h | 6 ++++++ vcl/inc/unx/salvd.h | 7 +++---- vcl/source/control/edit.cxx | 16 ++++++++++------ vcl/source/outdev/bitmap.cxx | 26 ++++++++++++++++++++++++++ vcl/source/outdev/curvedshapes.cxx | 9 +++++++++ vcl/source/outdev/gradient.cxx | 19 +++++++++++++++++-- vcl/source/outdev/hatch.cxx | 12 +++++++++--- vcl/source/outdev/line.cxx | 5 ++++- vcl/source/outdev/mask.cxx | 9 +++++++++ vcl/source/outdev/nativecontrols.cxx | 6 ++++++ 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/brdwin.cxx | 15 +++++---------- vcl/source/window/paint.cxx | 2 +- vcl/unx/generic/gdi/salvd.cxx | 27 ++++++++++++++++----------- vcl/unx/gtk/app/gtkinst.cxx | 6 +++++- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 11 ++++------- 26 files changed, 200 insertions(+), 56 deletions(-)
New commits: commit 891304bb0ad3af9d8d73f947f25477abf57485a4 Author: Jan Holesovsky <[email protected]> Date: Sun May 24 01:59:01 2015 +0200 rendercontext: Improve comboboxes in the double-buffered toolbar. Change-Id: I91bfb4ea4672ff09482679f8fcf18a65e5a6ee3c diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 114bab5..e67f09c 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -606,7 +606,7 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, bool bLayout) } // draw normal text Color aNormalTextColor = rRenderContext.GetTextColor(); - SetClipRegion(aNormalClipRegion); + rRenderContext.SetClipRegion(aNormalClipRegion); if (IsPaintTransparent()) rRenderContext.SetTextFillColor(); @@ -1027,6 +1027,10 @@ void Edit::ImplClearBackground(vcl::RenderContext& rRenderContext, long nXStart, void Edit::ImplPaintBorder(vcl::RenderContext& rRenderContext, long nXStart, long nXEnd) { + // this is not needed when double-buffering + if (SupportsDoubleBuffering()) + return; + Point aTmpPoint; Rectangle aRect(aTmpPoint, GetOutputSizePixel()); aRect.Left() = nXStart; commit 70bdecd7f0b423734d1b9042141b58180032caf9 Author: Jan Holesovsky <[email protected]> Date: Sun May 24 01:04:07 2015 +0200 rendercontext: Fix border window's painting to work well with rendercontext. This partially fixes rendering of comboboxes. Change-Id: I243f63a0cd83bb435876d3954a073df0acd54c58 diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index f35998c..0d6ab4e 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -637,16 +637,11 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, s bool bNativeOK = false; // for native widget drawing we must find out what // control this border belongs to - // FIXME RenderContext - ultimately we'll need to get rid of the - // vcl::Window here to get native widgets here - vcl::Window* pWin = NULL; - vcl::Window* pCtrl = NULL; - if (rRenderContext.GetOutDevType() == OUTDEV_WINDOW) - pWin = static_cast<vcl::Window*>(&rRenderContext); + vcl::Window* pCtrl = mpBorderWindow->GetWindow(GetWindowType::Client); ControlType aCtrlType = 0; ControlPart aCtrlPart = PART_ENTIRE_CONTROL; - if (pWin && (pCtrl = mpBorderWindow->GetWindow(GetWindowType::Client)) != NULL) + if (pCtrl) { switch (pCtrl->GetType()) { @@ -714,9 +709,9 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, s ImplControlValue aControlValue; ControlState nState = ControlState::ENABLED; - if (!pWin->IsEnabled()) + if (!mpBorderWindow->IsEnabled()) nState &= ~ControlState::ENABLED; - if (pWin->HasFocus()) + if (mpBorderWindow->HasFocus()) nState |= ControlState::FOCUSED; else if(mbNWFBorder) { @@ -782,7 +777,7 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, s if (nBorderStyle & WindowBorderStyle::MENU) nFlags |= DrawFrameFlags::Menu; // tell DrawFrame that we're drawing a window border of a frame window to avoid round corners - if (pWin && pWin == pWin->ImplGetFrameWindow()) + if (mpBorderWindow == mpBorderWindow->ImplGetFrameWindow()) nFlags |= DrawFrameFlags::WindowBorder; DecorationView aDecoView(&rRenderContext); commit 2d40468efc1a90969d4ed34f699a8f48277cb8b3 Author: Jan Holesovsky <[email protected]> Date: Sat May 23 21:37:25 2015 +0200 rendercontext: Make the Gtk+ native widgets work with double-buffering. Change-Id: Ic7101ab7cbaa7fd5f6b073a73ef0c0088b1af4c6 diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx index 5b0bda7..5177efe 100644 --- a/include/vcl/salnativewidgets.hxx +++ b/include/vcl/salnativewidgets.hxx @@ -246,11 +246,12 @@ enum class ControlState { HIDDEN = 0x0010, DEFAULT = 0x0020, SELECTED = 0x0040, - CACHING_ALLOWED = 0x8000, // set when the control is completely visible (i.e. not clipped) + DOUBLEBUFFERING = 0x4000, ///< Set when the control is painted using double-buffering via VirtualDevice. + CACHING_ALLOWED = 0x8000, ///< Set when the control is completely visible (i.e. not clipped). }; namespace o3tl { - template<> struct typed_flags<ControlState> : is_typed_flags<ControlState, 0x8007f> {}; + template<> struct typed_flags<ControlState> : is_typed_flags<ControlState, 0xc007f> {}; } /* ButtonValue: diff --git a/vcl/source/outdev/nativecontrols.cxx b/vcl/source/outdev/nativecontrols.cxx index 6fc43f6..6e9279c 100644 --- a/vcl/source/outdev/nativecontrols.cxx +++ b/vcl/source/outdev/nativecontrols.cxx @@ -18,6 +18,7 @@ */ #include <vcl/outdev.hxx> +#include <vcl/virdev.hxx> #include <vcl/window.hxx> #include <vcl/salnativewidgets.hxx> @@ -302,6 +303,9 @@ bool OutputDevice::DrawNativeControl( ControlType nType, if (aTestRegion == vcl::Region(rControlRegion)) nState |= ControlState::CACHING_ALLOWED; // control is not clipped, caching allowed + if (dynamic_cast<VirtualDevice*>(this)) + nState |= ControlState::DOUBLEBUFFERING; + bool bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, *aScreenCtrlValue, aCaption, this ); return bRet; diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index b4f1ba0..6eb6043 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -860,12 +860,9 @@ bool GtkSalGraphics::hitTestNativeControl( ControlType nType, * aValue: An optional value (tristate/numerical/string) * rCaption: A caption or title string (like button text etc) */ -bool GtkSalGraphics::drawNativeControl( ControlType nType, - ControlPart nPart, - const Rectangle& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - const OUString& rCaption ) +bool GtkSalGraphics::drawNativeControl(ControlType nType, ControlPart nPart, + const Rectangle& rControlRegion, ControlState nState, + const ImplControlValue& aValue, const OUString& rCaption) { // get a GC with current clipping region set GetFontGC(); @@ -891,7 +888,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, std::unique_ptr<GdkX11Pixmap> xPixmap; std::unique_ptr<GdkX11Pixmap> xMask; Rectangle aPixmapRect; - if( ( bNeedPixmapPaint ) + if ((bNeedPixmapPaint || (nState & ControlState::DOUBLEBUFFERING)) && nType != CTRL_SCROLLBAR && nType != CTRL_SPINBOX && nType != CTRL_TAB_ITEM commit 1926cfb9386269b81b6ca62bdc64591f2c403d03 Author: Jan Holesovsky <[email protected]> Date: Sat May 23 19:18:40 2015 +0200 rendercontext: Fix borderwindow rendering when called from class Edit. Change-Id: I0b63ee7fd30c9b6f67b9770386ba1904eea0e678 diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index b196dfa..114bab5 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1074,16 +1074,16 @@ void Edit::ImplPaintBorder(vcl::RenderContext& rRenderContext, long nXStart, lon aClipRgn.Move(aBorderOffs.X(), aBorderOffs.Y()); } - vcl::Region oldRgn(pBorder->GetClipRegion()); - pBorder->SetClipRegion(aClipRgn); + vcl::Region oldRgn(rRenderContext.GetClipRegion()); + rRenderContext.SetClipRegion(aClipRgn); - pBorder->Paint(*pBorder, Rectangle()); // FIXME + pBorder->Paint(rRenderContext, Rectangle()); - pBorder->SetClipRegion(oldRgn); + rRenderContext.SetClipRegion(oldRgn); } else { - pBorder->Paint(*pBorder, Rectangle()); // FIXME + pBorder->Paint(rRenderContext, Rectangle()); } } } commit 15afb15227667aa573a38249d3a24f962ecef9ce Author: Jan Holesovsky <[email protected]> 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 e46df33..6fc43f6 100644 --- a/vcl/source/outdev/nativecontrols.cxx +++ b/vcl/source/outdev/nativecontrols.cxx @@ -272,6 +272,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 5b42e32dcf0142b8ea3ffcfc2c7bbf9e4325465f Author: Jan Holesovsky <[email protected]> Date: Sat May 23 18:24:47 2015 +0200 rendercontext: PushPaintHelper needs the buffer as param too. Change-Id: I4e787356bd17fcaffdbe0dc51a549b359f416766 diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index e220a37..9776721 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -227,7 +227,7 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion) m_pBuffer->mnOutOffX = m_pWindow->GetOutOffXPixel() - m_pBuffer->mnOutOffX; m_pBuffer->mnOutOffY = m_pWindow->GetOutOffYPixel() - m_pBuffer->mnOutOffY; - m_pWindow->PushPaintHelper(this, *m_pWindow); + m_pWindow->PushPaintHelper(this, *m_pBuffer.get()); m_pWindow->Paint(*m_pBuffer.get(), m_aPaintRect); // restore the mnOutOffX/Y value commit b0cd381de11340de8e72020f774a64d3ade6bbd9 Author: Jan Holesovsky <[email protected]> Date: Sat May 23 15:31:51 2015 +0200 rendercontext: Initialize X11SalVirtualDevice with appropriate SalGraphics. Change-Id: I4230412ccc389b8ba6768229b569d7075e7ac466 diff --git a/vcl/inc/opengl/x11/salvd.hxx b/vcl/inc/opengl/x11/salvd.hxx index 2d60898..e4e6ecd 100644 --- a/vcl/inc/opengl/x11/salvd.hxx +++ b/vcl/inc/opengl/x11/salvd.hxx @@ -18,6 +18,7 @@ class SalDisplay; class X11OpenGLSalGraphics; +class X11SalGraphics; class X11OpenGLSalVirtualDevice : public SalVirtualDevice { diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index e0d0881..60b1513 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -26,12 +26,13 @@ #include <gdk/gdkkeysyms.h> #include <postx.h> +#include <unx/gtk/gtkframe.hxx> + #if GTK_CHECK_VERSION(3,0,0) #include <headless/svpgdi.hxx> #include "textrender.hxx" -class GtkSalFrame; class GtkSalGraphics : public SvpSalGraphics { GtkSalFrame *mpFrame; diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h index b8feb71..381ddda 100644 --- a/vcl/inc/unx/salinst.h +++ b/vcl/inc/unx/salinst.h @@ -34,6 +34,8 @@ namespace com { namespace sun { namespace star { namespace datatransfer { } } } } class SalXLib; +class X11SalGraphics; + class VCLPLUG_GEN_PUBLIC X11SalInstance : public SalGenericInstance { private: @@ -53,6 +55,10 @@ public: virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow = true ) SAL_OVERRIDE; virtual void DestroyObject( SalObject* pObject ) SAL_OVERRIDE; + /// Gtk vclplug needs to pass GtkSalGraphics to X11SalVirtualDevice, so create it, and pass as pNewGraphics. + virtual SalVirtualDevice* CreateX11VirtualDevice(SalGraphics* pGraphics, long &nDX, long &nDY, + sal_uInt16 nBitCount, const SystemGraphicsData* pData, X11SalGraphics* pNewGraphics); + virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) SAL_OVERRIDE; diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h index 4f98c0c..14ad97e 100644 --- a/vcl/inc/unx/salvd.h +++ b/vcl/inc/unx/salvd.h @@ -44,10 +44,9 @@ class X11SalVirtualDevice : public SalVirtualDevice bool bExternPixmap_; public: - X11SalVirtualDevice( SalGraphics *pGraphics, - long &nDX, long &nDY, - sal_uInt16 nBitCount, - const SystemGraphicsData *pData ); + X11SalVirtualDevice(SalGraphics *pGraphics, long &nDX, long &nDY, + sal_uInt16 nBitCount, const SystemGraphicsData *pData, X11SalGraphics* pNewGraphics); + virtual ~X11SalVirtualDevice(); Display *GetXDisplay() const diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index f64612b..847ea9d 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -35,14 +35,20 @@ #include <vcl/opengl/OpenGLHelper.hxx> #include <opengl/x11/salvd.hxx> -SalVirtualDevice* X11SalInstance::CreateVirtualDevice( SalGraphics* pGraphics, - long &nDX, long &nDY, - sal_uInt16 nBitCount, const SystemGraphicsData *pData ) +SalVirtualDevice* X11SalInstance::CreateX11VirtualDevice(SalGraphics* pGraphics, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData, + X11SalGraphics* pNewGraphics) { if (OpenGLHelper::isVCLOpenGLEnabled()) return new X11OpenGLSalVirtualDevice( pGraphics, nDX, nDY, nBitCount, pData ); else - return new X11SalVirtualDevice( pGraphics, nDX, nDY, nBitCount, pData ); + return new X11SalVirtualDevice(pGraphics, nDX, nDY, nBitCount, pData, pNewGraphics); +} + +SalVirtualDevice* X11SalInstance::CreateVirtualDevice(SalGraphics* pGraphics, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData) +{ + return CreateX11VirtualDevice(pGraphics, nDX, nDY, nBitCount, pData, new X11SalGraphics()); } void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, SalColormap* pColormap, @@ -81,12 +87,12 @@ void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, SalColormap* pColormap, mxImpl->Init(); } -X11SalVirtualDevice::X11SalVirtualDevice( SalGraphics* pGraphics, - long &nDX, long &nDY, - sal_uInt16 nBitCount, - const SystemGraphicsData *pData ) : - m_nXScreen( 0 ), - bGraphics_( false ) +X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics* pGraphics, long &nDX, long &nDY, + sal_uInt16 nBitCount, const SystemGraphicsData *pData, + X11SalGraphics* pNewGraphics) : + pGraphics_(pNewGraphics), + m_nXScreen(0), + bGraphics_(false) { SalColormap* pColormap = NULL; bool bDeleteColormap = false; @@ -95,7 +101,6 @@ X11SalVirtualDevice::X11SalVirtualDevice( SalGraphics* pGraphics, nBitCount = pGraphics->GetBitCount(); pDisplay_ = vcl_sal::getSalDisplay(GetGenericData()); - pGraphics_ = new X11SalGraphics(); nDepth_ = nBitCount; if( pData && pData->hDrawable != None ) diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx index f9883c8..11a18e5 100644 --- a/vcl/unx/gtk/app/gtkinst.cxx +++ b/vcl/unx/gtk/app/gtkinst.cxx @@ -23,6 +23,7 @@ #include <unx/gtk/gtkdata.hxx> #include <unx/gtk/gtkinst.hxx> #include <unx/salobj.h> +#include <unx/gtk/gtkgdi.hxx> #include <unx/gtk/gtkframe.hxx> #include <unx/gtk/gtkobject.hxx> #include <unx/gtk/atkbridge.hxx> @@ -320,7 +321,10 @@ SalVirtualDevice* GtkInstance::CreateVirtualDevice( SalGraphics *pG, pNew->SetSize( nDX, nDY ); return pNew; #else - return X11SalInstance::CreateVirtualDevice( pG, nDX, nDY, nBitCount, pGd ); + GtkSalGraphics *pGtkSalGraphics = dynamic_cast<GtkSalGraphics*>(pG); + assert(pGtkSalGraphics); + return CreateX11VirtualDevice(pG, nDX, nDY, nBitCount, pGd, + new GtkSalGraphics(pGtkSalGraphics->GetGtkFrame(), pGtkSalGraphics->GetGtkWidget())); #endif } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
