Summary: | [Haiku] Fix rect conversion and image rendering on Haiku | ||
---|---|---|---|
Product: | WebKit | Reporter: | Stephan Aßmus <superstippi> |
Component: | Platform | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | commit-queue, webkit.review.bot |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Other | ||
OS: | Other | ||
Attachments: |
Description
Stephan Aßmus
2010-02-06 13:58:54 PST
Created attachment 48296 [details] Fixes to the rect conversions and image rendering on Haiku Patch against r54275. Attachment 48296 [details] did not pass style-queue:
Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WebCore/platform/graphics/haiku/ImageHaiku.cpp:180: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5]
Total errors found: 1
If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 48297 [details]
Fixes to the rect conversions and image rendering on Haiku
Revised patch to please the style police. (I found it nicer to read before...)
Comment on attachment 48297 [details]
Fixes to the rect conversions and image rendering on Haiku
46 #include <stdio.h>
seems wrong.
This should be an OwnPtr:
BBitmap* bmp = new BBitmap(BRect(0, 0, width() - 1, height() - 1), 0,
38 B_RGBA32, bytesPerRow);
you can call .release() during return.
Comment on attachment 48297 [details] Fixes to the rect conversions and image rendering on Haiku Eric's comment plus these: > Index: WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp > NativeImagePtr RGBA32Buffer::asNewNativeImage() const > { > + int bytesPerRow = width() * sizeof(PixelData); > + BBitmap* bmp = new BBitmap(BRect(0, 0, width() - 1, height() - 1), 0, > + B_RGBA32, bytesPerRow); You don't need to wrap this line, but if you're going to do this, I think folks typically align with the enclosing paren. > + > + const uint8* src = reinterpret_cast<const uint8*>(m_bytes.data()); > + uint8* dst = reinterpret_cast<uint8*>(bmp->Bits()); In general WebKit, likes to avoid abbreviations. s/src/source/ s/dst/destination/ > + int h = height(); > + for (int y = 0; y < h; y++) { > + memcpy(dst, src, bytesPerRow); > + dst += bytesPerRow; > + src += bytesPerRow; Why doesn't this just do memcpy(dst, src, bytesPerRow * h); ? Created attachment 48521 [details]
Fixes to the rect conversions and image rendering on Haiku
New patch fixes the issues pointed out, but my code evolved to fix drawing pre-multiplied bitmaps.
Created attachment 48524 [details]
Fixes to the rect conversions and image rendering on Haiku
Patch properly created with "svn-create-patch", which adds the "namespaces". Sorry about that!
Created attachment 48526 [details]
Fixes to the rect conversions and image rendering on Haiku
Fixed patch, the old one didn't apply anymore because of the changes to AffineTransform.
Attachment 48526 [details] did not pass style-queue:
Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:51: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:52: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:53: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:54: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:55: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:56: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:57: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:58: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:59: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:60: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:61: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:62: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:63: Tab found; better to use spaces [whitespace/tab] [1]
Total errors found: 13
If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 48527 [details]
Fixes to the rect conversions and image rendering on Haiku
Renamed bpr -> bytesPerRow.
Attachment 48527 [details] did not pass style-queue:
Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:51: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:52: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:53: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:54: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:55: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:56: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:57: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:58: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:59: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:60: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:61: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:62: Tab found; better to use spaces [whitespace/tab] [1]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp:63: Tab found; better to use spaces [whitespace/tab] [1]
Total errors found: 13
If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 48528 [details]
Fixes to the rect conversions and image rendering on Haiku
Of course I forgot to replace tabs with spaces for the new code I added meanwhile. Really sorry for the noise!
Comment on attachment 48528 [details] Fixes to the rect conversions and image rendering on Haiku Clearing flags on attachment: 48528 Committed r54637: <http://trac.webkit.org/changeset/54637> All reviewed patches have been landed. Closing bug. |