some more inlining

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10259 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2005-07-16 18:25:58 +00:00
parent 83bf606e60
commit 372365845d
6 changed files with 36 additions and 50 deletions

View File

@ -310,12 +310,11 @@ FontInfo::FontInfo(LyXFont const & f)
<< font.pointSizeFloat() << endl;
// Is this an exact match?
if (font.exactMatch()) {
if (font.exactMatch())
lyxerr[Debug::FONT] << "This font is an exact match" << endl;
} else {
else
lyxerr[Debug::FONT] << "This font is NOT an exact match"
<< endl;
}
lyxerr[Debug::FONT] << "XFLD: " << font.rawName() << endl;
@ -328,7 +327,6 @@ int FontInfo::width(Uchar val) const
// Starting with version 3.1.0, Qt/X11 does its own caching of
// character width, so it is not necessary to provide ours.
#if defined (USE_LYX_FONTCACHE)
#error xxx
FontInfo::WidthCache::const_iterator cit = widthcache.find(val);
if (cit != widthcache.end())
return cit->second;

View File

@ -34,40 +34,40 @@ class FontInfo {
public:
FontInfo(LyXFont const & f);
/// return pixel width for the given unicode char
/// Return pixel width for the given unicode char
int width(Uchar val) const;
/// the font instance
/// The font instance
QFont font;
/// metrics on the font
/// Metrics on the font
QFontMetrics metrics;
#if defined(USE_LYX_FONTCACHE)
typedef std::map<Uchar, int> WidthCache;
/// cache of char widths
/// Cache of char widths
WidthCache widthcache;
#endif
};
/// Hold info about a particular font
class FontLoader {
public:
/// hold info about a particular font
///
FontLoader();
/// update fonts after zoom, dpi, font names, or norm change
/// Update fonts after zoom, dpi, font names, or norm change
void update();
/// do we have anything matching?
/// Do we have anything matching?
bool available(LyXFont const & f);
/// get the QFont for this LyXFont
/// Get the QFont for this LyXFont
QFont const & get(LyXFont const & f) {
return fontinfo(f).font;
}
/// get the QFont metrics for this LyXFont
/// Get the QFont metrics for this LyXFont
QFontMetrics const & metrics(LyXFont const & f) {
return fontinfo(f).metrics;
}
@ -78,7 +78,7 @@ public:
/// Called the first time when available() can't load a symbol font
static void addToFontPath();
/// get font info (font + metrics) for the given LyX font. Does not fail.
/// Get font info (font + metrics) for the given LyX font.
FontInfo & fontinfo(LyXFont const & f) {
FontInfo * & fi =
fontinfo_[f.family()][f.series()][f.realShape()][f.size()];

View File

@ -743,18 +743,19 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
row_type rs, re;
col_type cs, ce;
getSelection(cur, rs, re, cs, ce);
for (row_type i = rs; i <= re; ++i)
for (row_type i = rs; i <= re; ++i) {
for (col_type j = cs; j <= ce; ++j) {
// cursor follows cell:
cur.idx() = tabular.getCellNumber(i, j);
// select this cell only:
cur.pos() = 0;
cur.resetAnchor();
cur.resetAnchor();
cur.pos() = cur.top().lastpos();
cur.setCursor(cur);
cur.setSelection();
cur.setCursor(cur);
cur.setSelection();
cell(cur.idx())->dispatch(cur, cmd);
}
}
// Restore original selection
cur.idx() = tabular.getCellNumber(rs, cs);
cur.pos() = 0;

View File

@ -204,12 +204,6 @@ LColor_color LyXFont::color() const
}
Language const * LyXFont::language() const
{
return lang;
}
bool LyXFont::isRightToLeft() const
{
return lang->RightToLeft();
@ -917,23 +911,6 @@ LColor_color LyXFont::realColor() const
}
// Convert logical attributes to concrete shape attribute
LyXFont::FONT_SHAPE LyXFont::realShape() const
{
register FONT_SHAPE s = shape();
if (emph() == ON) {
if (s == UP_SHAPE)
s = ITALIC_SHAPE;
else
s = UP_SHAPE;
}
if (noun() == ON)
s = SMALLCAPS_SHAPE;
return s;
}
ostream & operator<<(ostream & os, LyXFont::FONT_MISC_STATE fms)
{
return os << int(fms);

View File

@ -221,7 +221,7 @@ public:
///
LColor_color color() const;
///
Language const * language() const;
Language const * language() const { return lang; }
///
bool isRightToLeft() const;
///
@ -319,7 +319,15 @@ public:
std::ostream & operator<<(std::ostream & os, LyXFont const & font);
/// Converts logical attributes to concrete shape attribute
LyXFont::FONT_SHAPE realShape() const;
// Try hard to inline this as it shows up with 4.6 % in the profiler.
LyXFont::FONT_SHAPE realShape() const {
if (bits.noun == ON)
return SMALLCAPS_SHAPE;
if (bits.emph == ON)
return (bits.shape == UP_SHAPE) ? ITALIC_SHAPE : UP_SHAPE;
return bits.shape;
}
/** Compaq cxx 6.5 requires that the definition be public so that
it can compile operator==()

View File

@ -302,18 +302,16 @@ public:
LyXFont const & font);
///
void insertChar(lyx::pos_type pos, value_type c,
Change change = Change(Change::INSERTED));
Change change = Change::INSERTED);
///
void insertChar(lyx::pos_type pos, value_type c,
LyXFont const &, Change change = Change(Change::INSERTED));
///
bool checkInsertChar(LyXFont &);
LyXFont const &, Change change = Change::INSERTED);
///
void insertInset(lyx::pos_type pos, InsetBase * inset,
Change change = Change(Change::INSERTED));
Change change = Change::INSERTED);
///
void insertInset(lyx::pos_type pos, InsetBase * inset,
LyXFont const &, Change change = Change(Change::INSERTED));
LyXFont const &, Change change = Change::INSERTED);
///
bool insetAllowed(InsetBase_code code);
///
@ -327,7 +325,9 @@ public:
///
bool isHfill(lyx::pos_type pos) const;
/// hinted by profiler
bool isInset(lyx::pos_type pos) const { return getChar(pos) == static_cast<value_type>(META_INSET); }
bool isInset(lyx::pos_type pos) const {
return getChar(pos) == static_cast<value_type>(META_INSET);
}
///
bool isNewline(lyx::pos_type pos) const;
///
@ -367,7 +367,9 @@ public:
unsigned int height() const { return dim_.height(); }
/// total width of paragraph, may differ from workwidth
unsigned int width() const { return dim_.width(); }
/// ascend of paragraph above baseline
unsigned int ascent() const { return dim_.ascent(); }
/// descend of paragraph below baseline
unsigned int descent() const { return dim_.descent(); }
/// LyXText updates the rows using this access point
RowList & rows() { return rows_; }