⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wingdi.c

📁 VLC Player Source Code
💻 C
📖 第 1 页 / 共 3 页
字号:
        p_vout->p_sys->b_on_top_change = false;    }    /* Check if the event thread is still running */    if( !vlc_object_alive (p_vout->p_sys->p_event) )    {        return VLC_EGENERIC; /* exit */    }    return VLC_SUCCESS;}/***************************************************************************** * Render: render previously calculated output *****************************************************************************/static void Render( vout_thread_t *p_vout, picture_t *p_pic ){    /* No need to do anything, the fake direct buffers stay as they are */    (void)p_vout;    (void)p_pic;}/***************************************************************************** * Display: displays previously rendered output *****************************************************************************/#define rect_src p_vout->p_sys->rect_src#define rect_src_clipped p_vout->p_sys->rect_src_clipped#define rect_dest p_vout->p_sys->rect_dest#define rect_dest_clipped p_vout->p_sys->rect_dest_clipped#ifndef MODULE_NAME_IS_wingapistatic void DisplayGDI( vout_thread_t *p_vout, picture_t *p_pic ){    vout_sys_t *p_sys = p_vout->p_sys;    RECT rect_dst = rect_dest_clipped;    HDC hdc = GetDC( p_sys->hvideownd );    OffsetRect( &rect_dst, -rect_dest.left, -rect_dest.top );    SelectObject( p_sys->off_dc, p_sys->off_bitmap );    if( rect_dest_clipped.right - rect_dest_clipped.left !=        rect_src_clipped.right - rect_src_clipped.left ||        rect_dest_clipped.bottom - rect_dest_clipped.top !=        rect_src_clipped.bottom - rect_src_clipped.top )    {        StretchBlt( hdc, rect_dst.left, rect_dst.top,                    rect_dst.right, rect_dst.bottom,                    p_sys->off_dc, rect_src_clipped.left, rect_src_clipped.top,                    rect_src_clipped.right, rect_src_clipped.bottom, SRCCOPY );    }    else    {        BitBlt( hdc, rect_dst.left, rect_dst.top,                rect_dst.right, rect_dst.bottom,                p_sys->off_dc, rect_src_clipped.left,                rect_src_clipped.top, SRCCOPY );    }    ReleaseDC( p_sys->hvideownd, hdc );}static void FirstDisplayGDI( vout_thread_t *p_vout, picture_t *p_pic ){    /*    ** Video window is initially hidden, show it now since we got a    ** picture to show.    */    SetWindowPos( p_vout->p_sys->hvideownd, 0, 0, 0, 0, 0,        SWP_ASYNCWINDOWPOS|        SWP_FRAMECHANGED|        SWP_SHOWWINDOW|        SWP_NOMOVE|        SWP_NOSIZE|        SWP_NOZORDER );    /* get initial picture presented */    DisplayGDI(p_vout, p_pic);    /* use and restores proper display function for further pictures */    p_vout->pf_display = DisplayGDI;}#elsestatic int GAPILockSurface( vout_thread_t *p_vout, picture_t *p_pic ){    vout_sys_t *p_sys = p_vout->p_sys;    int i_x, i_y, i_width, i_height;    RECT video_rect;    POINT point;    GetClientRect( p_sys->hwnd, &video_rect);    vout_PlacePicture( p_vout, video_rect.right - video_rect.left,                       video_rect.bottom - video_rect.top,                       &i_x, &i_y, &i_width, &i_height );    point.x = point.y = 0;    ClientToScreen( p_sys->hwnd, &point );    i_x += point.x + video_rect.left;    i_y += point.y + video_rect.top;    if( i_width != p_vout->output.i_width ||        i_height != p_vout->output.i_height )    {        GXDisplayProperties gxdisplayprop = GXGetDisplayProperties();        p_sys->render_width = i_width;        p_sys->render_height = i_height;        p_vout->i_changes |= VOUT_SIZE_CHANGE;        msg_Dbg( p_vout, "vout size change (%ix%i -> %ix%i)",                 i_width, i_height, p_vout->output.i_width,                 p_vout->output.i_height );        p_vout->p_sys->i_pic_pixel_pitch = gxdisplayprop.cbxPitch;        p_vout->p_sys->i_pic_pitch = gxdisplayprop.cbyPitch;        return VLC_EGENERIC;    }    else    {        GXDisplayProperties gxdisplayprop;        RECT display_rect, dest_rect;        uint8_t *p_dest, *p_src = p_pic->p->p_pixels;        video_rect.left = i_x; video_rect.top = i_y;        video_rect.right = i_x + i_width;        video_rect.bottom = i_y + i_height;        gxdisplayprop = GXGetDisplayProperties();        display_rect.left = 0; display_rect.top = 0;        display_rect.right = gxdisplayprop.cxWidth;        display_rect.bottom = gxdisplayprop.cyHeight;        if( !IntersectRect( &dest_rect, &video_rect, &display_rect ) )        {            return VLC_EGENERIC;        }#if 0        msg_Err( p_vout, "video (%d,%d,%d,%d) display (%d,%d,%d,%d) "                 "dest (%d,%d,%d,%d)",                 video_rect.left, video_rect.right,                 video_rect.top, video_rect.bottom,                 display_rect.left, display_rect.right,                 display_rect.top, display_rect.bottom,                 dest_rect.left, dest_rect.right,                 dest_rect.top, dest_rect.bottom );#endif        if( !(p_dest = GXBeginDraw()) )        {#if 0            msg_Err( p_vout, "GXBeginDraw error %d ", GetLastError() );#endif            return VLC_EGENERIC;        }        p_src += (dest_rect.left - video_rect.left) * gxdisplayprop.cbxPitch +            (dest_rect.top - video_rect.top) * p_pic->p->i_pitch;        p_dest += dest_rect.left * gxdisplayprop.cbxPitch +            dest_rect.top * gxdisplayprop.cbyPitch;        i_width = dest_rect.right - dest_rect.left;        i_height = dest_rect.bottom - dest_rect.top;        p_pic->p->p_pixels = p_dest;    }    return VLC_SUCCESS;}static int GAPIUnlockSurface( vout_thread_t *p_vout, picture_t *p_pic ){    GXEndDraw();    return VLC_SUCCESS;}static void DisplayGAPI( vout_thread_t *p_vout, picture_t *p_pic ){}static void FirstDisplayGAPI( vout_thread_t *p_vout, picture_t *p_pic ){    /* get initial picture presented through D3D */    DisplayGAPI(p_vout, p_pic);    /*    ** Video window is initially hidden, show it now since we got a    ** picture to show.    */    SetWindowPos( p_vout->p_sys->hvideownd, 0, 0, 0, 0, 0,        SWP_ASYNCWINDOWPOS|        SWP_FRAMECHANGED|        SWP_SHOWWINDOW|        SWP_NOMOVE|        SWP_NOSIZE|        SWP_NOZORDER );    /* use and restores proper display function for further pictures */    p_vout->pf_display = DisplayGAPI;}#endif#undef rect_src#undef rect_src_clipped#undef rect_dest#undef rect_dest_clipped/***************************************************************************** * SetPalette: sets an 8 bpp palette *****************************************************************************/static void SetPalette( vout_thread_t *p_vout,                        uint16_t *red, uint16_t *green, uint16_t *blue ){    msg_Err( p_vout, "FIXME: SetPalette unimplemented" );}/***************************************************************************** * InitBuffers: initialize an offscreen bitmap for direct buffer operations. *****************************************************************************/static void InitBuffers( vout_thread_t *p_vout ){    BITMAPINFOHEADER *p_header = &p_vout->p_sys->bitmapinfo.bmiHeader;    BITMAPINFO *p_info = &p_vout->p_sys->bitmapinfo;    HDC window_dc = GetDC( p_vout->p_sys->hvideownd );    /* Get screen properties */#ifdef MODULE_NAME_IS_wingapi    GXDisplayProperties gx_displayprop = GXGetDisplayProperties();    p_vout->p_sys->i_depth = gx_displayprop.cBPP;#else    p_vout->p_sys->i_depth = GetDeviceCaps( window_dc, PLANES ) *        GetDeviceCaps( window_dc, BITSPIXEL );#endif    msg_Dbg( p_vout, "GDI depth is %i", p_vout->p_sys->i_depth );#ifdef MODULE_NAME_IS_wingapi    GXOpenDisplay( p_vout->p_sys->hvideownd, GX_FULLSCREEN );#else    /* Initialize offscreen bitmap */    memset( p_info, 0, sizeof( BITMAPINFO ) + 3 * sizeof( RGBQUAD ) );    p_header->biSize = sizeof( BITMAPINFOHEADER );    p_header->biSizeImage = 0;    p_header->biPlanes = 1;    switch( p_vout->p_sys->i_depth )    {    case 8:        p_header->biBitCount = 8;        p_header->biCompression = BI_RGB;        /* FIXME: we need a palette here */        break;    case 15:        p_header->biBitCount = 15;        p_header->biCompression = BI_BITFIELDS;//BI_RGB;        ((DWORD*)p_info->bmiColors)[0] = 0x00007c00;        ((DWORD*)p_info->bmiColors)[1] = 0x000003e0;        ((DWORD*)p_info->bmiColors)[2] = 0x0000001f;        break;    case 16:        p_header->biBitCount = 16;        p_header->biCompression = BI_BITFIELDS;//BI_RGB;        ((DWORD*)p_info->bmiColors)[0] = 0x0000f800;        ((DWORD*)p_info->bmiColors)[1] = 0x000007e0;        ((DWORD*)p_info->bmiColors)[2] = 0x0000001f;        break;    case 24:        p_header->biBitCount = 24;        p_header->biCompression = BI_RGB;        ((DWORD*)p_info->bmiColors)[0] = 0x00ff0000;        ((DWORD*)p_info->bmiColors)[1] = 0x0000ff00;        ((DWORD*)p_info->bmiColors)[2] = 0x000000ff;        break;    case 32:        p_header->biBitCount = 32;        p_header->biCompression = BI_RGB;        ((DWORD*)p_info->bmiColors)[0] = 0x00ff0000;        ((DWORD*)p_info->bmiColors)[1] = 0x0000ff00;        ((DWORD*)p_info->bmiColors)[2] = 0x000000ff;        break;    default:        msg_Err( p_vout, "screen depth %i not supported",                 p_vout->p_sys->i_depth );        return;        break;    }    p_header->biWidth = p_vout->render.i_width;    p_header->biHeight = -p_vout->render.i_height;    p_header->biClrImportant = 0;    p_header->biClrUsed = 0;    p_header->biXPelsPerMeter = 0;    p_header->biYPelsPerMeter = 0;    p_vout->p_sys->i_pic_pixel_pitch = p_header->biBitCount / 8;    p_vout->p_sys->i_pic_pitch = p_header->biBitCount * p_header->biWidth / 8;    p_vout->p_sys->off_bitmap =        CreateDIBSection( window_dc, (BITMAPINFO *)p_header, DIB_RGB_COLORS,                          (void**)&p_vout->p_sys->p_pic_buffer, NULL, 0 );    p_vout->p_sys->off_dc = CreateCompatibleDC( window_dc );    SelectObject( p_vout->p_sys->off_dc, p_vout->p_sys->off_bitmap );    ReleaseDC( p_vout->p_sys->hvideownd, window_dc );#endif}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -