[Scummvm-git-logs] scummvm master -> 28d96e436a1f45307c1cedf80b968e722ed7559d

phcoder noreply at scummvm.org
Fri Mar 17 00:41:57 UTC 2023


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:
28d96e436a GRIM: Remove Chinese font scaling


Commit: 28d96e436a1f45307c1cedf80b968e722ed7559d
    https://github.com/scummvm/scummvm/commit/28d96e436a1f45307c1cedf80b968e722ed7559d
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-03-17T01:41:50+01:00

Commit Message:
GRIM: Remove Chinese font scaling

It's buggy and results in a crash. Additionally it's not necessarry.

Changed paths:
    engines/grim/font.cpp
    engines/grim/font.h


diff --git a/engines/grim/font.cpp b/engines/grim/font.cpp
index 703aec49351..73f51d0dda9 100644
--- a/engines/grim/font.cpp
+++ b/engines/grim/font.cpp
@@ -121,7 +121,6 @@ void BitmapFont::load(const Common::String &filename, Common::SeekableReadStream
 			uint16 point = data->readUint16LE();
 			_fwdCharIndex[i] = point ? point : -1;
 		}
-		_scale = 2;
 	} else {
 		// Read character indexes - are the key/value reversed?
 		Common::Array<uint16> revCharIndex;
@@ -153,7 +152,6 @@ void BitmapFont::load(const Common::String &filename, Common::SeekableReadStream
 			if (revCharIndex[i] == i)
 				_fwdCharIndex[revCharIndex[i]] = i;
 		}
-		_scale = 1;
 	}
 
 	// Read character headers
@@ -287,19 +285,15 @@ void BitmapFont::render(Graphics::Surface &buf, const Common::String &currentLin
 		int8 fontCol = getCharStartingCol(ch);
 
 		for (int line = 0; line < charBitmapHeight; line++) {
-			int lineOffset = (fontRow + line * _scale);
+			int lineOffset = (fontRow + line);
 			int columnOffset = startColumn + fontCol;
 			int fontOffset = (charBitmapWidth * line);
-			for (int bitmapCol = 0; bitmapCol < charBitmapWidth; bitmapCol++, columnOffset += _scale, fontOffset++) {
+			for (int bitmapCol = 0; bitmapCol < charBitmapWidth; bitmapCol++, columnOffset++, fontOffset++) {
 				byte pixel = getCharData(ch)[fontOffset];
 				if (pixel == 0x80) {
-					for (uint i = 0; i < _scale; i++)
-						for (uint j = 0; j < _scale; j++)
-							buf.setPixel(columnOffset + i, lineOffset + j, blackColor);
+					buf.setPixel(columnOffset, lineOffset, blackColor);
 				} else if (pixel == 0xFF) {
-					for (uint i = 0; i < _scale; i++)
-						for (uint j = 0; j < _scale; j++)
-							buf.setPixel(columnOffset + i, lineOffset + j, color);
+					buf.setPixel(columnOffset, lineOffset, color);
 				}
 			}
 		}
diff --git a/engines/grim/font.h b/engines/grim/font.h
index ef306a1bebd..f8b9cde5eb4 100644
--- a/engines/grim/font.h
+++ b/engines/grim/font.h
@@ -72,15 +72,15 @@ public:
 
 
 	const Common::String &getFilename() const { return _filename; }
-	int32 getKernedHeight() const override { return _kernedHeight * _scale; }
+	int32 getKernedHeight() const override { return _kernedHeight; }
 	int32 getFontWidth() const override { return getCharKernedWidth('w'); }
-	int32 getBaseOffsetY() const override { return _baseOffsetY * _scale; }
+	int32 getBaseOffsetY() const override { return _baseOffsetY; }
 	void render(Graphics::Surface &buf, const Common::String &currentLine, const Graphics::PixelFormat &pixelFormat, uint32 blackColor, uint32 color, uint32 colorKey) const override;
 	int32 getCharBitmapWidth(uint16 c) const { return _charHeaders[getCharIndex(c)].bitmapWidth; }
 	int32 getCharBitmapHeight(uint16 c) const { return _charHeaders[getCharIndex(c)].bitmapHeight; }
-	int32 getCharKernedWidth(uint16 c) const override { return _charHeaders[getCharIndex(c)].kernedWidth * _scale; }
-	int32 getCharStartingCol(uint16 c) const { return _charHeaders[getCharIndex(c)].startingCol * _scale; }
-	int32 getCharStartingLine(uint16 c) const { return _charHeaders[getCharIndex(c)].startingLine * _scale; }
+	int32 getCharKernedWidth(uint16 c) const override { return _charHeaders[getCharIndex(c)].kernedWidth; }
+	int32 getCharStartingCol(uint16 c) const { return _charHeaders[getCharIndex(c)].startingCol; }
+	int32 getCharStartingLine(uint16 c) const { return _charHeaders[getCharIndex(c)].startingLine; }
 	int32 getCharOffset(uint16 c) const { return _charHeaders[getCharIndex(c)].offset; }
 	const byte *getCharData(uint16 c) const { return _fontData + (_charHeaders[getCharIndex(c)].offset); }
 
@@ -120,7 +120,6 @@ private:
 	byte *_fontData;
 	void *_userData;
 	bool _isDBCS;
-	uint _scale;
 };
 
 class FontTTF : public Font, public PoolObject<FontTTF> {




More information about the Scummvm-git-logs mailing list