mirror of
https://github.com/holub/mame
synced 2025-07-02 16:49:22 +03:00
-emu/rendlay.cpp: Avoid another issue with floating point error accumulation when drawing disk components.
-fidel_dames.cpp: Draw buttons as single elements - improves appearance at small sizes.
This commit is contained in:
parent
c88f0006c9
commit
66d2045d35
@ -38,7 +38,8 @@
|
||||
|
||||
#define LOG_GROUP_BOUNDS_RESOLUTION (1U << 1)
|
||||
#define LOG_INTERACTIVE_ITEMS (1U << 2)
|
||||
#define LOG_IMAGE_LOAD (1U << 3)
|
||||
#define LOG_DISK_DRAW (1U << 3)
|
||||
#define LOG_IMAGE_LOAD (1U << 4)
|
||||
|
||||
//#define VERBOSE (LOG_GROUP_BOUNDS_RESOLUTION | LOG_INTERACTIVE_ITEMS | LOG_IMAGE_LOAD)
|
||||
#define LOG_OUTPUT_FUNC osd_printf_verbose
|
||||
@ -2041,6 +2042,8 @@ public:
|
||||
float const yradius = curbounds.height() * float(dest.height()) * 0.5F;
|
||||
s32 const miny = s32(curbounds.y0 * float(dest.height()));
|
||||
s32 const maxy = s32(std::ceil(curbounds.y1 * float(dest.height()))) - 1;
|
||||
LOGMASKED(LOG_DISK_DRAW, "Draw disk: bounds (%s %s %s %s); (((x - %s) ** 2) / (%s ** 2) + ((y - %s) ** 2) / (%s ** 2)) = 1; rows [%s %s]\n",
|
||||
curbounds.x0, curbounds.y0, curbounds.x1, curbounds.y1, xcenter, xradius, ycenter, yradius, miny, maxy);
|
||||
|
||||
if (miny == maxy)
|
||||
{
|
||||
@ -2115,17 +2118,18 @@ public:
|
||||
// draw rows above the axis
|
||||
s32 y = miny + 1;
|
||||
float ycoord1 = ycenter - float(y);
|
||||
float xval1 = xradius * std::sqrt((std::max)(1.0F - (ycoord1 * ycoord1) * ooyradius2, 0.0F));
|
||||
float l1 = xcenter - xval1;
|
||||
float r1 = xcenter + xval1;
|
||||
float xval1 = std::sqrt((std::max)(1.0F - (ycoord1 * ycoord1) * ooyradius2, 0.0F));
|
||||
float l1 = xcenter - (xval1 * xradius);
|
||||
float r1 = xcenter + (xval1 * xradius);
|
||||
for ( ; (maxy > y) && (float(y + 1) <= ycenter); ++y)
|
||||
{
|
||||
float const xval0 = xval1;
|
||||
float const l0 = l1;
|
||||
float const r0 = r1;
|
||||
ycoord1 = ycenter - float(y + 1);
|
||||
xval1 = xradius * std::sqrt((std::max)(1.0F - (ycoord1 * ycoord1) * ooyradius2, 0.0F));
|
||||
l1 = xcenter - xval1;
|
||||
r1 = xcenter + xval1;
|
||||
xval1 = std::sqrt((std::max)(1.0F - (ycoord1 * ycoord1) * ooyradius2, 0.0F));
|
||||
l1 = xcenter - (xval1 * xradius);
|
||||
r1 = xcenter + (xval1 * xradius);
|
||||
s32 minx = int(l1);
|
||||
s32 maxx = int(std::ceil(r1)) - 1;
|
||||
u32 *dst = &dest.pix(y, minx);
|
||||
@ -2142,13 +2146,13 @@ public:
|
||||
{
|
||||
float val = 0.0F;
|
||||
if (float(x + 1) <= l0)
|
||||
val += integral((xcenter - float(x + 1)) / xradius, (xcenter - (std::max)(float(x), l1)) / xradius);
|
||||
val += integral((std::max)((float(x) - xcenter) / xradius, -xval1), (float(x + 1) - xcenter) / xradius);
|
||||
else if (float(x) <= l0)
|
||||
val += integral((xcenter - l0) / xradius, (xcenter - (std::max)(float(x), l1)) / xradius);
|
||||
val += integral((std::max)((float(x) - xcenter) / xradius, -xval1), -xval0);
|
||||
else if (float(x) >= r0)
|
||||
val += integral((float(x) - xcenter) / xradius, ((std::min)(float(x + 1), r1) - xcenter) / xradius);
|
||||
val += integral((float(x) - xcenter) / xradius, (std::min)((float(x + 1) - xcenter) / xradius, xval1));
|
||||
else if (float(x + 1) >= r0)
|
||||
val += integral((r0 - xcenter) / xradius, ((std::min)(float(x + 1), r1) - xcenter) / xradius);
|
||||
val += integral(xval0, (std::min)((float(x + 1) - xcenter) / xradius, xval1));
|
||||
val *= scale;
|
||||
if (float(x) <= l0)
|
||||
val -= ((std::min)(float(x + 1), l0) - (std::max)(float(x), l1)) * ycoord1;
|
||||
@ -2166,9 +2170,9 @@ public:
|
||||
float const l0 = l1;
|
||||
float const r0 = r1;
|
||||
ycoord1 = float(y + 1) - ycenter;
|
||||
xval1 = xradius * std::sqrt((std::max)(1.0F - (ycoord1 * ycoord1) * ooyradius2, 0.0F));
|
||||
l1 = xcenter - xval1;
|
||||
r1 = xcenter + xval1;
|
||||
xval1 = std::sqrt((std::max)(1.0F - (ycoord1 * ycoord1) * ooyradius2, 0.0F));
|
||||
l1 = xcenter - (xval1 * xradius);
|
||||
r1 = xcenter + (xval1 * xradius);
|
||||
s32 const minx = int(curbounds.x0 * float(dest.width()));
|
||||
s32 const maxx = int(std::ceil(curbounds.x1 * float(dest.width()))) - 1;
|
||||
u32 *dst = &dest.pix(y, minx);
|
||||
@ -2213,12 +2217,13 @@ public:
|
||||
for ( ; maxy > y; ++y)
|
||||
{
|
||||
float const ycoord0 = ycoord1;
|
||||
float const xval0 = xval1;
|
||||
float const l0 = l1;
|
||||
float const r0 = r1;
|
||||
ycoord1 = float(y + 1) - ycenter;
|
||||
xval1 = xradius * std::sqrt((std::max)(1.0F - (ycoord1 * ycoord1) * ooyradius2, 0.0F));
|
||||
l1 = xcenter - xval1;
|
||||
r1 = xcenter + xval1;
|
||||
xval1 = std::sqrt((std::max)(1.0F - (ycoord1 * ycoord1) * ooyradius2, 0.0F));
|
||||
l1 = xcenter - (xval1 * xradius);
|
||||
r1 = xcenter + (xval1 * xradius);
|
||||
s32 minx = int(l0);
|
||||
s32 maxx = int(std::ceil(r0)) - 1;
|
||||
u32 *dst = &dest.pix(y, minx);
|
||||
@ -2235,13 +2240,13 @@ public:
|
||||
{
|
||||
float val = 0.0F;
|
||||
if (float(x + 1) <= l1)
|
||||
val += integral((xcenter - float(x + 1)) / xradius, (xcenter - (std::max)(float(x), l0)) / xradius);
|
||||
val += integral((std::max)((float(x) - xcenter) / xradius, -xval0), (float(x + 1) - xcenter) / xradius);
|
||||
else if (float(x) <= l1)
|
||||
val += integral((xcenter - l1) / xradius, (xcenter - (std::max)(float(x), l0)) / xradius);
|
||||
val += integral((std::max)((float(x) - xcenter) / xradius, -xval0), -xval1);
|
||||
else if (float(x) >= r1)
|
||||
val += integral((float(x) - xcenter) / xradius, ((std::min)(float(x + 1), r0) - xcenter) / xradius);
|
||||
val += integral((float(x) - xcenter) / xradius, (std::min)((float(x + 1) - xcenter) / xradius, xval0));
|
||||
else if (float(x + 1) >= r1)
|
||||
val += integral((r1 - xcenter) / xradius, ((std::min)(float(x + 1), r0) - xcenter) / xradius);
|
||||
val += integral(xval1, (std::min)((float(x + 1) - xcenter) / xradius, xval0));
|
||||
val *= scale;
|
||||
if (float(x) <= l1)
|
||||
val -= ((std::min)(float(x + 1), l1) - (std::max)(float(x), l0)) * ycoord0;
|
||||
|
@ -8,8 +8,32 @@ license:CC0
|
||||
|
||||
<element name="black"><rect><color red="0.17" green="0.15" blue="0.15" /></rect></element>
|
||||
<element name="white"><rect><color red="0.81" green="0.8" blue="0.79" /></rect></element>
|
||||
<element name="disk_black"><disk><color red="0.17" green="0.15" blue="0.15" /></disk></element>
|
||||
<element name="disk_white"><disk><color red="0.81" green="0.8" blue="0.79" /></disk></element>
|
||||
|
||||
<element name="btn_white">
|
||||
<disk>
|
||||
<bounds xc="0" yc="0" width="7" height="7" />
|
||||
<color red="0.17" green="0.15" blue="0.15" />
|
||||
</disk>
|
||||
<disk>
|
||||
<bounds xc="0" yc="0" width="5.2" height="5.2" />
|
||||
<color red="0.81" green="0.8" blue="0.79" />
|
||||
</disk>
|
||||
</element>
|
||||
|
||||
<element name="btn_black">
|
||||
<disk>
|
||||
<bounds xc="0" yc="0" width="7" height="7" />
|
||||
<color red="0.17" green="0.15" blue="0.15" />
|
||||
</disk>
|
||||
<disk>
|
||||
<bounds xc="0" yc="0" width="6.2" height="6.2" />
|
||||
<color red="0.81" green="0.8" blue="0.79" />
|
||||
</disk>
|
||||
<disk>
|
||||
<bounds xc="0" yc="0" width="5" height="5" />
|
||||
<color red="0.17" green="0.15" blue="0.15" />
|
||||
</disk>
|
||||
</element>
|
||||
|
||||
<element name="digit" defstate="0">
|
||||
<led7seg><color red="1.0" green="0.1" blue="0.15" /></led7seg>
|
||||
@ -21,10 +45,7 @@ license:CC0
|
||||
</element>
|
||||
|
||||
<element name="hlb" defstate="0">
|
||||
<text string=" ">
|
||||
<bounds x="0.0" y="0.0" width="1.0" height="1.0" />
|
||||
<color red="0.0" green="0.0" blue="0.0" />
|
||||
</text>
|
||||
<rect><color alpha="0" /></rect> <!-- force unit square element bounds -->
|
||||
<disk state="1">
|
||||
<bounds x="0.0" y="0.0" width="1.0" height="1.0" />
|
||||
<color red="1.0" green="1.0" blue="1.0" />
|
||||
@ -268,7 +289,7 @@ license:CC0
|
||||
<element name="cwhite"><rect><color red="0.81" green="0.8" blue="0.79" /></rect></element>
|
||||
|
||||
<element name="hlbb" defstate="0">
|
||||
<text string=" "><bounds x="0" y="0" width="1" height="1" /></text>
|
||||
<rect><color alpha="0" /></rect> <!-- force unit square element bounds -->
|
||||
<disk state="1">
|
||||
<bounds x="0.12" y="0.12" width="0.76" height="0.76" />
|
||||
<color red="0" green="0" blue="0" />
|
||||
@ -276,7 +297,7 @@ license:CC0
|
||||
</element>
|
||||
|
||||
<element name="piece" defstate="0">
|
||||
<text string=" "><bounds x="0" y="0" width="1" height="1" /></text>
|
||||
<rect><color alpha="0" /></rect> <!-- force unit square element bounds -->
|
||||
<disk state="1">
|
||||
<bounds x="0.1" y="0.1" width="0.8" height="0.8" />
|
||||
<color red="1" green="0.9" blue="0.6" />
|
||||
@ -523,28 +544,15 @@ license:CC0
|
||||
|
||||
<!-- right side -->
|
||||
|
||||
<element ref="disk_black"><bounds x="107" y="14.5" width="7" height="7" /></element>
|
||||
<element ref="disk_black"><bounds x="107" y="24.5" width="7" height="7" /></element>
|
||||
<element ref="disk_black"><bounds x="107" y="34.5" width="7" height="7" /></element>
|
||||
<element ref="disk_black"><bounds x="107" y="44.5" width="7" height="7" /></element>
|
||||
<element ref="disk_black"><bounds x="107" y="54.5" width="7" height="7" /></element>
|
||||
<element ref="disk_black"><bounds x="107" y="64.5" width="7" height="7" /></element>
|
||||
<element ref="disk_black"><bounds x="107" y="74.5" width="7" height="7" /></element>
|
||||
<element ref="disk_black"><bounds x="107" y="84.5" width="7" height="7" /></element>
|
||||
<element ref="disk_black"><bounds x="107" y="94.5" width="7" height="7" /></element>
|
||||
|
||||
<element ref="disk_white"><bounds x="107.9" y="15.4" width="5.2" height="5.2" /></element>
|
||||
<element ref="disk_white"><bounds x="107.9" y="25.4" width="5.2" height="5.2" /></element>
|
||||
<element ref="disk_white"><bounds x="107.9" y="35.4" width="5.2" height="5.2" /></element>
|
||||
<element ref="disk_white"><bounds x="107.9" y="45.4" width="5.2" height="5.2" /></element>
|
||||
<element ref="disk_white"><bounds x="107.9" y="55.4" width="5.2" height="5.2" /></element>
|
||||
<element ref="disk_white"><bounds x="107.9" y="65.4" width="5.2" height="5.2" /></element>
|
||||
<element ref="disk_white"><bounds x="107.9" y="75.4" width="5.2" height="5.2" /></element>
|
||||
|
||||
<element ref="disk_white"><bounds x="107.4" y="84.9" width="6.2" height="6.2" /></element>
|
||||
<element ref="disk_white"><bounds x="107.4" y="94.9" width="6.2" height="6.2" /></element>
|
||||
<element ref="disk_black"><bounds x="108" y="85.5" width="5" height="5" /></element>
|
||||
<element ref="disk_black"><bounds x="108" y="95.5" width="5" height="5" /></element>
|
||||
<element ref="btn_white"><bounds x="107" y="14.5" width="7" height="7" /></element>
|
||||
<element ref="btn_white"><bounds x="107" y="24.5" width="7" height="7" /></element>
|
||||
<element ref="btn_white"><bounds x="107" y="34.5" width="7" height="7" /></element>
|
||||
<element ref="btn_white"><bounds x="107" y="44.5" width="7" height="7" /></element>
|
||||
<element ref="btn_white"><bounds x="107" y="54.5" width="7" height="7" /></element>
|
||||
<element ref="btn_white"><bounds x="107" y="64.5" width="7" height="7" /></element>
|
||||
<element ref="btn_white"><bounds x="107" y="74.5" width="7" height="7" /></element>
|
||||
<element ref="btn_black"><bounds x="107" y="84.5" width="7" height="7" /></element>
|
||||
<element ref="btn_black"><bounds x="107" y="94.5" width="7" height="7" /></element>
|
||||
|
||||
<element ref="text_re"><bounds x="108" y="16.5" width="5" height="3" /></element>
|
||||
<element ref="text_pb"><bounds x="108" y="26.5" width="5" height="3" /></element>
|
||||
|
Loading…
Reference in New Issue
Block a user