[Scummvm-git-logs] scummvm master -> c2d6c84e65a69d277d5fe8cb94837f40a43e628e
sev-
noreply at scummvm.org
Sat Feb 25 14:29:54 UTC 2023
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
58ca66a5d6 GRAPHICS: Added option for debug output to BDF font scaling
4ef840d93d GRAPHICS: Const correctness
c2d6c84e65 TESTBED: Added test for fonts scaling
Commit: 58ca66a5d6fd21b6c20edccf2351bce8deeee1a7
https://github.com/scummvm/scummvm/commit/58ca66a5d6fd21b6c20edccf2351bce8deeee1a7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-25T15:29:30+01:00
Commit Message:
GRAPHICS: Added option for debug output to BDF font scaling
Changed paths:
graphics/fonts/bdf.cpp
diff --git a/graphics/fonts/bdf.cpp b/graphics/fonts/bdf.cpp
index 5dec680742b..f5d83fc6cc2 100644
--- a/graphics/fonts/bdf.cpp
+++ b/graphics/fonts/bdf.cpp
@@ -27,6 +27,8 @@
#include "graphics/surface.h"
+#define DRAWDEBUG 0
+
namespace Graphics {
BdfFont::BdfFont(const BdfFontData &data, DisposeAfterUse::Flag dispose)
@@ -804,14 +806,23 @@ BdfFont *BdfFont::scaleFont(BdfFont *src, int newSize) {
int sx = (int)((float)x / scale);
- if (srcd[sx / 8] & (0x80 >> (sx % 8)))
+ if (srcd[sx / 8] & (0x80 >> (sx % 8))) {
b |= 1;
+#if DRAWDEBUG
+ debugN("#");
+ } else {
+ debugN(" ");
+#endif
+ }
if (x % 8 == 7) {
*dst++ = b;
b = 0;
}
}
+#if DRAWDEBUG
+ debug("");
+#endif
if (((box.width - 1) % 8)) {
b <<= 7 - ((box.width - 1) % 8);
Commit: 4ef840d93dba61b53bfdf529342a8018e63de60a
https://github.com/scummvm/scummvm/commit/4ef840d93dba61b53bfdf529342a8018e63de60a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-25T15:29:30+01:00
Commit Message:
GRAPHICS: Const correctness
Changed paths:
graphics/fonts/bdf.cpp
graphics/fonts/bdf.h
diff --git a/graphics/fonts/bdf.cpp b/graphics/fonts/bdf.cpp
index f5d83fc6cc2..af11c77bd80 100644
--- a/graphics/fonts/bdf.cpp
+++ b/graphics/fonts/bdf.cpp
@@ -726,7 +726,7 @@ BdfFont *BdfFont::loadFromCache(Common::SeekableReadStream &stream) {
return new BdfFont(data, DisposeAfterUse::YES);
}
-BdfFont *BdfFont::scaleFont(BdfFont *src, int newSize) {
+BdfFont *BdfFont::scaleFont(const BdfFont *src, int newSize) {
if (!src) {
warning("BdfFont::scaleFont(): Empty font reference in scale font");
return nullptr;
diff --git a/graphics/fonts/bdf.h b/graphics/fonts/bdf.h
index 2d600541284..2811560b108 100644
--- a/graphics/fonts/bdf.h
+++ b/graphics/fonts/bdf.h
@@ -76,7 +76,7 @@ public:
static BdfFont *loadFont(Common::SeekableReadStream &stream);
static bool cacheFontData(const BdfFont &font, const Common::String &filename);
static BdfFont *loadFromCache(Common::SeekableReadStream &stream);
- static BdfFont *scaleFont(BdfFont *src, int newSize);
+ static BdfFont *scaleFont(const BdfFont *src, int newSize);
private:
int mapToIndex(uint32 ch) const;
Commit: c2d6c84e65a69d277d5fe8cb94837f40a43e628e
https://github.com/scummvm/scummvm/commit/c2d6c84e65a69d277d5fe8cb94837f40a43e628e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-25T15:29:30+01:00
Commit Message:
TESTBED: Added test for fonts scaling
Changed paths:
engines/testbed/graphics.cpp
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index d163c59a62d..582a8f36cb3 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -34,6 +34,8 @@
#include "graphics/surface.h"
#include "graphics/VectorRendererSpec.h"
+#include "graphics/fonts/bdf.h"
+
namespace Testbed {
byte GFXTestSuite::_palette[256 * 3] = {0, 0, 0, 255, 255, 255, 255, 255, 255};
@@ -834,7 +836,7 @@ TestExitStatus GFXtests::maskedCursors() {
g_system->getPaletteManager()->grabPalette(oldPalette, 0, 256);
byte newPalette[] = {0, 0, 0, 255, 255, 255, 255, 0, 0, 255, 255, 255};
-
+
g_system->getPaletteManager()->setPalette(newPalette, 0, 4);
if (haveCursorPalettes)
@@ -842,7 +844,7 @@ TestExitStatus GFXtests::maskedCursors() {
CursorMan.replaceCursor(cursorData, 16, 16, 1, 1, 0, false, nullptr, maskData);
CursorMan.showMouse(true);
-
+
bool waitingForClick = true;
while (waitingForClick) {
Common::Event event;
@@ -1020,6 +1022,31 @@ TestExitStatus GFXtests::copyRectToScreen() {
uint y = g_system->getHeight() / 2 - 10;
g_system->copyRectToScreen(buffer, 40, x, y, 40, 20);
+
+ x = 10;
+ y = 10;
+
+ Graphics::Surface *screen = g_system->lockScreen();
+
+ const char *text = "d";
+ const Graphics::BdfFont *origFont = (const Graphics::BdfFont *)FontMan.getFontByName("helvB12.bdf");
+
+ for (int i = origFont->getFontHeight(); i <= 20; i++) {
+
+ //const Graphics::BdfFont *font = Graphics::BdfFont::scaleFont(origFont, i);
+ const Graphics::BdfFont *font = origFont;
+ int width = font->getStringWidth(text);
+
+ Common::Rect bbox = font->getBoundingBox(text, x, y, g_system->getWidth());
+ screen->frameRect(bbox, 15);
+
+ font->drawString(screen, text, x, y, width, kColorCustom);
+
+ x += width + 1;
+ }
+
+ g_system->unlockScreen();
+
g_system->updateScreen();
g_system->delayMillis(1000);
More information about the Scummvm-git-logs
mailing list