Port Resize effect to XCB render

This commit is contained in:
Martin Gräßlin 2013-01-29 09:28:53 +01:00
parent cd1eab0c55
commit 29b36c87dd

View file

@ -24,8 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwinglutils.h>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <X11/Xlib.h>
#include <X11/extensions/Xrender.h>
#include <xcb/render.h>
#endif
#include <KColorScheme>
@ -108,14 +107,18 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (effects->compositingType() == XRenderCompositing) {
XRenderColor col;
xcb_render_color_t col;
col.alpha = int(alpha * 0xffff);
col.red = int(alpha * 0xffff * color.red() / 255);
col.green = int(alpha * 0xffff * color.green() / 255);
col.blue = int(alpha * 0xffff * color.blue() / 255);
foreach (const QRect & r, paintRegion.rects())
XRenderFillRectangle(display(), PictOpOver, effects->xrenderBufferPicture(),
&col, r.x(), r.y(), r.width(), r.height());
QVector<xcb_rectangle_t> rects;
foreach (const QRect & r, paintRegion.rects()) {
xcb_rectangle_t rect = {int16_t(r.x()), int16_t(r.y()), uint16_t(r.width()), uint16_t(r.height())};
rects << rect;
}
xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_OVER,
effects->xrenderBufferPicture(), col, rects.count(), rects.constData());
}
#endif
}