Changeset View
Changeset View
Standalone View
Standalone View
scene.cpp
Show First 20 Lines • Show All 985 Lines • ▼ Show 20 Line(s) | 984 | if (contentsRegion.rectCount() < 2) { | |||
---|---|---|---|---|---|
986 | QRectF sourceRect(contentsRect.topLeft() * textureScale, | 986 | QRectF sourceRect(contentsRect.topLeft() * textureScale, | ||
987 | contentsRect.bottomRight() * textureScale); | 987 | contentsRect.bottomRight() * textureScale); | ||
988 | 988 | | |||
989 | if (const auto *surface = toplevel->surface()) { | 989 | if (const auto *surface = toplevel->surface()) { | ||
990 | const QRectF rect = surface->sourceRectangle(); | 990 | const QRectF rect = surface->sourceRectangle(); | ||
991 | if (rect.isValid()) { | 991 | if (rect.isValid()) { | ||
992 | sourceRect = QRectF(rect.topLeft() * textureScale, | 992 | sourceRect = QRectF(rect.topLeft() * textureScale, | ||
993 | rect.bottomRight() * textureScale); | 993 | rect.bottomRight() * textureScale); | ||
994 | } else if (auto *buffer = surface->buffer()) { | 994 | } else { | ||
995 | auto *buffer = surface->buffer(); | ||||
996 | // XWayland client's geometry must be taken from their content placement since the | ||||
997 | // buffer size is not in sync. | ||||
998 | if (buffer && !toplevel->isClient()) { | ||||
995 | // Try to get the source rectangle from the buffer size, what defines the source | 999 | // Try to get the source rectangle from the buffer size, what defines the source | ||
996 | // size without respect to destination size. | 1000 | // size without respect to destination size. | ||
997 | const auto origin = contentsRect.topLeft(); | 1001 | const auto origin = contentsRect.topLeft(); | ||
998 | const QRectF rect = QRectF(origin, buffer->size() - QSize(origin.x(), origin.y())); | 1002 | const QRectF rect = QRectF(origin, | ||
1003 | buffer->size() - QSize(origin.x(), origin.y())); | ||||
1004 | Q_ASSERT(rect.isValid()); | ||||
999 | // Make sure a buffer was set already. | 1005 | // Make sure a buffer was set already. | ||
1000 | if (rect.isValid()) { | 1006 | if (rect.isValid()) { | ||
1001 | sourceRect = rect; | 1007 | sourceRect = rect; | ||
1002 | } | 1008 | } | ||
1003 | } | 1009 | } | ||
1004 | } | 1010 | } | ||
1011 | } | ||||
1005 | quads << createQuad(contentsRect, sourceRect); | 1012 | quads << createQuad(contentsRect, sourceRect); | ||
1006 | } else { | 1013 | } else { | ||
1007 | for (const QRectF &contentsRect : contentsRegion) { | 1014 | for (const QRectF &contentsRect : contentsRegion) { | ||
1008 | const QRectF sourceRect(contentsRect.topLeft() * textureScale, | 1015 | const QRectF sourceRect(contentsRect.topLeft() * textureScale, | ||
1009 | contentsRect.bottomRight() * textureScale); | 1016 | contentsRect.bottomRight() * textureScale); | ||
1010 | quads << createQuad(contentsRect, sourceRect); | 1017 | quads << createQuad(contentsRect, sourceRect); | ||
1011 | } | 1018 | } | ||
1012 | } | 1019 | } | ||
▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines |