-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
prevent invalid cairo matrix in expose #18420
base: master
Are you sure you want to change the base?
Conversation
@@ -578,7 +578,7 @@ float dt_dev_get_zoom_scale(dt_dev_viewport_t *port, | |||
zoom_scale *= (float)darktable.develop->full.pipe->processed_width | |||
/ darktable.develop->preview_pipe->processed_width; | |||
|
|||
return zoom_scale; | |||
return zoom_scale ?: 1.0f; |
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.
Is that standard C? First time I see such construct? An empty section for ? means what? Return the zoom_scale here?
EDIT: Anyway, I think this should be avoided and we should be explicit.
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 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.
Is that standard C?
At least not ISO C before C2X
I don't understand the necessity of this check, line 575 already makes sure zoom_level
will be non-zero.
So, you assume that full.pipe->processed_width
can be zero under some circumstances?
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.
So, you assume that
full.pipe->processed_width
can be zero under some circumstances?
No, I'm not assuming.
preview_pipe
and full.pipe
get processed in separate threads so there are "race" conditions where one is set and the other isn't. That occasionally leads to a zero zoom_scale
and a divide by zero in the code that uses it. This used to go unnoticed because we created and threw away an intermediate cairo surface. But it gets flagged by gtk now.
I specifically asked for feedback from @ralfbrown since he made further changes touching this code since I last did any significant restructuring.
prevent cairo errors reported up the chain after darkroom expose
as reported here #18375 (comment)
Since we no longer throw away the cairo context when returning from expose (we used to copy into an extra intermediary buffer) these error conditions now persist.
@ralfbrown since you looked at this recently, do these make sense to you?