Mercurial > octave
comparison src/octave-svgconvert.cc @ 31191:bb9d776eafac stable
Fix wrong color in PDF printout of some latex strings (bug #62884)
* octave-svgconvert (draw): For "rect" elements only set brush color if
necessary and eventually restore to previous color.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Sun, 14 Aug 2022 18:24:07 +0200 |
parents | 796f54d4ddbf |
children | 55415fa6a20f |
comparison
equal
deleted
inserted
replaced
31189:820d2c802247 | 31191:bb9d776eafac |
---|---|
658 painter.restore (); | 658 painter.restore (); |
659 } | 659 } |
660 } | 660 } |
661 else if (elt.tagName () == "rect") | 661 else if (elt.tagName () == "rect") |
662 { | 662 { |
663 // Color | |
664 QColor col (Qt::black); | |
665 QString str = elt.attribute ("fill"); | |
666 if (! str.isEmpty ()) | |
667 col = QColor (str); | |
668 | |
669 // Position | 663 // Position |
670 double x = elt.attribute ("x").toDouble (); | 664 double x = elt.attribute ("x").toDouble (); |
671 double y = elt.attribute ("y").toDouble (); | 665 double y = elt.attribute ("y").toDouble (); |
672 | 666 |
673 // Size | 667 // Size |
674 double wd = elt.attribute ("width").toDouble (); | 668 double wd = elt.attribute ("width").toDouble (); |
675 double hg = elt.attribute ("height").toDouble (); | 669 double hg = elt.attribute ("height").toDouble (); |
676 | 670 |
677 painter.setBrush (col); | 671 // Color |
672 QColor saved_color = painter.brush ().color (); | |
673 | |
674 QString str = elt.attribute ("fill"); | |
675 if (! str.isEmpty ()) | |
676 painter.setBrush (QColor (str)); | |
677 | |
678 painter.setPen (Qt::NoPen); | 678 painter.setPen (Qt::NoPen); |
679 | 679 |
680 painter.drawRect (QRectF (x, y, wd, hg)); | 680 painter.drawRect (QRectF (x, y, wd, hg)); |
681 | |
682 if (! str.isEmpty ()) | |
683 painter.setBrush (saved_color); | |
681 } | 684 } |
682 else if (elt.tagName () == "polygon") | 685 else if (elt.tagName () == "polygon") |
683 { | 686 { |
684 if (! clippath_id.isEmpty ()) | 687 if (! clippath_id.isEmpty ()) |
685 clippath[clippath_id] = qstr2ptsvectord (elt.attribute ("points")); | 688 clippath[clippath_id] = qstr2ptsvectord (elt.attribute ("points")); |