Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

初学1天,本来想做个自适应,结果放弃思考了 #12

Open
NukedBart opened this issue Feb 9, 2021 · 1 comment
Open

初学1天,本来想做个自适应,结果放弃思考了 #12

NukedBart opened this issue Feb 9, 2021 · 1 comment

Comments

@NukedBart
Copy link

if (event.user.code == VIDEO_SIZE_CHANGED_CODE) {
				RECT rtc, rtd;
				::SystemParametersInfo(SPI_GETWORKAREA, 0, (PVOID)&rtc, 0);
				::GetWindowRect(GetDesktopWindow(), &rtd); 
				int maxwidth = GetSystemMetrics(SM_CXSCREEN), 
					maxheight = GetSystemMetrics(SM_CYSCREEN),
					
					fullwidth = GetSystemMetrics(SM_CXSCREEN), 
					fullheight = GetSystemMetrics(SM_CYFULLSCREEN), 
					twid = 0, 
					thet = 0;
				
				unsigned int rawwidth = (unsigned int)event.user.data1, 
							rawheight = (unsigned int)event.user.data2;
				double proportion = rawwidth / rawheight;
				bool tskbarpos = rtc.top != rtd.top;
				std::cout
					<< "[Before processing]FullRes: "
					<< maxwidth << ", "
					<< maxheight << ", " << std::endl
					<< "[Before processing]NoTaskbar: "
					<< fullwidth << ", "
					<< fullheight << ", " << std::endl;
				int tskbarwid = (tskbarpos) ? maxheight - fullheight : maxwidth - fullwidth;
				std::cout << "TaskbarWidth: " << tskbarwid << std::endl;
				std::cout 
					<< "BigWidth: " << rawwidth-fullwidth 
					<< "BigHeight: " << rawheight-fullheight << std::endl;

				if (rawwidth > fullwidth | rawheight > fullheight) {
					if (
						((rawwidth > fullwidth) ? rawwidth - fullwidth : fullwidth - rawwidth) 
						> 
						((rawheight > fullheight) ? rawheight - fullheight : fullheight - rawheight) 
						& 
						rawwidth>fullwidth
					   ) {
						int twid = fullwidth - 20;
						std::cout << twid << std::endl;
						std::cout
							<< twid / rawwidth << std::endl
							<< twid / (int)rawwidth << std::endl
							<< (int)twid / (int)rawwidth << std::endl
							<< (double)twid / (double)rawwidth << std::endl;
						int thet = (int)(((double)twid / (double)rawwidth) * (double)rawheight);
					}
					else {
						int thet = fullheight - 20;
						std::cout
							<< thet / rawheight << std::endl
							<< thet / (int)rawheight << std::endl
							<< (int)thet / (int)rawheight << std::endl
							<< (double)thet / (double)rawheight << std::endl
							<< ((double)thet / (double)rawheight) * (double)rawheight << std::endl;
						double twid = (((double)thet / (double)rawheight) * (double)rawwidth);
						// (956/1080)*1440=-9.2559631349317831e+61
					}
				}
				else {
					twid = rawwidth, thet = rawheight;
				}
				std::cout 
					<< "FullRes: "
					<< maxwidth << ", "
					<< maxheight << ", "
					<< "NoTaskbar: "
					<< fullwidth << ", "
					<< fullheight << ", "
					<< "FromIDevices: "
					<< rawwidth << ", "
					<< rawheight << ", "
					<< "Outputting: "
					<< twid << ", "
					<< thet << std::endl;
				/*
				OnInit: 0, 0
				[Before processing]FullRes: 1920, 1080,
				[Before processing]NoTaskbar: 1920, 976,
				TaskbarWidth: 104
				BigWidth: 4294966816BigHeight: 104
				0
				0
				0
				0.885185
				956
				FullRes: 1920, 1080, NoTaskbar: 1920, 976, FromIDevices: 1440, 1080, Outputting: 0, 0
				*/
				if (twid != m_rect.w || thet != m_rect.h || m_yuv == NULL) {
					unInitVideo();
					initVideo(twid, thet);
				}
			}
@NukedBart
Copy link
Author

太丢人了qwq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant