[Coverity] Ensure window dimensions are at least 1x1 on text render

This commit is contained in:
baldurk
2018-05-08 12:44:31 +01:00
parent 8ef0d847ce
commit ada173ee26
4 changed files with 13 additions and 7 deletions
+2 -2
View File
@@ -40,8 +40,8 @@ public:
m_width = w;
m_height = h;
}
int GetWidth() { return m_width; }
int GetHeight() { return m_height; }
int GetWidth() { return RDCMAX(1, m_width); }
int GetHeight() { return RDCMAX(1, m_height); }
void SetOutputWindow(HWND w);
void RenderText(float x, float y, const char *textfmt, ...);
+2 -2
View File
@@ -45,8 +45,8 @@ public:
else
m_BBFmtIdx = RGBA8_BACKBUFFER;
}
int GetWidth() { return m_width; }
int GetHeight() { return m_height; }
int GetWidth() { return RDCMAX(1, m_width); }
int GetHeight() { return RDCMAX(1, m_height); }
void RenderText(ID3D12GraphicsCommandList *list, float x, float y, const char *textfmt, ...);
private:
+2 -2
View File
@@ -555,8 +555,8 @@ void WrappedOpenGL::RenderOverlayStr(float x, float y, const char *text)
ubo->TextPosition.x = x;
ubo->TextPosition.y = y;
ubo->FontScreenAspect.x = 1.0f / float(m_InitParams.width);
ubo->FontScreenAspect.y = 1.0f / float(m_InitParams.height);
ubo->FontScreenAspect.x = 1.0f / RDCMAX(1.0f, float(m_InitParams.width));
ubo->FontScreenAspect.y = 1.0f / RDCMAX(1.0f, float(m_InitParams.height));
ubo->TextSize = ctxdata.CharSize;
ubo->FontScreenAspect.x *= ctxdata.CharAspect;
@@ -682,7 +682,13 @@ VkResult WrappedVulkan::vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR
VkLayerDispatchTable *vt = ObjDisp(GetDev());
TextPrintState textstate = {
GetNextCmd(), rp, fb, swapInfo.extent.width, swapInfo.extent.height, swapInfo.format};
GetNextCmd(),
rp,
fb,
RDCMAX(1U, swapInfo.extent.width),
RDCMAX(1U, swapInfo.extent.height),
swapInfo.format,
};
VkCommandBufferBeginInfo beginInfo = {VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, NULL,
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT};