[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kwin/scaling_merged] /: provide scale offset to WindowVertex calculation
From:       David Edmundson <kde () davidedmundson ! co ! uk>
Date:       2016-11-24 20:48:40
Message-ID: E1cA0wi-0000TY-CO () code ! kde ! org
[Download RAW message or body]

Git commit 6c3aadf85f644571c32ce88f72d98b63940f1fb9 by David Edmundson.
Committed on 23/11/2016 at 17:15.
Pushed by davidedmundson into branch 'scaling_merged'.

provide scale offset to WindowVertex calculation

M  +18   -7    scene.cpp
M  +1    -1    scene.h

https://commits.kde.org/kwin/6c3aadf85f644571c32ce88f72d98b63940f1fb9

diff --git a/scene.cpp b/scene.cpp
index c236efe..c4b3727 100644
--- a/scene.cpp
+++ b/scene.cpp
@@ -815,14 +815,20 @@ WindowQuadList Scene::Window::buildQuads(bool force) const
     if (cached_quad_list != NULL && !force)
         return *cached_quad_list;
     WindowQuadList ret;
+    qreal scale = 1.0;
+    if (toplevel->surface()) {
+        scale = toplevel->surface()->scale();
+    }
+
     if (toplevel->clientPos() == QPoint(0, 0) && toplevel->clientSize() == \
                toplevel->decorationRect().size())
-        ret = makeQuads(WindowQuadContents, shape());  // has no decoration
+        ret = makeQuads(WindowQuadContents, shape(), QPoint(0,0), scale);  // has no \
decoration  else {
         AbstractClient *client = dynamic_cast<AbstractClient*>(toplevel);
         QRegion contents = clientShape();
         QRegion center = toplevel->transparentRect();
         QRegion decoration = (client ? QRegion(client->decorationRect()) : shape()) \
                - center;
-        ret = makeQuads(WindowQuadContents, contents, toplevel->clientContentPos());
+        ret = makeQuads(WindowQuadContents, contents, toplevel->clientContentPos(), \
scale); +
 
         QRect rects[4];
         bool isShadedClient = false;
@@ -905,16 +911,21 @@ WindowQuadList Scene::Window::makeDecorationQuads(const QRect \
*rects, const QReg  return list;
 }
 
-WindowQuadList Scene::Window::makeQuads(WindowQuadType type, const QRegion& reg, \
const QPoint &textureOffset) const +WindowQuadList \
Scene::Window::makeQuads(WindowQuadType type, const QRegion& reg, const QPoint \
&textureOffset, qreal scale) const  {
     WindowQuadList ret;
     foreach (const QRect & r, reg.rects()) {
         WindowQuad quad(type);
         // TODO asi mam spatne pravy dolni roh - bud tady, nebo v jinych castech
-        quad[ 0 ] = WindowVertex(r.x(), r.y(), r.x() + textureOffset.x(), r.y() + \
                textureOffset.y());
-        quad[ 1 ] = WindowVertex(r.x() + r.width(), r.y(), r.x() + r.width() + \
                textureOffset.x(), r.y() + textureOffset.y());
-        quad[ 2 ] = WindowVertex(r.x() + r.width(), r.y() + r.height(), r.x() + \
                r.width() + textureOffset.x(), r.y() + r.height() + \
                textureOffset.y());
-        quad[ 3 ] = WindowVertex(r.x(), r.y() + r.height(), r.x() + \
textureOffset.x(), r.y() + r.height() + textureOffset.y()); +        quad[ 0 ] = \
WindowVertex(QPointF(r.x(), r.y()), +                                 QPointF(r.x() + \
textureOffset.x(), r.y() + textureOffset.y()) * scale); +        quad[ 1 ] = \
WindowVertex(QPointF(r.x() + r.width(), r.y()), +                                 \
QPointF(r.x() + r.width() + textureOffset.x(), r.y() + textureOffset.y()) * scale); + \
quad[ 2 ] = WindowVertex(QPointF(r.x() + r.width(), r.y() + r.height()), +            \
QPointF(r.x() + r.width() + textureOffset.x(), r.y() + r.height() + \
textureOffset.y()) * scale); +        quad[ 3 ] = WindowVertex(QPointF(r.x(), r.y() + \
r.height()), +                                 QPointF(r.x() + textureOffset.x(), \
r.y() + r.height() + textureOffset.y()) * scale); +
         ret.append(quad);
     }
     return ret;
diff --git a/scene.h b/scene.h
index 7991616..97743e1 100644
--- a/scene.h
+++ b/scene.h
@@ -289,7 +289,7 @@ public:
     void referencePreviousPixmap();
     void unreferencePreviousPixmap();
 protected:
-    WindowQuadList makeQuads(WindowQuadType type, const QRegion& reg, const QPoint \
&textureOffset = QPoint(0, 0)) const; +    WindowQuadList makeQuads(WindowQuadType \
type, const QRegion& reg, const QPoint &textureOffset = QPoint(0, 0), qreal \
                textureScale = 1.0) const;
     WindowQuadList makeDecorationQuads(const QRect *rects, const QRegion &region) \
const;  /**
      * @brief Returns the WindowPixmap for this Window.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic