Port away from QRegion::rects
Summary: QRegion::rects was deprecated in Qt 5.11. It is advised to use begin() and end() methods instead. Reviewers: #kwin, romangg Reviewed By: #kwin, romangg Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D22353
This commit is contained in:
parent
e839c7067e
commit
4e5d3d0010
17 changed files with 58 additions and 65 deletions
|
@ -442,16 +442,15 @@ void ContrastEffect::drawWindow(EffectWindow *w, int mask, QRegion region, Windo
|
||||||
const bool scaled = data.xScale() != 1 || data.yScale() != 1;
|
const bool scaled = data.xScale() != 1 || data.yScale() != 1;
|
||||||
if (scaled) {
|
if (scaled) {
|
||||||
QPoint pt = shape.boundingRect().topLeft();
|
QPoint pt = shape.boundingRect().topLeft();
|
||||||
QVector<QRect> shapeRects = shape.rects();
|
QRegion scaledShape;
|
||||||
shape = QRegion(); // clear
|
for (QRect r : shape) {
|
||||||
foreach (QRect r, shapeRects) {
|
|
||||||
r.moveTo(pt.x() + (r.x() - pt.x()) * data.xScale() + data.xTranslation(),
|
r.moveTo(pt.x() + (r.x() - pt.x()) * data.xScale() + data.xTranslation(),
|
||||||
pt.y() + (r.y() - pt.y()) * data.yScale() + data.yTranslation());
|
pt.y() + (r.y() - pt.y()) * data.yScale() + data.yTranslation());
|
||||||
r.setWidth(r.width() * data.xScale());
|
r.setWidth(r.width() * data.xScale());
|
||||||
r.setHeight(r.height() * data.yScale());
|
r.setHeight(r.height() * data.yScale());
|
||||||
shape |= r;
|
scaledShape |= r;
|
||||||
}
|
}
|
||||||
shape = shape & region;
|
shape = scaledShape & region;
|
||||||
|
|
||||||
//Only translated, not scaled
|
//Only translated, not scaled
|
||||||
} else if (translated) {
|
} else if (translated) {
|
||||||
|
|
|
@ -591,16 +591,15 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPai
|
||||||
const bool scaled = data.xScale() != 1 || data.yScale() != 1;
|
const bool scaled = data.xScale() != 1 || data.yScale() != 1;
|
||||||
if (scaled) {
|
if (scaled) {
|
||||||
QPoint pt = shape.boundingRect().topLeft();
|
QPoint pt = shape.boundingRect().topLeft();
|
||||||
QVector<QRect> shapeRects = shape.rects();
|
QRegion scaledShape;
|
||||||
shape = QRegion(); // clear
|
for (QRect r : shape) {
|
||||||
foreach (QRect r, shapeRects) {
|
|
||||||
r.moveTo(pt.x() + (r.x() - pt.x()) * data.xScale() + data.xTranslation(),
|
r.moveTo(pt.x() + (r.x() - pt.x()) * data.xScale() + data.xTranslation(),
|
||||||
pt.y() + (r.y() - pt.y()) * data.yScale() + data.yTranslation());
|
pt.y() + (r.y() - pt.y()) * data.yScale() + data.yTranslation());
|
||||||
r.setWidth(r.width() * data.xScale());
|
r.setWidth(r.width() * data.xScale());
|
||||||
r.setHeight(r.height() * data.yScale());
|
r.setHeight(r.height() * data.yScale());
|
||||||
shape |= r;
|
scaledShape |= r;
|
||||||
}
|
}
|
||||||
shape = shape & region;
|
shape = scaledShape & region;
|
||||||
|
|
||||||
//Only translated, not scaled
|
//Only translated, not scaled
|
||||||
} else if (translated) {
|
} else if (translated) {
|
||||||
|
|
|
@ -1283,7 +1283,7 @@ void CubeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPa
|
||||||
quadSize = 150.0f;
|
quadSize = 150.0f;
|
||||||
else
|
else
|
||||||
quadSize = 250.0f;
|
quadSize = 250.0f;
|
||||||
foreach (const QRect & paintRect, paint.rects()) {
|
for (const QRect &paintRect : paint) {
|
||||||
for (int i = 0; i <= (paintRect.height() / quadSize); i++) {
|
for (int i = 0; i <= (paintRect.height() / quadSize); i++) {
|
||||||
for (int j = 0; j <= (paintRect.width() / quadSize); j++) {
|
for (int j = 0; j <= (paintRect.width() / quadSize); j++) {
|
||||||
verts << qMin(paintRect.x() + (j + 1)*quadSize, (float)paintRect.x() + paintRect.width()) << paintRect.y() + i*quadSize;
|
verts << qMin(paintRect.x() + (j + 1)*quadSize, (float)paintRect.x() + paintRect.width()) << paintRect.y() + i*quadSize;
|
||||||
|
|
|
@ -93,8 +93,8 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
|
||||||
color.setAlphaF(alpha);
|
color.setAlphaF(alpha);
|
||||||
vbo->setColor(color);
|
vbo->setColor(color);
|
||||||
QVector<float> verts;
|
QVector<float> verts;
|
||||||
verts.reserve(paintRegion.rects().count() * 12);
|
verts.reserve(paintRegion.rectCount() * 12);
|
||||||
foreach (const QRect & r, paintRegion.rects()) {
|
for (const QRect &r : paintRegion) {
|
||||||
verts << r.x() + r.width() << r.y();
|
verts << r.x() + r.width() << r.y();
|
||||||
verts << r.x() << r.y();
|
verts << r.x() << r.y();
|
||||||
verts << r.x() << r.y() + r.height();
|
verts << r.x() << r.y() + r.height();
|
||||||
|
@ -110,7 +110,7 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
|
||||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||||
if (effects->compositingType() == XRenderCompositing) {
|
if (effects->compositingType() == XRenderCompositing) {
|
||||||
QVector<xcb_rectangle_t> rects;
|
QVector<xcb_rectangle_t> rects;
|
||||||
foreach (const QRect & r, paintRegion.rects()) {
|
for (const QRect &r : paintRegion) {
|
||||||
xcb_rectangle_t rect = {int16_t(r.x()), int16_t(r.y()), uint16_t(r.width()), uint16_t(r.height())};
|
xcb_rectangle_t rect = {int16_t(r.x()), int16_t(r.y()), uint16_t(r.width()), uint16_t(r.height())};
|
||||||
rects << rect;
|
rects << rect;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
|
||||||
QPainter *painter = effects->scenePainter();
|
QPainter *painter = effects->scenePainter();
|
||||||
painter->save();
|
painter->save();
|
||||||
color.setAlphaF(alpha);
|
color.setAlphaF(alpha);
|
||||||
foreach (const QRect &r, paintRegion.rects()) {
|
for (const QRect &r : paintRegion) {
|
||||||
painter->fillRect(r, color);
|
painter->fillRect(r, color);
|
||||||
}
|
}
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
|
@ -145,8 +145,9 @@ void ShowFpsEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Windo
|
||||||
QRegion r2 = region & QRect(w->x(), w->y(), w->width(), w->height());
|
QRegion r2 = region & QRect(w->x(), w->y(), w->width(), w->height());
|
||||||
r2 -= fps_rect;
|
r2 -= fps_rect;
|
||||||
int winsize = 0;
|
int winsize = 0;
|
||||||
foreach (const QRect & r, r2.rects())
|
for (const QRect &r : r2) {
|
||||||
winsize += r.width() * r.height();
|
winsize += r.width() * r.height();
|
||||||
|
}
|
||||||
paint_size[ paints_pos ] += winsize;
|
paint_size[ paints_pos ] += winsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
geometry.cpp
22
geometry.cpp
|
@ -1178,44 +1178,44 @@ void AbstractClient::checkWorkspacePosition(QRect oldGeometry, int oldDesktop, Q
|
||||||
&Workspace::previousRestrictedMoveArea : //... the restricted areas changed
|
&Workspace::previousRestrictedMoveArea : //... the restricted areas changed
|
||||||
&Workspace::restrictedMoveArea; //... when e.g. active desktop or screen changes
|
&Workspace::restrictedMoveArea; //... when e.g. active desktop or screen changes
|
||||||
|
|
||||||
foreach (const QRect & r, (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaTop).rects()) {
|
for (const QRect &r : (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaTop)) {
|
||||||
QRect rect = r & oldGeomTall;
|
QRect rect = r & oldGeomTall;
|
||||||
if (!rect.isEmpty())
|
if (!rect.isEmpty())
|
||||||
oldTopMax = qMax(oldTopMax, rect.y() + rect.height());
|
oldTopMax = qMax(oldTopMax, rect.y() + rect.height());
|
||||||
}
|
}
|
||||||
foreach (const QRect & r, (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaRight).rects()) {
|
for (const QRect &r : (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaRight)) {
|
||||||
QRect rect = r & oldGeomWide;
|
QRect rect = r & oldGeomWide;
|
||||||
if (!rect.isEmpty())
|
if (!rect.isEmpty())
|
||||||
oldRightMax = qMin(oldRightMax, rect.x());
|
oldRightMax = qMin(oldRightMax, rect.x());
|
||||||
}
|
}
|
||||||
foreach (const QRect & r, (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaBottom).rects()) {
|
for (const QRect &r : (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaBottom)) {
|
||||||
QRect rect = r & oldGeomTall;
|
QRect rect = r & oldGeomTall;
|
||||||
if (!rect.isEmpty())
|
if (!rect.isEmpty())
|
||||||
oldBottomMax = qMin(oldBottomMax, rect.y());
|
oldBottomMax = qMin(oldBottomMax, rect.y());
|
||||||
}
|
}
|
||||||
foreach (const QRect & r, (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaLeft).rects()) {
|
for (const QRect &r : (workspace()->*moveAreaFunc)(oldDesktop, StrutAreaLeft)) {
|
||||||
QRect rect = r & oldGeomWide;
|
QRect rect = r & oldGeomWide;
|
||||||
if (!rect.isEmpty())
|
if (!rect.isEmpty())
|
||||||
oldLeftMax = qMax(oldLeftMax, rect.x() + rect.width());
|
oldLeftMax = qMax(oldLeftMax, rect.x() + rect.width());
|
||||||
}
|
}
|
||||||
|
|
||||||
// These 4 compute new bounds
|
// These 4 compute new bounds
|
||||||
foreach (const QRect & r, workspace()->restrictedMoveArea(desktop(), StrutAreaTop).rects()) {
|
for (const QRect &r : workspace()->restrictedMoveArea(desktop(), StrutAreaTop)) {
|
||||||
QRect rect = r & newGeomTall;
|
QRect rect = r & newGeomTall;
|
||||||
if (!rect.isEmpty())
|
if (!rect.isEmpty())
|
||||||
topMax = qMax(topMax, rect.y() + rect.height());
|
topMax = qMax(topMax, rect.y() + rect.height());
|
||||||
}
|
}
|
||||||
foreach (const QRect & r, workspace()->restrictedMoveArea(desktop(), StrutAreaRight).rects()) {
|
for (const QRect &r : workspace()->restrictedMoveArea(desktop(), StrutAreaRight)) {
|
||||||
QRect rect = r & newGeomWide;
|
QRect rect = r & newGeomWide;
|
||||||
if (!rect.isEmpty())
|
if (!rect.isEmpty())
|
||||||
rightMax = qMin(rightMax, rect.x());
|
rightMax = qMin(rightMax, rect.x());
|
||||||
}
|
}
|
||||||
foreach (const QRect & r, workspace()->restrictedMoveArea(desktop(), StrutAreaBottom).rects()) {
|
for (const QRect &r : workspace()->restrictedMoveArea(desktop(), StrutAreaBottom)) {
|
||||||
QRect rect = r & newGeomTall;
|
QRect rect = r & newGeomTall;
|
||||||
if (!rect.isEmpty())
|
if (!rect.isEmpty())
|
||||||
bottomMax = qMin(bottomMax, rect.y());
|
bottomMax = qMin(bottomMax, rect.y());
|
||||||
}
|
}
|
||||||
foreach (const QRect & r, workspace()->restrictedMoveArea(desktop(), StrutAreaLeft).rects()) {
|
for (const QRect &r : workspace()->restrictedMoveArea(desktop(), StrutAreaLeft)) {
|
||||||
QRect rect = r & newGeomWide;
|
QRect rect = r & newGeomWide;
|
||||||
if (!rect.isEmpty())
|
if (!rect.isEmpty())
|
||||||
leftMax = qMax(leftMax, rect.x() + rect.width());
|
leftMax = qMax(leftMax, rect.x() + rect.width());
|
||||||
|
@ -2948,7 +2948,7 @@ void AbstractClient::handleMoveResize(int x, int y, int x_root, int y_root)
|
||||||
const QRect titleRect(bTitleRect.translated(moveResizeGeometry().topLeft()));
|
const QRect titleRect(bTitleRect.translated(moveResizeGeometry().topLeft()));
|
||||||
int visiblePixels = 0;
|
int visiblePixels = 0;
|
||||||
int realVisiblePixels = 0;
|
int realVisiblePixels = 0;
|
||||||
foreach (const QRect &rect, availableArea.rects()) {
|
for (const QRect &rect : availableArea) {
|
||||||
const QRect r = rect & titleRect;
|
const QRect r = rect & titleRect;
|
||||||
realVisiblePixels += r.width() * r.height();
|
realVisiblePixels += r.width() * r.height();
|
||||||
if ((transposed && r.width() == titleRect.width()) || // Only the full size regions...
|
if ((transposed && r.width() == titleRect.width()) || // Only the full size regions...
|
||||||
|
@ -3073,7 +3073,7 @@ void AbstractClient::handleMoveResize(int x, int y, int x_root, int y_root)
|
||||||
QRect moveResizeGeom = moveResizeGeometry();
|
QRect moveResizeGeom = moveResizeGeometry();
|
||||||
const QRect titleRect(bTitleRect.translated(moveResizeGeom.topLeft()));
|
const QRect titleRect(bTitleRect.translated(moveResizeGeom.topLeft()));
|
||||||
int visiblePixels = 0;
|
int visiblePixels = 0;
|
||||||
foreach (const QRect &rect, availableArea.rects()) {
|
for (const QRect &rect : availableArea) {
|
||||||
const QRect r = rect & titleRect;
|
const QRect r = rect & titleRect;
|
||||||
if ((transposed && r.width() == titleRect.width()) || // Only the full size regions...
|
if ((transposed && r.width() == titleRect.width()) || // Only the full size regions...
|
||||||
(!transposed && r.height() == titleRect.height())) // ...prevents long slim areas
|
(!transposed && r.height() == titleRect.height())) // ...prevents long slim areas
|
||||||
|
@ -3094,7 +3094,7 @@ void AbstractClient::handleMoveResize(int x, int y, int x_root, int y_root)
|
||||||
if (screens()->count() > 1) { // optimization
|
if (screens()->count() > 1) { // optimization
|
||||||
// TODO: could be useful on partial screen struts (half-width panels etc.)
|
// TODO: could be useful on partial screen struts (half-width panels etc.)
|
||||||
int newTitleTop = -1;
|
int newTitleTop = -1;
|
||||||
foreach (const QRect &r, strut.rects()) {
|
for (const QRect &r : strut) {
|
||||||
if (r.top() == 0 && r.width() > r.height() && // "top panel"
|
if (r.top() == 0 && r.width() > r.height() && // "top panel"
|
||||||
r.intersects(moveResizeGeom) && moveResizeGeom.top() < r.bottom()) {
|
r.intersects(moveResizeGeom) && moveResizeGeom.top() < r.bottom()) {
|
||||||
newTitleTop = r.bottom() + 1;
|
newTitleTop = r.bottom() + 1;
|
||||||
|
|
|
@ -167,18 +167,15 @@ XRenderPictureData::~XRenderPictureData()
|
||||||
XFixesRegion::XFixesRegion(const QRegion ®ion)
|
XFixesRegion::XFixesRegion(const QRegion ®ion)
|
||||||
{
|
{
|
||||||
m_region = xcb_generate_id(XRenderUtils::s_connection);
|
m_region = xcb_generate_id(XRenderUtils::s_connection);
|
||||||
QVector< QRect > rects = region.rects();
|
QVector<xcb_rectangle_t> xrects;
|
||||||
QVector< xcb_rectangle_t > xrects(rects.count());
|
xrects.reserve(region.rectCount());
|
||||||
for (int i = 0;
|
for (const QRect &rect : region) {
|
||||||
i < rects.count();
|
|
||||||
++i) {
|
|
||||||
const QRect &rect = rects.at(i);
|
|
||||||
xcb_rectangle_t xrect;
|
xcb_rectangle_t xrect;
|
||||||
xrect.x = rect.x();
|
xrect.x = rect.x();
|
||||||
xrect.y = rect.y();
|
xrect.y = rect.y();
|
||||||
xrect.width = rect.width();
|
xrect.width = rect.width();
|
||||||
xrect.height = rect.height();
|
xrect.height = rect.height();
|
||||||
xrects[i] = xrect;
|
xrects.append(xrect);
|
||||||
}
|
}
|
||||||
xcb_xfixes_create_region(XRenderUtils::s_connection, m_region, xrects.count(), xrects.constData());
|
xcb_xfixes_create_region(XRenderUtils::s_connection, m_region, xrects.count(), xrects.constData());
|
||||||
}
|
}
|
||||||
|
|
|
@ -407,14 +407,14 @@ void AbstractEglTexture::updateTexture(WindowPixmap *pixmap)
|
||||||
if (GLPlatform::instance()->isGLES()) {
|
if (GLPlatform::instance()->isGLES()) {
|
||||||
if (s_supportsARGB32 && (image.format() == QImage::Format_ARGB32 || image.format() == QImage::Format_ARGB32_Premultiplied)) {
|
if (s_supportsARGB32 && (image.format() == QImage::Format_ARGB32 || image.format() == QImage::Format_ARGB32_Premultiplied)) {
|
||||||
const QImage im = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
const QImage im = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||||
for (const QRect &rect : damage.rects()) {
|
for (const QRect &rect : damage) {
|
||||||
auto scaledRect = QRect(rect.x() * scale, rect.y() * scale, rect.width() * scale, rect.height() * scale);
|
auto scaledRect = QRect(rect.x() * scale, rect.y() * scale, rect.width() * scale, rect.height() * scale);
|
||||||
glTexSubImage2D(m_target, 0, scaledRect.x(), scaledRect.y(), scaledRect.width(), scaledRect.height(),
|
glTexSubImage2D(m_target, 0, scaledRect.x(), scaledRect.y(), scaledRect.width(), scaledRect.height(),
|
||||||
GL_BGRA_EXT, GL_UNSIGNED_BYTE, im.copy(scaledRect).bits());
|
GL_BGRA_EXT, GL_UNSIGNED_BYTE, im.copy(scaledRect).bits());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const QImage im = image.convertToFormat(QImage::Format_RGBA8888_Premultiplied);
|
const QImage im = image.convertToFormat(QImage::Format_RGBA8888_Premultiplied);
|
||||||
for (const QRect &rect : damage.rects()) {
|
for (const QRect &rect : damage) {
|
||||||
auto scaledRect = QRect(rect.x() * scale, rect.y() * scale, rect.width() * scale, rect.height() * scale);
|
auto scaledRect = QRect(rect.x() * scale, rect.y() * scale, rect.width() * scale, rect.height() * scale);
|
||||||
glTexSubImage2D(m_target, 0, scaledRect.x(), scaledRect.y(), scaledRect.width(), scaledRect.height(),
|
glTexSubImage2D(m_target, 0, scaledRect.x(), scaledRect.y(), scaledRect.width(), scaledRect.height(),
|
||||||
GL_RGBA, GL_UNSIGNED_BYTE, im.copy(scaledRect).bits());
|
GL_RGBA, GL_UNSIGNED_BYTE, im.copy(scaledRect).bits());
|
||||||
|
@ -422,7 +422,7 @@ void AbstractEglTexture::updateTexture(WindowPixmap *pixmap)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const QImage im = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
const QImage im = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||||
for (const QRect &rect : damage.rects()) {
|
for (const QRect &rect : damage) {
|
||||||
auto scaledRect = QRect(rect.x() * scale, rect.y() * scale, rect.width() * scale, rect.height() * scale);
|
auto scaledRect = QRect(rect.x() * scale, rect.y() * scale, rect.width() * scale, rect.height() * scale);
|
||||||
glTexSubImage2D(m_target, 0, scaledRect.x(), scaledRect.y(), scaledRect.width(), scaledRect.height(),
|
glTexSubImage2D(m_target, 0, scaledRect.x(), scaledRect.y(), scaledRect.width(), scaledRect.height(),
|
||||||
GL_BGRA, GL_UNSIGNED_BYTE, im.copy(scaledRect).bits());
|
GL_BGRA, GL_UNSIGNED_BYTE, im.copy(scaledRect).bits());
|
||||||
|
|
|
@ -106,7 +106,7 @@ bool OpenGLBackend::perScreenRendering() const
|
||||||
void OpenGLBackend::copyPixels(const QRegion ®ion)
|
void OpenGLBackend::copyPixels(const QRegion ®ion)
|
||||||
{
|
{
|
||||||
const int height = screens()->size().height();
|
const int height = screens()->size().height();
|
||||||
foreach (const QRect &r, region.rects()) {
|
for (const QRect &r : region) {
|
||||||
const int x0 = r.x();
|
const int x0 = r.x();
|
||||||
const int y0 = height - r.y() - r.height();
|
const int y0 = height - r.y() - r.height();
|
||||||
const int x1 = r.x() + r.width();
|
const int x1 = r.x() + r.width();
|
||||||
|
|
|
@ -374,7 +374,7 @@ void EglOnXBackend::presentSurface(EGLSurface surface, const QRegion &damage, co
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// a part of the screen changed, and we can use eglPostSubBufferNV to copy the updated area
|
// a part of the screen changed, and we can use eglPostSubBufferNV to copy the updated area
|
||||||
foreach (const QRect & r, damage.rects()) {
|
for (const QRect &r : damage) {
|
||||||
eglPostSubBufferNV(eglDisplay(), surface, r.left(), screenGeometry.height() - r.bottom() - 1, r.width(), r.height());
|
eglPostSubBufferNV(eglDisplay(), surface, r.left(), screenGeometry.height() - r.bottom() - 1, r.width(), r.height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -733,7 +733,7 @@ void GlxBackend::present()
|
||||||
glXQueryDrawable(display(), glxWindow, GLX_BACK_BUFFER_AGE_EXT, (GLuint *) &m_bufferAge);
|
glXQueryDrawable(display(), glxWindow, GLX_BACK_BUFFER_AGE_EXT, (GLuint *) &m_bufferAge);
|
||||||
}
|
}
|
||||||
} else if (m_haveMESACopySubBuffer) {
|
} else if (m_haveMESACopySubBuffer) {
|
||||||
foreach (const QRect & r, lastDamage().rects()) {
|
for (const QRect &r : lastDamage()) {
|
||||||
// convert to OpenGL coordinates
|
// convert to OpenGL coordinates
|
||||||
int y = screenSize.height() - r.y() - r.height();
|
int y = screenSize.height() - r.y() - r.height();
|
||||||
glXCopySubBufferMESA(display(), glxWindow, r.x(), y, r.width(), r.height());
|
glXCopySubBufferMESA(display(), glxWindow, r.x(), y, r.width(), r.height());
|
||||||
|
|
|
@ -124,19 +124,9 @@ void OverlayWindowX11::setShape(const QRegion& reg)
|
||||||
// and triggers something).
|
// and triggers something).
|
||||||
if (reg == m_shape)
|
if (reg == m_shape)
|
||||||
return;
|
return;
|
||||||
QVector< QRect > rects = reg.rects();
|
const QVector<xcb_rectangle_t> xrects = Xcb::regionToRects(reg);
|
||||||
xcb_rectangle_t *xrects = new xcb_rectangle_t[rects.count()];
|
|
||||||
for (int i = 0;
|
|
||||||
i < rects.count();
|
|
||||||
++i) {
|
|
||||||
xrects[ i ].x = rects[ i ].x();
|
|
||||||
xrects[ i ].y = rects[ i ].y();
|
|
||||||
xrects[ i ].width = rects[ i ].width();
|
|
||||||
xrects[ i ].height = rects[ i ].height();
|
|
||||||
}
|
|
||||||
xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
|
xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
|
||||||
m_window, 0, 0, rects.count(), xrects);
|
m_window, 0, 0, xrects.count(), xrects.data());
|
||||||
delete[] xrects;
|
|
||||||
setupInputShape(m_window);
|
setupInputShape(m_window);
|
||||||
m_shape = reg;
|
m_shape = reg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,9 @@ qint64 SceneQPainter::paint(QRegion damage, ToplevelList toplevels)
|
||||||
void SceneQPainter::paintBackground(QRegion region)
|
void SceneQPainter::paintBackground(QRegion region)
|
||||||
{
|
{
|
||||||
m_painter->setBrush(Qt::black);
|
m_painter->setBrush(Qt::black);
|
||||||
m_painter->drawRects(region.rects());
|
for (const QRect &rect : region) {
|
||||||
|
m_painter->drawRect(rect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneQPainter::paintCursor()
|
void SceneQPainter::paintCursor()
|
||||||
|
|
|
@ -494,11 +494,16 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat
|
||||||
xform.matrix22 = DOUBLE_TO_FIXED(1.0 / yscale);
|
xform.matrix22 = DOUBLE_TO_FIXED(1.0 / yscale);
|
||||||
|
|
||||||
// transform the shape for clipping in paintTransformedScreen()
|
// transform the shape for clipping in paintTransformedScreen()
|
||||||
QVector<QRect> rects = transformed_shape.rects();
|
QVector<QRect> rects;
|
||||||
for (int i = 0; i < rects.count(); ++i) {
|
rects.reserve(transformed_shape.rectCount());
|
||||||
QRect& r = rects[ i ];
|
for (const QRect &rect : transformed_shape) {
|
||||||
r.setRect(qRound(r.x() * xscale), qRound(r.y() * yscale),
|
const QRect transformedRect(
|
||||||
qRound(r.width() * xscale), qRound(r.height() * yscale));
|
qRound(rect.x() * xscale),
|
||||||
|
qRound(rect.y() * yscale),
|
||||||
|
qRound(rect.width() * xscale),
|
||||||
|
qRound(rect.height() * yscale)
|
||||||
|
);
|
||||||
|
rects.append(transformedRect);
|
||||||
}
|
}
|
||||||
transformed_shape.setRects(rects.constData(), rects.count());
|
transformed_shape.setRects(rects.constData(), rects.count());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ void ScreenEdges::recreateEdges()
|
||||||
for (int i=0; i<screens()->count(); ++i) {
|
for (int i=0; i<screens()->count(); ++i) {
|
||||||
const QRegion screen = QRegion(screens()->geometry(i)).subtracted(processedRegion);
|
const QRegion screen = QRegion(screens()->geometry(i)).subtracted(processedRegion);
|
||||||
processedRegion += screen;
|
processedRegion += screen;
|
||||||
Q_FOREACH (const QRect &screenPart, screen.rects()) {
|
for (const QRect &screenPart : screen) {
|
||||||
if (isLeftScreen(screenPart, fullArea)) {
|
if (isLeftScreen(screenPart, fullArea)) {
|
||||||
// left most screen
|
// left most screen
|
||||||
createVerticalEdge(ElectricLeft, screenPart, fullArea);
|
createVerticalEdge(ElectricLeft, screenPart, fullArea);
|
||||||
|
|
|
@ -739,7 +739,7 @@ void Toplevel::addDamage(const QRegion &damage)
|
||||||
{
|
{
|
||||||
m_isDamaged = true;
|
m_isDamaged = true;
|
||||||
damage_region += damage;
|
damage_region += damage;
|
||||||
for (const QRect &r : damage.rects()) {
|
for (const QRect &r : damage) {
|
||||||
emit damaged(this, r);
|
emit damaged(this, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1787,10 +1787,10 @@ static inline xcb_rectangle_t fromQt(const QRect &rect)
|
||||||
|
|
||||||
static inline QVector<xcb_rectangle_t> regionToRects(const QRegion ®ion)
|
static inline QVector<xcb_rectangle_t> regionToRects(const QRegion ®ion)
|
||||||
{
|
{
|
||||||
const QVector<QRect> regionRects = region.rects();
|
QVector<xcb_rectangle_t> rects;
|
||||||
QVector<xcb_rectangle_t> rects(regionRects.count());
|
rects.reserve(region.rectCount());
|
||||||
for (int i=0; i<regionRects.count(); ++i) {
|
for (const QRect &rect : region) {
|
||||||
rects[i] = Xcb::fromQt(regionRects.at(i));
|
rects.append(Xcb::fromQt(rect));
|
||||||
}
|
}
|
||||||
return rects;
|
return rects;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue