[Scummvm-cvs-logs] scummvm master -> d3d5fb82681ba2e1a0d88774d9e1b1ecaced5400
eriktorbjorn
eriktorbjorn at telia.com
Sun Jun 26 23:18:04 CEST 2011
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:
e8c704a025 TOON: Fix the bottom pixels of text being cut off
d3d5fb8268 Merge branch 'master' of github.com:scummvm/scummvm
Commit: e8c704a02573fca7ebe99cbaa9b27eb4382d40f6
https://github.com/scummvm/scummvm/commit/e8c704a02573fca7ebe99cbaa9b27eb4382d40f6
Author: eriktorbjorn (eriktorbjorn at users.sourceforge.net)
Date: 2011-06-26T14:13:49-07:00
Commit Message:
TOON: Fix the bottom pixels of text being cut off
It's a dirty rect problem. The computeSize() function needs to
take into consideration that the glyph may be offset, so it's not
enough to just look at its size. For now, I'm assuming that this
is only a problem with characters that stick out below the base
line, so that's all this patch tries to fix. Let's see if that's
enough.
Changed paths:
engines/toon/anim.cpp
engines/toon/anim.h
engines/toon/font.cpp
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index 23bd0f6..07d51ef 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -271,6 +271,18 @@ void Animation::applyPalette(int32 offset, int32 srcOffset, int32 numEntries) {
_vm->setPaletteEntries(_palette + srcOffset, offset, numEntries);
}
+Common::Rect Animation::getFrameRect(int32 frame) {
+ debugC(4, kDebugAnim, "getFrameRect(%d)", frame);
+ if ((frame < 0) || (frame >= _numFrames)) {
+ return Common::Rect();
+ }
+
+ if (_frames[frame]._ref != -1)
+ frame = _frames[frame]._ref;
+
+ return Common::Rect(_frames[frame]._x1, _frames[frame]._y1, _frames[frame]._x2, _frames[frame]._y2);
+}
+
int32 Animation::getFrameWidth(int32 frame) {
debugC(4, kDebugAnim, "getFrameWidth(%d)", frame);
if ((frame < 0) || (frame >= _numFrames))
diff --git a/engines/toon/anim.h b/engines/toon/anim.h
index 13c501b..4b95b6c 100644
--- a/engines/toon/anim.h
+++ b/engines/toon/anim.h
@@ -68,6 +68,7 @@ public:
void drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 frame, int32 xx, int32 yy, int32 zz, Picture *mask, int32 scale);
void drawStrip(int32 offset = 0);
void applyPalette(int32 offset, int32 srcOffset, int32 numEntries);
+ Common::Rect getFrameRect(int32 frame);
int32 getFrameWidth(int32 frame);
int32 getFrameHeight(int32 frame);
int32 getWidth() const;
diff --git a/engines/toon/font.cpp b/engines/toon/font.cpp
index 4c491ae..63304c9 100644
--- a/engines/toon/font.cpp
+++ b/engines/toon/font.cpp
@@ -21,6 +21,7 @@
*/
#include "common/debug.h"
+#include "common/rect.h"
#include "toon/font.h"
@@ -80,7 +81,7 @@ void FontRenderer::renderText(int32 x, int32 y, Common::String origText, int32 m
x -= xx / 2;
}
- _vm->addDirtyRect(x, y, x + xx + 2, y + yy);
+ _vm->addDirtyRect(x, y, x + xx, y + yy);
int32 curX = x;
int32 curY = y;
@@ -110,6 +111,7 @@ void FontRenderer::computeSize(Common::String origText, int32 *retX, int32 *retY
int32 lineHeight = 0;
int32 totalHeight = 0;
int32 totalWidth = 0;
+ int32 lastLineHeight = 0;
const byte *text = (const byte *)origText.c_str();
while (*text) {
@@ -122,17 +124,25 @@ void FontRenderer::computeSize(Common::String origText, int32 *retX, int32 *retY
totalHeight += lineHeight;
lineHeight = 0;
lineWidth = 0;
+ lastLineHeight = 0;
} else {
curChar = textToFont(curChar);
int32 charWidth = _currentFont->getFrameWidth(curChar) - 1;
int32 charHeight = _currentFont->getFrameHeight(curChar);
lineWidth += charWidth;
lineHeight = MAX(lineHeight, charHeight);
+
+ // The character may be offset, so the height doesn't
+ // really tell how far it will stick out. For now,
+ // assume we only need to take the lower bound into
+ // consideration.
+ Common::Rect charRect = _currentFont->getFrameRect(curChar);
+ lastLineHeight = MAX<int32>(lastLineHeight, charRect.bottom);
}
text++;
}
- totalHeight += lineHeight;
+ totalHeight += lastLineHeight;
totalWidth = MAX(totalWidth, lineWidth);
*retX = totalWidth;
Commit: d3d5fb82681ba2e1a0d88774d9e1b1ecaced5400
https://github.com/scummvm/scummvm/commit/d3d5fb82681ba2e1a0d88774d9e1b1ecaced5400
Author: eriktorbjorn (eriktorbjorn at users.sourceforge.net)
Date: 2011-06-26T14:15:47-07:00
Commit Message:
Merge branch 'master' of github.com:scummvm/scummvm
Changed paths:
backends/taskbar/win32/win32-taskbar.cpp
engines/lastexpress/detection.cpp
engines/sword25/sfx/soundengine.cpp
engines/sword25/sfx/soundengine.h
graphics/png.cpp
More information about the Scummvm-git-logs
mailing list