20#include <config_features.h>
37#if HAVE_FEATURE_OPENGL
46 : mpFrameData(pFrameData),
121 if (!getenv(
"VCL_DOUBLEBUFFERING_AVOID_PAINT"))
220 , m_nPaintFlags(nPaintFlags)
222 , m_bRestoreCursor(false)
223 , m_bStartedBufferedPaint(false)
278#if HAVE_FEATURE_OPENGL
290 SAL_WARN(
"vcl.window",
"non-double buffered window in the double-buffered hierarchy, painting directly: " <<
typeid(*
m_pWindow.
get()).name());
315#if HAVE_FEATURE_OPENGL
326 bool bChecked,
bool bDrawBorder,
bool bDrawExtBorderOnly,
332 bool bRoundEdges = nCornerRadius > 0;
338 Color aSelectionFillColor(aSelectionBorderColor);
346 if (!bDark && !bBright && std::abs(c2 - c1) < (pPaintColor ? 40 : 75))
351 if( b > 50 ) b -= 40;
354 aSelectionBorderColor = aSelectionFillColor;
359 if (aSelectionBorderColor.
IsDark())
366 if (bDrawExtBorderOnly)
380 sal_uInt16 nPercent = 0;
390 if (bChecked && nHighlight == 2)
401 nPercent = bRoundEdges ? 40 : 20;
403 else if (bChecked || nHighlight == 1)
414 nPercent = bRoundEdges ? 60 : 35;
434 if (bDark && bDrawExtBorderOnly)
437 if (pSelectionTextColor)
443 if (pSelectionTextColor)
449 *pSelectionTextColor = (nHLDiff >= nTextDiff) ? aHLTextColor : aTextColor;
473 rRenderContext.
Pop();
494 rRenderContext.
ReMirror(aPaintRect);
495 rRenderContext.
ReMirror(rPaintRegion);
507 Erase(rRenderContext);
511 Erase(rRenderContext);
632 while ( pTempWindow )
653 if (IsSystemWindow() &&
static_cast<const SystemWindow*
>(
this)->hasPendingLayout())
655 mpWindowImpl->mpFrameData->maPaintIdle.Start();
660 if (mpWindowImpl->mbFrame &&
661 mpWindowImpl->mpFrameData->maResizeIdle.IsActive())
663 mpWindowImpl->mpFrameData->maPaintIdle.Start();
665 else if ( mpWindowImpl->mbReallyVisible )
667 ImplCallOverlapPaint();
669 mpWindowImpl->mpFrameData->maPaintIdle.IsActive())
670 mpWindowImpl->mpFrameData->maPaintIdle.Stop();
678 if( mpWindowImpl->mbReallyVisible )
681 if( mpWindowImpl->mpFrameData->maPaintIdle.IsActive() )
683 mpWindowImpl->mpFrameData->maPaintIdle.Stop();
684 mpWindowImpl->mpFrameData->maPaintIdle.Invoke(
nullptr );
746 if ( !
mpWindowImpl->mpFrameData->maPaintIdle.IsActive() )
760 while ( pTempWindow )
772 mpWindowImpl->mpFrameWindow->ImplInvalidateOverlapFrameRegion( rRegion );
783 bool bInvalidateAll = !pRegion;
790 while ( pTempWindow )
794 pOpaqueWindow = pTempWindow;
796 bInvalidateAll =
false;
817 bInvalidateAll =
false;
818 if ( bInvalidateAll )
868 aTempRegion.
Move( nHorzScroll, nVertScroll );
910 if ( !aPaintAllRegion.
IsEmpty() )
912 aPaintAllRegion.
Move( nHorzScroll, nVertScroll );
963 bool bValidateAll =
true;
970 bValidateAll =
false;
994 if (
mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
996 Point aPoint( 0, 0 );
1032 mpWindowImpl->mpBorderWindow->SetPaintTransparent( bTransparent );
1069 mpWindowImpl->mpBorderWindow->SetWindowRegionPixel( rRegion );
1081 mpWindowImpl->maWinRegion.GetRegionRectangles(aRectangles);
1082 mpWindowImpl->mpFrame->BeginSetClipRegion(aRectangles.size());
1084 for (
auto const&
rectangle : aRectangles)
1139 return aPaintRegion;
1213 std::vector<vcl::LOKPayloadItem> aPayload;
1216 aRect = *pRectangle;
1221 aPayload.emplace_back(
"rectangle", aRect.
toString());
1223 pNotifier->notifyWindow(
GetLOKWindowId(),
"invalidate", aPayload);
1229 pParent->PixelInvalidate(&aRect);
1247 if (
mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
1282 bool bFlush =
false;
1283 if (
mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
1285 Point aPoint( 0, 0 );
1299 pUpdateWindow = pWindow;
1306 pWindow = pUpdateWindow;
1310 pUpdateWindow = pWindow;
1326 pUpdateOverlapWindow = pUpdateOverlapWindow->
mpWindowImpl->mpFirstOverlap;
1328 pUpdateOverlapWindow =
nullptr;
1329 while ( pUpdateOverlapWindow )
1332 pUpdateOverlapWindow = pUpdateOverlapWindow->
mpWindowImpl->mpNext;
1360 pDevice->SetOutputSizePixel(aSize);
1363 pDevice->SetFont(aCopyFont);
1369 pDevice->SetLineColor();
1374 pDevice->SetFillColor();
1379 pDevice->SetTextLineColor();
1384 pDevice->SetOverlineColor();
1389 pDevice->SetTextFillColor();
1392 pDevice->SetRasterOp(
GetOutDev()->GetRasterOp());
1397 pDevice->SetClipRegion();
1399 pDevice->SetClipRegion(aClipRegion);
1408 i_pTargetOutDev->
DrawOutDev(i_rPos, aSize,
Point(), pDevice->PixelToLogic(aSize), *pDevice);
1410 bool bHasMirroredGraphics = pDevice->HasMirroredGraphics();
1418 if( pChild->mpWindowImpl->mpFrame ==
mpWindowImpl->mpFrame && pChild->IsVisible() )
1421 if( bHasMirroredGraphics )
1426 Point aPos( i_rPos );
1427 aPos +=
Point(nDeltaX, nDeltaY);
1429 pChild->ImplPaintToDevice( i_pTargetOutDev, aPos );
1529 aMtf.
Play(*pMaskedDevice);
1537 if( pChild->mpWindowImpl->mpFrame ==
mpWindowImpl->mpFrame && pChild->IsVisible() )
1544 Point aPos( i_rPos );
1545 Point aDelta( nDeltaX, nDeltaY );
1547 pChild->ImplPaintToDevice( i_pTargetOutDev, aPos );
1585 mpWindowImpl->mpBorderWindow->ImplPaintToDevice( pDev, rPos );
1600 bool bNativeOK =
false;
1621 if (
GetOutDev()->mbBackground && !bNativeOK)
1638 if ( !
GetOutDev()->IsDeviceOutputNecessary() )
1644 if ( !nHorzScroll && !nVertScroll )
1669 bScrollChildren =
false;
1692 if (!aInvalidateRegion.
IsEmpty())
1694 aInvalidateRegion.
Move(bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll);
1698 aDestRect.
Move(bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll);
1700 if (bCopyExistingAreaAndElideInvalidate)
1701 aWinInvalidateRegion.
Exclude(aDestRect);
1703 aInvalidateRegion.
Union(aWinInvalidateRegion);
1711 aRegion.
Exclude( aInvalidateRegion );
1714 if ( !bScrollChildren )
1746 if (pGraphics && bCopyExistingAreaAndElideInvalidate)
1754 pGraphics->
CopyArea( rRect.
Left()+nHorzScroll, rRect.
Top()+nVertScroll,
1769 if ( !aInvalidateRegion.
IsEmpty() )
1775 if ( !bScrollChildren )
1785 if ( bScrollChildren )
1791 aPos +=
Point( nHorzScroll, nVertScroll );
#define VCL_GL_INFO(stream)
Helper to do a SAL_INFO as well as a GL log.
const StyleSettings & GetStyleSettings() const
sal_uInt8 GetLuminance() const
void DecreaseLuminance(sal_uInt8 cLumDec)
void RGBtoHSB(sal_uInt16 &nHue, sal_uInt16 &nSaturation, sal_uInt16 &nBrightness) const
void IncreaseLuminance(sal_uInt8 cLumInc)
static Color HSBtoRGB(sal_uInt16 nHue, sal_uInt16 nSaturation, sal_uInt16 nBrightness)
MapUnit GetMapUnit() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
SAL_DLLPRIVATE sal_Int32 GetDPIX() const
Get the output device's DPI x-axis value.
virtual void SetSettings(const AllSettings &rSettings)
GDIMetaFile * GetConnectMetaFile() const
vcl::Region GetClipRegion() const
tools::Long GetOutOffYPixel() const
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
SAL_DLLPRIVATE bool ImplIsAntiparallel() const
void EnableOutput(bool bEnable=true)
void SetFont(const vcl::Font &rNewFont)
RasterOp GetRasterOp() const
SAL_DLLPRIVATE tools::Rectangle ImplLogicToDevicePixel(const tools::Rectangle &rLogicRect) const
Convert a logical rectangle to a rectangle in physical device pixel units.
SAL_DLLPRIVATE sal_Int32 GetDPIY() const
Get the output device's DPI y-axis value.
void SetTextAlign(TextAlign eAlign)
tools::Long mnOutOffX
Output offset for device output in pixel (pseudo window offset within window system's frames)
void DrawRect(const tools::Rectangle &rRect)
const Wallpaper & GetBackground() const
SAL_DLLPRIVATE tools::Long ImplLogicHeightToDevicePixel(tools::Long nHeight) const
Convert a logical height to a height in units of device pixels.
bool IsClipRegion() const
void SetConnectMetaFile(GDIMetaFile *pMtf)
virtual void DrawOutDev(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPt, const Size &rSrcSize)
SAL_DLLPRIVATE tools::Long ImplLogicWidthToDevicePixel(tools::Long nWidth) const
Convert a logical width to a width in units of device pixels.
void SetTextColor(const Color &rColor)
void SetOutOffYPixel(tools::Long nOutOffY)
bool IsRTLEnabled() const
void SetDigitLanguage(LanguageType)
void SetRasterOp(RasterOp eRasterOp)
SAL_DLLPRIVATE void ReMirror(Point &rPoint) const
SAL_DLLPRIVATE tools::Rectangle ImplDevicePixelToLogic(const tools::Rectangle &rPixelRect) const
Convert a rectangle in physical pixel units to a rectangle in physical pixel units and coords.
virtual bool HasMirroredGraphics() const
void SetOutOffXPixel(tools::Long nOutOffX)
VclPtr< VirtualDevice > mpAlphaVDev
void DrawWallpaper(const tools::Rectangle &rRect, const Wallpaper &rWallpaper)
bool IsBackground() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
bool IsOutputEnabled() const
bool DrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, const OUString &aCaption, const Color &rBackgroundColor=COL_AUTO)
Request rendering of a particular control and/or part.
tools::Long GetOutOffXPixel() const
void SetLayoutMode(vcl::text::ComplexTextLayoutFlags nTextLayoutMode)
bool SelectClipRegion(const vcl::Region &, SalGraphics *pGraphics=nullptr)
const AllSettings & GetSettings() const
void DrawTransparent(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent)
SAL_DLLPRIVATE vcl::Region ImplPixelToDevicePixel(const vcl::Region &rRegion) const
Convert a region in pixel units to a region in device pixel units and coords.
bool IsMapModeEnabled() const
vcl::Region & GetPaintRegion()
VclPtr< vcl::Window > m_pWindow
tools::Rectangle m_aPaintRect
void StartBufferedPaint()
Start buffered paint: set it up to have the same settings as m_pWindow.
bool GetRestoreCursor() const
void DoPaint(const vcl::Region *pRegion)
PaintHelper(vcl::Window *pWindow, ImplPaintFlags nPaintFlags)
void PaintBuffer()
Paint the content of the buffer to the current m_pWindow.
void SetSelectionRect(const tools::Rectangle &rRect)
void SetPaintRect(const tools::Rectangle &rRect)
void SetRestoreCursor(bool bRestoreCursor)
vcl::Region m_aPaintRegion
tools::Rectangle m_aSelectionRect
bool m_bStartedBufferedPaint
This PaintHelper started a buffered paint, and should paint it on the screen when being destructed.
std::unique_ptr< vcl::Region > m_pChildRegion
ImplPaintFlags m_nPaintFlags
ImplPaintFlags GetPaintFlags() const
void CopyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight, const OutputDevice &rOutDev)
const Color & GetHighlightColor() const
const Color & GetFaceColor() const
const Color & GetHighlightTextColor() const
const Color & GetButtonTextColor() const
A construction helper for a temporary VclPtr.
reference_type * get() const
Get the body.
virtual void EnableRTL(bool bEnable=true) override
ControlPart mnNativeBackground
vcl::Region maInvalidateRegion
ImplPaintFlags mnPaintFlags
std::unique_ptr< ImplWinData > mpWinData
VclPtr< vcl::Window > mpLastChild
tools::Long GetFontHeight() const
void SetAverageFontWidth(tools::Long nWidth)
void SetFontHeight(tools::Long nHeight)
tools::Long GetAverageFontWidth() const
Sets up the buffer to have settings matching the window, and restores the original state in the dtor.
vcl::RenderContext * GetRenderContext()
Returns either the frame's buffer or the window, in case of no buffering.
~PaintBufferGuard() COVERITY_NOEXCEPT_FALSE
ImplFrameData * mpFrameData
void SetPaintRect(const tools::Rectangle &rRectangle)
If this is called, then the dtor will also copy rRectangle to the window from the buffer,...
VclPtr< vcl::Window > m_pWindow
tools::Rectangle m_aPaintRect
PaintBufferGuard(ImplFrameData *pFrameData, vcl::Window *pWindow)
void Move(tools::Long nHorzMove, tools::Long nVertMove)
void Intersect(const tools::Rectangle &rRegion)
tools::Rectangle GetBoundRect() const
void Union(const tools::Rectangle &rRegion)
void Exclude(const tools::Rectangle &rRegion)
const Wallpaper & GetBackground() const
SAL_DLLPRIVATE void ImplInvertFocus(const tools::Rectangle &rRect)
SAL_DLLPRIVATE void PopPaintHelper(PaintHelper const *pHelper)
SAL_DLLPRIVATE void ImplUpdateAll()
void SetFont(const vcl::Font &rNewFont)
virtual void PrePaint(vcl::RenderContext &rRenderContext)
SAL_DLLPRIVATE void ImplScroll(const tools::Rectangle &rRect, tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags)
bool IsReallyVisible() const
vcl::Window * GetParent() const
SAL_DLLPRIVATE void ImplValidateFrameRegion(const vcl::Region *rRegion, ValidateFlags nFlags)
virtual void PixelInvalidate(const tools::Rectangle *pRectangle)
Notification about some rectangle of the output device got invalidated.
tools::Long GetOutOffXPixel() const
Point LogicToPixel(const Point &rLogicPt) const
SAL_DLLPRIVATE void ImplClipBoundaries(vcl::Region &rRegion, bool bThis, bool bOverlaps)
SAL_DLLPRIVATE void ImplCalcOverlapRegion(const tools::Rectangle &rSourceRect, vcl::Region &rRegion, bool bChildren, bool bSiblings)
bool IsBackground() const
TextAlign GetTextAlign() const
bool IsPaintTransparent() const
bool SupportsDoubleBuffering() const
Can the widget derived from this Window do the double-buffering via RenderContext properly?
SAL_DLLPRIVATE bool ImplIsOverlapWindow() const
Dialog * GetParentDialog() const
const Color & GetControlForeground() const
ParentClipMode GetParentClipMode() const
const Color & GetTextLineColor() const
void Erase(vcl::RenderContext &rRenderContext)
virtual Point GetPosPixel() const
void SetParent(vcl::Window *pNewParent)
SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion(const vcl::Region &rRegion)
const AllSettings & GetSettings() const
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
SAL_DLLPRIVATE bool ImplSetClipFlag(bool bSysObjOnlySmaller=false)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
tools::Long GetOutOffYPixel() const
SAL_DLLPRIVATE vcl::Window * ImplGetParent() const
const MapMode & GetMapMode() const
SAL_DLLPRIVATE vcl::Window * ImplGetFirstOverlapWindow()
VclPtr< vcl::Window > GetParentWithLOKNotifier()
Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set.
::OutputDevice const * GetOutDev() const
Color GetBackgroundColor() const
void SetTextAlign(TextAlign eAlign)
const vcl::Font & GetFont() const
const vcl::ILibreOfficeKitNotifier * GetLOKNotifier() const
bool IsTextLineColor() const
virtual void LogicInvalidate(const tools::Rectangle *pRectangle)
Notification about some rectangle of the output device got invalidated.Used for the main document win...
SAL_DLLPRIVATE vcl::Region & ImplGetWinChildClipRegion()
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
const Color & GetTextColor() const
SAL_DLLPRIVATE void ImplMoveInvalidateRegion(const tools::Rectangle &rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren)
SAL_DLLPRIVATE bool ImplClipChildren(vcl::Region &rRegion) const
std::unique_ptr< WindowImpl > mpWindowImpl
vcl::LOKWindowId GetLOKWindowId() const
bool IsRTLEnabled() const
Point PixelToLogic(const Point &rDevicePt) const
virtual Size GetSizePixel() const
Size GetOutputSizePixel() const
bool IsControlBackground() const
virtual void ImplInvalidate(const vcl::Region *pRegion, InvalidateFlags nFlags)
void DrawSelectionBackground(const tools::Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder)
void SetWindowRegionPixel()
void PaintToDevice(::OutputDevice *pDevice, const Point &rPos)
virtual void ApplySettings(vcl::RenderContext &rRenderContext)
vcl::Region GetPaintRegion() const
void SetPaintTransparent(bool bTransparent)
bool HasPaintEvent() const
SAL_DLLPRIVATE void ImplValidate()
SAL_DLLPRIVATE void ImplCallPaint(const vcl::Region *pRegion, ImplPaintFlags nPaintFlags)
Invoke the actual painting.
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
SAL_DLLPRIVATE void ImplMoveAllInvalidateRegions(const tools::Rectangle &rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren)
virtual void SetPosPixel(const Point &rNewPos)
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
virtual OUString GetText() const
SAL_DLLPRIVATE void ImplClipAllChildren(vcl::Region &rRegion) const
tools::Rectangle GetOutputRectPixel() const
SAL_DLLPRIVATE void PushPaintHelper(PaintHelper *pHelper, vcl::RenderContext &rRenderContext)
SAL_DLLPRIVATE void ImplCallOverlapPaint()
SAL_DLLPRIVATE void ImplInvalidateOverlapFrameRegion(const vcl::Region &rRegion)
bool IsTextFillColor() const
bool IsOverlineColor() const
void InvertTracking(const tools::Rectangle &rRect, ShowTrackFlags nFlags)
virtual void ImplPaintToDevice(::OutputDevice *pTargetOutDev, const Point &rPos)
virtual void PostPaint(vcl::RenderContext &rRenderContext)
SAL_DLLPRIVATE SalGraphics * ImplGetFrameGraphics() const
SAL_DLLPRIVATE void ImplInvalidateFrameRegion(const vcl::Region *pRegion, InvalidateFlags nFlags)
void EnableChildTransparentMode(bool bEnable=true)
Color GetTextFillColor() const
void SetTextColor(const Color &rColor)
const Color & GetOverlineColor() const
constexpr ::Color COL_GRAY(0x80, 0x80, 0x80)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
Color GetFillColor(Color const &rColor, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
Color GetLineColor(Color const &rColor, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
IMPL_LINK_NOARG(QuickSelectionEngine_Data, SearchStringTimeout, Timer *, void)
std::vector< tools::Rectangle > RectangleVector
VclPtr< VirtualDevice > mpBuffer
Buffer for the double-buffering.
bool mbInBufferedPaint
PaintHelper is in the process of painting into this buffer.
tools::Rectangle maBufferedRect
Rectangle in the buffer that has to be painted to the screen.
vcl::Window * ImplGetDefaultWindow()
Returns either the application window, or the default GL context window.
@ NoErase
The invalidated area is painted with the background color/pattern.
@ Update
The invalidated area is updated immediately.
@ Transparent
The parent window is invalidated, too.
@ Children
The child windows are invalidated, too.
@ NoClipChildren
The area is invalidated regardless of overlapping child windows.
@ NoTransparent
The parent window is not invalidated.
@ NoChildren
The child windows are not invalidated.
WinBits const WB_CLIPCHILDREN