diff options
author | Steve Block <steveblock@google.com> | 2010-08-27 11:02:25 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-09-02 17:17:20 +0100 |
commit | e8b154fd68f9b33be40a3590e58347f353835f5c (patch) | |
tree | 0733ce26384183245aaa5656af26c653636fe6c1 /WebCore/platform/win/BitmapInfo.h | |
parent | da56157816334089526a7a115a85fd85a6e9a1dc (diff) | |
download | external_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.zip external_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.tar.gz external_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.tar.bz2 |
Merge WebKit at r66079 : Initial merge by git
Change-Id: Ie2e1440fb9d487d24e52c247342c076fecaecac7
Diffstat (limited to 'WebCore/platform/win/BitmapInfo.h')
-rw-r--r-- | WebCore/platform/win/BitmapInfo.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/WebCore/platform/win/BitmapInfo.h b/WebCore/platform/win/BitmapInfo.h index d1c3319..caf1b31 100644 --- a/WebCore/platform/win/BitmapInfo.h +++ b/WebCore/platform/win/BitmapInfo.h @@ -35,19 +35,30 @@ namespace WebCore { struct BitmapInfo : public BITMAPINFO { + enum BitCount { + BitCount1 = 1, + BitCount4 = 4, + BitCount8 = 8, + BitCount16 = 16, + BitCount24 = 24, + BitCount32 = 32 + }; + BitmapInfo(); - static BitmapInfo create(const IntSize&, WORD bitCount = 32); - static BitmapInfo createBottomUp(const IntSize&, WORD bitCount = 32); + static BitmapInfo create(const IntSize&, BitCount bitCount = BitCount32); + static BitmapInfo createBottomUp(const IntSize&, BitCount bitCount = BitCount32); bool is16bit() const { return bmiHeader.biBitCount == 16; } bool is32bit() const { return bmiHeader.biBitCount == 32; } 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; }}; +}; + } // namespace WebCore #endif // BitmapInfo_h |