-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Effects manifest defaults #10837
Effects manifest defaults #10837
Conversation
src/effects/presets/effectpreset.cpp
Outdated
// overwrite our parameter by taking a copy of the same parameter from `other` | ||
*currentParameterIt = parameterToCopy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I just realized, does this create a dangling reference? How do I force a copy here so m_effectParameterPresets
takes ownership?
Does this suffice?
// overwrite our parameter by taking a copy of the same parameter from `other` | |
*currentParameterIt = parameterToCopy; | |
// overwrite our parameter by taking a copy of the same parameter from `other` | |
*currentParameterIt = EffectParameterPreset(parameterToCopy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the proposed version is redundant because the copy constructor is already used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking more about it, I'm pretty sure its the copy-assignment operator, so we should be good then.
This seems like a reasonable solution. |
5e30520
to
2188d7f
Compare
2188d7f
to
9b5c085
Compare
9b5c085
to
ac766af
Compare
ac766af
to
1f46f97
Compare
Friendly ping. Also, are we concerned about the |
Oh thank you for the reminder. This has slipped through. |
src/effects/presets/effectpreset.cpp
Outdated
DEBUG_ASSERT(backendType() == other.backendType()); | ||
|
||
// technically algorithmically inefficient solution O(n²). May be | ||
// optimizable by sorting first, gains depend on parameter count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the best way would be to make m_effectParameterPresets a QHash.
Than the std::find_if becomes a fast:
auto currentParameterIt = m_effectParameterPresets.find(parameterToCopy.id());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify? Do you mean that we change m_effectParameterPresets
to be a QHash instead of a QList
? That won't work because we need to preserve the ordering of m_effectParameterPresets
. What would work though is if we just built a temporary QHash on each call. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks already good. Do you have interest to interest to implement the suggestion?
Or should I merge this now? Than an updated comment would be nice.
I'd like to address the complexity issue first. |
Oh, yes. I have just realized that this does not work, because a stored custom sort order is lost. |
d1de41a
to
41d03d2
Compare
Tested and ready for review. I think the new code is even simpler. |
@daschuer merge? I tried experimenting with parallel algorithms but we need to link intel tbb for that and I don't feel like bothering with that right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice Solution. LGTM thank you.
fixes #10834