Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#369 closed bug (fixed)

BMP Translator. The alpha value is lost.

Reported by: bxi07354@… Owned by: marcusoverhagen
Priority: normal Milestone: R1
Component: Applications Version:
Keywords: Cc: diver
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

BMPTranslator.cpp

translate_from_bmpnpal_to_bits()

for (uint32 i = 0; i < msheader.width; i++) {

  • memcpy(pBitsPixel, pBmpPixel, 3);

+ memcpy(pBitsPixel, pBmpPixel, bmpBytesPerPixel);

pBitsPixel += 4; pBmpPixel += bmpBytesPerPixel;

}

Attachments (2)

aaa.png (21.5 KB) - added by bxi07354@… 13 years ago.
sample image preferences/menu CTL and ALT
menu.3.png (32.5 KB) - added by bxi07354@… 13 years ago.
BBitmap dump

Download all attachments as: .zip

Change History (15)

comment:1 Changed 13 years ago by jackburton

Can somebody look into this ? I am not really into that kind of stuff...

comment:2 Changed 13 years ago by jackburton

Summary: BMP Translator. The alpha value is lost. BMP Translator. The alpha value is lost.

comment:3 Changed 13 years ago by jackburton

BTW, translate_from_bmppal_to_bits() seems to be broken in a similar way

comment:4 Changed 13 years ago by jackburton

Could this also be the cause of #219 ?

Changed 13 years ago by bxi07354@…

Attachment: aaa.png added

sample image preferences/menu CTL and ALT

Changed 13 years ago by bxi07354@…

Attachment: menu.3.png added

BBitmap dump

comment:5 Changed 13 years ago by marcusoverhagen

Owner: changed from sikosis to marcusoverhagen

comment:6 Changed 13 years ago by marcusoverhagen

Status: newassigned

comment:7 Changed 13 years ago by marcusoverhagen

I'll try to fix that

comment:8 Changed 13 years ago by diver

Cc: diver added

comment:9 Changed 13 years ago by stippi

I'm just looking at the BMP translator right now and it is really poorly written with regards ot performance. memcpy(..., ..., 3) in the innermost loop everywhere. That's really bad. I've also come across clearing out the destination buffer with zeros and then filling it with pixel data in the next loop. Completely unnecessary.If the translator returns B_RGB32, then it is not expected to set the last byte (alpha), but if it is returning B_RGBA32, then it is expected to write alpha.I don't know enough about BMP to know if it actually supports alpha (but I would assume it does). The translator needs a complete overhaul.

comment:10 Changed 13 years ago by jackburton

Looks like this bug has been fixed. At least the Menu app shows its bitmaps correctly.

comment:11 Changed 13 years ago by bxi07354@…

Thanks. It became beautiful.

It is anxious for a moment. translate_from_bits_to_bmp24() {

.....

if (fromspace == B_CMAP8) {

pmap = system_colors();

  • if (!pmap)

+ if (!pmap) { + delete[] bmpRowData; + delete[] bitsRowData

return B_ERROR;

+ }

}

comment:12 Changed 13 years ago by bxi07354@…

Resolution: fixed

comment:13 Changed 13 years ago by bxi07354@…

Status: assignedclosed
Note: See TracTickets for help on using tickets.