void MediaPlayerPrivateMediaFoundation::setSize(const IntSize& size)
{
    m_size = size;

    if (!m_videoDisplay)
        return;

    LayoutSize scrollOffset;
    IntPoint positionInWindow(m_lastPaintRect.location());

    FrameView* view = nullptr;
    if (m_player && m_player->cachedResourceLoader() && m_player->cachedResourceLoader()->document())
        view = m_player->cachedResourceLoader()->document()->view();

    if (view) {
        scrollOffset = view->scrollOffsetForFixedPosition();
        positionInWindow = view->convertToContainingWindow(IntPoint(m_lastPaintRect.location()));
    }

    positionInWindow.move(-scrollOffset.width().toInt(), -scrollOffset.height().toInt());

    if (m_hwndVideo && !m_lastPaintRect.isEmpty())
        ::MoveWindow(m_hwndVideo, positionInWindow.x(), positionInWindow.y(), m_size.width(), m_size.height(), FALSE);

    RECT rc = { 0, 0, m_size.width(), m_size.height() };
    m_videoDisplay->SetVideoPosition(nullptr, &rc);
}
Пример #2
0
void handleCursorPosition(GLFWwindow *window, double xpos, double ypos) {
    static double last_xpos = xpos;
    static double last_ypos = ypos;
    
    if (windowIsActive && positionInWindow(window, xpos, ypos)) {
        double xpos_delta;
        double ypos_delta;

        xpos_delta = (last_xpos - xpos) * MOUSE_SENSITIVITY;
        ypos_delta = (last_ypos - ypos) * MOUSE_SENSITIVITY;
        
        camera.mouseUpdate(xpos_delta, ypos_delta);
    }
    
    last_xpos = xpos;
    last_ypos = ypos;
}