Fix rubber band selection drawing contents misaligned with scaling
ClosedPublic

Authored by davidedmundson on Nov 23 2017, 11:36 PM.

Details

Summary

in drawPixmap(source, sourceRect) the source rect is in native pixels.

In this code the size was scaled by the DPR, but the location was not.
blendRect is the contents of a selection rectangle, offset from the
bounding darker blue rectangle. Hence we haven't really noticed.

This completely fixes the rectangle when the scale == 2.0/3.0

Some smaller artifacts remain on fractional scale factors, which is a
separate code bug with the same symptoms.

CCBUG: 386111

Diff Detail

Repository
R223 Okular
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Restricted Application added a project: Okular. · View Herald TranscriptNov 23 2017, 11:36 PM
Restricted Application added a subscriber: Okular. · View Herald Transcript
anthonyfieroni added a subscriber: anthonyfieroni.
anthonyfieroni added inline comments.
ui/pageview.cpp
1783

Are you sure there haven't parentheses over subtractions

rkflx added a subscriber: rkflx.Jan 19 2018, 1:00 AM

@davidedmundson Could you confirm/refute Anthony's concern?

(I might be willing to try the patch afterwards.)

sander added a subscriber: sander.Jan 19 2018, 11:07 AM

I tried the patch, and it did not fix 386111 for me. But I use fractional scaling, so maybe that's to be expected.

I also added the parentheses that one would expect in line 1708, but that didn't change anything.

Update to fix Anthony's well spotted comment

davidedmundson marked an inline comment as done.Mar 21 2018, 12:59 PM
rkflx accepted this revision.Mar 24 2018, 5:07 PM

Thanks David, I can confirm this stops the text from moving upon selection with the rectangle tool (Ctrl+3) for integer scaling factors. Code LGTM.

For the inline selection tool (Ctrl+4) as well as fractional scaling factors the issue remains, as you noted.

I'd say this can go to the stable branch.

This revision is now accepted and ready to land.Mar 24 2018, 5:07 PM
This revision was automatically updated to reflect the committed changes.