mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Merge pull request #20907 from hrydgard/fix-assorted-bugs
Fix minor UI bugs
This commit is contained in:
6 files changed
+34
-47
No files matched your search
@@ -123,14 +123,14 @@ std::vector<Data> Bucket::Resolve(int image_width, Image &dest) {
|
||||
}
|
||||
// Brute force packing.
|
||||
int sz = (int)data[i].w;
|
||||
auto &masq_ty = masq.dat[ty];
|
||||
auto &masq_idy = masq.dat[ty + idy - 1];
|
||||
const auto *masq_ty = masq.line(ty);
|
||||
const auto *masq_idy = masq.line(ty + idy - 1);
|
||||
for (int tx = 0; tx < image_width - sz; tx++) {
|
||||
bool valid = !(masq_ty[tx] || masq_idy[tx] || masq_ty[tx + idx - 1] || masq_idy[tx + idx - 1]);
|
||||
if (valid) {
|
||||
for (int ity = 0; ity < idy && valid; ity++) {
|
||||
for (int itx = 0; itx < idx && valid; itx++) {
|
||||
if (masq.dat[ty + ity][tx + itx]) {
|
||||
if (masq.get(tx + itx, ty + ity)) {
|
||||
goto skip;
|
||||
}
|
||||
}
|
||||
@@ -176,8 +176,8 @@ AtlasImage ToAtlasImage(int id, std::string_view name, float tw, float th, const
|
||||
img.u2 = results[i].ex / tw - toffx;
|
||||
img.v2 = results[i].ey / th - toffy;
|
||||
// The w and h here is the UI-pixels width/height. So if we rasterized at another DPI than 1.0f, we need to scale here.
|
||||
img.w = results[i].w / results[i].scale;
|
||||
img.h = results[i].h / results[i].scale;
|
||||
img.w = (int)((float)results[i].w / results[i].scale);
|
||||
img.h = (int)((float)results[i].h / results[i].scale);
|
||||
truncate_cpy(img.name, name);
|
||||
return img;
|
||||
}
|
||||
|
||||
@@ -8,22 +8,35 @@
|
||||
#include "Common/Render/TextureAtlas.h"
|
||||
|
||||
struct ImageU8 {
|
||||
std::vector<std::vector<u8>> dat;
|
||||
void resize(int x, int y) {
|
||||
dat.resize(y);
|
||||
for (int i = 0; i < y; i++)
|
||||
dat[i].resize(x);
|
||||
data.resize(x * y);
|
||||
w = x;
|
||||
h = y;
|
||||
}
|
||||
int width() const {
|
||||
return (int)dat[0].size();
|
||||
return w;
|
||||
}
|
||||
int height() const {
|
||||
return (int)dat.size();
|
||||
return h;
|
||||
}
|
||||
void set(int sx, int sy, int ex, int ey, unsigned char fil) {
|
||||
for (int y = sy; y < ey; y++)
|
||||
std::fill(dat[y].begin() + sx, dat[y].begin() + ex, fil);
|
||||
u8 get(int x, int y) const {
|
||||
return data[y * w + x];
|
||||
}
|
||||
void set(int sx, int sy, int ex, int ey, unsigned char value) {
|
||||
for (int y = sy; y < ey; y++) {
|
||||
std::fill(data.begin() + (y * w + sx), data.begin() + (y * w + ex), value);
|
||||
}
|
||||
}
|
||||
u8 *line(int y) {
|
||||
return data.data() + y * w;
|
||||
}
|
||||
const u8 *line(int y) const {
|
||||
return data.data() + y * w;
|
||||
}
|
||||
private:
|
||||
std::vector<u8> data;
|
||||
int w;
|
||||
int h;
|
||||
};
|
||||
|
||||
struct Image {
|
||||
|
||||
+2
-2
@@ -143,8 +143,8 @@ static void DrawFrameTiming(UIContext *ctx, const Bounds &bounds) {
|
||||
"Presentation mode: %s Needs skip: %s\n"
|
||||
"Actual presentation mode: %s",
|
||||
Draw::PresentModeToString(g_frameTiming.PresentMode()),
|
||||
g_frameTiming.FastForwardNeedsSkipFlip() ? "true" : "false"),
|
||||
Draw::PresentModeToString(draw->GetCurrentPresentMode());
|
||||
g_frameTiming.FastForwardNeedsSkipFlip() ? "true" : "false",
|
||||
Draw::PresentModeToString(draw->GetCurrentPresentMode()));
|
||||
|
||||
ctx->Draw()->DrawTextRect(ubuntu24, statBuf, bounds.x + 10, bounds.y + 50, bounds.w - 20, bounds.h - 30, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII);
|
||||
|
||||
|
||||
+2
-25
@@ -920,8 +920,8 @@ void GameBrowser::Refresh() {
|
||||
|
||||
// Add any pinned paths before other directories.
|
||||
auto pinnedPaths = GetPinnedPaths();
|
||||
for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) {
|
||||
DirButton *pinnedDir = gameList_->Add(new DirButton(*it, GetBaseName((*it).ToString()), *gridStyle_, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT)));
|
||||
for (const auto &pinnedPath : pinnedPaths) {
|
||||
DirButton *pinnedDir = gameList_->Add(new DirButton(pinnedPath, pinnedPath.GetFilename(), *gridStyle_, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT)));
|
||||
pinnedDir->OnClick.Handle(this, &GameBrowser::NavigateClick);
|
||||
pinnedDir->SetPinned(true);
|
||||
}
|
||||
@@ -1008,29 +1008,6 @@ std::vector<Path> GameBrowser::GetPinnedPaths() const {
|
||||
return results;
|
||||
}
|
||||
|
||||
std::string GameBrowser::GetBaseName(const std::string &path) const {
|
||||
#ifndef _WIN32
|
||||
static const std::string sepChars = "/";
|
||||
#else
|
||||
static const std::string sepChars = "/\\";
|
||||
#endif
|
||||
|
||||
auto trailing = path.find_last_not_of(sepChars);
|
||||
if (trailing != path.npos) {
|
||||
size_t start = path.find_last_of(sepChars, trailing);
|
||||
if (start != path.npos) {
|
||||
return path.substr(start + 1, trailing - start);
|
||||
}
|
||||
return path.substr(0, trailing);
|
||||
}
|
||||
|
||||
size_t start = path.find_last_of(sepChars);
|
||||
if (start != path.npos) {
|
||||
return path.substr(start + 1);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
void GameBrowser::GameButtonClick(UI::EventParams &e) {
|
||||
GameButton *button = static_cast<GameButton *>(e.v);
|
||||
UI::EventParams e2{};
|
||||
|
||||
@@ -74,7 +74,6 @@ protected:
|
||||
private:
|
||||
bool IsCurrentPathPinned();
|
||||
std::vector<Path> GetPinnedPaths() const;
|
||||
std::string GetBaseName(const std::string &path) const;
|
||||
|
||||
void GameButtonClick(UI::EventParams &e);
|
||||
void GameButtonHoldClick(UI::EventParams &e);
|
||||
|
||||
@@ -12,7 +12,9 @@ androidGitVersion {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// 1.2.0 is the newest version we can use that won't complain about minSdk version.
|
||||
// 1.6.1 is the newest version we can use that won't complain about minSdk version,
|
||||
// and also doesn't collide kotlin versions with com.gladed.androidgitversion. Should probably
|
||||
// fork and upgrade that.
|
||||
implementation "androidx.appcompat:appcompat:1.6.1"
|
||||
|
||||
// Convenient wrapper around DocumentContract. Might look into writing our own
|
||||
@@ -133,7 +135,6 @@ android {
|
||||
cmake {
|
||||
// Available arguments listed at https://developer.android.com/ndk/guides/cmake.html
|
||||
arguments '-DANDROID=true',
|
||||
'-DANDROID_PLATFORM=android-21',
|
||||
'-DANDROID_TOOLCHAIN=clang',
|
||||
'-DANDROID_CPP_FEATURES=',
|
||||
'-DANDROID_STL=c++_static'
|
||||
@@ -150,7 +151,6 @@ android {
|
||||
cmake {
|
||||
// Available arguments listed at https://developer.android.com/ndk/guides/cmake.html
|
||||
arguments '-DANDROID=true',
|
||||
'-DANDROID_PLATFORM=android-21',
|
||||
'-DANDROID_TOOLCHAIN=clang',
|
||||
'-DANDROID_CPP_FEATURES=',
|
||||
'-DANDROID_STL=c++_static',
|
||||
@@ -170,7 +170,6 @@ android {
|
||||
cmake {
|
||||
// Available arguments listed at https://developer.android.com/ndk/guides/cmake.html
|
||||
arguments '-DANDROID=true',
|
||||
'-DANDROID_PLATFORM=android-21',
|
||||
'-DANDROID_TOOLCHAIN=clang',
|
||||
'-DANDROID_CPP_FEATURES=',
|
||||
'-DANDROID_STL=c++_static',
|
||||
@@ -190,7 +189,6 @@ android {
|
||||
cmake {
|
||||
// Available arguments listed at https://developer.android.com/ndk/guides/cmake.html
|
||||
arguments '-DANDROID=true',
|
||||
'-DANDROID_PLATFORM=android-21',
|
||||
'-DANDROID_TOOLCHAIN=clang',
|
||||
'-DANDROID_CPP_FEATURES=',
|
||||
'-DANDROID_STL=c++_static',
|
||||
|
||||
Reference in new issue
Block a user