[kdecoration] properly compare opacity values
AbandonedPublic

Authored by zzag on Mar 31 2018, 9:26 PM.

Details

Reviewers
davidedmundson
Group Reviewers
Breeze

Diff Detail

Repository
R31 Breeze
Branch
properly-compare-opacity
Lint
No Linters Available
Unit
No Unit Test Coverage
zzag created this revision.Mar 31 2018, 9:26 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 31 2018, 9:26 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
zzag requested review of this revision.Mar 31 2018, 9:26 PM
broulik added a subscriber: broulik.Apr 1 2018, 5:50 PM

Why not use qFuzzyCompare?

zzag added a comment.EditedApr 1 2018, 5:55 PM

Why not use qFuzzyCompare?

Opacity can be 0. But, yeah, I could use it with the +1 trick(e.g. qFuzzyCompare(m_opacity + 1.0, value + 1.0)).

That's mostly a matter of choice, I guess.

PS. Please notice that checking absolute error is enough when comparing opacities.

davidedmundson requested changes to this revision.Apr 2 2018, 10:10 PM
davidedmundson added a subscriber: davidedmundson.

Whilst qFuzzyCompare is indeed needed for comparing a calculation with a value, it's not relevant in all cases, like this.

We want setOpacity(actually zero) to update m_opacity over setOpacity(something near zero) as it hypothetically changes QPainter paths which check for actual zero.

This revision now requires changes to proceed.Apr 2 2018, 10:10 PM
zzag abandoned this revision.Apr 3 2018, 1:17 AM

Whilst qFuzzyCompare is indeed needed for comparing a calculation with a value, it's not relevant in all cases, like this.

We want setOpacity(actually zero) to update m_opacity over setOpacity(something near zero) as it hypothetically changes QPainter paths which check for actual zero.

Oh, I see.