Browse Source

Optimize song browser

kiwec 2 months ago
parent
commit
50fe55ea52

+ 1 - 1
Makefile

@@ -9,7 +9,7 @@ CXXFLAGS = -std=c++17 -fmessage-length=0 -fno-exceptions -Wno-sign-compare -Wno-
 CXXFLAGS += `pkgconf --static --cflags $(LIBS)` `curl-config --cflags`
 CXXFLAGS += -Isrc/App -Isrc/App/Osu -Isrc/Engine -Isrc/GUI -Isrc/GUI/Windows -Isrc/GUI/Windows/VinylScratcher -Isrc/Engine/Input -Isrc/Engine/Platform -Isrc/Engine/Main -Isrc/Engine/Renderer -Isrc/Util
 CXXFLAGS += -Ilibraries/bass/include -Ilibraries/bassasio/include -Ilibraries/bassfx/include -Ilibraries/bassmix/include -Ilibraries/basswasapi/include -Ilibraries/bassloud/include
-CXXFLAGS += -g3 -fsanitize=address
+CXXFLAGS += -O2 -g3 -fsanitize=address
 
 LDFLAGS = -ldiscord-rpc -lbass -lbassmix -lbass_fx -lbassloud -lstdc++
 LDFLAGS += `pkgconf --static --libs $(LIBS)` `curl-config --static-libs --libs`

+ 1 - 0
src/App/Osu/Changelog.cpp

@@ -35,6 +35,7 @@ Changelog::Changelog() : ScreenBackable() {
     latest.changes.push_back("- Chat: added support for map links (auto-downloads)");
     latest.changes.push_back("- Chat: added support for multiplayer invite links");
     latest.changes.push_back("- FPS counter will now display worst frametime instead of current frametime");
+    latest.changes.push_back("- Improved song browser performance");
     changelogs.push_back(latest);
 
     CHANGELOG v35_05;

+ 4 - 0
src/App/Osu/SongBrowser/Button.cpp

@@ -113,6 +113,10 @@ void Button::drawMenuButtonBackground(Graphics *g) {
 }
 
 void Button::mouse_update(bool *propagate_clicks) {
+    // Not correct, but clears most of the lag
+    if(m_vPos.y + m_vSize.y < 0) return;
+    if(m_vPos.y > engine->getScreenHeight()) return;
+
     // HACKHACK: absolutely disgusting
     // temporarily fool CBaseUIElement with modified position and size
     {

+ 2 - 2
src/App/Osu/SongBrowser/SongButton.cpp

@@ -69,12 +69,12 @@ SongButton::~SongButton() {
 }
 
 void SongButton::draw(Graphics *g) {
-    Button::draw(g);
     if(!m_bVisible) return;
-
     if(m_vPos.y + m_vSize.y < 0) return;
     if(m_vPos.y > engine->getScreenHeight()) return;
 
+    Button::draw(g);
+
     // draw background image
     sortChildren();
     if(m_databaseBeatmap != NULL && m_children.size() > 0) {