[education/rkward] /: Fix antialiasing
Thomas Friedrichsmeier
null at kde.org
Sat Sep 7 10:22:47 BST 2024
Git commit 0d311d1e04439f04d4d03007c868ebb56ae8f447 by Thomas Friedrichsmeier.
Committed on 06/09/2024 at 20:16.
Pushed by tfry into branch 'master'.
Fix antialiasing
M +1 -0 ChangeLog
M +8 -11 rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
M +2 -0 rkward/rbackend/rkwarddevice/rkgraphicsdevice.h
https://invent.kde.org/education/rkward/-/commit/0d311d1e04439f04d4d03007c868ebb56ae8f447
diff --git a/ChangeLog b/ChangeLog
index b15a0be48..ed60875da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
--- Version 0.8.1 - UNRELEASED
+- Fixed: antialising=FALSE was ignored in RK() device
- Added: Impoement glyph()-functionality in RK() device
- Fixed: Failure to paint symbols in onscreen device, under some circumstances
- Fixed: Potential library conflicts on systems shipping a more recent version of libglib2 than included in the AppImage
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
index 146502acf..b131bd005 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
@@ -28,14 +28,15 @@ SPDX-License-Identifier: GPL-2.0-or-later
QHash<int, RKGraphicsDevice*> RKGraphicsDevice::devices;
-RKGraphicsDevice::RKGraphicsDevice (double width, double height, const QString &title, bool antialias) :
- QObject (),
+RKGraphicsDevice::RKGraphicsDevice(double width, double height, const QString &title, bool antialias) :
+ QObject(),
#ifdef USE_QIMAGE_BUFFER
- area (qAbs (width) + 1, qAbs (height) + 1, QImage::Format_ARGB32),
+ area(qAbs(width) + 1, qAbs(height) + 1, QImage::Format_ARGB32),
#else
- area (qAbs (width) + 1, qAbs (height) + 1),
+ area(qAbs(width) + 1, qAbs(height) + 1),
#endif
- base_title (title) {
+ base_title(title),
+ antialias(antialias) {
RK_TRACE (GRAPHICS_DEVICE);
interaction_opcode = -1;
@@ -52,7 +53,6 @@ RKGraphicsDevice::RKGraphicsDevice (double width, double height, const QString &
updatetimer.setSingleShot (true);
beginPainter();
clear ();
- if (antialias) painter.setRenderHints (QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
setActive (true); // sets window title
}
@@ -67,12 +67,12 @@ void RKGraphicsDevice::beginPainter() {
if(!painter.isActive()) {
if (contexts.isEmpty()) {
painter.begin(&area); // plain old painting on the canvas itself
- painter.setRenderHints (QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
+ if (antialias) painter.setRenderHints (QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
recording_path = false;
} else {
auto &c = contexts.last();
painter.begin(&(c.surface));
- painter.setRenderHints (QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
+ if (antialias) painter.setRenderHints (QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
painter.setTransform(c.transform);
}
}
@@ -537,10 +537,7 @@ qDebug("invalid font %s, %d", qPrintable(font), index);
}
if (current_mask) initMaskedDraw();
- painter.save();
- painter.setRenderHint(QPainter::Antialiasing); // TODO
painter.fillPath(path, col);
- painter.restore();
if (current_mask) commitMaskedDraw();
triggerUpdate();
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.h b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.h
index f634375bc..a27fc1688 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.h
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.h
@@ -162,6 +162,8 @@ private:
PaintContext popContext();
void initMaskedDraw();
void commitMaskedDraw();
+
+ bool antialias;
};
#endif
More information about the rkward-tracker
mailing list