[Scummvm-git-logs] scummvm master -> 7e2f3edc61bdfa6e04379187e5cad44074a0394e
ysj1173886760
42030331+ysj1173886760 at users.noreply.github.com
Fri Jul 23 09:07:12 UTC 2021
This automated email contains information about 10 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3d0b7d5130 GRAPHICS: MACGUI: modify the parameter of scaleFont in macFont
0f6c0f0904 GRAPHICS: MACGUI: clean the formats in mactext
e434198924 GRAPHICS: MACGUI: implement underline font.
6752b923b9 GRAPHICS: MACGUI: amend makeOutline in macFont.
0aa7518c5b GRAPHICS: MACGUI: set the kerning offset to 0 when dealing with underLined space.
822ca12ab2 GRAPHICS: MACGUI: draw the underLine in kerning area when we are dealing with underLine font.
cae8166101 GRAPHICS: MACGUI: organize the code for extension.
1d7e82bf3e GRAPHICS: MACGUI: amend makeOutline
dc8418b547 GRAPHICS: MACGUI: implement shadow font.
7e2f3edc61 GRAPHICS: MACGUI: initialize bitImage to 0.
Commit: 3d0b7d513015e1da0c4ac97d0373596cb8c48c75
https://github.com/scummvm/scummvm/commit/3d0b7d513015e1da0c4ac97d0373596cb8c48c75
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-23T17:06:38+08:00
Commit Message:
GRAPHICS: MACGUI: modify the parameter of scaleFont in macFont
Changed paths:
graphics/fonts/macfont.cpp
graphics/fonts/macfont.h
graphics/macgui/macfontmanager.cpp
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index 19f2703b42..29452e4b38 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -23,6 +23,7 @@
#include "common/stream.h"
#include "common/textconsole.h"
#include "graphics/managed_surface.h"
+#include "graphics/macgui/macfontmanager.h"
#include "graphics/fonts/macfont.h"
#define DEBUGSCALING 0
@@ -470,7 +471,7 @@ static void makeBold(Surface *src, int *dstGray, MacGlyph *glyph, int height);
static void makeOutline(Surface *src, Surface *dst, MacGlyph *glyph, int height);
static void makeItalic(Surface *src, Surface *dst, MacGlyph *glyph, int height);
-MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, bool bold, bool italic, bool outline) {
+MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int slant) {
if (!src) {
warning("Empty font reference in scale font");
return NULL;
@@ -513,7 +514,7 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, bool bo
data._glyphs.resize(src->_data._glyphs.size());
- if (outline)
+ if (slant & kMacFontOutline)
data._fRectHeight += 2;
data._surfHeight = data._fRectHeight;
@@ -521,7 +522,7 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, bool bo
int newBitmapWidth = 0;
// offset for bold and italic, and we need to calc italic offset ourself
- int bitmapOffset = italic ? (data._fRectHeight - 1) / SLANTDEEP : 2;
+ int bitmapOffset = slant & kMacFontItalic ? (data._fRectHeight - 1) / SLANTDEEP : 2;
for (uint i = 0; i < src->_data._glyphs.size() + 1; i++) {
MacGlyph *glyph = (i == src->_data._glyphs.size()) ? &data._defaultChar : &data._glyphs[i];
@@ -584,7 +585,7 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, bool bo
#endif
}
- if (bold) {
+ if (slant & kMacFontBold) {
memset(dstGray, 0, dstGraySize * sizeof(int));
makeBold(&srcSurf, dstGray, glyph, data._fRectHeight);
@@ -609,13 +610,13 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, bool bo
}
}
- if (outline) {
+ if (slant & kMacFontOutline) {
tmpSurf.fillRect(Common::Rect(tmpSurf.w, tmpSurf.h), 0);
makeOutline(&srcSurf, &tmpSurf, glyph, data._fRectHeight);
srcSurf.copyFrom(tmpSurf);
}
- if (italic) {
+ if (slant & kMacFontItalic) {
tmpSurf.fillRect(Common::Rect(tmpSurf.w, tmpSurf.h), 0);
makeItalic(&srcSurf, &tmpSurf, glyph, data._fRectHeight);
srcSurf.copyFrom(tmpSurf);
diff --git a/graphics/fonts/macfont.h b/graphics/fonts/macfont.h
index 591f3022da..98d6022c41 100644
--- a/graphics/fonts/macfont.h
+++ b/graphics/fonts/macfont.h
@@ -174,7 +174,7 @@ public:
int getFontSize() const { return _data._size; }
- static MacFONTFont *scaleFont(const MacFONTFont *src, int newSize, bool bold = false, bool italic = false, bool outline = false);
+ static MacFONTFont *scaleFont(const MacFONTFont *src, int newSize, int slant);
static void testBlit(const MacFONTFont *src, ManagedSurface *dst, int color, int x0, int y0, int width);
private:
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index bce16a9997..a392b3525a 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -752,16 +752,12 @@ void MacFontManager::generateFONTFont(MacFont &toFont, MacFont &fromFont) {
debugN("Found font substitute for font '%s' ", getFontName(toFont).c_str());
debug("as '%s'", getFontName(fromFont).c_str());
- bool bold = false, italic = false, outline = false;
-
- if (fromFont.getSlant() == kMacFontRegular) {
- bold = toFont.getSlant() & kMacFontBold;
- italic = toFont.getSlant() & kMacFontItalic;
- outline = toFont.getSlant() & kMacFontOutline;
- }
+ int slant = kMacFontRegular;
+ if (fromFont.getSlant() == kMacFontRegular)
+ slant = toFont.getSlant();
MacFONTFont *fromFONTFont = static_cast<MacFONTFont *>(fromFont.getFont());
- MacFONTFont *font = Graphics::MacFONTFont::scaleFont(fromFONTFont, toFont.getSize(), bold, italic, outline);
+ MacFONTFont *font = Graphics::MacFONTFont::scaleFont(fromFONTFont, toFont.getSize(), slant);
if (!font) {
warning("Failed to generate font '%s'", getFontName(toFont).c_str());
Commit: 0f6c0f0904c8ad6a3a9a8127e9f3bae5f730625c
https://github.com/scummvm/scummvm/commit/0f6c0f0904c8ad6a3a9a8127e9f3bae5f730625c
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-23T17:06:38+08:00
Commit Message:
GRAPHICS: MACGUI: clean the formats in mactext
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 84dda6b1cb..915f05aa09 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -995,6 +995,7 @@ int MacText::getLineCharWidth(int line, bool enforce) {
int MacText::getLastLineWidth() {
if (_textLines.size() == 0)
return 0;
+
return getLineWidth(_textLines.size() - 1, true);
}
@@ -1009,6 +1010,7 @@ int MacText::getLineHeight(int line) {
void MacText::setInterLinear(int interLinear) {
_interLinear = interLinear;
+
recalcDims();
_fullRefresh = true;
render();
@@ -1053,6 +1055,7 @@ void MacText::recalcDims() {
void MacText::setAlignOffset(TextAlign align) {
if (_textAlignment == align)
return;
+
_contentIsDirty = true;
_fullRefresh = true;
_textAlignment = align;
@@ -1139,17 +1142,15 @@ void MacText::appendText(const Common::U32String &str, int fontId, int fontSize,
// then we remove those empty lines
// too many special check may cause some strange problem in the future
if (_str.empty()) {
- while (!_textLines.empty() && !_textLines.back().paragraphEnd) {
+ while (!_textLines.empty() && !_textLines.back().paragraphEnd)
removeLastLine();
- }
}
// we need to split the string with the font, in order to get the correct font
Common::U32String strWithFont = Common::U32String(fontRun.toString()) + str;
- if (!skipAdd) {
+ if (!skipAdd)
_str += strWithFont;
- }
appendText_(strWithFont, oldLen);
}
@@ -1161,18 +1162,15 @@ void MacText::appendText(const Common::U32String &str, const Font *font, uint16
_currentFormatting = fontRun;
- // we check _str here, if _str is empty but _textLines is not empty, and they are not the end of paragraph
- // then we remove those empty lines
- // too many special check may cause some strange problem in the future
if (_str.empty()) {
- while (!_textLines.empty() && !_textLines.back().paragraphEnd) {
+ while (!_textLines.empty() && !_textLines.back().paragraphEnd)
removeLastLine();
- }
}
- if (!skipAdd) {
- _str += str;
- }
+ Common::U32String strWithFont = Common::U32String(fontRun.toString()) + str;
+
+ if (!skipAdd)
+ _str += strWithFont;
appendText_(str, oldLen);
}
@@ -1284,7 +1282,7 @@ bool MacText::draw(bool forceRedraw) {
draw(_composeSurface, 0, _scrollPos, _surface->w, _scrollPos + _surface->h, offset.x, offset.y);
- for (int bb = 0; bb < _shadow; bb ++) {
+ for (int bb = 0; bb < _shadow; bb++) {
_composeSurface->hLine(_shadow, _composeSurface->h - _shadow + bb, _composeSurface->w, 0);
_composeSurface->vLine(_composeSurface->w - _shadow + bb, _shadow, _composeSurface->h - _shadow, 0);
}
Commit: e4341989240bc8259dfbef20507cb908e9c7b5ae
https://github.com/scummvm/scummvm/commit/e4341989240bc8259dfbef20507cb908e9c7b5ae
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-23T17:06:38+08:00
Commit Message:
GRAPHICS: MACGUI: implement underline font.
Changed paths:
graphics/fonts/macfont.cpp
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index 29452e4b38..80b8ee27ae 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -470,6 +470,7 @@ static void magnifyGray(Surface *src, int *dstGray, int width, int height, float
static void makeBold(Surface *src, int *dstGray, MacGlyph *glyph, int height);
static void makeOutline(Surface *src, Surface *dst, MacGlyph *glyph, int height);
static void makeItalic(Surface *src, Surface *dst, MacGlyph *glyph, int height);
+static void makeUnderLine(Surface *src, MacGlyph *glyph, int ascent);
MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int slant) {
if (!src) {
@@ -622,6 +623,9 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int sla
srcSurf.copyFrom(tmpSurf);
}
+ if (slant & kMacFontUnderline)
+ makeUnderLine(&srcSurf, glyph, data._ascent);
+
byte *ptr = &data._bitImage[glyph->bitmapOffset / 8];
for (int y = 0; y < data._fRectHeight; y++) {
@@ -798,6 +802,11 @@ static void makeItalic(Surface *src, Surface *dst, MacGlyph *glyph, int height)
glyph->kerningOffset -= dw / 2;
}
+static void makeUnderLine(Surface *src, MacGlyph *glyph, int ascent) {
+ for (int x = 0; x < glyph->width; x++)
+ *((byte *) src->getBasePtr(x, ascent + 2)) = 1;
+}
+
void MacFONTFont::testBlit(const MacFONTFont *src, ManagedSurface *dst, int color, int x0, int y0, int width) {
for (int y = 0; y < src->_data._fRectHeight; y++) {
byte *srcRow = src->_data._bitImage + y * src->_data._rowWords;
Commit: 6752b923b96c60576ef016c6fdfb882f0f41e842
https://github.com/scummvm/scummvm/commit/6752b923b96c60576ef016c6fdfb882f0f41e842
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-23T17:06:38+08:00
Commit Message:
GRAPHICS: MACGUI: amend makeOutline in macFont.
Changed paths:
graphics/fonts/macfont.cpp
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index 80b8ee27ae..c9fa749366 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -766,7 +766,6 @@ static void makeBold(Surface *src, int *dstGray, MacGlyph *glyph, int height) {
static void makeOutline(Surface *src, Surface *dst, MacGlyph *glyph, int height) {
glyph->bitmapWidth += 2;
glyph->width++;
- glyph->height++;
for (uint16 y = 0; y < height + 2; y++) {
byte *srcPtr = (byte *)src->getBasePtr(0, y);
Commit: 0aa7518c5b2280bdab497bd3fcb53d8b60ce5f15
https://github.com/scummvm/scummvm/commit/0aa7518c5b2280bdab497bd3fcb53d8b60ce5f15
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-23T17:06:38+08:00
Commit Message:
GRAPHICS: MACGUI: set the kerning offset to 0 when dealing with underLined space.
Changed paths:
graphics/fonts/macfont.cpp
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index c9fa749366..46c7505214 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -802,6 +802,11 @@ static void makeItalic(Surface *src, Surface *dst, MacGlyph *glyph, int height)
}
static void makeUnderLine(Surface *src, MacGlyph *glyph, int ascent) {
+ // this case is for space, which has the same number of kerning offset and width.
+ // inorder to draw the underLine for space, we need to disable the kerning offset of it.
+ if (glyph->width == glyph->kerningOffset)
+ glyph->kerningOffset = 0;
+
for (int x = 0; x < glyph->width; x++)
*((byte *) src->getBasePtr(x, ascent + 2)) = 1;
}
Commit: 822ca12ab21b20f3abc4f22845b7a385e460c16b
https://github.com/scummvm/scummvm/commit/822ca12ab21b20f3abc4f22845b7a385e460c16b
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-23T17:06:38+08:00
Commit Message:
GRAPHICS: MACGUI: draw the underLine in kerning area when we are dealing with underLine font.
Changed paths:
graphics/fonts/macfont.cpp
graphics/fonts/macfont.h
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index 46c7505214..ce64f1b08c 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -423,6 +423,18 @@ void MacFONTFont::drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color)
if (x + glyph->bitmapWidth >= dst->w)
xStop = dst->w - x;
+ // for the underLine font, we need to draw the line at the whole area, which includes the kerning space.
+ if ((_data._slant & kMacFontUnderline) && glyph->kerningOffset) {
+ for (uint16 j = 1; j <= glyph->kerningOffset; j++) {
+ if (dst->format.bytesPerPixel == 1)
+ *((byte *)dst->getBasePtr(x - j, y + _data._ascent + 2)) = color;
+ else if (dst->format.bytesPerPixel == 2)
+ *((uint16 *)dst->getBasePtr(x - j, y + _data._ascent + 2)) = color;
+ else if (dst->format.bytesPerPixel == 4)
+ *((uint32 *)dst->getBasePtr(x - j, y + _data._ascent + 2)) = color;
+ }
+ }
+
for (uint16 i = yStart; i < yStop; i++) {
byte *srcRow = _data._bitImage + i * _data._rowWords;
@@ -515,6 +527,9 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int sla
data._glyphs.resize(src->_data._glyphs.size());
+ // when we are generating the slant fonts. e.g. italic font, underLine font. we set this. more detail is in drawChar
+ data._slant = slant;
+
if (slant & kMacFontOutline)
data._fRectHeight += 2;
data._surfHeight = data._fRectHeight;
diff --git a/graphics/fonts/macfont.h b/graphics/fonts/macfont.h
index 98d6022c41..98266f0c9f 100644
--- a/graphics/fonts/macfont.h
+++ b/graphics/fonts/macfont.h
@@ -151,6 +151,9 @@ struct MacFONTdata {
MacFontFamily *_family;
int _size;
int _style;
+
+ // currently only available in generated fonts
+ int _slant;
};
/**
Commit: cae81661014b4b3016112db326e858f07c2e9be7
https://github.com/scummvm/scummvm/commit/cae81661014b4b3016112db326e858f07c2e9be7
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-23T17:06:38+08:00
Commit Message:
GRAPHICS: MACGUI: organize the code for extension.
Changed paths:
graphics/fonts/macfont.cpp
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index ce64f1b08c..ae7a51167a 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -530,15 +530,22 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int sla
// when we are generating the slant fonts. e.g. italic font, underLine font. we set this. more detail is in drawChar
data._slant = slant;
- if (slant & kMacFontOutline)
+ if ((slant & kMacFontShadow) || (slant & kMacFontOutline))
data._fRectHeight += 2;
data._surfHeight = data._fRectHeight;
// Determine width of the bit image table
int newBitmapWidth = 0;
- // offset for bold and italic, and we need to calc italic offset ourself
- int bitmapOffset = slant & kMacFontItalic ? (data._fRectHeight - 1) / SLANTDEEP : 2;
+ // add the offset which we may use when we are making fonts
+ int bitmapOffset = 2;
+
+ // for italic, we need to calc our self. for shadow, it's 3
+ // for bold and outline, it's 2
+ if (slant & kMacFontItalic)
+ bitmapOffset = (data._fRectHeight - 1) / SLANTDEEP;
+ else if (slant & kMacFontShadow)
+ bitmapOffset++;
for (uint i = 0; i < src->_data._glyphs.size() + 1; i++) {
MacGlyph *glyph = (i == src->_data._glyphs.size()) ? &data._defaultChar : &data._glyphs[i];
@@ -550,7 +557,7 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int sla
glyph->bitmapOffset = newBitmapWidth;
// Align width to a byte
- newBitmapWidth += (glyph->bitmapWidth + 7 + bitmapOffset) & ~0x7; // Add 2 pixels for italic and bold
+ newBitmapWidth += (glyph->bitmapWidth + 7 + bitmapOffset) & ~0x7;
}
data._rowWords = newBitmapWidth;
Commit: 1d7e82bf3e9926531219f5ef3fbde1558ecdf424
https://github.com/scummvm/scummvm/commit/1d7e82bf3e9926531219f5ef3fbde1558ecdf424
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-23T17:06:38+08:00
Commit Message:
GRAPHICS: MACGUI: amend makeOutline
Changed paths:
graphics/fonts/macfont.cpp
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index ae7a51167a..05586f32e2 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -789,6 +789,9 @@ static void makeOutline(Surface *src, Surface *dst, MacGlyph *glyph, int height)
glyph->bitmapWidth += 2;
glyph->width++;
+ int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
+ int dy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
+
for (uint16 y = 0; y < height + 2; y++) {
byte *srcPtr = (byte *)src->getBasePtr(0, y);
byte *dstPtr = (byte *)dst->getBasePtr(0, y);
@@ -797,12 +800,17 @@ static void makeOutline(Surface *src, Surface *dst, MacGlyph *glyph, int height)
if (*srcPtr)
continue;
// for every white pixel, if there is black pixel around it. It means that the white pixel is boundary, then we draw it as black pixel.
- byte *left = (byte *)src->getBasePtr(MAX(x - 1, 0), y);
- byte *right = (byte *)src->getBasePtr(MIN(x + 1, src->w - 1), y);
- byte *up = (byte *)src->getBasePtr(x, MAX(y - 1, 0));
- byte *down = (byte *)src->getBasePtr(x, MIN(y + 1, src->h - 1));
- if (*left || *right || *up || *down)
- *dstPtr = 1;
+ for (int i = 0; i < 8; i++) {
+ int nx = x + dx[i];
+ int ny = y + dy[i];
+ if (nx >= src->w || nx < 0 || ny >= src->h || ny < 0)
+ continue;
+
+ if (*((byte *)src->getBasePtr(nx, ny))) {
+ *dstPtr = 1;
+ break;
+ }
+ }
}
}
}
Commit: dc8418b547eb031257f32660b51e96c749e1ad63
https://github.com/scummvm/scummvm/commit/dc8418b547eb031257f32660b51e96c749e1ad63
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-23T17:06:38+08:00
Commit Message:
GRAPHICS: MACGUI: implement shadow font.
Changed paths:
graphics/fonts/macfont.cpp
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index 05586f32e2..d8e32ff7c1 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -483,6 +483,7 @@ static void makeBold(Surface *src, int *dstGray, MacGlyph *glyph, int height);
static void makeOutline(Surface *src, Surface *dst, MacGlyph *glyph, int height);
static void makeItalic(Surface *src, Surface *dst, MacGlyph *glyph, int height);
static void makeUnderLine(Surface *src, MacGlyph *glyph, int ascent);
+static void makeShadow(Surface *src, Surface *dst, MacGlyph *glyph, int height);
MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int slant) {
if (!src) {
@@ -648,6 +649,12 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int sla
if (slant & kMacFontUnderline)
makeUnderLine(&srcSurf, glyph, data._ascent);
+ if (slant & kMacFontShadow) {
+ tmpSurf.fillRect(Common::Rect(tmpSurf.w, tmpSurf.h), 0);
+ makeShadow(&srcSurf, &tmpSurf, glyph, data._fRectHeight);
+ srcSurf.copyFrom(tmpSurf);
+ }
+
byte *ptr = &data._bitImage[glyph->bitmapOffset / 8];
for (int y = 0; y < data._fRectHeight; y++) {
@@ -841,6 +848,45 @@ static void makeUnderLine(Surface *src, MacGlyph *glyph, int ascent) {
*((byte *) src->getBasePtr(x, ascent + 2)) = 1;
}
+static void makeShadow(Surface *src, Surface *dst, MacGlyph *glyph, int height) {
+ // makeShadow looks like just the outLine font with one more shadow at right-most edge and lowest edge
+ makeOutline(src, dst, glyph, height);
+ glyph->bitmapWidth++;
+ glyph->width++;
+
+ // right to left
+ for (uint16 y = 0; y < height + 2; y++) {
+ for (int x = dst->w - 1; x >= 0; x--) {
+ byte *dstPtr = (byte *)dst->getBasePtr(x, y);
+ if (*dstPtr)
+ continue;
+
+ // check the left pixel. if it's black, then we black the current one and break.
+ byte *left = (byte *)dst->getBasePtr(MAX(x - 1, 0), y);
+ if (*left) {
+ *dstPtr = 1;
+ break;
+ }
+ }
+ }
+
+ // down to up
+ for (uint16 x = 0; x < glyph->bitmapWidth; x++) {
+ for (int y = dst->h - 1; y >= 0; y--) {
+ byte *dstPtr = (byte *) dst->getBasePtr(x, y);
+
+ if (*dstPtr)
+ continue;
+
+ byte *up = (byte *)dst->getBasePtr(x, MAX(y - 1, 0));
+ if (*up) {
+ *dstPtr = 1;
+ break;
+ }
+ }
+ }
+}
+
void MacFONTFont::testBlit(const MacFONTFont *src, ManagedSurface *dst, int color, int x0, int y0, int width) {
for (int y = 0; y < src->_data._fRectHeight; y++) {
byte *srcRow = src->_data._bitImage + y * src->_data._rowWords;
Commit: 7e2f3edc61bdfa6e04379187e5cad44074a0394e
https://github.com/scummvm/scummvm/commit/7e2f3edc61bdfa6e04379187e5cad44074a0394e
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-23T17:06:38+08:00
Commit Message:
GRAPHICS: MACGUI: initialize bitImage to 0.
Changed paths:
graphics/fonts/macfont.cpp
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index d8e32ff7c1..d17bfb8fa7 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -565,6 +565,7 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int sla
uint bitImageSize = data._rowWords * data._fRectHeight;
data._bitImage = new byte[bitImageSize];
+ memset(data._bitImage, 0, bitImageSize * sizeof(byte));
int dstPitch = data._rowWords;
More information about the Scummvm-git-logs
mailing list