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 190 Lines • ▼ Show 20 Line(s) | 1286 | if (data.crossFadeProgress() != 1.0 && (data.opacity() < 0.95 || toplevel->hasAlpha())) { | |||
1288 | nodes[ContentLeaf].opacity = data.opacity() * (1 - pow(opacity, 1.0f + 2.0f * data.opacity())); | 1288 | nodes[ContentLeaf].opacity = data.opacity() * (1 - pow(opacity, 1.0f + 2.0f * data.opacity())); | ||
1289 | } else { | 1289 | } else { | ||
1290 | nodes[ContentLeaf].opacity = data.opacity(); | 1290 | nodes[ContentLeaf].opacity = data.opacity(); | ||
1291 | } | 1291 | } | ||
1292 | nodes[ContentLeaf].coordinateType = UnnormalizedCoordinates; | 1292 | nodes[ContentLeaf].coordinateType = UnnormalizedCoordinates; | ||
1293 | 1293 | | |||
1294 | if (data.crossFadeProgress() != 1.0) { | 1294 | if (data.crossFadeProgress() != 1.0) { | ||
1295 | OpenGLWindowPixmap *previous = previousWindowPixmap<OpenGLWindowPixmap>(); | 1295 | OpenGLWindowPixmap *previous = previousWindowPixmap<OpenGLWindowPixmap>(); | ||
1296 | nodes[PreviousContentLeaf].texture = previous ? previous->texture() : NULL; | 1296 | nodes[PreviousContentLeaf].texture = previous ? previous->texture() : nullptr; | ||
1297 | nodes[PreviousContentLeaf].hasAlpha = !isOpaque(); | 1297 | nodes[PreviousContentLeaf].hasAlpha = !isOpaque(); | ||
1298 | nodes[PreviousContentLeaf].opacity = data.opacity() * (1.0 - data.crossFadeProgress()); | 1298 | nodes[PreviousContentLeaf].opacity = data.opacity() * (1.0 - data.crossFadeProgress()); | ||
1299 | nodes[PreviousContentLeaf].coordinateType = NormalizedCoordinates; | 1299 | nodes[PreviousContentLeaf].coordinateType = NormalizedCoordinates; | ||
1300 | } | 1300 | } | ||
1301 | } | 1301 | } | ||
1302 | 1302 | | |||
1303 | QMatrix4x4 SceneOpenGL2Window::modelViewProjectionMatrix(int mask, const WindowPaintData &data) const | 1303 | QMatrix4x4 SceneOpenGL2Window::modelViewProjectionMatrix(int mask, const WindowPaintData &data) const | ||
1304 | { | 1304 | { | ||
▲ Show 20 Lines • Show All 286 Lines • ▼ Show 20 Line(s) | 1588 | { | |||
1591 | } | 1591 | } | ||
1592 | return WindowPixmap::isValid(); | 1592 | return WindowPixmap::isValid(); | ||
1593 | } | 1593 | } | ||
1594 | 1594 | | |||
1595 | //**************************************** | 1595 | //**************************************** | ||
1596 | // SceneOpenGL::EffectFrame | 1596 | // SceneOpenGL::EffectFrame | ||
1597 | //**************************************** | 1597 | //**************************************** | ||
1598 | 1598 | | |||
1599 | GLTexture* SceneOpenGL::EffectFrame::m_unstyledTexture = NULL; | 1599 | GLTexture* SceneOpenGL::EffectFrame::m_unstyledTexture = nullptr; | ||
1600 | QPixmap* SceneOpenGL::EffectFrame::m_unstyledPixmap = NULL; | 1600 | QPixmap* SceneOpenGL::EffectFrame::m_unstyledPixmap = nullptr; | ||
1601 | 1601 | | |||
1602 | SceneOpenGL::EffectFrame::EffectFrame(EffectFrameImpl* frame, SceneOpenGL *scene) | 1602 | SceneOpenGL::EffectFrame::EffectFrame(EffectFrameImpl* frame, SceneOpenGL *scene) | ||
1603 | : Scene::EffectFrame(frame) | 1603 | : Scene::EffectFrame(frame) | ||
1604 | , m_texture(NULL) | 1604 | , m_texture(nullptr) | ||
1605 | , m_textTexture(NULL) | 1605 | , m_textTexture(nullptr) | ||
1606 | , m_oldTextTexture(NULL) | 1606 | , m_oldTextTexture(nullptr) | ||
1607 | , m_textPixmap(NULL) | 1607 | , m_textPixmap(nullptr) | ||
1608 | , m_iconTexture(NULL) | 1608 | , m_iconTexture(nullptr) | ||
1609 | , m_oldIconTexture(NULL) | 1609 | , m_oldIconTexture(nullptr) | ||
1610 | , m_selectionTexture(NULL) | 1610 | , m_selectionTexture(nullptr) | ||
1611 | , m_unstyledVBO(NULL) | 1611 | , m_unstyledVBO(nullptr) | ||
1612 | , m_scene(scene) | 1612 | , m_scene(scene) | ||
1613 | { | 1613 | { | ||
1614 | if (m_effectFrame->style() == EffectFrameUnstyled && !m_unstyledTexture) { | 1614 | if (m_effectFrame->style() == EffectFrameUnstyled && !m_unstyledTexture) { | ||
1615 | updateUnstyledTexture(); | 1615 | updateUnstyledTexture(); | ||
1616 | } | 1616 | } | ||
1617 | } | 1617 | } | ||
1618 | 1618 | | |||
1619 | SceneOpenGL::EffectFrame::~EffectFrame() | 1619 | SceneOpenGL::EffectFrame::~EffectFrame() | ||
1620 | { | 1620 | { | ||
1621 | delete m_texture; | 1621 | delete m_texture; | ||
1622 | delete m_textTexture; | 1622 | delete m_textTexture; | ||
1623 | delete m_textPixmap; | 1623 | delete m_textPixmap; | ||
1624 | delete m_oldTextTexture; | 1624 | delete m_oldTextTexture; | ||
1625 | delete m_iconTexture; | 1625 | delete m_iconTexture; | ||
1626 | delete m_oldIconTexture; | 1626 | delete m_oldIconTexture; | ||
1627 | delete m_selectionTexture; | 1627 | delete m_selectionTexture; | ||
1628 | delete m_unstyledVBO; | 1628 | delete m_unstyledVBO; | ||
1629 | } | 1629 | } | ||
1630 | 1630 | | |||
1631 | void SceneOpenGL::EffectFrame::free() | 1631 | void SceneOpenGL::EffectFrame::free() | ||
1632 | { | 1632 | { | ||
1633 | glFlush(); | 1633 | glFlush(); | ||
1634 | delete m_texture; | 1634 | delete m_texture; | ||
1635 | m_texture = NULL; | 1635 | m_texture = nullptr; | ||
1636 | delete m_textTexture; | 1636 | delete m_textTexture; | ||
1637 | m_textTexture = NULL; | 1637 | m_textTexture = nullptr; | ||
1638 | delete m_textPixmap; | 1638 | delete m_textPixmap; | ||
1639 | m_textPixmap = NULL; | 1639 | m_textPixmap = nullptr; | ||
1640 | delete m_iconTexture; | 1640 | delete m_iconTexture; | ||
1641 | m_iconTexture = NULL; | 1641 | m_iconTexture = nullptr; | ||
1642 | delete m_selectionTexture; | 1642 | delete m_selectionTexture; | ||
1643 | m_selectionTexture = NULL; | 1643 | m_selectionTexture = nullptr; | ||
1644 | delete m_unstyledVBO; | 1644 | delete m_unstyledVBO; | ||
1645 | m_unstyledVBO = NULL; | 1645 | m_unstyledVBO = nullptr; | ||
1646 | delete m_oldIconTexture; | 1646 | delete m_oldIconTexture; | ||
1647 | m_oldIconTexture = NULL; | 1647 | m_oldIconTexture = nullptr; | ||
1648 | delete m_oldTextTexture; | 1648 | delete m_oldTextTexture; | ||
1649 | m_oldTextTexture = NULL; | 1649 | m_oldTextTexture = nullptr; | ||
1650 | } | 1650 | } | ||
1651 | 1651 | | |||
1652 | void SceneOpenGL::EffectFrame::freeIconFrame() | 1652 | void SceneOpenGL::EffectFrame::freeIconFrame() | ||
1653 | { | 1653 | { | ||
1654 | delete m_iconTexture; | 1654 | delete m_iconTexture; | ||
1655 | m_iconTexture = NULL; | 1655 | m_iconTexture = nullptr; | ||
1656 | } | 1656 | } | ||
1657 | 1657 | | |||
1658 | void SceneOpenGL::EffectFrame::freeTextFrame() | 1658 | void SceneOpenGL::EffectFrame::freeTextFrame() | ||
1659 | { | 1659 | { | ||
1660 | delete m_textTexture; | 1660 | delete m_textTexture; | ||
1661 | m_textTexture = NULL; | 1661 | m_textTexture = nullptr; | ||
1662 | delete m_textPixmap; | 1662 | delete m_textPixmap; | ||
1663 | m_textPixmap = NULL; | 1663 | m_textPixmap = nullptr; | ||
1664 | } | 1664 | } | ||
1665 | 1665 | | |||
1666 | void SceneOpenGL::EffectFrame::freeSelection() | 1666 | void SceneOpenGL::EffectFrame::freeSelection() | ||
1667 | { | 1667 | { | ||
1668 | delete m_selectionTexture; | 1668 | delete m_selectionTexture; | ||
1669 | m_selectionTexture = NULL; | 1669 | m_selectionTexture = nullptr; | ||
1670 | } | 1670 | } | ||
1671 | 1671 | | |||
1672 | void SceneOpenGL::EffectFrame::crossFadeIcon() | 1672 | void SceneOpenGL::EffectFrame::crossFadeIcon() | ||
1673 | { | 1673 | { | ||
1674 | delete m_oldIconTexture; | 1674 | delete m_oldIconTexture; | ||
1675 | m_oldIconTexture = m_iconTexture; | 1675 | m_oldIconTexture = m_iconTexture; | ||
1676 | m_iconTexture = NULL; | 1676 | m_iconTexture = nullptr; | ||
1677 | } | 1677 | } | ||
1678 | 1678 | | |||
1679 | void SceneOpenGL::EffectFrame::crossFadeText() | 1679 | void SceneOpenGL::EffectFrame::crossFadeText() | ||
1680 | { | 1680 | { | ||
1681 | delete m_oldTextTexture; | 1681 | delete m_oldTextTexture; | ||
1682 | m_oldTextTexture = m_textTexture; | 1682 | m_oldTextTexture = m_textTexture; | ||
1683 | m_textTexture = NULL; | 1683 | m_textTexture = nullptr; | ||
1684 | } | 1684 | } | ||
1685 | 1685 | | |||
1686 | void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double frameOpacity) | 1686 | void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double frameOpacity) | ||
1687 | { | 1687 | { | ||
1688 | if (m_effectFrame->geometry().isEmpty()) | 1688 | if (m_effectFrame->geometry().isEmpty()) | ||
1689 | return; // Nothing to display | 1689 | return; // Nothing to display | ||
1690 | 1690 | | |||
1691 | region = infiniteRegion(); // TODO: Old region doesn't seem to work with OpenGL | 1691 | region = infiniteRegion(); // TODO: Old region doesn't seem to work with OpenGL | ||
▲ Show 20 Lines • Show All 254 Lines • ▼ Show 20 Line(s) | 1945 | if (shader) { | |||
1946 | ShaderManager::instance()->popShader(); | 1946 | ShaderManager::instance()->popShader(); | ||
1947 | } | 1947 | } | ||
1948 | glDisable(GL_BLEND); | 1948 | glDisable(GL_BLEND); | ||
1949 | } | 1949 | } | ||
1950 | 1950 | | |||
1951 | void SceneOpenGL::EffectFrame::updateTexture() | 1951 | void SceneOpenGL::EffectFrame::updateTexture() | ||
1952 | { | 1952 | { | ||
1953 | delete m_texture; | 1953 | delete m_texture; | ||
1954 | m_texture = 0L; | 1954 | m_texture = nullptr; | ||
1955 | if (m_effectFrame->style() == EffectFrameStyled) { | 1955 | if (m_effectFrame->style() == EffectFrameStyled) { | ||
1956 | QPixmap pixmap = m_effectFrame->frame().framePixmap(); | 1956 | QPixmap pixmap = m_effectFrame->frame().framePixmap(); | ||
1957 | m_texture = new GLTexture(pixmap); | 1957 | m_texture = new GLTexture(pixmap); | ||
1958 | } | 1958 | } | ||
1959 | } | 1959 | } | ||
1960 | 1960 | | |||
1961 | void SceneOpenGL::EffectFrame::updateTextTexture() | 1961 | void SceneOpenGL::EffectFrame::updateTextTexture() | ||
1962 | { | 1962 | { | ||
1963 | delete m_textTexture; | 1963 | delete m_textTexture; | ||
1964 | m_textTexture = 0L; | 1964 | m_textTexture = nullptr; | ||
1965 | delete m_textPixmap; | 1965 | delete m_textPixmap; | ||
1966 | m_textPixmap = 0L; | 1966 | m_textPixmap = nullptr; | ||
1967 | 1967 | | |||
1968 | if (m_effectFrame->text().isEmpty()) | 1968 | if (m_effectFrame->text().isEmpty()) | ||
1969 | return; | 1969 | return; | ||
1970 | 1970 | | |||
1971 | // Determine position on texture to paint text | 1971 | // Determine position on texture to paint text | ||
1972 | QRect rect(QPoint(0, 0), m_effectFrame->geometry().size()); | 1972 | QRect rect(QPoint(0, 0), m_effectFrame->geometry().size()); | ||
1973 | if (!m_effectFrame->icon().isNull() && !m_effectFrame->iconSize().isEmpty()) | 1973 | if (!m_effectFrame->icon().isNull() && !m_effectFrame->iconSize().isEmpty()) | ||
1974 | rect.setLeft(m_effectFrame->iconSize().width()); | 1974 | rect.setLeft(m_effectFrame->iconSize().width()); | ||
Show All 16 Lines | |||||
1991 | p.drawText(rect, m_effectFrame->alignment(), text); | 1991 | p.drawText(rect, m_effectFrame->alignment(), text); | ||
1992 | p.end(); | 1992 | p.end(); | ||
1993 | m_textTexture = new GLTexture(*m_textPixmap); | 1993 | m_textTexture = new GLTexture(*m_textPixmap); | ||
1994 | } | 1994 | } | ||
1995 | 1995 | | |||
1996 | void SceneOpenGL::EffectFrame::updateUnstyledTexture() | 1996 | void SceneOpenGL::EffectFrame::updateUnstyledTexture() | ||
1997 | { | 1997 | { | ||
1998 | delete m_unstyledTexture; | 1998 | delete m_unstyledTexture; | ||
1999 | m_unstyledTexture = 0L; | 1999 | m_unstyledTexture = nullptr; | ||
2000 | delete m_unstyledPixmap; | 2000 | delete m_unstyledPixmap; | ||
2001 | m_unstyledPixmap = 0L; | 2001 | m_unstyledPixmap = nullptr; | ||
2002 | // Based off circle() from kwinxrenderutils.cpp | 2002 | // Based off circle() from kwinxrenderutils.cpp | ||
2003 | #define CS 8 | 2003 | #define CS 8 | ||
2004 | m_unstyledPixmap = new QPixmap(2 * CS, 2 * CS); | 2004 | m_unstyledPixmap = new QPixmap(2 * CS, 2 * CS); | ||
2005 | m_unstyledPixmap->fill(Qt::transparent); | 2005 | m_unstyledPixmap->fill(Qt::transparent); | ||
2006 | QPainter p(m_unstyledPixmap); | 2006 | QPainter p(m_unstyledPixmap); | ||
2007 | p.setRenderHint(QPainter::Antialiasing); | 2007 | p.setRenderHint(QPainter::Antialiasing); | ||
2008 | p.setPen(Qt::NoPen); | 2008 | p.setPen(Qt::NoPen); | ||
2009 | p.setBrush(Qt::black); | 2009 | p.setBrush(Qt::black); | ||
2010 | p.drawEllipse(m_unstyledPixmap->rect()); | 2010 | p.drawEllipse(m_unstyledPixmap->rect()); | ||
2011 | p.end(); | 2011 | p.end(); | ||
2012 | #undef CS | 2012 | #undef CS | ||
2013 | m_unstyledTexture = new GLTexture(*m_unstyledPixmap); | 2013 | m_unstyledTexture = new GLTexture(*m_unstyledPixmap); | ||
2014 | } | 2014 | } | ||
2015 | 2015 | | |||
2016 | void SceneOpenGL::EffectFrame::cleanup() | 2016 | void SceneOpenGL::EffectFrame::cleanup() | ||
2017 | { | 2017 | { | ||
2018 | delete m_unstyledTexture; | 2018 | delete m_unstyledTexture; | ||
2019 | m_unstyledTexture = NULL; | 2019 | m_unstyledTexture = nullptr; | ||
2020 | delete m_unstyledPixmap; | 2020 | delete m_unstyledPixmap; | ||
2021 | m_unstyledPixmap = NULL; | 2021 | m_unstyledPixmap = nullptr; | ||
2022 | } | 2022 | } | ||
2023 | 2023 | | |||
2024 | //**************************************** | 2024 | //**************************************** | ||
2025 | // SceneOpenGL::Shadow | 2025 | // SceneOpenGL::Shadow | ||
2026 | //**************************************** | 2026 | //**************************************** | ||
2027 | class DecorationShadowTextureCache | 2027 | class DecorationShadowTextureCache | ||
2028 | { | 2028 | { | ||
2029 | public: | 2029 | public: | ||
▲ Show 20 Lines • Show All 564 Lines • Show Last 20 Lines |