[Scummvm-git-logs] scummvm master -> b3e3c9ec55459017a2250bf1a193a07cf04203b1
OMGPizzaGuy
48367439+OMGPizzaGuy at users.noreply.github.com
Tue Feb 23 13:38:00 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b3e3c9ec55 ULTIMA8: Update ttf border render to allow semi-transparent border color
Commit: b3e3c9ec55459017a2250bf1a193a07cf04203b1
https://github.com/scummvm/scummvm/commit/b3e3c9ec55459017a2250bf1a193a07cf04203b1
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2021-02-23T07:37:44-06:00
Commit Message:
ULTIMA8: Update ttf border render to allow semi-transparent border color
Changed paths:
engines/ultima/ultima8/graphics/fonts/tt_font.cpp
diff --git a/engines/ultima/ultima8/graphics/fonts/tt_font.cpp b/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
index 390652016f..689f6de75c 100644
--- a/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
@@ -193,10 +193,11 @@ RenderedText *TTFont::renderText(const Std::string &text, unsigned int &remainin
texBuf[ty * resultWidth + tx] = borderColor;
}
else if (sqrDist < sqrEdge) {
- // Blend border color with destination
+ // Blend border color at source intensity with destination
uint8 dA, dR, dG, dB;
PF_RGBA.colorToARGB(dColor, dA, dR, dG, dB);
+ double bAlpha = (double)bA / 255.0;
double sAlpha = (double)sA / 255.0;
double dAlpha = (double)dA / 255.0;
dAlpha *= (1.0 - sAlpha);
@@ -204,7 +205,7 @@ RenderedText *TTFont::renderText(const Std::string &text, unsigned int &remainin
dR = static_cast<uint8>((bR * sAlpha + dR * dAlpha) / (sAlpha + dAlpha));
dG = static_cast<uint8>((bG * sAlpha + dG * dAlpha) / (sAlpha + dAlpha));
dB = static_cast<uint8>((bB * sAlpha + dB * dAlpha) / (sAlpha + dAlpha));
- dA = static_cast<uint8>(255. * (sAlpha + dAlpha));
+ dA = static_cast<uint8>(255. * bAlpha * (sAlpha + dAlpha));
texBuf[ty * resultWidth + tx] = PF_RGBA.ARGBToColor(dA, dR, dG, dB);
}
@@ -243,14 +244,10 @@ RenderedText *TTFont::renderText(const Std::string &text, unsigned int &remainin
uint8 sR, sG, sB, sA;
PF_RGBA.colorToARGB(sColor, sA, sR, sG, sB);
- if (sA == 0x00)
- continue;
-
- switch (sA) {
- case 0xFF:
+ if (sA == 0xFF) {
texBuf[ty * resultWidth + tx] = sColor;
- break;
- default:
+ }
+ else if (sA != 0x00) {
// Blend color with destination
int32 dColor = texBuf[ty * resultWidth + tx];
uint8 dA, dR, dG, dB;
@@ -266,7 +263,6 @@ RenderedText *TTFont::renderText(const Std::string &text, unsigned int &remainin
dA = static_cast<uint8>(255. * (sAlpha + dAlpha));
texBuf[ty * resultWidth + tx] = PF_RGBA.ARGBToColor(dA, dR, dG, dB);
- break;
}
}
else if (surfrow[x] == 1) {
More information about the Scummvm-git-logs
mailing list