mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
Work to improve performance a bit
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7373 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
80d7f70dc3
commit
672ab42137
@ -1,3 +1,12 @@
|
||||
2003-07-26 Asger Alstrup <alstrup@local>
|
||||
|
||||
* text2.C (metrics): change a brain-dead algorithm to a smarter one.
|
||||
|
||||
* text.C (singleWidth): Spurious font copying in hot-spot
|
||||
singleWidth avoided. Reorder tests for arabic for efficiency.
|
||||
|
||||
* text.C (fill): handle empty paragraphs better.
|
||||
|
||||
2003-07-27 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* ispell.C:
|
||||
|
@ -48,7 +48,6 @@ InsetOld::InsetOld(InsetOld const & in)
|
||||
top_x(0), top_baseline(0), scx(0), id_(in.id_), owner_(0),
|
||||
name_(in.name_), background_color_(in.background_color_)
|
||||
{
|
||||
lyxerr << "inset id: " << id_ << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1076,7 +1076,6 @@ void paintRows(BufferView const & bv, LyXText const & text,
|
||||
// calling metrics() directly is (a) slow and (b) crashs
|
||||
if (&text == bv.text) {
|
||||
#if 1
|
||||
lyxerr << "paintRows, global...\n";
|
||||
// make sure all insets are updated
|
||||
ParagraphList::iterator pit = text.ownerParagraphs().begin();
|
||||
ParagraphList::iterator end = text.ownerParagraphs().end();
|
||||
|
31
src/text.C
31
src/text.C
@ -284,14 +284,14 @@ int LyXText::singleWidth(ParagraphList::iterator pit,
|
||||
if (pos >= pit->size())
|
||||
return 0;
|
||||
|
||||
LyXFont const font = getFont(bv()->buffer(), pit, pos);
|
||||
LyXFont const & font = getFont(bv()->buffer(), pit, pos);
|
||||
|
||||
// The most common case is handled first (Asger)
|
||||
if (IsPrintable(c)) {
|
||||
if (font.language()->RightToLeft()) {
|
||||
if (font.language()->lang() == "arabic" &&
|
||||
(lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
|
||||
lyxrc.font_norm_type == LyXRC::ISO_10646_1)) {
|
||||
if ((lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
|
||||
lyxrc.font_norm_type == LyXRC::ISO_10646_1)
|
||||
&& font.language()->lang() == "arabic") {
|
||||
if (Encodings::IsComposeChar_arabic(c))
|
||||
return 0;
|
||||
else
|
||||
@ -301,7 +301,6 @@ int LyXText::singleWidth(ParagraphList::iterator pit,
|
||||
return 0;
|
||||
}
|
||||
return font_metrics::width(c, font);
|
||||
|
||||
}
|
||||
|
||||
if (c == Paragraph::META_INSET) {
|
||||
@ -935,17 +934,19 @@ int LyXText::fill(RowList::iterator row, int paper_width) const
|
||||
pos_type const body_pos = pit->beginningOfBody();
|
||||
pos_type i = row->pos();
|
||||
|
||||
while (i <= last) {
|
||||
if (body_pos > 0 && i == body_pos) {
|
||||
w += font_metrics::width(layout->labelsep, getLabelFont(bv()->buffer(), pit));
|
||||
if (pit->isLineSeparator(i - 1))
|
||||
w -= singleWidth(pit, i - 1);
|
||||
int left_margin = labelEnd(*row);
|
||||
if (w < left_margin)
|
||||
w = left_margin;
|
||||
if (! pit->empty()) {
|
||||
while (i <= last) {
|
||||
if (body_pos > 0 && i == body_pos) {
|
||||
w += font_metrics::width(layout->labelsep, getLabelFont(bv()->buffer(), pit));
|
||||
if (pit->isLineSeparator(i - 1))
|
||||
w -= singleWidth(pit, i - 1);
|
||||
int left_margin = labelEnd(*row);
|
||||
if (w < left_margin)
|
||||
w = left_margin;
|
||||
}
|
||||
w += singleWidth(pit, i);
|
||||
++i;
|
||||
}
|
||||
w += singleWidth(pit, i);
|
||||
++i;
|
||||
}
|
||||
if (body_pos > 0 && body_pos > last) {
|
||||
w += font_metrics::width(layout->labelsep, getLabelFont(bv()->buffer(), pit));
|
||||
|
13
src/text2.C
13
src/text2.C
@ -711,13 +711,12 @@ void LyXText::metrics(MetricsInfo & mi, Dimension & dim)
|
||||
ParagraphList::iterator end = ownerParagraphs().end();
|
||||
|
||||
for (; pit != end; ++pit) {
|
||||
// compute inset metrics
|
||||
for (int pos = 0; pos != pit->size(); ++pos) {
|
||||
if (pit->isInset(pos)) {
|
||||
Dimension dim;
|
||||
MetricsInfo m = mi;
|
||||
pit->getInset(pos)->metrics(m, dim);
|
||||
}
|
||||
InsetList::iterator ii = pit->insetlist.begin();
|
||||
InsetList::iterator iend = pit->insetlist.end();
|
||||
for (; ii != iend; ++ii) {
|
||||
Dimension dim;
|
||||
MetricsInfo m = mi;
|
||||
ii->inset->metrics(m, dim);
|
||||
}
|
||||
|
||||
// insert a new row, starting at position 0
|
||||
|
Loading…
Reference in New Issue
Block a user