summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2018-06-22 15:56:15 +0200
committerEirik Aavitsland <eirik.aavitsland@qt.io>2018-06-28 14:28:53 +0000
commite5b3db841d9912cfc1a8252f5e6f687006a5ea2b (patch)
tree99a5c975042885594ab6eddbd2f0059b703d9d4e /src/gui/opengl
parent80a550dd79b8ed0ac72e775c98caefc4df16b882 (diff)
Fix: bad-looking scaled rendering of painterpath in OpenGL paint engine
For performance, the triangulation of a painter path is stored for reuse. Re-triangulation was only done if the path was to be painted at a significantly different scale AND it contained a curve (bezier) element. But also the triangulation of a path with only straight lines can lose precision if rendered at a small scale, and so look bad when used at a higher scale factor. Fix by removing the mentioned curve element condition. Task-number: QTBUG-68873 Change-Id: Id3492514e9382a5828377b7bafea8cfac7b850a6 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/opengl')
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index 17dc9df619..3d1c362275 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -797,20 +797,18 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
if (data) {
cache = (QOpenGL2PEVectorPathCache *) data->data;
- // Check if scale factor is exceeded for curved paths and generate curves if so...
- if (path.isCurved()) {
- qreal scaleFactor = cache->iscale / inverseScale;
- if (scaleFactor < 0.5 || scaleFactor > 2.0) {
+ // Check if scale factor is exceeded and regenerate if so...
+ qreal scaleFactor = cache->iscale / inverseScale;
+ if (scaleFactor < 0.5 || scaleFactor > 2.0) {
#ifdef QT_OPENGL_CACHE_AS_VBOS
- glDeleteBuffers(1, &cache->vbo);
- cache->vbo = 0;
- Q_ASSERT(cache->ibo == 0);
+ glDeleteBuffers(1, &cache->vbo);
+ cache->vbo = 0;
+ Q_ASSERT(cache->ibo == 0);
#else
- free(cache->vertices);
- Q_ASSERT(cache->indices == 0);
+ free(cache->vertices);
+ Q_ASSERT(cache->indices == 0);
#endif
- updateCache = true;
- }
+ updateCache = true;
}
} else {
cache = new QOpenGL2PEVectorPathCache;
@@ -879,19 +877,17 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
if (data) {
cache = (QOpenGL2PEVectorPathCache *) data->data;
- // Check if scale factor is exceeded for curved paths and generate curves if so...
- if (path.isCurved()) {
- qreal scaleFactor = cache->iscale / inverseScale;
- if (scaleFactor < 0.5 || scaleFactor > 2.0) {
+ // Check if scale factor is exceeded and regenerate if so...
+ qreal scaleFactor = cache->iscale / inverseScale;
+ if (scaleFactor < 0.5 || scaleFactor > 2.0) {
#ifdef QT_OPENGL_CACHE_AS_VBOS
- glDeleteBuffers(1, &cache->vbo);
- glDeleteBuffers(1, &cache->ibo);
+ glDeleteBuffers(1, &cache->vbo);
+ glDeleteBuffers(1, &cache->ibo);
#else
- free(cache->vertices);
- free(cache->indices);
+ free(cache->vertices);
+ free(cache->indices);
#endif
- updateCache = true;
- }
+ updateCache = true;
}
} else {
cache = new QOpenGL2PEVectorPathCache;