mirror of https://github.com/stella-emu/stella.git
Reverted to the old font handling code. I was trying to find a font
that looks roughly the same as the current default but was bigger. Then it occurred to me to simply modify that font to be twice as large :) git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1441 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
bb8ebc853e
commit
3bba5a6892
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FrameBufferGL.cxx,v 1.100 2008-03-23 16:22:39 stephena Exp $
|
// $Id: FrameBufferGL.cxx,v 1.101 2008-03-24 00:02:16 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifdef DISPLAY_OPENGL
|
#ifdef DISPLAY_OPENGL
|
||||||
|
@ -534,27 +534,26 @@ void FrameBufferGL::drawChar(const GUI::Font* font, uInt8 chr,
|
||||||
// If this character is not included in the font, use the default char.
|
// If this character is not included in the font, use the default char.
|
||||||
if(chr < desc.firstchar || chr >= desc.firstchar + desc.size)
|
if(chr < desc.firstchar || chr >= desc.firstchar + desc.size)
|
||||||
{
|
{
|
||||||
if (chr == ' ')
|
if (chr == ' ') return;
|
||||||
return;
|
|
||||||
chr = desc.defaultchar;
|
chr = desc.defaultchar;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Int32 w = font->getCharWidth(chr);
|
const Int32 w = font->getCharWidth(chr);
|
||||||
const Int32 h = font->getFontHeight();
|
const Int32 h = font->getFontHeight();
|
||||||
chr -= desc.firstchar;
|
chr -= desc.firstchar;
|
||||||
const uInt16* tmp = desc.bits + (desc.offset ?
|
const uInt32* tmp = desc.bits + (desc.offset ? desc.offset[chr] : (chr * h));
|
||||||
desc.offset[chr] : (chr * h));
|
|
||||||
|
|
||||||
uInt16* buffer = (uInt16*) myTexture->pixels + ty * myBuffer.pitch + tx;
|
uInt16* buffer = (uInt16*) myTexture->pixels + ty * myBuffer.pitch + tx;
|
||||||
for(int y = 0; y < h; ++y)
|
for(int y = 0; y < h; ++y)
|
||||||
{
|
{
|
||||||
const uInt16 ptr = *tmp++;
|
const uInt32 ptr = *tmp++;
|
||||||
uInt16 mask = 0x8000;
|
if(ptr)
|
||||||
|
{
|
||||||
for(int x = 0; x < w; ++x, mask >>= 1)
|
uInt32 mask = 0x80000000;
|
||||||
if(ptr & mask)
|
for(int x = 0; x < w; ++x, mask >>= 1)
|
||||||
buffer[x] = (uInt16) myDefPalette[color];
|
if(ptr & mask)
|
||||||
|
buffer[x] = (uInt16) myDefPalette[color];
|
||||||
|
}
|
||||||
buffer += myBuffer.pitch;
|
buffer += myBuffer.pitch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FrameBufferSoft.cxx,v 1.77 2008-03-13 22:58:06 stephena Exp $
|
// $Id: FrameBufferSoft.cxx,v 1.78 2008-03-24 00:02:16 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -499,19 +499,19 @@ void FrameBufferSoft::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, int color
|
||||||
void FrameBufferSoft::drawChar(const GUI::Font* font, uInt8 chr,
|
void FrameBufferSoft::drawChar(const GUI::Font* font, uInt8 chr,
|
||||||
uInt32 xorig, uInt32 yorig, int color)
|
uInt32 xorig, uInt32 yorig, int color)
|
||||||
{
|
{
|
||||||
// If this character is not included in the font, use the default char.
|
|
||||||
const FontDesc& desc = font->desc();
|
const FontDesc& desc = font->desc();
|
||||||
|
|
||||||
|
// If this character is not included in the font, use the default char.
|
||||||
if(chr < desc.firstchar || chr >= desc.firstchar + desc.size)
|
if(chr < desc.firstchar || chr >= desc.firstchar + desc.size)
|
||||||
{
|
{
|
||||||
if (chr == ' ')
|
if (chr == ' ') return;
|
||||||
return;
|
|
||||||
chr = desc.defaultchar;
|
chr = desc.defaultchar;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Int32 w = font->getCharWidth(chr);
|
const Int32 w = font->getCharWidth(chr);
|
||||||
const Int32 h = font->getFontHeight();
|
const Int32 h = font->getFontHeight();
|
||||||
chr -= desc.firstchar;
|
chr -= desc.firstchar;
|
||||||
const uInt16* tmp = desc.bits + (desc.offset ? desc.offset[chr] : (chr * h));
|
const uInt32* tmp = desc.bits + (desc.offset ? desc.offset[chr] : (chr * h));
|
||||||
|
|
||||||
// Scale the origins to the current zoom
|
// Scale the origins to the current zoom
|
||||||
xorig *= myZoomLevel;
|
xorig *= myZoomLevel;
|
||||||
|
@ -528,20 +528,23 @@ void FrameBufferSoft::drawChar(const GUI::Font* font, uInt8 chr,
|
||||||
uInt16* buffer = (uInt16*) myScreen->pixels + myBaseOffset + yorig * myPitch + xorig;
|
uInt16* buffer = (uInt16*) myScreen->pixels + myBaseOffset + yorig * myPitch + xorig;
|
||||||
for(int y = h; y; --y)
|
for(int y = h; y; --y)
|
||||||
{
|
{
|
||||||
const uInt16 fontbuf = *tmp++;
|
const uInt32 fontbuf = *tmp++;
|
||||||
int ystride = myZoomLevel;
|
int ystride = myZoomLevel;
|
||||||
while(ystride--)
|
while(ystride--)
|
||||||
{
|
{
|
||||||
uInt16 mask = 0x8000;
|
if(fontbuf)
|
||||||
int pos = screenofsY;
|
|
||||||
for(int x = 0; x < w; x++, mask >>= 1)
|
|
||||||
{
|
{
|
||||||
int xstride = myZoomLevel;
|
uInt32 mask = 0x80000000;
|
||||||
if((fontbuf & mask) != 0)
|
int pos = screenofsY;
|
||||||
while(xstride--)
|
for(int x = 0; x < w; x++, mask >>= 1)
|
||||||
buffer[pos++] = myDefPalette[color];
|
{
|
||||||
else
|
int xstride = myZoomLevel;
|
||||||
pos += xstride;
|
if((fontbuf & mask) != 0)
|
||||||
|
while(xstride--)
|
||||||
|
buffer[pos++] = myDefPalette[color];
|
||||||
|
else
|
||||||
|
pos += xstride;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
screenofsY += myPitch;
|
screenofsY += myPitch;
|
||||||
}
|
}
|
||||||
|
@ -559,24 +562,27 @@ void FrameBufferSoft::drawChar(const GUI::Font* font, uInt8 chr,
|
||||||
|
|
||||||
for(int y = h; y; --y)
|
for(int y = h; y; --y)
|
||||||
{
|
{
|
||||||
const uInt16 fontbuf = *tmp++;
|
const uInt32 fontbuf = *tmp++;
|
||||||
int ystride = myZoomLevel;
|
int ystride = myZoomLevel;
|
||||||
while(ystride--)
|
while(ystride--)
|
||||||
{
|
{
|
||||||
uInt16 mask = 0x8000;
|
if(fontbuf)
|
||||||
int pos = screenofsY;
|
|
||||||
for(int x = 0; x < w; x++, mask >>= 1)
|
|
||||||
{
|
{
|
||||||
int xstride = myZoomLevel;
|
uInt32 mask = 0x80000000;
|
||||||
if((fontbuf & mask) != 0)
|
int pos = screenofsY;
|
||||||
|
for(int x = 0; x < w; x++, mask >>= 1)
|
||||||
{
|
{
|
||||||
while(xstride--)
|
int xstride = myZoomLevel;
|
||||||
|
if((fontbuf & mask) != 0)
|
||||||
{
|
{
|
||||||
buffer[pos++] = r; buffer[pos++] = g; buffer[pos++] = b;
|
while(xstride--)
|
||||||
|
{
|
||||||
|
buffer[pos++] = r; buffer[pos++] = g; buffer[pos++] = b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
pos += xstride + xstride + xstride;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
pos += xstride + xstride + xstride;
|
|
||||||
}
|
}
|
||||||
screenofsY += myPitch;
|
screenofsY += myPitch;
|
||||||
}
|
}
|
||||||
|
@ -589,20 +595,23 @@ void FrameBufferSoft::drawChar(const GUI::Font* font, uInt8 chr,
|
||||||
uInt32* buffer = (uInt32*) myScreen->pixels + myBaseOffset + yorig * myPitch + xorig;
|
uInt32* buffer = (uInt32*) myScreen->pixels + myBaseOffset + yorig * myPitch + xorig;
|
||||||
for(int y = h; y; --y)
|
for(int y = h; y; --y)
|
||||||
{
|
{
|
||||||
const uInt16 fontbuf = *tmp++;
|
const uInt32 fontbuf = *tmp++;
|
||||||
int ystride = myZoomLevel;
|
int ystride = myZoomLevel;
|
||||||
while(ystride--)
|
while(ystride--)
|
||||||
{
|
{
|
||||||
uInt16 mask = 0x8000;
|
if(fontbuf)
|
||||||
int pos = screenofsY;
|
|
||||||
for(int x = 0; x < w; x++, mask >>= 1)
|
|
||||||
{
|
{
|
||||||
int xstride = myZoomLevel;
|
uInt32 mask = 0x80000000;
|
||||||
if((fontbuf & mask) != 0)
|
int pos = screenofsY;
|
||||||
while(xstride--)
|
for(int x = 0; x < w; x++, mask >>= 1)
|
||||||
buffer[pos++] = myDefPalette[color];
|
{
|
||||||
else
|
int xstride = myZoomLevel;
|
||||||
pos += xstride;
|
if((fontbuf & mask) != 0)
|
||||||
|
while(xstride--)
|
||||||
|
buffer[pos++] = myDefPalette[color];
|
||||||
|
else
|
||||||
|
pos += xstride;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
screenofsY += myPitch;
|
screenofsY += myPitch;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Font.hxx,v 1.10 2008-03-23 16:22:46 stephena Exp $
|
// $Id: Font.hxx,v 1.11 2008-03-24 00:02:16 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -24,31 +24,21 @@
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
struct BBX
|
|
||||||
{
|
|
||||||
Int8 w;
|
|
||||||
Int8 h;
|
|
||||||
Int8 x;
|
|
||||||
Int8 y;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* builtin C-based proportional/fixed font structure */
|
/* builtin C-based proportional/fixed font structure */
|
||||||
/* based on The Microwindows Project http://microwindows.org */
|
/* based on The Microwindows Project http://microwindows.org */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const char* name; /* font name */
|
const char* name; /* font name */
|
||||||
int maxwidth; /* max width in pixels */
|
int maxwidth; /* max width in pixels */
|
||||||
int height; /* height in pixels */
|
int height; /* height in pixels */
|
||||||
int fbbw, fbbh, fbbx, fbby; /* max bounding box */
|
int ascent; /* ascent (baseline) height */
|
||||||
int ascent; /* ascent (baseline) height */
|
int firstchar; /* first character in bitmap */
|
||||||
int firstchar; /* first character in bitmap */
|
int size; /* font size in glyphs */
|
||||||
int size; /* font size in glyphs */
|
const uInt32* bits; /* 32-bit right-padded bitmap data */
|
||||||
const uInt16* bits; /* 16-bit right-padded bitmap data */
|
const uInt16* offset; /* offsets into bitmap data */
|
||||||
const uInt32* offset; /* offsets into bitmap data*/
|
const uInt8* width; /* character widths or NULL if fixed */
|
||||||
const uInt8* width; /* character widths or NULL if fixed */
|
int defaultchar; /* default char (not glyph index) */
|
||||||
const BBX* bbx; /* character bounding box or NULL if fixed */
|
long bits_size; /* # words of bitmap_t bits */
|
||||||
int defaultchar; /* default char (not glyph index) */
|
|
||||||
long bits_size; /* # words of bitmap_t bits */
|
|
||||||
} FontDesc;
|
} FontDesc;
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue