Changeset View
Changeset View
Standalone View
Standalone View
plugins/scenes/opengl/scene_opengl.cpp
Show First 20 Lines • Show All 488 Lines • ▼ Show 20 Line(s) | 487 | { | |||
---|---|---|---|---|---|
489 | if (!backend) { | 489 | if (!backend) { | ||
490 | return nullptr; | 490 | return nullptr; | ||
491 | } | 491 | } | ||
492 | if (!backend->isFailed()) { | 492 | if (!backend->isFailed()) { | ||
493 | backend->init(); | 493 | backend->init(); | ||
494 | } | 494 | } | ||
495 | if (backend->isFailed()) { | 495 | if (backend->isFailed()) { | ||
496 | delete backend; | 496 | delete backend; | ||
497 | return NULL; | 497 | return nullptr; | ||
498 | } | 498 | } | ||
499 | SceneOpenGL *scene = NULL; | 499 | SceneOpenGL *scene = nullptr; | ||
500 | // first let's try an OpenGL 2 scene | 500 | // first let's try an OpenGL 2 scene | ||
501 | if (SceneOpenGL2::supported(backend)) { | 501 | if (SceneOpenGL2::supported(backend)) { | ||
502 | scene = new SceneOpenGL2(backend, parent); | 502 | scene = new SceneOpenGL2(backend, parent); | ||
503 | if (scene->initFailed()) { | 503 | if (scene->initFailed()) { | ||
504 | delete scene; | 504 | delete scene; | ||
505 | scene = NULL; | 505 | scene = nullptr; | ||
506 | } else { | 506 | } else { | ||
507 | return scene; | 507 | return scene; | ||
508 | } | 508 | } | ||
509 | } | 509 | } | ||
510 | if (!scene) { | 510 | if (!scene) { | ||
511 | if (GLPlatform::instance()->recommendedCompositor() == XRenderCompositing) { | 511 | if (GLPlatform::instance()->recommendedCompositor() == XRenderCompositing) { | ||
512 | qCCritical(KWIN_OPENGL) << "OpenGL driver recommends XRender based compositing. Falling back to XRender."; | 512 | qCCritical(KWIN_OPENGL) << "OpenGL driver recommends XRender based compositing. Falling back to XRender."; | ||
513 | qCCritical(KWIN_OPENGL) << "To overwrite the detection use the environment variable KWIN_COMPOSE"; | 513 | qCCritical(KWIN_OPENGL) << "To overwrite the detection use the environment variable KWIN_COMPOSE"; | ||
▲ Show 20 Lines • Show All 399 Lines • ▼ Show 20 Line(s) | 912 | if (GLPlatform::instance()->recommendedCompositor() < OpenGL2Compositing) { | |||
913 | qCDebug(KWIN_OPENGL) << "Driver does not recommend OpenGL 2 compositing"; | 913 | qCDebug(KWIN_OPENGL) << "Driver does not recommend OpenGL 2 compositing"; | ||
914 | return false; | 914 | return false; | ||
915 | } | 915 | } | ||
916 | return true; | 916 | return true; | ||
917 | } | 917 | } | ||
918 | 918 | | |||
919 | SceneOpenGL2::SceneOpenGL2(OpenGLBackend *backend, QObject *parent) | 919 | SceneOpenGL2::SceneOpenGL2(OpenGLBackend *backend, QObject *parent) | ||
920 | : SceneOpenGL(backend, parent) | 920 | : SceneOpenGL(backend, parent) | ||
921 | , m_lanczosFilter(NULL) | 921 | , m_lanczosFilter(nullptr) | ||
922 | { | 922 | { | ||
923 | if (!init_ok) { | 923 | if (!init_ok) { | ||
924 | // base ctor already failed | 924 | // base ctor already failed | ||
925 | return; | 925 | return; | ||
926 | } | 926 | } | ||
927 | 927 | | |||
928 | // We only support the OpenGL 2+ shader API, not GL_ARB_shader_objects | 928 | // We only support the OpenGL 2+ shader API, not GL_ARB_shader_objects | ||
929 | if (!hasGLVersion(2, 0)) { | 929 | if (!hasGLVersion(2, 0)) { | ||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 1017 | { | |||
1022 | Scene::paintGenericScreen(mask, data); | 1022 | Scene::paintGenericScreen(mask, data); | ||
1023 | } | 1023 | } | ||
1024 | 1024 | | |||
1025 | void SceneOpenGL2::doPaintBackground(const QVector< float >& vertices) | 1025 | void SceneOpenGL2::doPaintBackground(const QVector< float >& vertices) | ||
1026 | { | 1026 | { | ||
1027 | GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); | 1027 | GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); | ||
1028 | vbo->reset(); | 1028 | vbo->reset(); | ||
1029 | vbo->setUseColor(true); | 1029 | vbo->setUseColor(true); | ||
1030 | vbo->setData(vertices.count() / 2, 2, vertices.data(), NULL); | 1030 | vbo->setData(vertices.count() / 2, 2, vertices.data(), nullptr); | ||
1031 | 1031 | | |||
1032 | ShaderBinder binder(ShaderTrait::UniformColor); | 1032 | ShaderBinder binder(ShaderTrait::UniformColor); | ||
1033 | binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, m_projectionMatrix); | 1033 | binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, m_projectionMatrix); | ||
1034 | 1034 | | |||
1035 | vbo->render(GL_TRIANGLES); | 1035 | vbo->render(GL_TRIANGLES); | ||
1036 | } | 1036 | } | ||
1037 | 1037 | | |||
1038 | Scene::Window *SceneOpenGL2::createWindow(Toplevel *t) | 1038 | Scene::Window *SceneOpenGL2::createWindow(Toplevel *t) | ||
Show All 16 Lines | 1054 | { | |||
1055 | if (mask & PAINT_WINDOW_LANCZOS) { | 1055 | if (mask & PAINT_WINDOW_LANCZOS) { | ||
1056 | if (!m_lanczosFilter) { | 1056 | if (!m_lanczosFilter) { | ||
1057 | m_lanczosFilter = new LanczosFilter(this); | 1057 | m_lanczosFilter = new LanczosFilter(this); | ||
1058 | // reset the lanczos filter when the screen gets resized | 1058 | // reset the lanczos filter when the screen gets resized | ||
1059 | // it will get created next paint | 1059 | // it will get created next paint | ||
1060 | connect(screens(), &Screens::changed, this, [this]() { | 1060 | connect(screens(), &Screens::changed, this, [this]() { | ||
1061 | makeOpenGLContextCurrent(); | 1061 | makeOpenGLContextCurrent(); | ||
1062 | delete m_lanczosFilter; | 1062 | delete m_lanczosFilter; | ||
1063 | m_lanczosFilter = NULL; | 1063 | m_lanczosFilter = nullptr; | ||
1064 | }); | 1064 | }); | ||
1065 | } | 1065 | } | ||
1066 | m_lanczosFilter->performPaint(w, mask, region, data); | 1066 | m_lanczosFilter->performPaint(w, mask, region, data); | ||
1067 | } else | 1067 | } else | ||
1068 | w->sceneWindow()->performPaint(mask, region, data); | 1068 | w->sceneWindow()->performPaint(mask, region, data); | ||
1069 | } | 1069 | } | ||
1070 | 1070 | | |||
1071 | //**************************************** | 1071 | //**************************************** | ||
1072 | // SceneOpenGL::Window | 1072 | // SceneOpenGL::Window | ||
1073 | //**************************************** | 1073 | //**************************************** | ||
1074 | 1074 | | |||
1075 | SceneOpenGL::Window::Window(Toplevel* c) | 1075 | SceneOpenGL::Window::Window(Toplevel* c) | ||
1076 | : Scene::Window(c) | 1076 | : Scene::Window(c) | ||
1077 | , m_scene(NULL) | 1077 | , m_scene(nullptr) | ||
1078 | { | 1078 | { | ||
1079 | } | 1079 | } | ||
1080 | 1080 | | |||
1081 | SceneOpenGL::Window::~Window() | 1081 | SceneOpenGL::Window::~Window() | ||
1082 | { | 1082 | { | ||
1083 | } | 1083 | } | ||
1084 | 1084 | | |||
1085 | static SceneOpenGLTexture *s_frameTexture = NULL; | 1085 | static SceneOpenGLTexture *s_frameTexture = nullptr; | ||
1086 | // Bind the window pixmap to an OpenGL texture. | 1086 | // Bind the window pixmap to an OpenGL texture. | ||
1087 | bool SceneOpenGL::Window::bindTexture() | 1087 | bool SceneOpenGL::Window::bindTexture() | ||
1088 | { | 1088 | { | ||
1089 | s_frameTexture = NULL; | 1089 | s_frameTexture = nullptr; | ||
1090 | OpenGLWindowPixmap *pixmap = windowPixmap<OpenGLWindowPixmap>(); | 1090 | OpenGLWindowPixmap *pixmap = windowPixmap<OpenGLWindowPixmap>(); | ||
1091 | if (!pixmap) { | 1091 | if (!pixmap) { | ||
1092 | return false; | 1092 | return false; | ||
1093 | } | 1093 | } | ||
1094 | s_frameTexture = pixmap->texture(); | 1094 | s_frameTexture = pixmap->texture(); | ||
1095 | if (pixmap->isDiscarded()) { | 1095 | if (pixmap->isDiscarded()) { | ||
1096 | return !pixmap->texture()->isNull(); | 1096 | return !pixmap->texture()->isNull(); | ||
1097 | } | 1097 | } | ||
▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Line(s) | 1281 | if (data.crossFadeProgress() != 1.0 && (data.opacity() < 0.95 || toplevel->hasAlpha())) { | |||
1283 | nodes[ContentLeaf].opacity = data.opacity() * (1 - pow(opacity, 1.0f + 2.0f * data.opacity())); | 1283 | nodes[ContentLeaf].opacity = data.opacity() * (1 - pow(opacity, 1.0f + 2.0f * data.opacity())); | ||
1284 | } else { | 1284 | } else { | ||
1285 | nodes[ContentLeaf].opacity = data.opacity(); | 1285 | nodes[ContentLeaf].opacity = data.opacity(); | ||
1286 | } | 1286 | } | ||
1287 | nodes[ContentLeaf].coordinateType = UnnormalizedCoordinates; | 1287 | nodes[ContentLeaf].coordinateType = UnnormalizedCoordinates; | ||
1288 | 1288 | | |||
1289 | if (data.crossFadeProgress() != 1.0) { | 1289 | if (data.crossFadeProgress() != 1.0) { | ||
1290 | OpenGLWindowPixmap *previous = previousWindowPixmap<OpenGLWindowPixmap>(); | 1290 | OpenGLWindowPixmap *previous = previousWindowPixmap<OpenGLWindowPixmap>(); | ||
1291 | nodes[PreviousContentLeaf].texture = previous ? previous->texture() : NULL; | 1291 | nodes[PreviousContentLeaf].texture = previous ? previous->texture() : nullptr; | ||
1292 | nodes[PreviousContentLeaf].hasAlpha = !isOpaque(); | 1292 | nodes[PreviousContentLeaf].hasAlpha = !isOpaque(); | ||
1293 | nodes[PreviousContentLeaf].opacity = data.opacity() * (1.0 - data.crossFadeProgress()); | 1293 | nodes[PreviousContentLeaf].opacity = data.opacity() * (1.0 - data.crossFadeProgress()); | ||
1294 | nodes[PreviousContentLeaf].coordinateType = NormalizedCoordinates; | 1294 | nodes[PreviousContentLeaf].coordinateType = NormalizedCoordinates; | ||
1295 | } | 1295 | } | ||
1296 | } | 1296 | } | ||
1297 | 1297 | | |||
1298 | QMatrix4x4 SceneOpenGL2Window::modelViewProjectionMatrix(int mask, const WindowPaintData &data) const | 1298 | QMatrix4x4 SceneOpenGL2Window::modelViewProjectionMatrix(int mask, const WindowPaintData &data) const | ||
1299 | { | 1299 | { | ||
▲ Show 20 Lines • Show All 276 Lines • ▼ Show 20 Line(s) | 1573 | { | |||
1576 | } | 1576 | } | ||
1577 | return WindowPixmap::isValid(); | 1577 | return WindowPixmap::isValid(); | ||
1578 | } | 1578 | } | ||
1579 | 1579 | | |||
1580 | //**************************************** | 1580 | //**************************************** | ||
1581 | // SceneOpenGL::EffectFrame | 1581 | // SceneOpenGL::EffectFrame | ||
1582 | //**************************************** | 1582 | //**************************************** | ||
1583 | 1583 | | |||
1584 | GLTexture* SceneOpenGL::EffectFrame::m_unstyledTexture = NULL; | 1584 | GLTexture* SceneOpenGL::EffectFrame::m_unstyledTexture = nullptr; | ||
1585 | QPixmap* SceneOpenGL::EffectFrame::m_unstyledPixmap = NULL; | 1585 | QPixmap* SceneOpenGL::EffectFrame::m_unstyledPixmap = nullptr; | ||
1586 | 1586 | | |||
1587 | SceneOpenGL::EffectFrame::EffectFrame(EffectFrameImpl* frame, SceneOpenGL *scene) | 1587 | SceneOpenGL::EffectFrame::EffectFrame(EffectFrameImpl* frame, SceneOpenGL *scene) | ||
1588 | : Scene::EffectFrame(frame) | 1588 | : Scene::EffectFrame(frame) | ||
1589 | , m_texture(NULL) | 1589 | , m_texture(nullptr) | ||
1590 | , m_textTexture(NULL) | 1590 | , m_textTexture(nullptr) | ||
1591 | , m_oldTextTexture(NULL) | 1591 | , m_oldTextTexture(nullptr) | ||
1592 | , m_textPixmap(NULL) | 1592 | , m_textPixmap(nullptr) | ||
1593 | , m_iconTexture(NULL) | 1593 | , m_iconTexture(nullptr) | ||
1594 | , m_oldIconTexture(NULL) | 1594 | , m_oldIconTexture(nullptr) | ||
1595 | , m_selectionTexture(NULL) | 1595 | , m_selectionTexture(nullptr) | ||
1596 | , m_unstyledVBO(NULL) | 1596 | , m_unstyledVBO(nullptr) | ||
1597 | , m_scene(scene) | 1597 | , m_scene(scene) | ||
1598 | { | 1598 | { | ||
1599 | if (m_effectFrame->style() == EffectFrameUnstyled && !m_unstyledTexture) { | 1599 | if (m_effectFrame->style() == EffectFrameUnstyled && !m_unstyledTexture) { | ||
1600 | updateUnstyledTexture(); | 1600 | updateUnstyledTexture(); | ||
1601 | } | 1601 | } | ||
1602 | } | 1602 | } | ||
1603 | 1603 | | |||
1604 | SceneOpenGL::EffectFrame::~EffectFrame() | 1604 | SceneOpenGL::EffectFrame::~EffectFrame() | ||
1605 | { | 1605 | { | ||
1606 | delete m_texture; | 1606 | delete m_texture; | ||
1607 | delete m_textTexture; | 1607 | delete m_textTexture; | ||
1608 | delete m_textPixmap; | 1608 | delete m_textPixmap; | ||
1609 | delete m_oldTextTexture; | 1609 | delete m_oldTextTexture; | ||
1610 | delete m_iconTexture; | 1610 | delete m_iconTexture; | ||
1611 | delete m_oldIconTexture; | 1611 | delete m_oldIconTexture; | ||
1612 | delete m_selectionTexture; | 1612 | delete m_selectionTexture; | ||
1613 | delete m_unstyledVBO; | 1613 | delete m_unstyledVBO; | ||
1614 | } | 1614 | } | ||
1615 | 1615 | | |||
1616 | void SceneOpenGL::EffectFrame::free() | 1616 | void SceneOpenGL::EffectFrame::free() | ||
1617 | { | 1617 | { | ||
1618 | glFlush(); | 1618 | glFlush(); | ||
1619 | delete m_texture; | 1619 | delete m_texture; | ||
1620 | m_texture = NULL; | 1620 | m_texture = nullptr; | ||
1621 | delete m_textTexture; | 1621 | delete m_textTexture; | ||
1622 | m_textTexture = NULL; | 1622 | m_textTexture = nullptr; | ||
1623 | delete m_textPixmap; | 1623 | delete m_textPixmap; | ||
1624 | m_textPixmap = NULL; | 1624 | m_textPixmap = nullptr; | ||
1625 | delete m_iconTexture; | 1625 | delete m_iconTexture; | ||
1626 | m_iconTexture = NULL; | 1626 | m_iconTexture = nullptr; | ||
1627 | delete m_selectionTexture; | 1627 | delete m_selectionTexture; | ||
1628 | m_selectionTexture = NULL; | 1628 | m_selectionTexture = nullptr; | ||
1629 | delete m_unstyledVBO; | 1629 | delete m_unstyledVBO; | ||
1630 | m_unstyledVBO = NULL; | 1630 | m_unstyledVBO = nullptr; | ||
1631 | delete m_oldIconTexture; | 1631 | delete m_oldIconTexture; | ||
1632 | m_oldIconTexture = NULL; | 1632 | m_oldIconTexture = nullptr; | ||
1633 | delete m_oldTextTexture; | 1633 | delete m_oldTextTexture; | ||
1634 | m_oldTextTexture = NULL; | 1634 | m_oldTextTexture = nullptr; | ||
1635 | } | 1635 | } | ||
1636 | 1636 | | |||
1637 | void SceneOpenGL::EffectFrame::freeIconFrame() | 1637 | void SceneOpenGL::EffectFrame::freeIconFrame() | ||
1638 | { | 1638 | { | ||
1639 | delete m_iconTexture; | 1639 | delete m_iconTexture; | ||
1640 | m_iconTexture = NULL; | 1640 | m_iconTexture = nullptr; | ||
1641 | } | 1641 | } | ||
1642 | 1642 | | |||
1643 | void SceneOpenGL::EffectFrame::freeTextFrame() | 1643 | void SceneOpenGL::EffectFrame::freeTextFrame() | ||
1644 | { | 1644 | { | ||
1645 | delete m_textTexture; | 1645 | delete m_textTexture; | ||
1646 | m_textTexture = NULL; | 1646 | m_textTexture = nullptr; | ||
1647 | delete m_textPixmap; | 1647 | delete m_textPixmap; | ||
1648 | m_textPixmap = NULL; | 1648 | m_textPixmap = nullptr; | ||
1649 | } | 1649 | } | ||
1650 | 1650 | | |||
1651 | void SceneOpenGL::EffectFrame::freeSelection() | 1651 | void SceneOpenGL::EffectFrame::freeSelection() | ||
1652 | { | 1652 | { | ||
1653 | delete m_selectionTexture; | 1653 | delete m_selectionTexture; | ||
1654 | m_selectionTexture = NULL; | 1654 | m_selectionTexture = nullptr; | ||
1655 | } | 1655 | } | ||
1656 | 1656 | | |||
1657 | void SceneOpenGL::EffectFrame::crossFadeIcon() | 1657 | void SceneOpenGL::EffectFrame::crossFadeIcon() | ||
1658 | { | 1658 | { | ||
1659 | delete m_oldIconTexture; | 1659 | delete m_oldIconTexture; | ||
1660 | m_oldIconTexture = m_iconTexture; | 1660 | m_oldIconTexture = m_iconTexture; | ||
1661 | m_iconTexture = NULL; | 1661 | m_iconTexture = nullptr; | ||
1662 | } | 1662 | } | ||
1663 | 1663 | | |||
1664 | void SceneOpenGL::EffectFrame::crossFadeText() | 1664 | void SceneOpenGL::EffectFrame::crossFadeText() | ||
1665 | { | 1665 | { | ||
1666 | delete m_oldTextTexture; | 1666 | delete m_oldTextTexture; | ||
1667 | m_oldTextTexture = m_textTexture; | 1667 | m_oldTextTexture = m_textTexture; | ||
1668 | m_textTexture = NULL; | 1668 | m_textTexture = nullptr; | ||
1669 | } | 1669 | } | ||
1670 | 1670 | | |||
1671 | void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double frameOpacity) | 1671 | void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double frameOpacity) | ||
1672 | { | 1672 | { | ||
1673 | if (m_effectFrame->geometry().isEmpty()) | 1673 | if (m_effectFrame->geometry().isEmpty()) | ||
1674 | return; // Nothing to display | 1674 | return; // Nothing to display | ||
1675 | 1675 | | |||
1676 | region = infiniteRegion(); // TODO: Old region doesn't seem to work with OpenGL | 1676 | region = infiniteRegion(); // TODO: Old region doesn't seem to work with OpenGL | ||
▲ Show 20 Lines • Show All 254 Lines • ▼ Show 20 Line(s) | 1930 | if (shader) { | |||
1931 | ShaderManager::instance()->popShader(); | 1931 | ShaderManager::instance()->popShader(); | ||
1932 | } | 1932 | } | ||
1933 | glDisable(GL_BLEND); | 1933 | glDisable(GL_BLEND); | ||
1934 | } | 1934 | } | ||
1935 | 1935 | | |||
1936 | void SceneOpenGL::EffectFrame::updateTexture() | 1936 | void SceneOpenGL::EffectFrame::updateTexture() | ||
1937 | { | 1937 | { | ||
1938 | delete m_texture; | 1938 | delete m_texture; | ||
1939 | m_texture = 0L; | 1939 | m_texture = nullptr; | ||
1940 | if (m_effectFrame->style() == EffectFrameStyled) { | 1940 | if (m_effectFrame->style() == EffectFrameStyled) { | ||
1941 | QPixmap pixmap = m_effectFrame->frame().framePixmap(); | 1941 | QPixmap pixmap = m_effectFrame->frame().framePixmap(); | ||
1942 | m_texture = new GLTexture(pixmap); | 1942 | m_texture = new GLTexture(pixmap); | ||
1943 | } | 1943 | } | ||
1944 | } | 1944 | } | ||
1945 | 1945 | | |||
1946 | void SceneOpenGL::EffectFrame::updateTextTexture() | 1946 | void SceneOpenGL::EffectFrame::updateTextTexture() | ||
1947 | { | 1947 | { | ||
1948 | delete m_textTexture; | 1948 | delete m_textTexture; | ||
1949 | m_textTexture = 0L; | 1949 | m_textTexture = nullptr; | ||
1950 | delete m_textPixmap; | 1950 | delete m_textPixmap; | ||
1951 | m_textPixmap = 0L; | 1951 | m_textPixmap = nullptr; | ||
1952 | 1952 | | |||
1953 | if (m_effectFrame->text().isEmpty()) | 1953 | if (m_effectFrame->text().isEmpty()) | ||
1954 | return; | 1954 | return; | ||
1955 | 1955 | | |||
1956 | // Determine position on texture to paint text | 1956 | // Determine position on texture to paint text | ||
1957 | QRect rect(QPoint(0, 0), m_effectFrame->geometry().size()); | 1957 | QRect rect(QPoint(0, 0), m_effectFrame->geometry().size()); | ||
1958 | if (!m_effectFrame->icon().isNull() && !m_effectFrame->iconSize().isEmpty()) | 1958 | if (!m_effectFrame->icon().isNull() && !m_effectFrame->iconSize().isEmpty()) | ||
1959 | rect.setLeft(m_effectFrame->iconSize().width()); | 1959 | rect.setLeft(m_effectFrame->iconSize().width()); | ||
Show All 16 Lines | |||||
1976 | p.drawText(rect, m_effectFrame->alignment(), text); | 1976 | p.drawText(rect, m_effectFrame->alignment(), text); | ||
1977 | p.end(); | 1977 | p.end(); | ||
1978 | m_textTexture = new GLTexture(*m_textPixmap); | 1978 | m_textTexture = new GLTexture(*m_textPixmap); | ||
1979 | } | 1979 | } | ||
1980 | 1980 | | |||
1981 | void SceneOpenGL::EffectFrame::updateUnstyledTexture() | 1981 | void SceneOpenGL::EffectFrame::updateUnstyledTexture() | ||
1982 | { | 1982 | { | ||
1983 | delete m_unstyledTexture; | 1983 | delete m_unstyledTexture; | ||
1984 | m_unstyledTexture = 0L; | 1984 | m_unstyledTexture = nullptr; | ||
1985 | delete m_unstyledPixmap; | 1985 | delete m_unstyledPixmap; | ||
1986 | m_unstyledPixmap = 0L; | 1986 | m_unstyledPixmap = nullptr; | ||
1987 | // Based off circle() from kwinxrenderutils.cpp | 1987 | // Based off circle() from kwinxrenderutils.cpp | ||
1988 | #define CS 8 | 1988 | #define CS 8 | ||
1989 | m_unstyledPixmap = new QPixmap(2 * CS, 2 * CS); | 1989 | m_unstyledPixmap = new QPixmap(2 * CS, 2 * CS); | ||
1990 | m_unstyledPixmap->fill(Qt::transparent); | 1990 | m_unstyledPixmap->fill(Qt::transparent); | ||
1991 | QPainter p(m_unstyledPixmap); | 1991 | QPainter p(m_unstyledPixmap); | ||
1992 | p.setRenderHint(QPainter::Antialiasing); | 1992 | p.setRenderHint(QPainter::Antialiasing); | ||
1993 | p.setPen(Qt::NoPen); | 1993 | p.setPen(Qt::NoPen); | ||
1994 | p.setBrush(Qt::black); | 1994 | p.setBrush(Qt::black); | ||
1995 | p.drawEllipse(m_unstyledPixmap->rect()); | 1995 | p.drawEllipse(m_unstyledPixmap->rect()); | ||
1996 | p.end(); | 1996 | p.end(); | ||
1997 | #undef CS | 1997 | #undef CS | ||
1998 | m_unstyledTexture = new GLTexture(*m_unstyledPixmap); | 1998 | m_unstyledTexture = new GLTexture(*m_unstyledPixmap); | ||
1999 | } | 1999 | } | ||
2000 | 2000 | | |||
2001 | void SceneOpenGL::EffectFrame::cleanup() | 2001 | void SceneOpenGL::EffectFrame::cleanup() | ||
2002 | { | 2002 | { | ||
2003 | delete m_unstyledTexture; | 2003 | delete m_unstyledTexture; | ||
2004 | m_unstyledTexture = NULL; | 2004 | m_unstyledTexture = nullptr; | ||
2005 | delete m_unstyledPixmap; | 2005 | delete m_unstyledPixmap; | ||
2006 | m_unstyledPixmap = NULL; | 2006 | m_unstyledPixmap = nullptr; | ||
2007 | } | 2007 | } | ||
2008 | 2008 | | |||
2009 | //**************************************** | 2009 | //**************************************** | ||
2010 | // SceneOpenGL::Shadow | 2010 | // SceneOpenGL::Shadow | ||
2011 | //**************************************** | 2011 | //**************************************** | ||
2012 | class DecorationShadowTextureCache | 2012 | class DecorationShadowTextureCache | ||
2013 | { | 2013 | { | ||
2014 | public: | 2014 | public: | ||
▲ Show 20 Lines • Show All 564 Lines • Show Last 20 Lines |