[Scummvm-git-logs] scummvm master -> 0c59abf327282dd17b9659dcf4bdb09c7ed5c28c
bluegr
bluegr at gmail.com
Sun May 23 07:33:21 UTC 2021
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:
909be8a933 GRAPHICS: Add a Normal5x scaler
0c59abf327 GRAPHICS: Optimize the Normal scaler slightly
Commit: 909be8a93350ad42d0edde2e2efe4dbbdd605b78
https://github.com/scummvm/scummvm/commit/909be8a93350ad42d0edde2e2efe4dbbdd605b78
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-05-23T10:33:18+03:00
Commit Message:
GRAPHICS: Add a Normal5x scaler
Changed paths:
graphics/scaler/normal.cpp
diff --git a/graphics/scaler/normal.cpp b/graphics/scaler/normal.cpp
index a007d6a0b3..441e04a0ee 100644
--- a/graphics/scaler/normal.cpp
+++ b/graphics/scaler/normal.cpp
@@ -28,6 +28,7 @@ NormalPlugin::NormalPlugin() {
_factors.push_back(2);
_factors.push_back(3);
_factors.push_back(4);
+ _factors.push_back(5);
#endif
}
@@ -164,6 +165,56 @@ void Normal4x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit
dstPtr += dstPitch4;
}
}
+
+/**
+ * Trivial nearest-neighbor 5x scaler.
+ */
+template<typename Pixel>
+void Normal5x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
+ int width, int height) {
+ uint8 *r;
+ const uint32 dstPitch2 = dstPitch * 2;
+ const uint32 dstPitch3 = dstPitch * 3;
+ const uint32 dstPitch4 = dstPitch * 4;
+ const uint32 dstPitch5 = dstPitch * 5;
+ int b = sizeof(Pixel);
+
+ assert(IS_ALIGNED(dstPtr, 2));
+ while (height--) {
+ r = dstPtr;
+ for (int i = 0; i < width; ++i, r += b * 5) {
+ Pixel color = *(((const Pixel *)srcPtr) + i);
+
+ *(Pixel *)(r + b * 0) = color;
+ *(Pixel *)(r + b * 1) = color;
+ *(Pixel *)(r + b * 2) = color;
+ *(Pixel *)(r + b * 3) = color;
+ *(Pixel *)(r + b * 4) = color;
+ *(Pixel *)(r + b * 0 + dstPitch) = color;
+ *(Pixel *)(r + b * 1 + dstPitch) = color;
+ *(Pixel *)(r + b * 2 + dstPitch) = color;
+ *(Pixel *)(r + b * 3 + dstPitch) = color;
+ *(Pixel *)(r + b * 4 + dstPitch) = color;
+ *(Pixel *)(r + b * 0 + dstPitch2) = color;
+ *(Pixel *)(r + b * 1 + dstPitch2) = color;
+ *(Pixel *)(r + b * 2 + dstPitch2) = color;
+ *(Pixel *)(r + b * 3 + dstPitch2) = color;
+ *(Pixel *)(r + b * 4 + dstPitch2) = color;
+ *(Pixel *)(r + b * 0 + dstPitch3) = color;
+ *(Pixel *)(r + b * 1 + dstPitch3) = color;
+ *(Pixel *)(r + b * 2 + dstPitch3) = color;
+ *(Pixel *)(r + b * 3 + dstPitch3) = color;
+ *(Pixel *)(r + b * 4 + dstPitch3) = color;
+ *(Pixel *)(r + b * 0 + dstPitch4) = color;
+ *(Pixel *)(r + b * 1 + dstPitch4) = color;
+ *(Pixel *)(r + b * 2 + dstPitch4) = color;
+ *(Pixel *)(r + b * 3 + dstPitch4) = color;
+ *(Pixel *)(r + b * 4 + dstPitch4) = color;
+ }
+ srcPtr += srcPitch;
+ dstPtr += dstPitch5;
+ }
+}
#endif
void NormalPlugin::scaleIntern(const uint8 *srcPtr, uint32 srcPitch,
@@ -184,6 +235,9 @@ void NormalPlugin::scaleIntern(const uint8 *srcPtr, uint32 srcPitch,
case 4:
Normal4x<uint16>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
break;
+ case 5:
+ Normal5x<uint16>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+ break;
}
} else {
assert(_format.bytesPerPixel == 4);
@@ -197,6 +251,9 @@ void NormalPlugin::scaleIntern(const uint8 *srcPtr, uint32 srcPitch,
case 4:
Normal4x<uint32>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
break;
+ case 5:
+ Normal5x<uint32>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+ break;
}
}
#endif
@@ -204,7 +261,7 @@ void NormalPlugin::scaleIntern(const uint8 *srcPtr, uint32 srcPitch,
uint NormalPlugin::increaseFactor() {
#ifdef USE_SCALERS
- if (_factor < 4)
+ if (_factor < 5)
setFactor(_factor + 1);
#endif
return _factor;
Commit: 0c59abf327282dd17b9659dcf4bdb09c7ed5c28c
https://github.com/scummvm/scummvm/commit/0c59abf327282dd17b9659dcf4bdb09c7ed5c28c
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-05-23T10:33:18+03:00
Commit Message:
GRAPHICS: Optimize the Normal scaler slightly
Changed paths:
graphics/scaler/normal.cpp
diff --git a/graphics/scaler/normal.cpp b/graphics/scaler/normal.cpp
index 441e04a0ee..140f6c52cb 100644
--- a/graphics/scaler/normal.cpp
+++ b/graphics/scaler/normal.cpp
@@ -41,7 +41,7 @@ template<typename Pixel>
void Normal2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
int width, int height) {
uint8 *r;
- int b = sizeof(Pixel);
+ const int b = sizeof(Pixel);
assert(IS_ALIGNED(dstPtr, 2));
while (height--) {
@@ -103,7 +103,7 @@ void Normal3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit
uint8 *r;
const uint32 dstPitch2 = dstPitch * 2;
const uint32 dstPitch3 = dstPitch * 3;
- int b = sizeof(Pixel);
+ const int b = sizeof(Pixel);
assert(IS_ALIGNED(dstPtr, 2));
while (height--) {
@@ -136,7 +136,7 @@ void Normal4x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit
const uint32 dstPitch2 = dstPitch * 2;
const uint32 dstPitch3 = dstPitch * 3;
const uint32 dstPitch4 = dstPitch * 4;
- int b = sizeof(Pixel);
+ const int b = sizeof(Pixel);
assert(IS_ALIGNED(dstPtr, 2));
while (height--) {
@@ -177,7 +177,7 @@ void Normal5x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit
const uint32 dstPitch3 = dstPitch * 3;
const uint32 dstPitch4 = dstPitch * 4;
const uint32 dstPitch5 = dstPitch * 5;
- int b = sizeof(Pixel);
+ const int b = sizeof(Pixel);
assert(IS_ALIGNED(dstPtr, 2));
while (height--) {
More information about the Scummvm-git-logs
mailing list