コード例 #1
0
// clip is in screen coordinates
void ShaderProgram::clip(const FloatRect& clip)
{
    if (clip == m_clipRect)
        return;

    // we should only call glScissor in this function, so that we can easily
    // track the current clipping rect.

    IntRect screenClip(clip.x(),
                       clip.y(),
                       clip.width(), clip.height());

    if (!m_screenClip.isEmpty())
        screenClip.intersect(m_screenClip);

    screenClip.setY(screenClip.y() + m_viewRect.y());
    if (screenClip.x() < 0) {
        int w = screenClip.width();
        w += screenClip.x();
        screenClip.setX(0);
        screenClip.setWidth(w);
    }
    if (screenClip.y() < 0) {
        int h = screenClip.height();
        h += screenClip.y();
        screenClip.setY(0);
        screenClip.setHeight(h);
    }

    glScissor(screenClip.x(), screenClip.y(), screenClip.width(), screenClip.height());

    m_clipRect = clip;
}
コード例 #2
0
void ShaderProgram::setScreenClip(const IntRect& clip)
{
    m_screenClip = clip;
    IntRect mclip = clip;

    // the clip from frameworks is in full screen coordinates
    mclip.setY(clip.y() - m_webViewRect.y() - m_titleBarHeight);
    FloatRect tclip = convertInvScreenCoordToScreenCoord(mclip);
    IntRect screenClip(tclip.x(), tclip.y(), tclip.width(), tclip.height());
    m_screenClip = screenClip;
}
コード例 #3
0
// clip is in screen coordinates
void ShaderProgram::clip(const FloatRect& clip)
{
    if (clip == m_clipRect)
        return;

    ALOGV("--clipping rect %f %f, %f x %f",
          clip.x(), clip.y(), clip.width(), clip.height());

    // we should only call glScissor in this function, so that we can easily
    // track the current clipping rect.

    IntRect screenClip(clip.x(),
                       clip.y(),
                       clip.width(), clip.height());

    if (!m_invViewClip.isEmpty())
        screenClip.intersect(m_invViewClip);

    // The previous intersection calculation is using local screen coordinates.
    // Now we need to convert things from local screen coordinates to global
    // screen coordinates and pass to the GL functions.
    screenClip.setX(screenClip.x() + m_invScreenRect.x());
    screenClip.setY(screenClip.y() + m_invScreenRect.y());
    if (screenClip.x() < 0) {
        int w = screenClip.width();
        w += screenClip.x();
        screenClip.setX(0);
        screenClip.setWidth(w);
    }
    if (screenClip.y() < 0) {
        int h = screenClip.height();
        h += screenClip.y();
        screenClip.setY(0);
        screenClip.setHeight(h);
    }

    glScissor(screenClip.x(), screenClip.y(), screenClip.width(), screenClip.height());

    m_clipRect = clip;
}