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);
}
}