mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
[HRP] Fixed a crash and a visual glitch in the interface bar
* when the game width is greater than side panel graphics + iface bar. (closes #598)
This commit is contained in:
+5
-5
@@ -28,7 +28,7 @@ long Image::GetDarkColor(fo::PALETTE* palette) {
|
||||
return index;
|
||||
}
|
||||
|
||||
long Image::GetAspectSize(long sW, long sH, long* x, long* y, long &dW, long &dH) {
|
||||
void Image::GetAspectSize(long sW, long sH, long* x, long* y, long &dW, long &dH) {
|
||||
float sWf = (float)sW;
|
||||
float sHf = (float)sH;
|
||||
|
||||
@@ -38,17 +38,17 @@ long Image::GetAspectSize(long sW, long sH, long* x, long* y, long &dW, long &dH
|
||||
float aspectS = sWf / sHf;
|
||||
|
||||
if (aspectD < aspectS) {
|
||||
dH = (long)((sHf / sWf) * dW); // set new height
|
||||
dH = (long)((dW / sWf) * sHf); // set new height
|
||||
long cy = (height - dH) / 2; // shift y-offset center
|
||||
if (y) *y = cy;
|
||||
return cy * width;
|
||||
//return cy * width;
|
||||
} else if (aspectD > aspectS) {
|
||||
dW = (long)((dH / sHf) * sWf); // set new width
|
||||
long cx = (width - dW) / 2; // shift x-offset center
|
||||
if (x) *x = cx;
|
||||
return cx;
|
||||
//return cx;
|
||||
}
|
||||
return 0;
|
||||
//return 0;
|
||||
}
|
||||
|
||||
// Resizes src image to dWidth/dHeight size
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ class Image {
|
||||
public:
|
||||
static long GetDarkColor(fo::PALETTE* palette);
|
||||
|
||||
static long GetAspectSize(long sW, long sH, long* x, long* y, long &dW, long &dH);
|
||||
static void GetAspectSize(long sW, long sH, long* x, long* y, long &dW, long &dH);
|
||||
|
||||
static void Scale(BYTE* src, long sWight, long sHeight, BYTE* dst, long dWight, long dHeight, long dPitch = 0, long sPitch = 0);
|
||||
static void ScaleText(BYTE* dst, const char* text, long txtWidth, long dstWidth, long colorFlags, float scaleFactor);
|
||||
|
||||
@@ -55,8 +55,8 @@ static class Panels {
|
||||
BYTE* scr = frm->frameData[0].data;
|
||||
|
||||
// set the position to the right side
|
||||
if (!IFaceBar::IFACE_BAR_SIDES_ORI && win->wRect.left <= 0) scr += (frm->frameData[0].width - win->width);
|
||||
if (IFaceBar::IFACE_BAR_SIDES_ORI && win->wRect.left > xPosition) scr += (frm->frameData[0].width - win->width);
|
||||
if (!IFaceBar::IFACE_BAR_SIDES_ORI && win->wRect.left <= 0) scr += (frm->frameData[0].width - width);
|
||||
if (IFaceBar::IFACE_BAR_SIDES_ORI && win->wRect.left > xPosition) scr += (frm->frameData[0].width - width);
|
||||
|
||||
fo::func::cscale(scr, width, frm->frameData[0].height, frm->frameData[0].width, win->surface, win->width, win->height, win->width);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user