[client] switched srcRect to srcSize and type to SDL_Point

This commit is contained in:
Geoffrey McRae 2017-12-08 17:02:33 +11:00
parent 7f3657e5f0
commit 59a894ae04

View File

@ -52,7 +52,7 @@ struct AppState
bool started; bool started;
TTF_Font *font; TTF_Font *font;
SDL_Rect srcRect; SDL_Point srcSize;
LG_RendererRect dstRect; LG_RendererRect dstRect;
float scaleX, scaleY; float scaleX, scaleY;
@ -112,7 +112,7 @@ inline void updatePositionInfo()
if (params.keepAspect) if (params.keepAspect)
{ {
const float srcAspect = (float)state.srcRect.h / (float)state.srcRect.w; const float srcAspect = (float)state.srcSize.y / (float)state.srcSize.x;
const float wndAspect = (float)h / (float)w; const float wndAspect = (float)h / (float)w;
if (wndAspect < srcAspect) if (wndAspect < srcAspect)
{ {
@ -137,19 +137,8 @@ inline void updatePositionInfo()
state.dstRect.h = h; state.dstRect.h = h;
} }
state.scaleX = (float)state.srcRect.h / (float)state.dstRect.h; state.scaleX = (float)state.srcSize.y / (float)state.dstRect.h;
state.scaleY = (float)state.srcRect.w / (float)state.dstRect.w; state.scaleY = (float)state.srcSize.x / (float)state.dstRect.w;
}
inline bool areFormatsSame(const struct KVMFRHeader s1, const struct KVMFRHeader s2)
{
return
(s1.frameType != FRAME_TYPE_INVALID) &&
(s2.frameType != FRAME_TYPE_INVALID) &&
(s1.version == s2.version ) &&
(s1.frameType == s2.frameType) &&
(s1.width == s2.width ) &&
(s1.height == s2.height );
} }
inline uint64_t microtime() inline uint64_t microtime()
@ -332,10 +321,8 @@ int renderThread(void * unused)
} }
} }
state.srcRect.x = 0; state.srcSize.x = header.width;
state.srcRect.y = 0; state.srcSize.y = header.height;
state.srcRect.w = header.width;
state.srcRect.h = header.height;
updatePositionInfo(); updatePositionInfo();
} }