mirror of
https://github.com/libretro/ppsspp.git
synced 2024-12-12 10:56:45 +00:00
gedbg: Allow grow and shrink to fit.
This commit is contained in:
parent
c6ffed6484
commit
6ebbf2cb72
@ -322,7 +322,7 @@ void SimpleGLWindow::GetContentSize(float &x, float &y, float &fw, float &fh) {
|
||||
x = 0.0f;
|
||||
y = 0.0f;
|
||||
|
||||
if (flags_ & (RESIZE_SHRINK_FIT | RESIZE_CENTER) && !zoom_) {
|
||||
if ((flags_ & RESIZE_SHRINK_FIT) != 0 && !zoom_) {
|
||||
float wscale = fw / w_, hscale = fh / h_;
|
||||
|
||||
// Too wide, and width is the biggest problem, so scale based on that.
|
||||
@ -334,6 +334,17 @@ void SimpleGLWindow::GetContentSize(float &x, float &y, float &fw, float &fh) {
|
||||
fh = (float)h_;
|
||||
}
|
||||
}
|
||||
if ((flags_ & RESIZE_GROW_FIT) != 0) {
|
||||
float wscale = fw / w_, hscale = fh / h_;
|
||||
|
||||
if (wscale > hscale && wscale < 1.0f) {
|
||||
fw = (float)w_;
|
||||
fh /= wscale;
|
||||
} else if (hscale > wscale && hscale < 1.0f) {
|
||||
fw /= hscale;
|
||||
fh = (float)h_;
|
||||
}
|
||||
}
|
||||
if (flags_ & RESIZE_CENTER) {
|
||||
x = ((float)w_ - fw) / 2;
|
||||
y = ((float)h_ - fh) / 2;
|
||||
|
@ -46,11 +46,16 @@ struct SimpleGLWindow {
|
||||
|
||||
enum Flags {
|
||||
RESIZE_NONE = 0x00,
|
||||
RESIZE_CENTER = 0x02,
|
||||
RESIZE_SHRINK_FIT = 0x01,
|
||||
RESIZE_CENTER = 0x01,
|
||||
RESIZE_SHRINK_FIT = 0x02,
|
||||
RESIZE_SHRINK_CENTER = 0x03,
|
||||
RESIZE_GROW_FIT = 0x04,
|
||||
RESIZE_GROW_CENTER = 0x05,
|
||||
RESIZE_BEST_FIT = 0x06,
|
||||
RESIZE_BEST_CENTER = 0x07,
|
||||
|
||||
ALPHA_IGNORE = 0x00,
|
||||
ALPHA_BLEND = 0x04,
|
||||
ALPHA_BLEND = 0x08,
|
||||
};
|
||||
|
||||
SimpleGLWindow(HWND wnd);
|
||||
|
Loading…
Reference in New Issue
Block a user