Bug 28835

Summary: [Haiku] Correction of native image creating.
Product: WebKit Reporter: Maxime Simon <simon.maxime>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Major CC: eric, pkasting, superstippi
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Other   
Attachments:
Description Flags
Patch v1 eric: review-

Maxime Simon
Reported 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.
Attachments
Patch v1 (1.58 KB, patch)
2009-08-30 08:19 PDT, Maxime Simon
eric: review-
Maxime Simon
Comment 1 2009-08-30 08:19:37 PDT
Created attachment 38792 [details] Patch v1
Eric Seidel (no email)
Comment 2 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?
Maxime Simon
Comment 3 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
Stephan Aßmus
Comment 4 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.
Peter Kasting
Comment 5 2010-02-18 10:49:38 PST
Closing per comment 4.
Note You need to log in before you can comment on or make changes to this bug.