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

📄 rtwin.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 4 页
字号:
    if(!bDoingScrollOfRect  &&  listSize  &&	    (TIME_INVALID != ulTimeOfCurrentDraw) )    {	LISTPOSITION pos = pTextWindow->GetStartPosition();#if defined(XXXEH_TESTING_DATAURLPLAINTEXT_HANDLING2)FILE* f1 = ::fopen("c:\\LogDataURLhandling.txt", "a+");::fprintf(f1, "\tDraw(): about to draw %lu TextContainers; pos=%p\n", listSize, pos);::fclose(f1);#endif	//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();	}	int bkModeOld;	bkModeOld = SetBkMode(hDC, TRANSPARENT);#if defined(USE_FREETYPE_DIRECTLY) /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/	CTextServices crossPlatTextSvcs;#endif /* END USE_FREETYPE_DIRECTLY. */ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/	while(pos)	{	    TextContainer* curTextContainerPtr =			    /*  Note: effectively does GetAt(pos++):  */			    (TextContainer*)pTextWindow->GetNext(pos);	    ///Added call to the new function 	    ///	"::textShouldBeDrawn()" because textHasChanged..() was	    ///	not enough -- repaint of background was overwriting	    /// non-moved text:	    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  = MulDiv(xScaled,  				    lWindowWidth,  				    pTextWindow->getWidth());		    lScaledUpperLeftXWithOffsets = MulDiv(				    lUpperLeftXWithOffsets,				    lWindowWidth,  				    pTextWindow->getWidth());		    lScaledLowerRightXWithOffsets = MulDiv(				    lLowerRightXWithOffsets,				    lWindowWidth,  				    pTextWindow->getWidth());		}		if (bWindowHeightIsNotTheOriginalValue)		{		    yScaled = MulDiv(yScaled, 				    lWindowHeight, 				    pTextWindow->getHeight());		    lScaledUpperLeftYWithOffsets = MulDiv(				    lUpperLeftYWithOffsets,				    lWindowHeight,  				    pTextWindow->getHeight());		    lScaledLowerRightYWithOffsets = MulDiv(				    lLowerRightYWithOffsets,				    lWindowHeight,  				    pTextWindow->getHeight());		}		///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;		}				#if defined(USE_FREETYPE_DIRECTLY) /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/		/* encoding.  Pre-defined values are:		* ft_encoding_symbol, ft_encoding_unicode,		* ft_encoding_latin_2, ft_encoding_sjis,		* ft_encoding_gb2312, ft_encoding_big5,		* ft_encoding_wansung (Hangeul(?) A.K.A. ksc5601),		* ft_encoding_johab, ft_encoding_apple_roman		*/		FT_Encoding ftCharsetEncoding = ft_encoding_none;#endif /* USE_FREETYPE_DIRECTLY. */ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/#if !defined(USE_FREETYPE_DIRECTLY) /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/		HFONT hfont, hfontOld;#endif /* !USE_FREETYPE_DIRECTLY. */ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/		DWORD fdwCharset = ANSI_CHARSET;		ULONG32 ulCharset = curTextContainerPtr->getFontCharset();		if(ulCharset & HX_WEST_EUROPE_CHARSET)		{		    fdwCharset = ANSI_CHARSET;#if defined(USE_FREETYPE_DIRECTLY) /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/		    ftCharsetEncoding = ft_encoding_none;#endif /* !USE_FREETYPE_DIRECTLY. */ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/		}		else if(ulCharset & HX_JAPANESE_CHARSET)		{		    fdwCharset = SHIFTJIS_CHARSET;#if defined(USE_FREETYPE_DIRECTLY) /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/		    ftCharsetEncoding = ft_encoding_sjis;#endif /* !USE_FREETYPE_DIRECTLY. */ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/		}		else if(ulCharset & HX_KOREAN_CHARSET)		{		    fdwCharset = HANGEUL_CHARSET;#if defined(USE_FREETYPE_DIRECTLY) /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/		    ftCharsetEncoding = ft_encoding_wansung; // /==Hangeul=ksc5601?#endif /* !USE_FREETYPE_DIRECTLY. */ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/		}		else if(ulCharset & HX_CHINESE_CHARSET)		{		    //Note: there are two charsets for 2312, namely		    // CHARSET__gb_2312 and CHARSET__gb_2312_80, but Windows		    // doesn't know about the _80 one, so treat them both as		    // GB2312_CHARSET.		    fdwCharset = GB2312_CHARSET; #if defined(USE_FREETYPE_DIRECTLY) /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/		    ftCharsetEncoding = ft_encoding_gb2312;#endif /* !USE_FREETYPE_DIRECTLY. */ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/		    if(ulCharset == CHARSET__big5)		    {			fdwCharset = CHINESEBIG5_CHARSET;#if defined(USE_FREETYPE_DIRECTLY) /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/			ftCharsetEncoding = ft_encoding_big5;#endif /* !USE_FREETYPE_DIRECTLY. */ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/		    }		} 		/* XXXXXEH- don't do this yet; there's no point in defaulting		 * to the default charset for this computer because RT requires		 * you to specify a font face otherwise it uses "times"		else		{		    fdwCharset = OEM_CHARSET;		}		*/		ULONG32 ulFontFaceIndex =			curTextContainerPtr->getFontFace();		ULONG32 ulFontPointSize =			curTextContainerPtr->getFontPointSize();		BOOL bIsBold =			curTextContainerPtr->isBold();		BOOL bIsItalicized =			curTextContainerPtr->isItalicized();		//Create the appropriate font for this block of text:		// XXXBHG -  Support for font scaling in 2x and FS mode		LONG32 ulScaledHeight = ulFontPointSize;		LONG32 ulScaledWidth  = 0;		_CHAR* pCurFontFaceString =			(_CHAR*)curTextContainerPtr->getFontFaceString(			pTextWindow->getMajorContentVersion(),			pTextWindow->getMinorContentVersion());#if !defined(USE_FREETYPE_DIRECTLY) /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/		// if we're not at 1x mode, then create a temporary 1x font		// to determine it's average width, we'll use this to ask		// for the right average width in 2x and FS modes		if (bWindowHeightIsNotTheOriginalValue)		{		    HFONT htempfont = CreateFont(			    ulFontPointSize, //logical ht 			    0, // logical average character width 			    0, // angle of escapement 			    0, //base-line orientation angle (==escapement Win95)			    (bIsBold?FW_BOLD:FW_NORMAL),			    bIsItalicized,//italic flag			    //Do underlining manually now (due to			    // possible gaps if alternate font has to be			    // used and forced spacing is not quite as os			    // calculates it:			    FALSE,			    curTextContainerPtr->isStruckOut(),//strikeout flag			    fdwCharset,			    OUT_DEFAULT_PRECIS,	// output precision 			    CLIP_DEFAULT_PRECIS,// clipping precision 			    DEFAULT_QUALITY,// output quality 			    DEFAULT_PITCH|FF_DONTCARE,// pitch and family			    (char*)pCurFontFaceString			    );		    LOGFONT logfont;		    GetObject(htempfont,sizeof(logfont),&logfont);		    DeleteObject(htempfont);		    ulScaledHeight = MulDiv(logfont.lfHeight, lWindowHeight,			    pTextWindow->getHeight());		    ulScaledWidth  = MulDiv(logfont.lfWidth,  lWindowWidth,			    pTextWindow->getWidth() );		}		hfont = CreateFont(			(INT32)ulScaledHeight, //logical ht 			(INT32)ulScaledWidth, // logical average character width 			0, // angle of escapement 			0, //base-line orientation angle (==escapement Win95)			(bIsBold?FW_BOLD:FW_NORMAL),			bIsItalicized,//italic flag			//Do underlining manually now (due to			// possible gaps if alternate font has to be			// used and forced spacing is not quite as os			// calculates it:			FALSE,			//Do strike-through manually now (due to			// possible gaps if alternate font has to be			// used and forced spacing is not quite as os			// calculates it:			FALSE, //curTextContainerPtr->isStruckOut(),			fdwCharset,			OUT_DEFAULT_PRECIS,	// output precision 			CLIP_DEFAULT_PRECIS,// clipping precision 			DEFAULT_QUALITY,// output quality 			DEFAULT_PITCH|FF_DONTCARE,// pitch and family			(char*)pCurFontFaceString			);		if(!hfont)		{#if !defined(USE_DIB_SECTION)		    SelectObject(hDC, hbmpOld);#endif		    return FALSE;		}		hfontOld = (HFONT)SelectObject(hDC, hfont);		if(!hfontOld)		{#if !defined(USE_DIB_SECTION)		    SelectObject(hDC, hbmpOld);#endif		    DeleteObject(hfont);		    return FALSE;		}#endif /* !USE_FREETYPE_DIRECTLY. */ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/		COLORTYPE textColor, textColorOld;		COLORTYPE bgTextColor;		textColor = curTextContainerPtr->getTextColor();		if(TYPE_TICKERTAPE == pTextWindow->getType())		{		    textColor =curTextContainerPtr->getTickertapeTextColor();		}		textColorOld = SetTextColor(			hDC, convertCOLORTYPEtoWinBGRColor(textColor) );		if(CLR_INVALID == textColorOld)		{#if !defined(USE_DIB_SECTION)		    SelectObject(hDC, hbmpOld);#endif#if !defined(USE_FREETYPE_DIRECTLY) /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/		    DeleteObject(hfont);#endif /* USE_FREETYPE_DIRECTLY. */ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/		    return FALSE;		}		bgTextColor = curTextContainerPtr->getTextBackgroundColor();		_CHAR* pTextbuffer = curTextContainerPtr->getBuffer();		ULONG32 ulTextLengthPlusOneOfCurTC =			curTextContainerPtr->getTextLengthPlus1();		char tmpString[4]; /* Flawfinder: ignore */  //[0] holds char to be drawn (or [0] and				    // [1] do if DBCS), and [1] (or [2] if 				    // 2-byte char) holds '\0';		tmpString[1] = tmpString[2] = tmpString[3] = '\0';		INT16 tmpStringLen = 0;#if defined(XXXEH_TESTING_DATAURLPLAINTEXT_HANDLING2)FILE* f1 = ::fopen("c:\\LogDataURLhandling.txt", "a+");::fprintf(f1, "\tDraw(): pTextBuffer={{{%s}}}\n", pTextbuffer);::fclose(f1);#endif		if(pTextbuffer  &&  ulTextLengthPlusOneOfCurTC > 1)		{#if 0UINT prevAlignment = 	SetTextAlign(hDC, VTA_BASELINE);#endif		    //if bgcolor is not transparent, and/or if isUnderlined		    // is TRUE, draw a rect (or line for underline) manually		    // behind the entire text rather than letting textout do		    // it for each letter (which is slower and sometimes leaves

⌨️ 快捷键说明

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