[Scummvm-git-logs] scummvm master -> 20ae3b79f4c6b9b498359548d25a481d91add67d
OMGPizzaGuy
noreply at scummvm.org
Fri Sep 15 21:58:04 UTC 2023
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:
bd32dc0fbe ULTIMA8: Move paint invisible back to a separate loop to improve speed
20ae3b79f4 ULTIMA8: Clean up fillBlended
Commit: bd32dc0fbe745cfc8a258bc4bc27c58513fb5666
https://github.com/scummvm/scummvm/commit/bd32dc0fbe745cfc8a258bc4bc27c58513fb5666
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-09-15T16:57:46-05:00
Commit Message:
ULTIMA8: Move paint invisible back to a separate loop to improve speed
Changed paths:
engines/ultima/ultima8/graphics/render_surface.cpp
diff --git a/engines/ultima/ultima8/graphics/render_surface.cpp b/engines/ultima/ultima8/graphics/render_surface.cpp
index fab7d532fde..96e48648d01 100644
--- a/engines/ultima/ultima8/graphics/render_surface.cpp
+++ b/engines/ultima/ultima8/graphics/render_surface.cpp
@@ -744,7 +744,10 @@ void inline paintBlendedLogic(uint8 *pixels, int32 pitch,
const uint8 *srcPixels = reinterpret_cast<const uint8 *>(src.getBasePtr(srcRect.left, srcRect.top));
uint8 *dstPixels = reinterpret_cast<uint8 *>(pixels + x * sizeof(uintX) + pitch * y);
- if (highlight || invisible) {
+ uint8 dr, dg, db;
+ uint8 sr, sg, sb;
+
+ if (highlight) {
uint32 ca = TEX32_A(highlight);
uint32 cr = TEX32_R(highlight);
uint32 cg = TEX32_G(highlight);
@@ -756,8 +759,6 @@ void inline paintBlendedLogic(uint8 *pixels, int32 pitch,
const uint8 color = *srcPixels;
if (color != keycolor) {
uintX *dstpix = reinterpret_cast<uintX *>(dstPixels);
- uint8 dr, dg, db;
- uint8 sr, sg, sb;
format.colorToRGB(*dstpix, dr, dg, db);
if (xform_map && xform_map[color]) {
@@ -775,23 +776,51 @@ void inline paintBlendedLogic(uint8 *pixels, int32 pitch,
format.colorToRGB(map[color], sr, sg, sb);
}
- if (highlight && invisible) {
+ if (invisible) {
dr = (((sr * ica + cr * ca) >> 1) + (dr << 7)) >> 8;
dg = (((sg * ica + cg * ca) >> 1) + (dg << 7)) >> 8;
db = (((sb * ica + cb * ca) >> 1) + (db << 7)) >> 8;
- }
- else if (highlight)
- {
+ } else {
dr = (sr * ica + cr * ca) >> 8;
dg = (sg * ica + cg * ca) >> 8;
db = (sb * ica + cb * ca) >> 8;
}
- else if (invisible)
- {
- dr = (sr * 128 + dr * 128) >> 8;
- dg = (sg * 128 + dg * 128) >> 8,
- db = (sb * 128 + db * 128) >> 8;
+ *dstpix = static_cast<uintX>(format.RGBToColor(dr, dg, db));
+ }
+ srcPixels += srcStep;
+ dstPixels += dstStep;
+ }
+
+ srcPixels += srcDelta;
+ dstPixels += dstDelta;
+ }
+ } else if (invisible) {
+ for (int i = 0; i < h; i++) {
+ for (int j = 0; j < w; j++) {
+ const uint8 color = *srcPixels;
+ if (color != keycolor) {
+ uintX *dstpix = reinterpret_cast<uintX *>(dstPixels);
+ format.colorToRGB(*dstpix, dr, dg, db);
+
+ if (xform_map && xform_map[color]) {
+ uint32 val = xform_map[color];
+
+ uint32 ia = 256 - TEX32_A(val);
+ uint32 r = (dr * ia + 256 * TEX32_R(val)) >> 8;
+ uint32 g = (dg * ia + 256 * TEX32_G(val)) >> 8;
+ uint32 b = (db * ia + 256 * TEX32_B(val)) >> 8;
+
+ sr = r > 0xFF ? 0xFF : r;
+ sg = g > 0xFF ? 0xFF : g;
+ sb = b > 0xFF ? 0xFF : b;
+ } else {
+ format.colorToRGB(map[color], sr, sg, sb);
}
+
+ dr = (sr * 128 + dr * 128) >> 8;
+ dg = (sg * 128 + dg * 128) >> 8,
+ db = (sb * 128 + db * 128) >> 8;
+
*dstpix = static_cast<uintX>(format.RGBToColor(dr, dg, db));
}
srcPixels += srcStep;
@@ -808,7 +837,6 @@ void inline paintBlendedLogic(uint8 *pixels, int32 pitch,
if (color != keycolor) {
uintX *dstpix = reinterpret_cast<uintX *>(dstPixels);
if (xform_map && xform_map[color]) {
- uint8 dr, dg, db;
format.colorToRGB(*dstpix, dr, dg, db);
uint32 val = xform_map[color];
Commit: 20ae3b79f4c6b9b498359548d25a481d91add67d
https://github.com/scummvm/scummvm/commit/20ae3b79f4c6b9b498359548d25a481d91add67d
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-09-15T16:57:46-05:00
Commit Message:
ULTIMA8: Clean up fillBlended
Changed paths:
engines/ultima/ultima8/graphics/render_surface.cpp
diff --git a/engines/ultima/ultima8/graphics/render_surface.cpp b/engines/ultima/ultima8/graphics/render_surface.cpp
index 96e48648d01..36d833b3b51 100644
--- a/engines/ultima/ultima8/graphics/render_surface.cpp
+++ b/engines/ultima/ultima8/graphics/render_surface.cpp
@@ -213,12 +213,11 @@ void inline fillBlendedLogic(uint8 *pixels, int32 pitch, uint32 rgba, const Comm
if (!w || !h)
return;
- uint32 aMask = format.aMax() << format.aShift;
- int alpha = TEX32_A(rgba);
- rgba = TEX32_PACK_RGBA((TEX32_R(rgba) * alpha) >> 8,
- (TEX32_G(rgba) * alpha) >> 8,
- (TEX32_B(rgba) * alpha) >> 8,
- (255 * alpha) >> 8);
+ uint32 sa = TEX32_A(rgba);
+ uint32 sr = TEX32_R(rgba);
+ uint32 sg = TEX32_G(rgba);
+ uint32 sb = TEX32_B(rgba);
+ uint32 ia = 256 - TEX32_A(rgba);
uint8 *pixel = pixels + rect.top * pitch + rect.left * format.bytesPerPixel;
int diff = pitch - w * format.bytesPerPixel;
@@ -226,16 +225,16 @@ void inline fillBlendedLogic(uint8 *pixels, int32 pitch, uint32 rgba, const Comm
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x) {
uintX *dest = reinterpret_cast<uintX *>(pixel);
- uint32 d = *dest;
- uint8 dr, dg, db;
- format.colorToRGB(d, dr, dg, db);
+ uint8 dr, dg, db, da;
+ format.colorToARGB(*dest, da, dr, dg, db);
- uint32 ia = 256 - TEX32_A(rgba);
- uint32 r = (dr * ia + 256 * TEX32_R(rgba)) >> 8;
- uint32 g = (dg * ia + 256 * TEX32_G(rgba)) >> 8;
- uint32 b = (db * ia + 256 * TEX32_B(rgba)) >> 8;
+ if (da) {
+ dr = (dr * ia + sr * sa) >> 8;
+ dg = (dg * ia + sg * sa) >> 8;
+ db = (db * ia + sb * sa) >> 8;
- *dest = (d & aMask) | format.RGBToColor(r, g, b);
+ *dest = format.ARGBToColor(da, dr, dg, db);
+ }
pixel += format.bytesPerPixel;
}
More information about the Scummvm-git-logs
mailing list