Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/gui/gui.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/***************************************************************************

Check notice on line 1 in src/gui/gui.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Lines of Code in a Single File

The lines of code decreases from 2464 to 2463, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.
* Copyright (C) 2019 PCSX-Redux authors *
* *
* This program is free software; you can redistribute it and/or modify *
Expand Down Expand Up @@ -553,6 +553,8 @@
glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
});
m_listener.listen<Events::ExecutionFlow::Run>([this](const auto& event) {
m_enableSplashScreen = false;

glfwSwapInterval(0);
setRawMouseMotion();
});
Expand Down Expand Up @@ -951,16 +953,19 @@
glBindTexture(GL_TEXTURE_2D, m_offscreenTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_renderSize.x, m_renderSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);

if (m_clearTextures) {
const auto allocSize = static_cast<size_t>(std::ceil(m_renderSize.x * m_renderSize.y * sizeof(uint32_t)));
GLubyte* data = new GLubyte[allocSize]();
if (m_clearTextures || m_enableSplashScreen) {
m_clearTextures = false;
std::unique_ptr<uint32_t[]> splashImageData = getSplashScreen(m_renderSize.x, m_renderSize.y);

// Upload to both textures
for (int i = 0; i < 2; i++) {
glBindTexture(GL_TEXTURE_2D, m_offscreenTextures[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_renderSize.x, m_renderSize.y, GL_RGBA, GL_UNSIGNED_BYTE,
data);
splashImageData.get());
}
m_clearTextures = false;
delete[] data;
}

glBindRenderbuffer(GL_RENDERBUFFER, m_offscreenDepthBuffer);
Expand Down Expand Up @@ -1067,9 +1072,6 @@
glBindFramebuffer(GL_FRAMEBUFFER, m_offscreenFrameBuffer);
glBindTexture(GL_TEXTURE_2D, m_offscreenTextures[m_currentTexture]);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

glBindRenderbuffer(GL_RENDERBUFFER, m_offscreenDepthBuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_offscreenDepthBuffer);
GLuint texture = m_offscreenTextures[m_currentTexture];
Expand Down Expand Up @@ -2890,4 +2892,4 @@
m_currentScale = scale;
m_allScales.emplace(scale);
ImGui::SetCurrentFont(getMainFont());
}
}
3 changes: 3 additions & 0 deletions src/gui/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <functional>
#include <magic_enum_all.hpp>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <string_view>
Expand Down Expand Up @@ -454,8 +455,10 @@ class GUI final : public UI {
bool m_updateAvailable = false;
bool m_updateDownloading = false;
bool m_aboutSelectAuthors = false;
bool m_enableSplashScreen = true;

void setDefaultShaders();
std::unique_ptr<uint32_t[]> getSplashScreen(uint32_t destWidth, uint32_t destHeight);

public:
bool hasJapanese() { return m_hasJapanese; }
Expand Down
Loading
Loading