Changeset View
Changeset View
Standalone View
Standalone View
scene.cpp
Show First 20 Lines • Show All 893 Lines • ▼ Show 20 Line(s) | 884 | { | |||
---|---|---|---|---|---|
894 | const Qt::Orientation orientations[4] = { | 894 | const Qt::Orientation orientations[4] = { | ||
895 | Qt::Vertical, // Left | 895 | Qt::Vertical, // Left | ||
896 | Qt::Horizontal, // Top | 896 | Qt::Horizontal, // Top | ||
897 | Qt::Vertical, // Right | 897 | Qt::Vertical, // Right | ||
898 | Qt::Horizontal, // Bottom | 898 | Qt::Horizontal, // Bottom | ||
899 | }; | 899 | }; | ||
900 | 900 | | |||
901 | for (int i = 0; i < 4; i++) { | 901 | for (int i = 0; i < 4; i++) { | ||
902 | foreach (const QRect &r, (region & rects[i]).rects()) { | 902 | const QRegion intersectedRegion = (region & rects[i]); | ||
903 | for (const QRect &r : intersectedRegion) { | ||||
fredrik: operator & doesn't combine; it intersects. | |||||
903 | if (!r.isValid()) | 904 | if (!r.isValid()) | ||
904 | continue; | 905 | continue; | ||
905 | 906 | | |||
906 | const bool swap = orientations[i] == Qt::Vertical; | 907 | const bool swap = orientations[i] == Qt::Vertical; | ||
907 | 908 | | |||
908 | const int x0 = r.x(); | 909 | const int x0 = r.x(); | ||
909 | const int y0 = r.y(); | 910 | const int y0 = r.y(); | ||
910 | const int x1 = r.x() + r.width(); | 911 | const int x1 = r.x() + r.width(); | ||
Show All 24 Lines | |||||
935 | } | 936 | } | ||
936 | 937 | | |||
937 | return list; | 938 | return list; | ||
938 | } | 939 | } | ||
939 | 940 | | |||
940 | WindowQuadList Scene::Window::makeQuads(WindowQuadType type, const QRegion& reg, const QPoint &textureOffset, qreal scale) const | 941 | WindowQuadList Scene::Window::makeQuads(WindowQuadType type, const QRegion& reg, const QPoint &textureOffset, qreal scale) const | ||
941 | { | 942 | { | ||
942 | WindowQuadList ret; | 943 | WindowQuadList ret; | ||
943 | foreach (const QRect & r, reg.rects()) { | 944 | ret.reserve(reg.rectCount()); | ||
945 | for (const QRect &r : reg) { | ||||
944 | WindowQuad quad(type); | 946 | WindowQuad quad(type); | ||
945 | // TODO asi mam spatne pravy dolni roh - bud tady, nebo v jinych castech | 947 | // TODO asi mam spatne pravy dolni roh - bud tady, nebo v jinych castech | ||
946 | quad[ 0 ] = WindowVertex(QPointF(r.x(), r.y()), | 948 | quad[ 0 ] = WindowVertex(QPointF(r.x(), r.y()), | ||
947 | QPointF(r.x() + textureOffset.x(), r.y() + textureOffset.y()) * scale); | 949 | QPointF(r.x() + textureOffset.x(), r.y() + textureOffset.y()) * scale); | ||
948 | quad[ 1 ] = WindowVertex(QPointF(r.x() + r.width(), r.y()), | 950 | quad[ 1 ] = WindowVertex(QPointF(r.x() + r.width(), r.y()), | ||
949 | QPointF(r.x() + r.width() + textureOffset.x(), r.y() + textureOffset.y()) * scale); | 951 | QPointF(r.x() + r.width() + textureOffset.x(), r.y() + textureOffset.y()) * scale); | ||
950 | quad[ 2 ] = WindowVertex(QPointF(r.x() + r.width(), r.y() + r.height()), | 952 | quad[ 2 ] = WindowVertex(QPointF(r.x() + r.width(), r.y() + r.height()), | ||
951 | QPointF(r.x() + r.width() + textureOffset.x(), r.y() + r.height() + textureOffset.y()) * scale); | 953 | QPointF(r.x() + r.width() + textureOffset.x(), r.y() + r.height() + textureOffset.y()) * scale); | ||
▲ Show 20 Lines • Show All 197 Lines • Show Last 20 Lines |
operator & doesn't combine; it intersects.