diff options
Diffstat (limited to 'WebCore/platform/win/BitmapInfo.h')
-rw-r--r-- | WebCore/platform/win/BitmapInfo.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/WebCore/platform/win/BitmapInfo.h b/WebCore/platform/win/BitmapInfo.h index 0127fdb..d1c3319 100644 --- a/WebCore/platform/win/BitmapInfo.h +++ b/WebCore/platform/win/BitmapInfo.h @@ -1,6 +1,8 @@ /* * Copyright (C) 2009 Apple Inc. All Rights Reserved. * Copyright (C) 2009 Brent Fulgham + * Copyright (C) 2007-2009 Torch Mobile, Inc. All Rights Reserved. + * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,17 +29,25 @@ #ifndef BitmapInfo_h #define BitmapInfo_h -#include <windows.h> #include "IntSize.h" +#include <windows.h> namespace WebCore { struct BitmapInfo : public BITMAPINFO { - BitmapInfo (); - static BitmapInfo create(const IntSize&); - static BitmapInfo createBottomUp(const IntSize&); -}; + BitmapInfo(); + static BitmapInfo create(const IntSize&, WORD bitCount = 32); + static BitmapInfo createBottomUp(const IntSize&, WORD bitCount = 32); + 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 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 |