Try to fix #4889 in the right way

For reference, the bug was that quote insets grew bolder because, when
painted over themselves, anti-aliasing made them darker.

It turned out that the fix there created others than were
painstakingly fixed: #7164, #7165, #7174, #7193... More recently, it
created other problems:
http://article.gmane.org/gmane.editors.lyx.devel/163471

We use the right fix here:
* draw background of quote inset when not doing full repaint
* draw background of math macro template when not doing full repaint
* remove hack that grew from #4889 fix.
This commit is contained in:
Jean-Marc Lasgouttes 2016-07-20 00:12:21 +02:00
parent e35110eab7
commit 9940acc506
5 changed files with 26 additions and 8 deletions

View File

@ -550,15 +550,8 @@ void RowPainter::paintOnlyInsets()
Row::const_iterator const & end = row_.end();
for ( ; cit != end ; ++cit) {
Row::Element const & e = *cit;
if (e.type == Row::INSET) {
// If outer row has changed, nested insets are repainted completely.
// FIXME: check what this really does. The test is weird.
bool const nested_inset =
(e.inset->asInsetMath() && !e.inset->asInsetMath()->asMacroTemplate())
|| e.inset->asInsetText() || e.inset->asInsetTabular();
if (nested_inset)
if (e.type == Row::INSET)
paintInset(e);
}
x_ += e.full_width();
}
}

View File

@ -211,6 +211,16 @@ void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const
}
void InsetQuotes::drawBackground(PainterInfo & pi, int x, int y) const
{
if (pi.full_repaint)
return;
Dimension const dim = dimension(*pi.base.bv);
pi.pain.fillRectangle(x, y - dim.asc, dim.wid, dim.asc + dim.des,
pi.backgroundColor(this));
}
void InsetQuotes::draw(PainterInfo & pi, int x, int y) const
{
FontInfo font = pi.base.font;

View File

@ -70,6 +70,8 @@ public:
///
void metrics(MetricsInfo &, Dimension &) const;
///
void drawBackground(PainterInfo & pi, int x, int y) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
void write(std::ostream &) const;

View File

@ -583,6 +583,17 @@ void MathMacroTemplate::metrics(MetricsInfo & mi, Dimension & dim) const
}
void MathMacroTemplate::drawBackground(PainterInfo & pi, int x, int y) const
{
if (pi.full_repaint)
return;
Dimension const dim = dimension(*pi.base.bv);
pi.pain.fillRectangle(x, y - dim.asc, dim.wid, dim.asc + dim.des,
pi.backgroundColor(this));
}
void MathMacroTemplate::draw(PainterInfo & pi, int x, int y) const
{
// FIXME: Calling Changer on the same object repeatedly is inefficient.

View File

@ -92,6 +92,8 @@ public:
///
void draw(PainterInfo & pi, int x, int y) const;
///
void drawBackground(PainterInfo & pi, int x, int y) const;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
/// identifies macro templates
MathMacroTemplate * asMacroTemplate() { return this; }