nss: upgrade to release 3.73
[LibreOffice.git] / vcl / unx / generic / gdi / salgdi2.cxx
blobd688f00fa7437fc2a5ff0ad7049d0ef0069320e1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <salgdiimpl.hxx>
22 #include <vcl/sysdata.hxx>
24 #include <unx/saldisp.hxx>
25 #include <unx/salgdi.h>
26 #include <unx/x11/xrender_peer.hxx>
27 #include <salframe.hxx>
29 extern "C"
31 static Bool GraphicsExposePredicate( Display*, XEvent* pEvent, const XPointer pFrameWindow )
33 Bool bRet = False;
34 if( (pEvent->type == GraphicsExpose || pEvent->type == NoExpose) &&
35 pEvent->xnoexpose.drawable == reinterpret_cast<Drawable>(pFrameWindow) )
37 bRet = True;
39 return bRet;
43 void X11SalGraphics::YieldGraphicsExpose()
45 // get frame if necessary
46 SalFrame* pFrame = m_pFrame;
47 Display* pDisplay = GetXDisplay();
48 ::Window aWindow = GetDrawable();
49 if( ! pFrame )
51 for (auto pSalFrame : vcl_sal::getSalDisplay(GetGenericUnixSalData())->getFrames() )
53 const SystemEnvData* pEnvData = pSalFrame->GetSystemData();
54 if( Drawable(pEnvData->GetWindowHandle(pSalFrame)) == aWindow )
56 pFrame = pSalFrame;
57 break;
60 if( ! pFrame )
61 return;
64 XEvent aEvent;
65 while( XCheckTypedWindowEvent( pDisplay, aWindow, Expose, &aEvent ) )
67 SalPaintEvent aPEvt( aEvent.xexpose.x, aEvent.xexpose.y, aEvent.xexpose.width+1, aEvent.xexpose.height+1 );
68 pFrame->CallCallback( SalEvent::Paint, &aPEvt );
73 if( ! GetDisplay()->XIfEventWithTimeout( &aEvent, reinterpret_cast<XPointer>(aWindow), GraphicsExposePredicate ) )
74 // this should not happen at all; still sometimes it happens
75 break;
77 if( aEvent.type == NoExpose )
78 break;
80 if( pFrame )
82 SalPaintEvent aPEvt( aEvent.xgraphicsexpose.x, aEvent.xgraphicsexpose.y, aEvent.xgraphicsexpose.width+1, aEvent.xgraphicsexpose.height+1 );
83 pFrame->CallCallback( SalEvent::Paint, &aPEvt );
85 } while( aEvent.xgraphicsexpose.count != 0 );
88 void X11SalGraphics::copyBits( const SalTwoRect& rPosAry,
89 SalGraphics *pSSrcGraphics )
91 mxImpl->copyBits( rPosAry, pSSrcGraphics );
94 void X11SalGraphics::copyArea ( tools::Long nDestX, tools::Long nDestY,
95 tools::Long nSrcX, tools::Long nSrcY,
96 tools::Long nSrcWidth, tools::Long nSrcHeight,
97 bool bWindowInvalidate)
99 mxImpl->copyArea( nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, bWindowInvalidate );
102 bool X11SalGraphics::blendBitmap( const SalTwoRect& rTR,
103 const SalBitmap& rBitmap )
105 return mxImpl->blendBitmap( rTR, rBitmap );
108 bool X11SalGraphics::blendAlphaBitmap( const SalTwoRect& rTR,
109 const SalBitmap& rSrcBitmap,
110 const SalBitmap& rMaskBitmap,
111 const SalBitmap& rAlphaBitmap )
113 return mxImpl->blendAlphaBitmap( rTR, rSrcBitmap, rMaskBitmap, rAlphaBitmap );
116 void X11SalGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap )
118 mxImpl->drawBitmap( rPosAry, rSalBitmap );
121 void X11SalGraphics::drawBitmap( const SalTwoRect& rPosAry,
122 const SalBitmap& rSrcBitmap,
123 const SalBitmap& rMaskBitmap )
125 mxImpl->drawBitmap( rPosAry, rSrcBitmap, rMaskBitmap );
128 bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
129 const SalBitmap& rSrcBitmap, const SalBitmap& rAlphaBmp )
131 return mxImpl->drawAlphaBitmap( rTR, rSrcBitmap, rAlphaBmp );
134 bool X11SalGraphics::drawTransformedBitmap(
135 const basegfx::B2DPoint& rNull,
136 const basegfx::B2DPoint& rX,
137 const basegfx::B2DPoint& rY,
138 const SalBitmap& rSourceBitmap,
139 const SalBitmap* pAlphaBitmap)
141 return mxImpl->drawTransformedBitmap( rNull, rX, rY, rSourceBitmap, pAlphaBitmap );
144 bool X11SalGraphics::drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth,
145 tools::Long nHeight, sal_uInt8 nTransparency )
147 return mxImpl->drawAlphaRect( nX, nY, nWidth, nHeight, nTransparency );
150 void X11SalGraphics::drawMask( const SalTwoRect& rPosAry,
151 const SalBitmap &rSalBitmap,
152 Color nMaskColor )
154 mxImpl->drawMask( rPosAry, rSalBitmap, nMaskColor );
157 std::shared_ptr<SalBitmap> X11SalGraphics::getBitmap( tools::Long nX, tools::Long nY, tools::Long nDX, tools::Long nDY )
159 return mxImpl->getBitmap( nX, nY, nDX, nDY );
162 Color X11SalGraphics::getPixel( tools::Long nX, tools::Long nY )
164 return mxImpl->getPixel( nX, nY );
167 void X11SalGraphics::invert( tools::Long nX,
168 tools::Long nY,
169 tools::Long nDX,
170 tools::Long nDY,
171 SalInvert nFlags )
173 mxImpl->invert( nX, nY, nDX, nDY, nFlags );
176 bool X11SalGraphics::supportsOperation( OutDevSupportType eType ) const
178 return mxImpl->supportsOperation(eType);
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */