Opened 14 years ago

Closed 14 years ago

Last modified 14 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@… 14 years ago.
sample image preferences/menu CTL and ALT
menu.3.png (32.5 KB ) - added by bxi07354@… 14 years ago.
BBitmap dump

Download all attachments as: .zip

Change History (15)

comment:1 by jackburton, 14 years ago

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

comment:2 by jackburton, 14 years ago

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

comment:3 by jackburton, 14 years ago

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

comment:4 by jackburton, 14 years ago

Could this also be the cause of #219 ?

by bxi07354@…, 14 years ago

Attachment: aaa.png added

sample image preferences/menu CTL and ALT

by bxi07354@…, 14 years ago

Attachment: menu.3.png added

BBitmap dump

comment:5 by marcusoverhagen, 14 years ago

Owner: changed from sikosis to marcusoverhagen

comment:6 by marcusoverhagen, 14 years ago

Status: newassigned

comment:7 by marcusoverhagen, 14 years ago

I'll try to fix that

comment:8 by diver, 14 years ago

Cc: diver added

comment:9 by stippi, 14 years ago

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 by jackburton, 14 years ago

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

comment:11 by bxi07354@…, 14 years ago

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 by bxi07354@…, 14 years ago

Resolution: fixed

comment:13 by bxi07354@…, 14 years ago

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