Bug 28835 - [Haiku] Correction of native image creating.
Summary: [Haiku] Correction of native image creating.
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Other
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-30 08:07 PDT by Maxime Simon
Modified: 2010-02-18 10:49 PST (History)
3 users (show)

See Also:


Attachments
Patch v1 (1.58 KB, patch)
2009-08-30 08:19 PDT, Maxime Simon
eric: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Simon 2009-08-30 08:07:28 PDT
In ImageDecoderHaiku.cpp, the RGBA32Buffer::asNewNativeImage() function doesn't correctly handle the creation of native images. Actually, we used the BBitmap::SetBits() method but the RGBA32 image in the buffer didn't have the same number of bytes per row as the defined constant B_RGBA32 in Haiku. So instead of using this handy method I made a memcpy of the buffer into the BBitmap with the correct number of bytes per row.
Comment 1 Maxime Simon 2009-08-30 08:19:37 PDT
Created attachment 38792 [details]
Patch v1
Comment 2 Eric Seidel (no email) 2009-08-31 03:04:54 PDT
Comment on attachment 38792 [details]
Patch v1

The ChangeLog really needs a clearer description of why you're doing this.  The code might benefit from similar comments.

I would probably have pre-computed the source and dest into nicely named locals first:
         memcpy(static_cast<uint8*>(bmp->Bits()) + y * bmp->BytesPerRow(),
 42                reinterpret_cast<const uint8*>(m_bytes.data()) + y * bytesPerRow, minBytesPerRow);

r- for an unclear ChangeLog.

How is the B_RGBA32 storage different from WebCore's?  Should we be using some sort of COMPILE_ASSERTs here to verify the current assumptions?
Comment 3 Maxime Simon 2009-08-31 03:27:12 PDT
(In reply to comment #2)
> r- for an unclear ChangeLog.
> 
> How is the B_RGBA32 storage different from WebCore's?  Should we be using some
> sort of COMPILE_ASSERTs here to verify the current assumptions?

Actually, the B_RGBA32 storage has a different bytes per row value.
I know this can be changed when creating a BBitmap, but unfortunately it only accepts a value greater than the one specficied by the storage (B_RGBA32 in this case). And that's not the case for WebCore's.

This results in images that appear as follows (if using BBitmap::Setbits()):
http://picasaweb.google.com/lh/photo/Ixx-Io8UeGY--fxhTROE1A
Comment 4 Stephan Aßmus 2010-02-18 00:54:48 PST
This bug is outdated and can be closed. A more complete patch which fixes the issue has been landed. The problem the patch above tried to fix rooted in the wrong rect conversion. Otherwise BBitmap::BytesPerRow() is 32 bit aligned, i.e. there is no difference to the WebCore internal image data storage in this regard.
Comment 5 Peter Kasting 2010-02-18 10:49:38 PST
Closing per comment 4.