Ejemplo n.º 1
0
void GlideEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{
    InfoHash::const_iterator info = windows.constFind(w);
    if (info != windows.constEnd()) {
        const double progress = info->timeLine->currentValue();
        data.setRotationAxis(Qt::XAxis);
        data.setRotationAngle(angle * (1 - progress));
        data.multiplyOpacity(progress);
        switch(effect) {
        default:
        case GlideInOut:
            if (info->added)
                glideIn(w, data, info);
            else if (info->closed)
                glideOut(w, data, info);
            break;
        case GlideOutIn:
            if (info->added)
                glideOut(w, data, info);
            if (info->closed)
                glideIn(w, data, info);
            break;
        case GlideIn: glideIn(w, data, info); break;
        case GlideOut: glideOut(w, data, info); break;
        }
    }
    effects->paintWindow(w, mask, region, data);
}
Ejemplo n.º 2
0
void KscreenEffect::paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data)
{
    switch (m_state) {
    case StateFadingOut:
        data.multiplyOpacity(1.0 - m_timeLine.currentValue());
        break;
    case StateFadedOut:
        data.multiplyOpacity(0.0);
        break;
    case StateFadingIn:
        data.multiplyOpacity(m_timeLine.currentValue());
        break;
    default:
        // no adjustment
        break;
    }
    effects->paintWindow(w, mask, region, data);
}
Ejemplo n.º 3
0
void ScaleInEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{
    if (mTimeLineWindows.contains(w) && isScaleWindow(w)) {
        const qreal value = mTimeLineWindows[ w ]->currentValue();
        data.multiplyOpacity(value);
        data *= QVector2D(value, value);
        data += QPoint(int(w->width() / 2 * (1 - value)), int(w->height() / 2 * (1 - value)));
    }
    effects->paintWindow(w, mask, region, data);
}
Ejemplo n.º 4
0
void ExplosionEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{
    // Make sure we have OpenGL compositing and the window is vidible and not a
    //  special window
    bool useshader = (mValid && mWindows.contains(w));
    if (useshader) {
        double maxscaleadd = 1.5f;
        double scale = 1 + maxscaleadd * mWindows[w];
        data.setXScale(scale);
        data.setYScale(scale);
        data.translate(int(w->width() / 2 * (1 - scale)), int(w->height() / 2 * (1 - scale)));
        data.multiplyOpacity(0.99);  // Force blending
        ShaderManager *manager = ShaderManager::instance();
        GLShader *shader = manager->pushShader(ShaderManager::GenericShader);
        QMatrix4x4 screenTransformation = shader->getUniformMatrix4x4("screenTransformation");
        manager->popShader();
        ShaderManager::instance()->pushShader(mShader);
        mShader->setUniform("screenTransformation", screenTransformation);
        mShader->setUniform("factor", (float)mWindows[w]);
        mShader->setUniform("scale", (float)scale);
        mShader->setUniform("windowSize", QVector2D(w->width(), w->height()));
        glActiveTexture(GL_TEXTURE4);
        mStartOffsetTex->bind();
        glActiveTexture(GL_TEXTURE5);
        mEndOffsetTex->bind();
        glActiveTexture(GL_TEXTURE0);
        data.shader = mShader;
    }

    // Call the next effect.
    effects->paintWindow(w, mask, region, data);

    if (useshader) {
        ShaderManager::instance()->popShader();
        glActiveTexture(GL_TEXTURE4);
        mStartOffsetTex->unbind();
        glActiveTexture(GL_TEXTURE5);
        mEndOffsetTex->unbind();
        glActiveTexture(GL_TEXTURE0);
    }
}
Ejemplo n.º 5
0
void HighlightWindowEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{
    data.multiplyOpacity(m_windowOpacity.value(w, 1.0f));
    effects->paintWindow(w, mask, region, data);
}
Ejemplo n.º 6
0
void TranslucencyEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{
    if (w->isDesktop() || w->isDock()) {
        effects->paintWindow(w, mask, region, data);
        return;
    }
    // Handling active and inactive windows
    if (inactive != 1.0 && isInactive(w)) {
        data.multiplyOpacity(inactive);

        if (w == previous) {
            data.multiplyOpacity((inactive + ((1.0 - inactive) * (1.0 - activeinactive_timeline.currentValue()))));
            if (activeinactive_timeline.currentValue() < 1.0)
                w->addRepaintFull();
            else
                previous = NULL;
        }
    } else {
        // Fading in
        if (!isInactive(w) && !w->isDesktop()) {
            data.multiplyOpacity((inactive + ((1.0 - inactive) * activeinactive_timeline.currentValue())));
            if (activeinactive_timeline.currentValue() < 1.0)
                w->addRepaintFull();
        }
        // decoration and dialogs
        if (decoration != 1.0 && w->hasDecoration())
            data.multiplyDecorationOpacity(decoration);
        if (dialogs != 1.0 && w->isDialog())
            data.multiplyOpacity(dialogs);

        // Handling moving and resizing
        if (moveresize != 1.0 && !w->isDesktop() && !w->isDock()) {
            double progress = moveresize_timeline.currentValue();
            if (w->isUserMove() || w->isUserResize()) {
                // Fading to translucent
                data.multiplyOpacity((moveresize + ((1.0 - moveresize) * (1.0 - progress))));
                if (progress < 1.0 && progress > 0.0) {
                    w->addRepaintFull();
                    fadeout = w;
                }
            } else {
                // Fading back to more opaque
                if (w == fadeout && !w->isUserMove() && !w->isUserResize()) {
                    data.multiplyOpacity((moveresize + ((1.0 - moveresize) * (progress))));
                    if (progress == 1.0 || progress == 0.0)
                        fadeout = NULL;
                    else
                        w->addRepaintFull();

                }
            }
        }

        // Menus and combos
        if (dropdownmenus != 1.0 && w->isDropdownMenu())
            data.multiplyOpacity(dropdownmenus);
        if (popupmenus != 1.0 && w->isPopupMenu())
            data.multiplyOpacity(popupmenus);
        if (tornoffmenus != 1.0 && w->isMenu())
            data.multiplyOpacity(tornoffmenus);
        if (comboboxpopups != 1.0 && w->isComboBox())
            data.multiplyOpacity(comboboxpopups);

    }
    effects->paintWindow(w, mask, region, data);
}