mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
one less use of ownerPar means faster code
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8939 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1c8329d3a4
commit
0fe5cc3913
@ -1,3 +1,11 @@
|
||||
2004-08-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* metricsinfo.h: add a new field ltr_pos to PainterInfo
|
||||
|
||||
* rowpainter.C (paintInset): initialize PainterInfo::ltr_pos
|
||||
|
||||
* text.C (singleWidth): remove useless test
|
||||
|
||||
2004-08-14 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* tabular.h: remove bogus comments
|
||||
|
@ -1,3 +1,6 @@
|
||||
2004-08-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* insetnewline.C (draw): use PainterInfo::ltr_pos instead of ownerPar.
|
||||
|
||||
2004-08-14 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -86,11 +86,6 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
|
||||
int const wid = font_metrics::width('n', pi.base.font);
|
||||
int const asc = font_metrics::maxAscent(pi.base.font);
|
||||
|
||||
// hack, and highly dubious
|
||||
lyx::pos_type pos = ownerPar(*pi.base.bv->buffer(), this)
|
||||
.getPositionOfInset(this);
|
||||
bool const ltr_pos = (pi.base.bv->text()->bidi.level(pos) % 2 == 0);
|
||||
|
||||
int xp[3];
|
||||
int yp[3];
|
||||
|
||||
@ -98,7 +93,7 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
|
||||
yp[1] = int(y - 0.500 * asc * 0.75);
|
||||
yp[2] = int(y - 0.125 * asc * 0.75);
|
||||
|
||||
if (ltr_pos) {
|
||||
if (pi.ltr_pos) {
|
||||
xp[0] = int(x + wid * 0.375);
|
||||
xp[1] = int(x);
|
||||
xp[2] = int(x + wid * 0.375);
|
||||
@ -114,7 +109,7 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
|
||||
yp[1] = int(y - 0.500 * asc * 0.75);
|
||||
yp[2] = int(y - asc * 0.75);
|
||||
|
||||
if (ltr_pos) {
|
||||
if (pi.ltr_pos) {
|
||||
xp[0] = int(x);
|
||||
xp[1] = int(x + wid);
|
||||
xp[2] = int(x + wid);
|
||||
|
@ -47,7 +47,7 @@ MetricsInfo::MetricsInfo(BufferView * bv, LyXFont const & font, int textwidth)
|
||||
|
||||
|
||||
PainterInfo::PainterInfo(BufferView * bv, Painter & painter)
|
||||
: pain(painter)
|
||||
: pain(painter), ltr_pos(false)
|
||||
{
|
||||
base.bv = bv;
|
||||
}
|
||||
|
@ -84,6 +84,8 @@ struct PainterInfo {
|
||||
MetricsBase base;
|
||||
///
|
||||
Painter & pain;
|
||||
/// Whether the text at this point is right-to-left (for InsetNewline)
|
||||
bool ltr_pos;
|
||||
};
|
||||
|
||||
|
||||
|
@ -200,6 +200,7 @@ void RowPainter::paintInset(pos_type const pos)
|
||||
BOOST_ASSERT(inset);
|
||||
PainterInfo pi(const_cast<BufferView *>(&bv_), pain_);
|
||||
pi.base.font = getFont(pos);
|
||||
pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0);
|
||||
theCoords.insets_.add(inset, int(x_), yo_ + row_.baseline());
|
||||
inset->drawSelection(pi, int(x_), yo_ + row_.baseline());
|
||||
inset->draw(pi, int(x_), yo_ + row_.baseline());
|
||||
|
@ -441,9 +441,6 @@ int LyXText::height() const
|
||||
|
||||
int LyXText::singleWidth(par_type par, pos_type pos) const
|
||||
{
|
||||
if (pos >= pars_[par].size())
|
||||
return 0;
|
||||
|
||||
char const c = pars_[par].getChar(pos);
|
||||
return singleWidth(par, pos, c, getFont(par, pos));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user