Port zoom effect to XCB render
Still strong usage of other XLib components. REVIEW: 108652
This commit is contained in:
parent
29b36c87dd
commit
e68f7f960b
1 changed files with 20 additions and 18 deletions
|
@ -39,7 +39,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KDE/KLocale>
|
||||
|
||||
#include <kwinglutils.h>
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
#include <kwinxrenderutils.h>
|
||||
#include <xcb/render.h>
|
||||
#endif
|
||||
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
#include <X11/Xcursor/Xcursor.h>
|
||||
|
@ -255,15 +258,6 @@ void ZoomEffect::prePaintScreen(ScreenPrePaintData& data, int time)
|
|||
effects->prePaintScreen(data, time);
|
||||
}
|
||||
|
||||
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
static XTransform xrenderIdentity = {{
|
||||
{ XDoubleToFixed( 1.0 ), XDoubleToFixed( 0.0 ), XDoubleToFixed( 0.0 ) },
|
||||
{ XDoubleToFixed( 0.0 ), XDoubleToFixed( 1.0 ), XDoubleToFixed( 0.0 ) },
|
||||
{ XDoubleToFixed( 0.0 ), XDoubleToFixed( 0.0 ), XDoubleToFixed( 1.0 ) }
|
||||
}};
|
||||
#endif
|
||||
|
||||
void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
|
||||
{
|
||||
if (zoom != 1.0) {
|
||||
|
@ -349,18 +343,26 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
|
|||
}
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
if (xrenderPicture) {
|
||||
#define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536))
|
||||
static xcb_render_transform_t xrenderIdentity = {
|
||||
DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0),
|
||||
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0),
|
||||
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1)
|
||||
};
|
||||
if (mousePointer == MousePointerScale) {
|
||||
XRenderSetPictureFilter(display(), *xrenderPicture, const_cast<char*>("good"), NULL, 0);
|
||||
XTransform xform = {{
|
||||
{ XDoubleToFixed( 1.0 / zoom ), XDoubleToFixed( 0.0 ), XDoubleToFixed( 0.0 ) },
|
||||
{ XDoubleToFixed( 0.0 ), XDoubleToFixed( 1.0 / zoom ), XDoubleToFixed( 0.0 ) },
|
||||
{ XDoubleToFixed( 0.0 ), XDoubleToFixed( 0.0 ), XDoubleToFixed( 1.0 ) }
|
||||
}};
|
||||
XRenderSetPictureTransform( display(), *xrenderPicture, &xform );
|
||||
xcb_render_set_picture_filter(connection(), *xrenderPicture, 4, const_cast<char*>("good"), 0, NULL);
|
||||
const xcb_render_transform_t xform = {
|
||||
DOUBLE_TO_FIXED(1.0 / zoom), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0),
|
||||
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1.0 / zoom), DOUBLE_TO_FIXED(0),
|
||||
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1)
|
||||
};
|
||||
xcb_render_set_picture_transform(connection(), *xrenderPicture, xform);
|
||||
}
|
||||
XRenderComposite(display(), PictOpOver, *xrenderPicture, None, effects->xrenderBufferPicture(), 0, 0, 0, 0, rect.x(), rect.y(), rect.width(), rect.height());
|
||||
xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *xrenderPicture, XCB_RENDER_PICTURE_NONE,
|
||||
effects->xrenderBufferPicture(), 0, 0, 0, 0, rect.x(), rect.y(), rect.width(), rect.height());
|
||||
if (mousePointer == MousePointerScale)
|
||||
XRenderSetPictureTransform( display(), *xrenderPicture, &xrenderIdentity );
|
||||
xcb_render_set_picture_transform(connection(), *xrenderPicture, xrenderIdentity);
|
||||
#undef DOUBLE_TO_FIXED
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue