summaryrefslogtreecommitdiffstats
path: root/src/animation/backend/animationutils.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-06-19 19:30:04 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-06-21 11:23:28 +0000
commit11f092ce7c555814baeffc204f7fadc0f36fdcbb (patch)
treeca02202f42a9338d269226c78600dafc391d07b5 /src/animation/backend/animationutils.cpp
parentcbef13342b3d7613d861b810cc536fea09e711a2 (diff)
Add support for channel components with no name
Some API clients are able to generate properly ordered channel component lists on their own. (properly ordered meaning X=0, Y=1, etc.) It is a waste of time to perform string comparisons in this case so just recognize this case (the QChannelComponent name is simply unset, empty) and use the index as-is. Change-Id: I7aae5f3be427e60e705ef3dd174c0bf5d1fdee19 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/animation/backend/animationutils.cpp')
-rw-r--r--src/animation/backend/animationutils.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp
index c12ad99f7..2bfca2a33 100644
--- a/src/animation/backend/animationutils.cpp
+++ b/src/animation/backend/animationutils.cpp
@@ -184,6 +184,12 @@ ComponentIndices channelComponentsToIndicesHelper(const Channel &channel,
ComponentIndices indices(expectedComponentCount);
for (int i = 0; i < expectedComponentCount; ++i) {
const QString &componentName = channel.channelComponents[i].name;
+ // An unset component name indicates that the no mapping is necessary
+ // and the index can be used as-is.
+ if (componentName.isEmpty()) {
+ indices[i] = i + offset;
+ continue;
+ }
char suffix = componentName.at(componentName.length() - 1).toLatin1();
int index = suffixes.indexOf(suffix);
if (index != -1)