Changeset View
Changeset View
Standalone View
Standalone View
scene.cpp
Show First 20 Lines • Show All 809 Lines • ▼ Show 20 Line(s) | 809 | { | |||
---|---|---|---|---|---|
810 | disable_painting |= reason; | 810 | disable_painting |= reason; | ||
811 | } | 811 | } | ||
812 | 812 | | |||
813 | WindowQuadList Scene::Window::buildQuads(bool force) const | 813 | WindowQuadList Scene::Window::buildQuads(bool force) const | ||
814 | { | 814 | { | ||
815 | if (cached_quad_list != NULL && !force) | 815 | if (cached_quad_list != NULL && !force) | ||
816 | return *cached_quad_list; | 816 | return *cached_quad_list; | ||
817 | WindowQuadList ret; | 817 | WindowQuadList ret; | ||
818 | qreal scale = 1.0; | ||||
819 | if (toplevel->surface()) { | ||||
820 | scale = toplevel->surface()->scale(); | ||||
821 | } | ||||
822 | | ||||
818 | if (toplevel->clientPos() == QPoint(0, 0) && toplevel->clientSize() == toplevel->decorationRect().size()) | 823 | if (toplevel->clientPos() == QPoint(0, 0) && toplevel->clientSize() == toplevel->decorationRect().size()) | ||
819 | ret = makeQuads(WindowQuadContents, shape()); // has no decoration | 824 | ret = makeQuads(WindowQuadContents, shape(), QPoint(0,0), scale); // has no decoration | ||
820 | else { | 825 | else { | ||
821 | AbstractClient *client = dynamic_cast<AbstractClient*>(toplevel); | 826 | AbstractClient *client = dynamic_cast<AbstractClient*>(toplevel); | ||
822 | QRegion contents = clientShape(); | 827 | QRegion contents = clientShape(); | ||
823 | QRegion center = toplevel->transparentRect(); | 828 | QRegion center = toplevel->transparentRect(); | ||
824 | QRegion decoration = (client ? QRegion(client->decorationRect()) : shape()) - center; | 829 | QRegion decoration = (client ? QRegion(client->decorationRect()) : shape()) - center; | ||
825 | ret = makeQuads(WindowQuadContents, contents, toplevel->clientContentPos()); | 830 | ret = makeQuads(WindowQuadContents, contents, toplevel->clientContentPos(), scale); | ||
831 | | ||||
826 | 832 | | |||
827 | QRect rects[4]; | 833 | QRect rects[4]; | ||
828 | bool isShadedClient = false; | 834 | bool isShadedClient = false; | ||
829 | 835 | | |||
830 | if (client) { | 836 | if (client) { | ||
831 | client->layoutDecorationRects(rects[0], rects[1], rects[2], rects[3]); | 837 | client->layoutDecorationRects(rects[0], rects[1], rects[2], rects[3]); | ||
832 | isShadedClient = client->isShade() || center.isEmpty(); | 838 | isShadedClient = client->isShade() || center.isEmpty(); | ||
833 | } | 839 | } | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 876 | foreach (const QRect &r, (region & rects[i]).rects()) { | |||
900 | 906 | | |||
901 | list.append(quad); | 907 | list.append(quad); | ||
902 | } | 908 | } | ||
903 | } | 909 | } | ||
904 | 910 | | |||
905 | return list; | 911 | return list; | ||
906 | } | 912 | } | ||
907 | 913 | | |||
908 | WindowQuadList Scene::Window::makeQuads(WindowQuadType type, const QRegion& reg, const QPoint &textureOffset) const | 914 | WindowQuadList Scene::Window::makeQuads(WindowQuadType type, const QRegion& reg, const QPoint &textureOffset, qreal scale) const | ||
909 | { | 915 | { | ||
910 | WindowQuadList ret; | 916 | WindowQuadList ret; | ||
911 | foreach (const QRect & r, reg.rects()) { | 917 | foreach (const QRect & r, reg.rects()) { | ||
912 | WindowQuad quad(type); | 918 | WindowQuad quad(type); | ||
913 | // TODO asi mam spatne pravy dolni roh - bud tady, nebo v jinych castech | 919 | // TODO asi mam spatne pravy dolni roh - bud tady, nebo v jinych castech | ||
914 | quad[ 0 ] = WindowVertex(r.x(), r.y(), r.x() + textureOffset.x(), r.y() + textureOffset.y()); | 920 | quad[ 0 ] = WindowVertex(QPointF(r.x(), r.y()), | ||
915 | quad[ 1 ] = WindowVertex(r.x() + r.width(), r.y(), r.x() + r.width() + textureOffset.x(), r.y() + textureOffset.y()); | 921 | QPointF(r.x() + textureOffset.x(), r.y() + textureOffset.y()) * scale); | ||
916 | quad[ 2 ] = WindowVertex(r.x() + r.width(), r.y() + r.height(), r.x() + r.width() + textureOffset.x(), r.y() + r.height() + textureOffset.y()); | 922 | quad[ 1 ] = WindowVertex(QPointF(r.x() + r.width(), r.y()), | ||
917 | quad[ 3 ] = WindowVertex(r.x(), r.y() + r.height(), r.x() + textureOffset.x(), r.y() + r.height() + textureOffset.y()); | 923 | QPointF(r.x() + r.width() + textureOffset.x(), r.y() + textureOffset.y()) * scale); | ||
924 | quad[ 2 ] = WindowVertex(QPointF(r.x() + r.width(), r.y() + r.height()), | ||||
925 | QPointF(r.x() + r.width() + textureOffset.x(), r.y() + r.height() + textureOffset.y()) * scale); | ||||
926 | quad[ 3 ] = WindowVertex(QPointF(r.x(), r.y() + r.height()), | ||||
927 | QPointF(r.x() + textureOffset.x(), r.y() + r.height() + textureOffset.y()) * scale); | ||||
928 | | ||||
918 | ret.append(quad); | 929 | ret.append(quad); | ||
919 | } | 930 | } | ||
920 | return ret; | 931 | return ret; | ||
921 | } | 932 | } | ||
922 | 933 | | |||
923 | void Scene::Window::updateShadow(Shadow* shadow) | 934 | void Scene::Window::updateShadow(Shadow* shadow) | ||
924 | { | 935 | { | ||
925 | if (m_shadow == shadow) { | 936 | if (m_shadow == shadow) { | ||
▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines |