diff --git a/Core/Screenshot.cpp b/Core/Screenshot.cpp index 46694c35a1..2a2ddcf27c 100644 --- a/Core/Screenshot.cpp +++ b/Core/Screenshot.cpp @@ -237,26 +237,24 @@ static bool ConvertPixelTo8888RGBA(GPUDebugBufferFormat fmt, u8 &r, u8 &g, u8 &b } const u8 *ConvertBufferToScreenshot(const GPUDebugBuffer &buf, bool alpha, u8 *&temp, u32 &w, u32 &h) { - int pixelSize = alpha ? 4 : 3; + size_t pixelSize = alpha ? 4 : 3; GPUDebugBufferFormat nativeFmt = alpha ? GPU_DBG_FORMAT_8888 : GPU_DBG_FORMAT_888_RGB; w = std::min(w, buf.GetStride()); h = std::min(h, buf.GetHeight()); // The temp buffer will be freed by the caller if set, and can be the return value. - if (buf.GetFlipped() || buf.GetFormat() != nativeFmt) { - temp = new u8[pixelSize * w * h]; - } else { - temp = nullptr; - } + temp = nullptr; const u8 *buffer = buf.GetData(); if (buf.GetFlipped() && buf.GetFormat() == nativeFmt) { + temp = new u8[pixelSize * w * h]; // Silly OpenGL reads upside down, we flip to another buffer for simplicity. for (u32 y = 0; y < h; y++) { memcpy(temp + y * w * pixelSize, buffer + (buf.GetHeight() - y - 1) * buf.GetStride() * pixelSize, w * pixelSize); } } else if (buf.GetFormat() < GPU_DBG_FORMAT_FLOAT && buf.GetFormat() != nativeFmt) { + temp = new u8[pixelSize * w * h]; // Let's boil it down to how we need to interpret the bits. int baseFmt = buf.GetFormat() & ~(GPU_DBG_FORMAT_REVERSE_FLAG | GPU_DBG_FORMAT_BRSWAP_FLAG); bool rev = (buf.GetFormat() & GPU_DBG_FORMAT_REVERSE_FLAG) != 0; @@ -284,6 +282,7 @@ const u8 *ConvertBufferToScreenshot(const GPUDebugBuffer &buf, bool alpha, u8 *& } } } else if (buf.GetFormat() != nativeFmt) { + temp = new u8[pixelSize * w * h]; bool flip = buf.GetFlipped(); // This is pretty inefficient. diff --git a/GPU/Common/GPUDebugInterface.h b/GPU/Common/GPUDebugInterface.h index d02521be54..93c100e4fc 100644 --- a/GPU/Common/GPUDebugInterface.h +++ b/GPU/Common/GPUDebugInterface.h @@ -168,7 +168,7 @@ private: u8 *data_ = nullptr; u32 stride_ = 0; u32 height_ = 0; - GPUDebugBufferFormat fmt_; + GPUDebugBufferFormat fmt_ = GPU_DBG_FORMAT_INVALID; bool flipped_ = false; }; diff --git a/ext/native/thin3d/VulkanRenderManager.cpp b/ext/native/thin3d/VulkanRenderManager.cpp index 5cd79d4dcb..2938590d67 100644 --- a/ext/native/thin3d/VulkanRenderManager.cpp +++ b/ext/native/thin3d/VulkanRenderManager.cpp @@ -156,7 +156,7 @@ void VulkanRenderManager::CreateBackbuffers() { VkCommandBuffer cmdInit = GetInitCmd(); for (uint32_t i = 0; i < swapchainImageCount_; i++) { - SwapchainImageData sc_buffer; + SwapchainImageData sc_buffer{}; sc_buffer.image = swapchainImages[i]; VkImageViewCreateInfo color_image_view = { VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO }; diff --git a/ext/native/ui/ui_screen.h b/ext/native/ui/ui_screen.h index c7090e23dd..c044e961a0 100644 --- a/ext/native/ui/ui_screen.h +++ b/ext/native/ui/ui_screen.h @@ -190,7 +190,7 @@ private: std::string units_; std::string negativeLabel_; int *value_; - int sliderValue_; + int sliderValue_ = 0; int minValue_; int maxValue_; int step_; diff --git a/ext/native/ui/view.h b/ext/native/ui/view.h index 7486ac4cd6..45d0538d44 100644 --- a/ext/native/ui/view.h +++ b/ext/native/ui/view.h @@ -580,7 +580,7 @@ private: float paddingLeft_; float paddingRight_; int repeat_; - int repeatCode_; + int repeatCode_ = 0; }; // Basic button that modifies a bitfield based on the pressed status. Supports multitouch. diff --git a/ext/native/util/text/wrap_text.h b/ext/native/util/text/wrap_text.h index 7418a8022e..61049bccef 100644 --- a/ext/native/util/text/wrap_text.h +++ b/ext/native/util/text/wrap_text.h @@ -31,7 +31,7 @@ protected: // Position the current word starts at. float x_ = 0.0f; // Most recent width of word since last index. - float wordWidth_; + float wordWidth_ = 0.0f; // Force the next word to cut partially and wrap. bool forceEarlyWrap_ = false; };