do a better job at charset clipping; some reengineering. However, to properly fix text drawing in COMI, we need to do some major changes
svn-id: r12417
This commit is contained in:
parent
968436767c
commit
11425a0cdd
2 changed files with 30 additions and 15 deletions
|
@ -1296,7 +1296,7 @@ void CharsetRendererNut::printChar(int chr) {
|
|||
shadow.bottom = _top + height + 2;
|
||||
|
||||
_hasMask = true;
|
||||
_current->drawShadowChar(chr, _left, _top - _vm->_screenTop, _color, !_ignoreCharsetMask);
|
||||
_current->drawShadowChar(chr, _left, _top, _color, !_ignoreCharsetMask);
|
||||
_vm->markRectAsDirty(kMainVirtScreen, shadow);
|
||||
|
||||
if (_str.left > _left)
|
||||
|
|
|
@ -237,9 +237,9 @@ int NutRenderer::getCharHeight(byte c) {
|
|||
}
|
||||
|
||||
void NutRenderer::drawShadowChar(int c, int x, int y, byte color, bool useMask) {
|
||||
debug(8, "NutRenderer::drawChar('%c', %d, %d, %d, %d) called", c, x, y, (int)color, useMask);
|
||||
debug(8, "NutRenderer::drawShadowChar('%c', %d, %d, %d, %d) called", c, x, y, (int)color, useMask);
|
||||
if (!_loaded) {
|
||||
warning("NutRenderer::drawChar() Font is not loaded");
|
||||
warning("NutRenderer::drawShadowChar() Font is not loaded");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -263,14 +263,18 @@ void NutRenderer::drawShadowChar(int c, int x, int y, byte color, bool useMask)
|
|||
y += offsetY[i];
|
||||
color = cTable[i];
|
||||
|
||||
dst = vs->screenPtr + (y + _vm->_screenTop) * vs->width + x + vs->xstart;
|
||||
if (y >= vs->height || x + vs->xstart >= vs->width) {
|
||||
continue;
|
||||
}
|
||||
|
||||
dst = vs->screenPtr + y * vs->width + x + vs->xstart;
|
||||
if (useMask)
|
||||
mask = _vm->getMaskBuffer(x, y + _vm->_screenTop, 0);
|
||||
mask = _vm->getMaskBuffer(x, y, 0);
|
||||
|
||||
if (c >= 256 && _vm->_CJKMode)
|
||||
draw2byte(dst, mask, c, x, y, color);
|
||||
draw2byte(dst, mask, c, x, y - _vm->_screenTop, color);
|
||||
else
|
||||
drawChar(dst, mask, (byte)c, x, y, color);
|
||||
drawChar(dst, mask, (byte)c, x, y - _vm->_screenTop, color);
|
||||
|
||||
x -= offsetX[i];
|
||||
y -= offsetY[i];
|
||||
|
@ -287,13 +291,16 @@ void NutRenderer::drawFrame(byte *dst, int c, int x, int y) {
|
|||
const int minX = x < 0 ? -x : 0;
|
||||
const int minY = y < 0 ? -y : 0;
|
||||
|
||||
if (height <= 0 || width <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
dst += _vm->_screenWidth * y + x;
|
||||
if (minY) {
|
||||
src += minY * srcPitch;
|
||||
dst += minY * _vm->_screenWidth;
|
||||
}
|
||||
|
||||
|
||||
for (int ty = minY; ty < height; ty++) {
|
||||
for (int tx = minX; tx < width; tx++) {
|
||||
bits = src[tx];
|
||||
|
@ -318,6 +325,10 @@ void NutRenderer::drawChar(byte *dst, byte *mask, byte c, int x, int y, byte col
|
|||
const int minX = x < 0 ? -x : 0;
|
||||
const int minY = y < 0 ? -y : 0;
|
||||
|
||||
if (height <= 0 || width <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (minY) {
|
||||
src += minY * srcPitch;
|
||||
dst += minY * _vm->_screenWidth;
|
||||
|
@ -353,14 +364,18 @@ void NutRenderer::draw2byte(byte *dst, byte *mask, int c, int x, int y, byte col
|
|||
return;
|
||||
}
|
||||
|
||||
int width = _vm->_2byteWidth;
|
||||
int height = MIN(_vm->_2byteHeight, _vm->_screenHeight - y);
|
||||
const int width = _vm->_2byteWidth;
|
||||
const int height = MIN(_vm->_2byteHeight, _vm->_screenHeight - y);
|
||||
byte *src = _vm->get2byteCharPtr(c);
|
||||
byte bits = 0;
|
||||
|
||||
byte maskmask;
|
||||
int maskpos;
|
||||
|
||||
if (height <= 0 || width <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int ty = 0; ty < height; ty++) {
|
||||
maskmask = revBitMask[x & 7];
|
||||
maskpos = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue