aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2020-07-08 20:30:07 +1000
committerNeil <nyamatongwe@gmail.com>2020-07-08 20:30:07 +1000
commit5db47041156b975b99ca9284479f306a3063c3da (patch)
treecc5d8252b0d22c5862ed1986922a094a59adeaf2
parent2a04e668c7069e63dd350d4eeb8de54507f1d69d (diff)
downloadscintilla-mirror-5db47041156b975b99ca9284479f306a3063c3da.tar.gz
Fix translucent rectangle drawing on Qt.
-rw-r--r--doc/ScintillaHistory.html6
-rw-r--r--qt/ScintillaEditBase/PlatQt.cpp40
2 files changed, 34 insertions, 12 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index ec85a8a00..1b8522a2a 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -602,6 +602,12 @@
when Lua script calls os.execute or io.popen.
</li>
<li>
+ Fix translucent rectangle drawing on Qt. When drawing a translucent selection, there were edge
+ artifacts as the calls used were drawing outlines over fill areas. Make bottom and right borders on
+ INDIC_ROUNDBOX be same intensity as top and left.
+ Replaced some deprecated Qt calls with currently supported calls.
+ </li>
+ <li>
Fix printing on Windows to use correct text size.
<a href="https://sourceforge.net/p/scintilla/bugs/2185/">Bug #2185</a>.
</li>
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp
index 8f572981c..d9838841c 100644
--- a/qt/ScintillaEditBase/PlatQt.cpp
+++ b/qt/ScintillaEditBase/PlatQt.cpp
@@ -353,18 +353,34 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc,
int alphaOutline,
int /*flags*/)
{
- QColor qOutline = QColorFromCA(outline);
- qOutline.setAlpha(alphaOutline);
- GetPainter()->setPen(QPen(qOutline));
-
- QColor qFill = QColorFromCA(fill);
- qFill.setAlpha(alphaFill);
- GetPainter()->setBrush(QBrush(qFill));
-
- // A radius of 1 shows no curve so add 1
- qreal radius = cornerSize+1;
- QRectF rect(rc.left, rc.top, rc.Width() - 1, rc.Height() - 1);
- GetPainter()->drawRoundedRect(rect, radius, radius);
+ const QColor qFill = QColorFromColourAlpha(ColourAlpha(fill, alphaFill));
+ const QBrush brushFill(qFill);
+ GetPainter()->setBrush(brushFill);
+
+ if ((fill == outline) && (alphaFill == alphaOutline)) {
+ painter->setPen(Qt::NoPen);
+ const QRectF rect = QRectFFromPRect(rc);
+ if (cornerSize > 0.0f) {
+ // A radius of 1 shows no curve so add 1
+ qreal radius = cornerSize+1;
+ GetPainter()->drawRoundedRect(rect, radius, radius);
+ } else {
+ GetPainter()->fillRect(rect, brushFill);
+ }
+ } else {
+ const QColor qOutline = QColorFromColourAlpha(ColourAlpha(outline, alphaOutline));
+ const QPen penOutline(qOutline);
+ GetPainter()->setPen(penOutline);
+
+ const QRectF rect(rc.left, rc.top, rc.Width() - 1.5, rc.Height() - 1.5);
+ if (cornerSize > 0.0f) {
+ // A radius of 1 shows no curve so add 1
+ qreal radius = cornerSize+1;
+ GetPainter()->drawRoundedRect(rect, radius, radius);
+ } else {
+ GetPainter()->drawRect(rect);
+ }
+ }
}
void SurfaceImpl::GradientRectangle(PRectangle rc, const std::vector<ColourStop> &stops, GradientOptions options) {