[Scummvm-git-logs] scummvm master -> deff7ab16072948c078eb94551427738ceb1ca0d
sev-
noreply at scummvm.org
Wed Apr 24 22:37:52 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
37f8f829ff Revert "GRAPHICS: Round border length to nearest interger"
deff7ab160 GRAPHICS: NINEPATCH: Change the way remaining_stretch is distributed
Commit: 37f8f829ffa585c916cab27055e388473bd7b5ce
https://github.com/scummvm/scummvm/commit/37f8f829ffa585c916cab27055e388473bd7b5ce
Author: polyesterswing (kurianjojo2004 at gmail.com)
Date: 2024-04-25T00:37:48+02:00
Commit Message:
Revert "GRAPHICS: Round border length to nearest interger"
This reverts commit 920a9252655f0598e9bfec17e37861c34c2a6c96.
Changed paths:
graphics/nine_patch.cpp
diff --git a/graphics/nine_patch.cpp b/graphics/nine_patch.cpp
index d2fb3a85c11..c31ec1599d3 100644
--- a/graphics/nine_patch.cpp
+++ b/graphics/nine_patch.cpp
@@ -147,7 +147,7 @@ void NinePatchSide::calcOffsets(int len, int titleIndex, int titleWidth) {
if (_m[i]->ratio == 0) {
_m[i]->dest_length = _m[i]->length;
} else {
- _m[i]->dest_length = (len - _fix - titleWidth) * _m[i]->ratio + 0.5;
+ _m[i]->dest_length = (len - _fix - titleWidth) * _m[i]->ratio;
remaining_stretch -= _m[i]->dest_length;
j = i;
}
Commit: deff7ab16072948c078eb94551427738ceb1ca0d
https://github.com/scummvm/scummvm/commit/deff7ab16072948c078eb94551427738ceb1ca0d
Author: polyesterswing (kurianjojo2004 at gmail.com)
Date: 2024-04-25T00:37:48+02:00
Commit Message:
GRAPHICS: NINEPATCH: Change the way remaining_stretch is distributed
Remaining stretch is given to the last stretchable mark. This commit
changes things so that the first stretchable mark is given it.
Changed paths:
graphics/nine_patch.cpp
diff --git a/graphics/nine_patch.cpp b/graphics/nine_patch.cpp
index c31ec1599d3..ce86fed5a60 100644
--- a/graphics/nine_patch.cpp
+++ b/graphics/nine_patch.cpp
@@ -128,7 +128,9 @@ bool NinePatchSide::init(Graphics::ManagedSurface *bmp, bool vertical, uint32 bl
}
void NinePatchSide::calcOffsets(int len, int titleIndex, int titleWidth) {
- uint i, j;
+ uint i;
+ int j = -1;
+
int dest_offset = 0;
// if we don't got titleIndex, then we better set titleWidth to 0
if (titleIndex == 0)
@@ -138,7 +140,7 @@ void NinePatchSide::calcOffsets(int len, int titleIndex, int titleWidth) {
if (remaining_stretch < 0)
remaining_stretch = 0;
- for (i = 0, j = 0; i < _m.size(); ++i) {
+ for (i = 0; i < _m.size(); ++i) {
_m[i]->dest_offset = dest_offset;
if (titleIndex > 0 && i == (uint)titleIndex) {
@@ -149,16 +151,23 @@ void NinePatchSide::calcOffsets(int len, int titleIndex, int titleWidth) {
} else {
_m[i]->dest_length = (len - _fix - titleWidth) * _m[i]->ratio;
remaining_stretch -= _m[i]->dest_length;
- j = i;
+
+ // Find the first stretchable mark
+ if (j == -1) {
+ j = i;
+ }
}
}
dest_offset += _m[i]->dest_length;
}
- if (remaining_stretch && _m.size()) {
+ if (remaining_stretch && _m.size() && j != -1) {
_m[j]->dest_length += remaining_stretch;
- if (j + 1 < _m.size())
- _m[j + 1]->dest_offset += remaining_stretch;
+
+ // Go through all marks to the right of j and update their offsets
+ for (uint k = j + 1; k < _m.size(); k++) {
+ _m[k]->dest_offset += remaining_stretch;
+ }
}
}
More information about the Scummvm-git-logs
mailing list