diff options
author | Marc Mutz <[email protected]> | 2022-09-30 14:09:04 +0200 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2022-10-04 07:40:08 +0200 |
commit | df9d882d41b741fef7c5beeddb0abe9d904443d8 (patch) | |
tree | 6f3e90dacad4581b7f1cabe235cca298833a3da4 /src/opengl/qopenglframebufferobject.cpp | |
parent | 109e088c7c5d0c9325966e88d55fd9f7a58f67ea (diff) |
Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator:
auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.
<classes> are:
// sequential:
"QByteArray",
"QList",
"QQueue",
"QStack",
"QString",
"QVarLengthArray",
"QVector",
// associative:
"QHash",
"QMultiHash",
"QMap",
"QMultiMap",
"QSet",
// Qt has no QMultiSet
Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'src/opengl/qopenglframebufferobject.cpp')
-rw-r--r-- | src/opengl/qopenglframebufferobject.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/opengl/qopenglframebufferobject.cpp b/src/opengl/qopenglframebufferobject.cpp index 7bb4f49f6ec..a0034adf749 100644 --- a/src/opengl/qopenglframebufferobject.cpp +++ b/src/opengl/qopenglframebufferobject.cpp @@ -1053,7 +1053,7 @@ void QOpenGLFramebufferObject::addColorAttachment(const QSize &size, GLenum inte QOpenGLFramebufferObjectPrivate::ColorAttachment color(size, effectiveInternalFormat(internalFormat)); d->colorAttachments.append(color); - const int idx = d->colorAttachments.count() - 1; + const int idx = d->colorAttachments.size() - 1; if (d->requestedSamples == 0) { d->initTexture(idx); @@ -1134,7 +1134,7 @@ bool QOpenGLFramebufferObject::bind() if (d->format.samples() == 0) { // Create new textures to replace the ones stolen via takeTexture(). - for (int i = 0; i < d->colorAttachments.count(); ++i) { + for (int i = 0; i < d->colorAttachments.size(); ++i) { if (!d->colorAttachments.at(i).guard) d->initTexture(i); } @@ -1214,7 +1214,7 @@ QList<GLuint> QOpenGLFramebufferObject::textures() const QList<GLuint> ids; if (d->format.samples() != 0) return ids; - ids.reserve(d->colorAttachments.count()); + ids.reserve(d->colorAttachments.size()); for (const auto &color : d->colorAttachments) ids.append(color.guard ? color.guard->id() : 0); return ids; @@ -1266,7 +1266,7 @@ GLuint QOpenGLFramebufferObject::takeTexture(int colorAttachmentIndex) { Q_D(QOpenGLFramebufferObject); GLuint id = 0; - if (isValid() && d->format.samples() == 0 && d->colorAttachments.count() > colorAttachmentIndex) { + if (isValid() && d->format.samples() == 0 && d->colorAttachments.size() > colorAttachmentIndex) { QOpenGLContext *current = QOpenGLContext::currentContext(); if (current && current->shareGroup() == d->fbo_guard->group() && isBound()) release(); @@ -1491,7 +1491,7 @@ QImage QOpenGLFramebufferObject::toImage(bool flipped, int colorAttachmentIndex) return QImage(); } - if (d->colorAttachments.count() <= colorAttachmentIndex) { + if (d->colorAttachments.size() <= colorAttachmentIndex) { qWarning("QOpenGLFramebufferObject::toImage() called for missing color attachment"); return QImage(); } |