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

📄 mrtwin.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	    // /It's "transparent" and has high enough content version #:	    bDrawBackgroundAsTransparent = TRUE;	}#endif /* defined (HANDLE_TRANSPARENT_WINDOW_BACKGROUND). */////	Erase the background with the specified color.//	RGBColor	backColor, prevBackColor;	ConvertCOLORTYPEtoRGBColor(backColor, backColorType);	if (1#if defined(DO_CPU_FRIENDLY_SCROLLING)		&&  !bDoingScrollOfRect  // /Don't re-draw bg if moving#endif /* defined(DO_CPU_FRIENDLY_SCROLLING). */#if defined (HANDLE_TRANSPARENT_WINDOW_BACKGROUND)		&&  !bDrawBackgroundAsTransparent // /Don't draw transparent bg#endif /* defined (HANDLE_TRANSPARENT_WINDOW_BACKGROUND). */		)	{	    //	    //	Set the Background color of the offscreen port.	    //	    ::GetBackColor(&prevBackColor);	    ::RGBBackColor(&backColor);	    ::EraseRect(&updateRect);	}	//Only draw the text again if we really need to:	if (listSize  &&#if defined(DO_CPU_FRIENDLY_SCROLLING)		!bDoingScrollOfRect  &&#endif /* defined(DO_CPU_FRIENDLY_SCROLLING) */		(TIME_INVALID != ulTimeOfCurrentDraw) )	{	    LISTPOSITION pos = pTextWindow->GetStartPosition();	    //We must adjust for where the virtual window location is due to	    // looping:	    LONG32 currentXOffsetDueToLooping = 0L;	    LONG32 currentYOffsetDueToLooping = 0L;	    if(pTextWindow->isLooping())	    {		currentXOffsetDueToLooping =			pTextWindow->getCurrentXOffsetDueToLooping();		currentYOffsetDueToLooping =			pTextWindow->getCurrentYOffsetDueToLooping();	    }	    BOOL bWindowHeightIsNotTheOriginalValue = 		    lWindowHeight != pTextWindow->getHeight();	    BOOL bWindowWidthIsNotTheOriginalValue =		    lWindowWidth != pTextWindow->getWidth();	    //We must adjust for where the virtual window location is due to	    // "teleprompter" adjustment so that the last line of text is visible	    // at the bottom edge of the window:	    LONG32 currentYOffsetForTeleprompter = 0L;	    if(TYPE_TELEPROMPTER == pTextWindow->getType())	    {		currentYOffsetForTeleprompter =			pTextWindow->getCurrentYOffsetForTeleprompter();	    }	    ///	    /// Draw each text item in the offscreen port.	    ///	    	    float fXScaleFactor = (float)lWindowWidth / (float)pTextWindow->getWidth();	    float fYScaleFactor = (float)lWindowHeight / (float)pTextWindow->getHeight();	    	    // /Helps fix PR 83385:	    // Initialize chromaKey flag. If background color is the same as the	    // chroma key, then we know we are applying the chroma key. Also,	    // when we draw text of a certain color later down in this method,	    // we may be setting this flag, depending on the text color:	    if (pTextWindow->isChromaKeySet())	    {	        if (DoesChromaKeyMatch(backColorType, ulChromaKey,			 ulChromaKeyTolerance) )	        {	            if (ulChromaKeyOpacity < 255)	            {	                bChromaKeyWasAppliedToBg = TRUE;	                ulEffectiveBgOpacity = ulChromaKeyOpacity;	            }	        }	    }    	    while(pos)	    {		TextContainer* curTextContainerPtr =				/*  Note: effectively does GetAt(pos++):  */				(TextContainer*)pTextWindow->GetNext(pos);		if(curTextContainerPtr->textHasChangedSinceLastDraw()  ||			curTextContainerPtr->textShouldBeDrawn())		{		    LONG32 lUpperLeftXWithOffsets =			    currentXOffsetDueToLooping +			    curTextContainerPtr->getXUpperLeftCorner();		    LONG32 lLowerRightXWithOffsets =			    currentXOffsetDueToLooping +			    curTextContainerPtr->getXLowerRightCorner();		    LONG32 lUpperLeftYWithOffsets =			    currentYOffsetDueToLooping +			    currentYOffsetForTeleprompter +			    curTextContainerPtr->getYUpperLeftCorner();		    LONG32 lLowerRightYWithOffsets =			    currentYOffsetDueToLooping +			    currentYOffsetForTeleprompter +			    curTextContainerPtr->getYLowerRightCorner();		    LONG32 xScaled = lUpperLeftXWithOffsets;		    LONG32 yScaled = lUpperLeftYWithOffsets;		    LONG32 lScaledUpperLeftXWithOffsets =			    lUpperLeftXWithOffsets;		    LONG32 lScaledLowerRightXWithOffsets =			    lLowerRightXWithOffsets;		    LONG32 lScaledUpperLeftYWithOffsets =			    lUpperLeftYWithOffsets;		    LONG32 lScaledLowerRightYWithOffsets =			    lLowerRightYWithOffsets;		    if (bWindowWidthIsNotTheOriginalValue)		    {			xScaled  = 				LONG32((float)xScaled * fXScaleFactor);			lScaledUpperLeftXWithOffsets =				LONG32((float)lScaledUpperLeftXWithOffsets *				fXScaleFactor);			lScaledLowerRightXWithOffsets =				LONG32((float)lScaledLowerRightXWithOffsets *				fXScaleFactor);		    }		    if (bWindowHeightIsNotTheOriginalValue)		    {			yScaled  = 				LONG32((float)yScaled * fYScaleFactor);			lScaledUpperLeftYWithOffsets =				LONG32((float)lScaledUpperLeftYWithOffsets *				fYScaleFactor);			lScaledLowerRightYWithOffsets =				LONG32((float)lScaledLowerRightYWithOffsets *				fYScaleFactor);		    }		    ///Make sure curTextContainerPtr's text is located in the		    ///window before we go to the trouble of doing a TextOut:		    if(	    (lScaledUpperLeftXWithOffsets				> updateRect.right) 			    ||  (lScaledLowerRightXWithOffsets				< updateRect.left)			    ||  (lScaledUpperLeftYWithOffsets				> updateRect.bottom) 			    ||  (lScaledLowerRightYWithOffsets				< updateRect.top) )		    {			continue; //text doesn't overlap the window.		    }		    //If updateRect is in stretched coordinates, then the above		    // check won't find everyone who is outside the window, so		    // let's make sure we do here:		    if (bWindowHeightIsNotTheOriginalValue)		    {			if(yScaled > updateRect.bottom)			    continue; //It's outside the window		    }		    if (bWindowWidthIsNotTheOriginalValue)		    {			if(xScaled > updateRect.right)			    continue; //It's outside the window		    }		    //Since OnTimeSync()/OnTimeSynch() may not yet have been		    //called, we need to time-bounds check:		    //XXXEH- revisit this; don't do this every time for every T.C.,		    // but instead just keep track of whether or not OnTimeSynch()		    // has been called yet or not (...???):		    //First, if we're live, we need to compare times keeping		    // ULONG32-wrap-around in mind:		    BOOL bBeginTimeIsMoreRecentThanCurTime =			    IsTimeAMoreRecentThanTimeB(			    curTextContainerPtr->getBeginTime(),			    ulTimeOfCurrentDraw,			    pTextWindow->isLiveSource());		    BOOL bCurTimeIsMoreRecentThanEndTime =			    IsTimeAMoreRecentThanTimeB(			    ulTimeOfCurrentDraw,			    curTextContainerPtr->getEndTime(),			    pTextWindow->isLiveSource());		    //Sanity check:		    if(TIME_INVALID == curTextContainerPtr->getEndTime())		    {			HX_ASSERT(!bCurTimeIsMoreRecentThanEndTime);		    }		    if(bBeginTimeIsMoreRecentThanCurTime  ||			    bCurTimeIsMoreRecentThanEndTime)		    {			continue;		    }		    //		    //	For the current text container, setup the style.		    //		    Style	tcStyle=NULL;		    		    if (curTextContainerPtr->isBold()) tcStyle +=bold;		    if (curTextContainerPtr->isItalicized()) tcStyle +=italic;		    TextFace(tcStyle);		    UINT32 ulAuthoredFaceIndx = curTextContainerPtr->getFontFace();		    // /Use a short int in Mac APIs that take a short* .		    // This is needed to fix PR 92364:		    short iFaceIndx = (short)ulAuthoredFaceIndx;		    //Get the face name and see if it's installed on this		    // system, but first we need to translate the faceIndx		    // back to a string and then use the string to query		    // the system for installation status; the reason for		    // this is that a face index may differ from Mac to		    // Mac; Apple gave up on hard-coded indices a while ago:		    _CHAR pFontFaceBuf[FONTFACE_BUF_SIZE];		    getFontFaceStringFromFaceIndex(ulAuthoredFaceIndx,			    pFontFaceBuf, FONTFACE_BUF_SIZE,			    pTextWindow->getMajorContentVersion(),			    pTextWindow->getMinorContentVersion());			    		    BOOL bFontFaceFoundOnSystem = FALSE;		    BOOL bActiveContentVersionIncludesKorean = FALSE;		    //XXXEH: docs need updating: version="1.3" or higher must		    // be set in the <window> tag of the rt file in order for		    // Korean to be rendered:		    if(pTextWindow->getMajorContentVersion() >			REAL_TEXT_KOREAN_FONT_HANDLING_CONTENT_MAJOR_VERSION			||			(pTextWindow->getMajorContentVersion() ==			REAL_TEXT_KOREAN_FONT_HANDLING_CONTENT_MAJOR_VERSION			&&			pTextWindow->getMinorContentVersion() >=			REAL_TEXT_KOREAN_FONT_HANDLING_CONTENT_MINOR_VERSION)			)		    {			bActiveContentVersionIncludesKorean = TRUE;		    }		    if(strlen(pFontFaceBuf))		    {			c2pstrcpy((StringPtr)pFontFaceBuf, pFontFaceBuf);//change C str to Pascal str			// /Calling GetFNum() with a short* (&iFaceIndx)			// instead of a (short*)&UINT32 fixes PR 92364; the			// value being returned was flipped due to the way a			// UINT32 is stored on a Big-Endian machine, e.g., Mac			GetFNum((StringPtr)pFontFaceBuf, &iFaceIndx);			bFontFaceFoundOnSystem = (iFaceIndx != 0);		    }		    //else it's an empty string so do mapping, below...		    //If this font was not found installed on the system,		    // then we need to use a reasonable substitute:		    if(!bFontFaceFoundOnSystem)		    {		    	iFaceIndx = (short)ulAuthoredFaceIndx;			if (ulAuthoredFaceIndx & ARIAL_DERIVATIVE_FONT  ||				ulAuthoredFaceIndx & USES_ARIAL_SPACING)			{			    //Just go ahead and use Arial if it exists:			    GetFNum("\pArial", &iFaceIndx);			    if(0==iFaceIndx)			    {							//Just go ahead and use Helvetica, but use				// its string name first since the hardcoded				// index is not necessarily the same on all				// Macs now :-(				GetFNum("\pHelvetica", &iFaceIndx);				if(0==iFaceIndx)				{							    iFaceIndx = HELVETICA_FONT_FACE_INDX;				}			    }			}			else if (ulAuthoredFaceIndx & USES_TIMES_SPACING)			{			    iFaceIndx = TIMES_FONT_FACE_INDX;			}			else if (ulAuthoredFaceIndx & USES_COURIER_SPACING)			{			    iFaceIndx = COURIERTT_FONT_FACE_INDX;			}			else if (ulAuthoredFaceIndx & USES_SYSTEM_SPACING)			{			    iFaceIndx = GENEVA_FONT_FACE_INDX;			}#if defined(CJK_FONT_INDEX) 			if (OSAKA_FONT_FACE_INDX == ulAuthoredFaceIndx)			{			    GetFNum("\pOsaka", &iFaceIndx);			}			else if (SIMPLECHINESE_FONT_FACE_INDX == ulAuthoredFaceIndx)			{			    GetFNum("\p'宋体", &iFaceIndx);			}			else if (TRADITIONALCHINESE_FONT_FACE_INDX == ulAuthoredFaceIndx)			{			    GetFNum("\p灿

⌨️ 快捷键说明

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