[effects/magnifier] Fix 1 px gap between magnified area and frame
Summary: The x-coordinate of the area's left edge and y-coordinate of the area's top edge are adjusted by 1px leading to a gap between the frame and magnified area. Because area has type of QRect, we have to adjust only coordinates of the right and bottom edge by 1 px. Because QRectF::right() == QRectF::x() + QRectF::width(), we can use QRectF, which leads to more cleaner code because we don't need to do 1px adjustments. Test Plan: Before: {F6235388, layout=center, size=full} After: {F6235439, layout=center, size=full} Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: davidedmundson, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D15275
This commit is contained in:
parent
de6db0599e
commit
617b4d92fa
1 changed files with 25 additions and 24 deletions
|
@ -166,34 +166,35 @@ void MagnifierEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
|
|||
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
|
||||
vbo->reset();
|
||||
vbo->setColor(QColor(0, 0, 0));
|
||||
const QRectF areaF = area;
|
||||
// top frame
|
||||
verts << area.right() + FRAME_WIDTH << area.top() - FRAME_WIDTH;
|
||||
verts << area.left() - FRAME_WIDTH << area.top() - FRAME_WIDTH;
|
||||
verts << area.left() - FRAME_WIDTH << area.top() - 1;
|
||||
verts << area.left() - FRAME_WIDTH << area.top() - 1;
|
||||
verts << area.right() + FRAME_WIDTH << area.top() - 1;
|
||||
verts << area.right() + FRAME_WIDTH << area.top() - FRAME_WIDTH;
|
||||
verts << areaF.right() + FRAME_WIDTH << areaF.top() - FRAME_WIDTH;
|
||||
verts << areaF.left() - FRAME_WIDTH << areaF.top() - FRAME_WIDTH;
|
||||
verts << areaF.left() - FRAME_WIDTH << areaF.top();
|
||||
verts << areaF.left() - FRAME_WIDTH << areaF.top();
|
||||
verts << areaF.right() + FRAME_WIDTH << areaF.top();
|
||||
verts << areaF.right() + FRAME_WIDTH << areaF.top() - FRAME_WIDTH;
|
||||
// left frame
|
||||
verts << area.left() - 1 << area.top() - FRAME_WIDTH;
|
||||
verts << area.left() - FRAME_WIDTH << area.top() - FRAME_WIDTH;
|
||||
verts << area.left() - FRAME_WIDTH << area.bottom() + FRAME_WIDTH;
|
||||
verts << area.left() - FRAME_WIDTH << area.bottom() + FRAME_WIDTH;
|
||||
verts << area.left() - 1 << area.bottom() + FRAME_WIDTH;
|
||||
verts << area.left() - 1 << area.top() - FRAME_WIDTH;
|
||||
verts << areaF.left() << areaF.top() - FRAME_WIDTH;
|
||||
verts << areaF.left() - FRAME_WIDTH << areaF.top() - FRAME_WIDTH;
|
||||
verts << areaF.left() - FRAME_WIDTH << areaF.bottom() + FRAME_WIDTH;
|
||||
verts << areaF.left() - FRAME_WIDTH << areaF.bottom() + FRAME_WIDTH;
|
||||
verts << areaF.left() << areaF.bottom() + FRAME_WIDTH;
|
||||
verts << areaF.left() << areaF.top() - FRAME_WIDTH;
|
||||
// right frame
|
||||
verts << area.right() + FRAME_WIDTH << area.top() - FRAME_WIDTH;
|
||||
verts << area.right() + 1 << area.top() - FRAME_WIDTH;
|
||||
verts << area.right() + 1 << area.bottom() + FRAME_WIDTH;
|
||||
verts << area.right() + 1 << area.bottom() + FRAME_WIDTH;
|
||||
verts << area.right() + FRAME_WIDTH << area.bottom() + FRAME_WIDTH;
|
||||
verts << area.right() + FRAME_WIDTH << area.top() - FRAME_WIDTH;
|
||||
verts << areaF.right() + FRAME_WIDTH << areaF.top() - FRAME_WIDTH;
|
||||
verts << areaF.right() << areaF.top() - FRAME_WIDTH;
|
||||
verts << areaF.right() << areaF.bottom() + FRAME_WIDTH;
|
||||
verts << areaF.right() << areaF.bottom() + FRAME_WIDTH;
|
||||
verts << areaF.right() + FRAME_WIDTH << areaF.bottom() + FRAME_WIDTH;
|
||||
verts << areaF.right() + FRAME_WIDTH << areaF.top() - FRAME_WIDTH;
|
||||
// bottom frame
|
||||
verts << area.right() + FRAME_WIDTH << area.bottom() + 1;
|
||||
verts << area.left() - FRAME_WIDTH << area.bottom() + 1;
|
||||
verts << area.left() - FRAME_WIDTH << area.bottom() + FRAME_WIDTH;
|
||||
verts << area.left() - FRAME_WIDTH << area.bottom() + FRAME_WIDTH;
|
||||
verts << area.right() + FRAME_WIDTH << area.bottom() + FRAME_WIDTH;
|
||||
verts << area.right() + FRAME_WIDTH << area.bottom() + 1;
|
||||
verts << areaF.right() + FRAME_WIDTH << areaF.bottom();
|
||||
verts << areaF.left() - FRAME_WIDTH << areaF.bottom();
|
||||
verts << areaF.left() - FRAME_WIDTH << areaF.bottom() + FRAME_WIDTH;
|
||||
verts << areaF.left() - FRAME_WIDTH << areaF.bottom() + FRAME_WIDTH;
|
||||
verts << areaF.right() + FRAME_WIDTH << areaF.bottom() + FRAME_WIDTH;
|
||||
verts << areaF.right() + FRAME_WIDTH << areaF.bottom();
|
||||
vbo->setData(verts.size() / 2, 2, verts.constData(), NULL);
|
||||
|
||||
ShaderBinder binder(ShaderTrait::UniformColor);
|
||||
|
|
Loading…
Reference in a new issue