-
-
Notifications
You must be signed in to change notification settings - Fork 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
Server: fix label opacity when OPACITIES is set #53438
Server: fix label opacity when OPACITIES is set #53438
Conversation
ebcdb86
to
b396f11
Compare
This is used to change the labeling opacity in the server.
c4b8af6
to
a7c803e
Compare
image.save('/tmp/img.png') | ||
# Text | ||
self.assertEqual(image.pixelColor(105, 84).name(), '#5f5f5f') | ||
# Buffer | ||
self.assertEqual(image.pixelColor(92, 84).name(), '#bfbfbf') | ||
# Shadow | ||
self.assertEqual(image.pixelColor(169, 136).name(), '#f0f0f0') |
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.
could we use the standard render checker approach here? I'm concerned that these tests will be tricky to debug if they start failing in future (eg due to qt rendering changes)
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 was hoping to skip the mask dance and spare a few hours. This kind of test is much more robust and less prone to false negatives because by checking a pixel in the middle of the rendered object there is no way that aliasing and other small rendering differences will step in the way.
I agree that if that fails it could be harder to visually inspect the differences.
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.
there is no way that aliasing and other small rendering differences will step in the way.
That sounds reasonable in theory, but I've seen numerous times were a Qt update has changed something in how qt handles alpha composition resulting in different overlaid color results 🙃
@@ -56,6 +57,7 @@ class QgsLayerRestorer | |||
{ | |||
QString name; | |||
double mOpacity; | |||
QgsAbstractVectorLayerLabeling *mLabeling = nullptr; |
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.
unique ptr?
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.
This is tricky, because the settings struct is copied.
Technically the settings never owns the resource, it just keeps it for the duration of its lifetime and transfers it back to the layer when the destructor is called.
Also , the struct is private and it's not exposed to API, given the (non-copyable) complications of turning this into a unique_ptr I'd rather not follow your advice.
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.
BTW here is an attempt: ae23847
Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
ping @rldhont @pblottiere can you please review so that I can merge in time for the next release ? |
The backport to
stderr
stdout
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-queued_ltr_backports queued_ltr_backports
# Navigate to the new working tree
cd .worktrees/backport-queued_ltr_backports
# Create a new branch
git switch --create backport-53438-to-queued_ltr_backports
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick fb427d17dff9f88e03eda60ce4eaf8a27f7c97ed,a7c803e6c0b8fe30e8fa84917168cbdd532e236a,b9ce813edd027cae7da3d5d7d2a8f19683a6e44d,b1b8fb8e159775c378ce94ab7099a24573cfd3ed,9a81957d3927b1ce899582e22c3afec583f9597c,ae23847c5998208d22343ef89bb0b8dbbaa8fe14,7b89a398f73375cc948962bb34440743814b06b9
# Push it to GitHub
git push --set-upstream origin backport-53438-to-queued_ltr_backports
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-queued_ltr_backports Then, create a pull request where the |
Fix #48020
Implement multiplyOpacity() for QgsTextFormat and use it to alter labeling opacity during server rendering.