Changeset View
Changeset View
Standalone View
Standalone View
plugins/scenes/opengl/scene_opengl.cpp
Show First 20 Lines • Show All 1528 Lines • ▼ Show 20 Line(s) | 1526 | OpenGLWindowPixmap::OpenGLWindowPixmap(const QPointer<KWayland::Server::SubSurfaceInterface> &subSurface, WindowPixmap *parent, SceneOpenGL *scene) | |||
---|---|---|---|---|---|
1529 | , m_scene(scene) | 1529 | , m_scene(scene) | ||
1530 | { | 1530 | { | ||
1531 | } | 1531 | } | ||
1532 | 1532 | | |||
1533 | OpenGLWindowPixmap::~OpenGLWindowPixmap() | 1533 | OpenGLWindowPixmap::~OpenGLWindowPixmap() | ||
1534 | { | 1534 | { | ||
1535 | } | 1535 | } | ||
1536 | 1536 | | |||
1537 | static bool needsPixmapUpdate(const OpenGLWindowPixmap *pixmap) | ||||
1538 | { | ||||
1539 | // That's a regular Wayland client. | ||||
1540 | if (pixmap->surface()) { | ||||
1541 | return !pixmap->surface()->trackedDamage().isEmpty(); | ||||
1542 | } | ||||
1543 | | ||||
1544 | // That's an internal client with a raster buffer attached. | ||||
1545 | if (!pixmap->internalImage().isNull()) { | ||||
1546 | return !pixmap->toplevel()->damage().isEmpty(); | ||||
1547 | } | ||||
1548 | | ||||
1549 | // That's an internal client with an opengl framebuffer object attached. | ||||
1550 | if (!pixmap->fbo().isNull()) { | ||||
1551 | return !pixmap->toplevel()->damage().isEmpty(); | ||||
1552 | } | ||||
1553 | | ||||
1554 | // That's an X11 client. | ||||
1555 | return false; | ||||
1556 | } | ||||
1557 | | ||||
1537 | bool OpenGLWindowPixmap::bind() | 1558 | bool OpenGLWindowPixmap::bind() | ||
1538 | { | 1559 | { | ||
1539 | if (!m_texture->isNull()) { | 1560 | if (!m_texture->isNull()) { | ||
1540 | // always call updateBuffer to get the sub-surface tree updated | 1561 | // always call updateBuffer to get the sub-surface tree updated | ||
1541 | if (subSurface().isNull() && !toplevel()->damage().isEmpty()) { | 1562 | if (subSurface().isNull() && !toplevel()->damage().isEmpty()) { | ||
1542 | updateBuffer(); | 1563 | updateBuffer(); | ||
1543 | } | 1564 | } | ||
1544 | auto s = surface(); | 1565 | if (needsPixmapUpdate(this)) { | ||
1545 | if (s && !s->trackedDamage().isEmpty()) { | | |||
1546 | m_texture->updateFromPixmap(this); | 1566 | m_texture->updateFromPixmap(this); | ||
1547 | // mipmaps need to be updated | 1567 | // mipmaps need to be updated | ||
1548 | m_texture->setDirty(); | 1568 | m_texture->setDirty(); | ||
1549 | } | 1569 | } | ||
1550 | if (subSurface().isNull()) { | 1570 | if (subSurface().isNull()) { | ||
1551 | toplevel()->resetDamage(); | 1571 | toplevel()->resetDamage(); | ||
1552 | } | 1572 | } | ||
1553 | // also bind all children | 1573 | // also bind all children | ||
▲ Show 20 Lines • Show All 1040 Lines • Show Last 20 Lines |