]> git.lyx.org Git - lyx.git/commitdiff
Try to fix #4889 in the right way
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 19 Jul 2016 22:12:21 +0000 (00:12 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 19 Jul 2016 22:24:24 +0000 (00:24 +0200)
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.

src/RowPainter.cpp
src/insets/InsetQuotes.cpp
src/insets/InsetQuotes.h
src/mathed/MathMacroTemplate.cpp
src/mathed/MathMacroTemplate.h

index 1c48b5bb348bd1dadc8bbeb6afc421a160ac9931..08ac66d467c85bcfc7e72d979ef42f96fa8fa05a 100644 (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();
        }
 }
index 1a6c925bf7cd9fcd478f5844553ae27ebc9a0fce..c4affc15158fff5c96d5352b8dcc978c1e96db03 100644 (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;
index fec7fbca2349c600c1bf1360c8e5b739646a01d3..ba3ed994ddfa79fb97e24aaa649ee231bfaeeddd 100644 (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;
index 31250e29df547156c91d650e72659e832fe95ad9..5b2a016c63ad2f62bcb411aae3dfc7417a765253 100644 (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.
index b0c301897761a0caeb9124c91270386b960875a9..dbcce5d410c57252309e8b6eb3dba51e4879ea6c 100644 (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; }