Port SnapHelper effect to XCB

This commit is contained in:
Martin Gräßlin 2013-01-29 08:28:30 +01:00
parent 5dc4b1d85d
commit e790284eee

View file

@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "kwinglutils.h" #include "kwinglutils.h"
#ifdef KWIN_HAVE_XRENDER_COMPOSITING #ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include "kwinxrenderutils.h" #include "kwinxrenderutils.h"
#include <xcb/render.h>
#endif #endif
namespace KWin namespace KWin
@ -134,7 +135,7 @@ void SnapHelperEffect::postPaintScreen()
int halfWidth = m_window->width() / 2; int halfWidth = m_window->width() / 2;
int halfHeight = m_window->height() / 2; int halfHeight = m_window->height() / 2;
XRectangle rects[6]; xcb_rectangle_t rects[6];
// Center lines // Center lines
rects[0].x = rect.x() + rect.width() / 2 - 2; rects[0].x = rect.x() + rect.width() / 2 - 2;
rects[0].y = rect.y(); rects[0].y = rect.y();
@ -164,8 +165,9 @@ void SnapHelperEffect::postPaintScreen()
rects[5].width = 4; rects[5].width = 4;
rects[5].height = 2*halfHeight - 4; rects[5].height = 2*halfHeight - 4;
XRenderColor c = preMultiply(QColor(128, 128, 128, m_timeline.currentValue()*128)); XRenderColor xc = preMultiply(QColor(128, 128, 128, m_timeline.currentValue()*128));
XRenderFillRectangles(display(), PictOpOver, effects->xrenderBufferPicture(), &c, rects, 6); xcb_render_color_t c = {xc.red, xc.green, xc.blue, xc.alpha};
xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_OVER, effects->xrenderBufferPicture(), c, 6, rects);
} }
#endif #endif
} }