Opened 4 years ago

Closed 4 years ago

#12343 closed defect (fixed)

[wxDFB] wxBitmap swaps R and B colours in certain situations

Reported by: alarsen Owned by: vadz
Priority: normal Milestone: 2.9.2
Component: wxDFB Version: stable-latest
Keywords: Cc: vaclavslavik
Blocked By: Blocking:
Patch: no

Description

wxBitmap displays with R and B colours swapped IFF the wxBitmap does NOT have an alpha channel, as can be demonstrated by the attached patch to the old wxDFB test-bitmap sample.

If the sample function LoadBitmap() is modified to not convert the bitmap to and from a wxImage, the leftmost image is shown with interchanged colours, otherwise it's the rightmost one that's displayed wrong.
If the body of DrawRedEffectsOnBitmap() is commented out completely, both images are displayed identically (as expected).

Text colours are always correct, only wxBitmaps get their colours swapped.

I'm using DirectFB c59be091ecbd83bfcc1535c934bbaf1305b5feac from Wed Jun 4 23:00:39 2008 +0200 plus a VT-switch patch from Vaclav;
the framebuffer is 240x320 RGB16.
(This used to work on an older system with an older DirectFB version; the problem manifests itself on new hardware with newer compiler (4.2.4 vs 3.4.4), newer Linux kernel/framebuffer driver, newer wxWidgets and newer DirectFB...)

Attachments (3)

testbitmap.cpp.diff download (1.1 KB) - added by alarsen 4 years ago.
Modification of testbitmap.cpp
testbitmap.cpp download (5.3 KB) - added by alarsen 4 years ago.
original sample
0001-Remove-the-BGR-RGB-conversion-from-Bop_rgb24_to_Aop.patch download (2.8 KB) - added by alarsen 4 years ago.
Patch against DirectFB git master

Download all attachments as: .zip

Change History (8)

Changed 4 years ago by alarsen

Modification of testbitmap.cpp

Changed 4 years ago by alarsen

original sample

comment:1 Changed 4 years ago by alarsen

  • Summary changed from wxBitmap swaps R and B colours in certain situations to [wxDFB] wxBitmap swaps R and B colours in certain situations

comment:2 follow-up: Changed 4 years ago by vaclavslavik

As far as I can tell, this is a bug in DirectFB -- the wx code looks innocent and I was able to reproduce the bug in pure DirectFB code. Removing Bop_rgb24_to_Aop_rgb16_LE() helps, presumably it didn't yet exist in the version that worked for you (see the details here: http://mail.directfb.org/pipermail/directfb-dev/2010-September/005820.html).

Changed 4 years ago by alarsen

Patch against DirectFB git master

comment:3 in reply to: ↑ 2 Changed 4 years ago by alarsen

Replying to vaclavslavik:
The attached patch 0001-Remove-the-BGR-RGB-conversion-from-Bop_rgb24_to_Aop.patch seems to solve my original wxBitmap problem.
Could you please check if the df_porter example behaves correctly with the patch applied before submitting it upstream?

BTW what exactly do you mean by "removing Bop_rgb24_to_Aop_rgb16_LE()"?

(Too bad your report didn't prompt more reaction upstream)

Thanks for looking into it!
Anders

comment:4 follow-up: Changed 4 years ago by vaclavslavik

Works for my pure-DFB example too, thanks! Will you submit your patch to DFB developers or should I?

comment:5 in reply to: ↑ 4 Changed 4 years ago by alarsen

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

Replying to vaclavslavik:

Will you submit your patch to DFB developers or should I?

Well, since you obviously already have posting rights to the DFB list...

Thanks again,
Anders

Note: See TracTickets for help on using tickets.