📄 pxgifrnd.cpp
字号:
((ulBgAlpha << 24) & 0xFF000000); } // Do we need to update the display buffer if (bUpdateNeeded && !m_bImageBombed) { // If we haven't received our first time sync yet // (m_bFirstTimeSync == TRUE), then all we need to do // is redraw the transparent background color into the // the display buffer. If we have already received our // first time sync, then we need to redraw the entire buffer, // including redrawing the frames if (m_bFirstTimeSync) { // We haven't draw any frames into our display buffer // yet, so all we have to do is redraw a transparent // background color into the buffer. DrawBackgroundColor(); // We definitely will be using the alpha channel m_bUsesAlphaChannel = TRUE; } else { if (m_pGIFCodec && m_pOutputBuffer) { // Compute the current frame we are on (note that // m_ulCurImg contains the index of the NEXT frame // that we are about to draw UINT32 ulCurFrame = (m_ulCurImg > 0 ? m_ulCurImg - 1 : 0); // Update the buffer // XXXMEH - optimization for later. In some cases if we // just changed the media opacity, then it may not be necessary // to start back at the beginning and rebuild the frame buffer // from the first frame. m_pGIFCodec->GetRGBImageEx(-1, ulCurFrame, m_pOutputBuffer->GetBuffer(), m_pGIFCodec->GetLogicalScreenWidth(), m_pGIFCodec->GetLogicalScreenHeight(), m_ulPadWidth, m_ulBytesPerPixel, m_bRowsInverted, m_bRGBOrdering, m_ulBackgroundColor, (m_ulMediaOpacity == 255 ? FALSE : TRUE), m_ulMediaOpacity, m_bMediaChromaKeySpecified, m_ulMediaChromaKey, m_ulMediaChromaKeyTolerance, m_ulMediaChromaKeyOpacity); // XXXMEH - do dumb assignment for now. We should later check // chroma key to find if any colors were actually encountered. if (m_ulBackgroundOpacity < 255 || m_ulMediaOpacity < 255 || m_bMediaChromaKeySpecified) { m_bUsesAlphaChannel = TRUE; } } } } retVal = m_pValues->SetPropertyCString(pName, pVal); } return retVal;}STDMETHODIMP CGIFRenderer::GetPropertyCString(const char* pName, REF(IHXBuffer*) rpVal){ HX_RESULT retVal = HXR_FAIL; if (m_pValues) { retVal = m_pValues->GetPropertyCString(pName, rpVal); } return retVal;}STDMETHODIMP CGIFRenderer::GetFirstPropertyCString(REF(const char*) rpName, REF(IHXBuffer*) rpVal){ HX_RESULT retVal = HXR_FAIL; if (m_pValues) { retVal = m_pValues->GetFirstPropertyCString(rpName, rpVal); } return retVal;}STDMETHODIMP CGIFRenderer::GetNextPropertyCString(REF(const char*) rpName, REF(IHXBuffer*) rpVal){ HX_RESULT retVal = HXR_FAIL; if (m_pValues) { retVal = m_pValues->GetNextPropertyCString(rpName, rpVal); } return retVal;}STDMETHODIMP CGIFRenderer::UpdatePacketTimeOffset(INT32 lTimeOffset){ HX_RESULT retVal = HXR_OK; // Save the time offset // XXXMEH - should this be negative m_lTimeOffset = -lTimeOffset; return retVal;}/************************************************************************ * Method: * IHXUpdateProperties::UpdatePlayTimes * Purpose: * Call this method to update the playtime attributes */STDMETHODIMPCGIFRenderer::UpdatePlayTimes(IHXValues* pProps){ return HXR_OK;}STDMETHODIMP CGIFRenderer::HandleCallback(UINT32 ulSchedulerTime, UINT32 ulInstance){ HX_RESULT retVal = HXR_OK; if (!m_bPaused) { // Get the current scheduler time HXTimeval cTime = m_pScheduler->GetCurrentSchedulerTime(); // Compute the difference in scheduler time UINT32 ulSchedDiff = GetTimevalDiff(m_tSchedulerTimeBase, cTime); // Compute the time in our timeline UINT32 ulTime = m_ulTimeAtSchedulerTimeBase + ulSchedDiff; // Update the display (if necessary) retVal = UpdateDisplay(ulTime); } return retVal;}STDMETHODIMP CGIFRenderer::CASOnPosLength(UINT32 ulPosition, UINT32 ulLength){ HX_RESULT retVal = HXR_OK; // XXXMEH// char szDbgStr[128];// DEBUGPRINTF(szDbgStr, "CGIFRenderer::CASOnPosLength(%lu,%lu) tick=%lu\n",// ulPosition, ulLength, HX_GET_BETTERTICKCOUNT()); if (m_bPaused) { // Clear the paused flag m_bPaused = FALSE; // Adjust the time according to the // offset passed in through OnPacket() INT32 lAdjustedTime = ((INT32) ulPosition) + m_lTimeOffset; UINT32 ulAdjustedTime = (UINT32) (lAdjustedTime >= 0 ? lAdjustedTime : 0); // Set the current scheduler time base if (m_pScheduler) { // Compute time in milliseconds m_tSchedulerTimeBase = m_pScheduler->GetCurrentSchedulerTime(); m_ulTimeAtSchedulerTimeBase = ulAdjustedTime; } // Update the display UpdateDisplay(ulAdjustedTime); } return retVal;}STDMETHODIMP CGIFRenderer::CASOnPresentationOpened(){ HX_RESULT retVal = HXR_OK; return retVal;}STDMETHODIMP CGIFRenderer::CASOnPresentationClosed(){ HX_RESULT retVal = HXR_OK; return retVal;}STDMETHODIMP CGIFRenderer::CASOnStatisticsChanged(){ HX_RESULT retVal = HXR_OK; return retVal;}STDMETHODIMP CGIFRenderer::CASOnPreSeek(ULONG32 ulOldTime, ULONG32 ulNewTime){ HX_RESULT retVal = HXR_OK; return retVal;}STDMETHODIMP CGIFRenderer::CASOnPostSeek(ULONG32 ulOldTime, ULONG32 ulNewTime){ HX_RESULT retVal = HXR_OK; return retVal;}STDMETHODIMP CGIFRenderer::CASOnStop(){ HX_RESULT retVal = HXR_OK; return retVal;}STDMETHODIMP CGIFRenderer::CASOnPause(ULONG32 ulTime){ MLOG_MISC(m_pErrorMessages, "0x%08x::CASOnPause(%lu)\n", this, ulTime); HX_RESULT retVal = HXR_OK; m_bPaused = TRUE; return retVal;}STDMETHODIMP CGIFRenderer::CASOnBegin(ULONG32 ulTime){ MLOG_MISC(m_pErrorMessages, "0x%08x::CASOnBegin(%lu)\n", this, ulTime); HX_RESULT retVal = HXR_OK; return retVal;}STDMETHODIMP CGIFRenderer::CASOnBuffering(ULONG32 ulFlags, UINT16 unPercentComplete){ HX_RESULT retVal = HXR_OK; return retVal;}STDMETHODIMP CGIFRenderer::CASOnContacting(const char* pHostName){ HX_RESULT retVal = HXR_OK; return retVal;}void CGIFRenderer::OnMouseMove(INT16 fwKeys, INT16 xPos, INT16 yPos){ // Make sure we're up and running if (!m_pGIFCodec) { return; } // don't do anything if the x/y coordinates have changed from the // last call to OnMouseMove - this is needed because the call to // IHXStatusMessage::SetStatus() results in a WM_MOUSEMOVE event if(xPos == m_sOldMouseX && yPos == m_sOldMouseY) { return; } m_sOldMouseX = xPos; m_sOldMouseY = yPos;#if defined(_WINDOWS) HCURSOR hCurrentCursor = GetCursor();#endif if (xPos >= 0 && xPos < (INT16) m_pGIFCodec->GetLogicalScreenWidth() && yPos >= 0 && yPos < (INT16) m_pGIFCodec->GetLogicalScreenHeight() && m_cURL.length() > 0) // we have a link { // We ARE over a hyperlink#if defined(_WINDOWS) if(!m_hHyperlinkCursor) { m_hHyperlinkCursor = LoadCursor(g_hInstance, MAKEINTRESOURCE(HANDCURSOR)); if(!m_hHyperlinkCursor) { m_hHyperlinkCursor = LoadCursor(NULL, IDC_UPARROW); } } if(m_hHyperlinkCursor && hCurrentCursor != m_hHyperlinkCursor) { // We're over a link and the cursor is NOT already the hyperlink cursor, // so change it. This will happen when we get a WM_SETCURSOR event m_bSetHyperlinkCursor = TRUE; }#elif defined(_MACINTOSH) if (m_hHyperlinkCursor) { ::SetCursor(*m_hHyperlinkCursor); m_eCurrentCursor = CURSOR_HYPERLINK; }#elif defined(_UNIX) && defined(USE_XWINDOWS) if (m_hCurrentCursor == -1 && m_pDisplay && m_Window && m_hHyperlinkCursor != -1) { XLockDisplay(m_pDisplay); XDefineCursor(m_pDisplay, m_Window, m_hHyperlinkCursor); XUnlockDisplay(m_pDisplay); m_hCurrentCursor = m_hHyperlinkCursor; }#endif if (m_pStatusMessage) { m_bStatusMsgWillNeedErasing = TRUE; m_pStatusMessage->SetStatus(m_cURL.c_str()); } } else { // We are NOT over a hyperlink#if defined(_WINDOWS) if(hCurrentCursor == m_hHyperlinkCursor) { // We are not over a hyperlink and out cursor IS the hyperlink cursor, // so we need to change it back. This will happen when we get a WM_SETCURSOR event m_bSetHyperlinkCursor = FALSE; }#elif defined(_MACINTOSH) if (m_eCurrentCursor == CURSOR_HYPERLINK) { ::InitCursor(); m_eCurrentCursor = CURSOR_ARROW; }#elif defined(_UNIX) && defined(USE_XWINDOWS) if (m_hCurrentCursor == m_hHyperlinkCursor) { if (m_pDisplay && m_Window) { XLockDisplay(m_pDisplay); XUndefineCursor(m_pDisplay, m_Window); XUnlockDisplay(m_pDisplay); m_hCurrentCursor = -1; } }#endif if (m_pStatusMessage && // /Fixes PR 65008 (GIF version): only set this to NULL if we // have recently set the status message, otherwise we may // cause SMIL's setting of the status message to be // overwritten with NULL, i.e., erased: m_bStatusMsgWillNeedErasing) { m_bStatusMsgWillNeedErasing = FALSE; m_pStatusMessage->SetStatus(NULL); } }}STDMETHODIMP CGIFRenderer::HandleEvent(HXxEvent* pEvent){ HX_RESULT retVal = HXR_OK; if (pEvent) { // Set defaults pEvent->handled = FALSE; pEvent->result = 0; // Switch based on event type switch (pEvent->event) { case HX_SURFACE_UPDATE: { if (m_pOutputBuffer) { IHXVideoSurface *pSurface = (IHXVideoSurface *) (pEvent->param1); HXxSize size; m_pMISUSSite->GetSize(size); DrawToRMASurface(pSurface, 0, 0, size); }#if defined(_UNIX) && defined(USE_XWINDOWS) { HXxWindow *pWnd = (HXxWindow*)pEvent->param2; if (pWnd) { m_pDisplay = (Display*)pWnd->display; m_Window = (Window)pWnd->window; if (m_pDisplay && m_hHyperlinkCursor == -1) { XLockDisplay(m_pDisplay); m_hHyperlinkCursor = XCreateFontCursor(m_pDisplay, XC_hand2); XUnlockDisplay(m_pDisplay); } } }#endi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -