[Webkit-unassigned] [Bug 43724] Support all available biBitCount values in BitmapInfo

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 16 07:41:37 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=43724


Adam Roben (aroben) <aroben at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #63902|review?, commit-queue?      |review+, commit-queue-
               Flag|                            |




--- Comment #2 from Adam Roben (aroben) <aroben at apple.com>  2010-08-16 07:41:37 PST ---
(From update of attachment 63902)
>  BitmapInfo bitmapInfoForSize(int width, int height, WORD bitCount)
>  {
> -    ASSERT_ARG(bitCount, bitCount == 16 || bitCount == 32);
> +    ASSERT_ARG(bitCount, bitCount == 1 || bitCount == 4 || bitCount == 8 || bitCount == 16 || bitCount == 24 || bitCount == 32);

Maybe an enum would be better for the bitCount parameter?

> @@ -43,11 +43,6 @@ BitmapInfo bitmapInfoForSize(int width, 
>      bitmapInfo.bmiHeader.biPlanes        = 1;
>      bitmapInfo.bmiHeader.biBitCount      = bitCount;
>      bitmapInfo.bmiHeader.biCompression   = BI_RGB;
> -    bitmapInfo.bmiHeader.biSizeImage     = 0;
> -    bitmapInfo.bmiHeader.biXPelsPerMeter = 0;
> -    bitmapInfo.bmiHeader.biYPelsPerMeter = 0;
> -    bitmapInfo.bmiHeader.biClrUsed       = 0;
> -    bitmapInfo.bmiHeader.biClrImportant  = 0;

Please explain this change in the ChangeLog just as you did in an earlier comment in this bug.
> @@ -44,10 +44,12 @@ struct BitmapInfo : public BITMAPINFO {
>      unsigned width() const { return abs(bmiHeader.biWidth); }
>      unsigned height() const { return abs(bmiHeader.biHeight); }
>      IntSize size() const { return IntSize(width(), height()); }
> -    unsigned paddedWidth() const { return is16bit() ? (width() + 1) & ~0x1 : width(); }
> +    unsigned bytesPerLine() const { return (width() * bmiHeader.biBitCount + 7) / 8; }
> +    unsigned paddedBytesPerLine() const { return (bytesPerLine() + 3) & ~0x3; }
> +    unsigned paddedWidth() const { return paddedBytesPerLine() * 8 / bmiHeader.biBitCount; }
>      unsigned numPixels() const { return paddedWidth() * height(); }
> -    unsigned paddedBytesPerLine() const { return is16bit() ? paddedWidth() * 2 : width() * 4; }
> -    unsigned bytesPerLine() const { return width() * bmiHeader.biBitCount / 8; }};

How will someone know whether they should call width() or paddedWidth()? (Ditto for the other functions.)

r=me

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list