Opened 7 years ago

Closed 15 months ago

Last modified 15 months ago

#3995 closed defect (fixed)

[MSW] Masks mirrored in RTL

Reported by: xeee Owned by: vadz
Priority: normal Milestone:
Component: wxMSW Version: stable-latest
Keywords: RTL Cc: xeee
Blocked By: Blocking:
Patch: no

Description

When I run the contrib editlbox sample in RTL mode, the button images don't look right, after some investigation I found out that masks are mirrored horizontally, unfortunately I'm not experienced with GDI, I really spent a lot of time trying to fix this bug but I couldn't.
I don't know whether the bug happens with anything else, but I assume it does, at least with other XPM images, I'm not sure that it's MSW-only, but I assume so.

If someone guides me in the right direction, I'm ready to put more effort trying to solve this bug.

you can find images of the sample in both RTL and LTR mode.

Attachments (2)

editlbox_rtl_ltr.png download (12.0 KB) - added by xeee 7 years ago.
RTL to the left, LTR to the right.
test3995_minimal.diff download (1.9 KB) - added by catalin 15 months ago.

Download all attachments as: .zip

Change History (9)

Changed 7 years ago by xeee

RTL to the left, LTR to the right.

comment:1 Changed 6 years ago by wojdyr

  • Component set to wxMSW
  • Keywords RTL added

comment:2 Changed 15 months ago by catalin

This one (using "contrib editlbox sample") is most probably not about wxW sources.

comment:3 Changed 15 months ago by vadz

It is, this contrib was moved into wx itself, see source:wxWidgets/trunk/include/wx/editlbox.h.

The problem here is that I thought bitmaps were supposed to be mirrored in RTL, so I'm not sure if the problem is that the masks are mirrored or that bitmaps themselves are not...

Changed 15 months ago by catalin

comment:4 Changed 15 months ago by catalin

  • Status changed from new to confirmed
  • Version set to 2.9-svn

AFAICS in wxW the bitmaps are not rotated for RTL layout. Nor are they in Firefox, Opera, LibreOffice.
The problem here looks like it is with the mask. If the drawing is done without using the mask (in wxAnyButton::MSWOnDraw), the results are identical.
Test patch attached.

comment:5 Changed 15 months ago by vadz

  • Owner set to vadz
  • Status changed from confirmed to accepted

Thanks for debugging, I've fixed this locally (the bug is at wxDC level, we don't use the same layout for the temporary memory HDC we create as for the main one) but while doing it I found #15031 so it's not like RTL is usable in wxMSW currently :-(

comment:6 Changed 15 months ago by VZ

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [73484]) Fix drawing of bitmaps with masks in mirrored wxDC.

The mask must be mirrored in the same way as the main bitmap itself (currently
it's not mirrored at all but this could change in the future), so create the
temporary memory HDC with the same layout as is used by the main HDC.

Closes #3995.

comment:7 Changed 15 months ago by VZ

(In [73488]) Don't call ::GetLayout() in wxMSW code directly.

Use wxMSW::GetLayout() wrapper to avoid directly binding to a function not
present in old Windows versions and also to fix linking errors with MinGW
after the changes of r73484.

See #3995.

Note: See TracTickets for help on using tickets.