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>
This commit is contained in:
parent
80a550dd79
commit
e5b3db841d
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user