diff options
| author | manuel <manuel@nc8430.lan> | 2009-05-02 16:44:53 +0200 |
|---|---|---|
| committer | manuel <manuel@nc8430.lan> | 2009-05-02 16:44:53 +0200 |
| commit | bcadfa267f976fe9f29afa50a635cbe3ea174e38 (patch) | |
| tree | b069a34c9d100dcc9229311b47cbfa0697ee7fc9 /ue2/imgsynth2/cpixelformat_bgr555.cpp | |
| parent | bca08c6de2b156cbec90944c809e5e7faecd231d (diff) | |
| download | ooprog-bcadfa267f976fe9f29afa50a635cbe3ea174e38.tar.gz ooprog-bcadfa267f976fe9f29afa50a635cbe3ea174e38.tar.bz2 ooprog-bcadfa267f976fe9f29afa50a635cbe3ea174e38.zip | |
- colortable now uses uint32_t as identifier
- rewrote xpm colortable parsing to convert their identifiers to our own and vica vi
- implemented indexed8::setpixel/getpixel
- moved rowsize to member variable in cbitmap
- added second test for xpm/indexed8
Diffstat (limited to 'ue2/imgsynth2/cpixelformat_bgr555.cpp')
| -rw-r--r-- | ue2/imgsynth2/cpixelformat_bgr555.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/ue2/imgsynth2/cpixelformat_bgr555.cpp b/ue2/imgsynth2/cpixelformat_bgr555.cpp index 2f98cc7..657c148 100644 --- a/ue2/imgsynth2/cpixelformat_bgr555.cpp +++ b/ue2/imgsynth2/cpixelformat_bgr555.cpp | |||
| @@ -17,15 +17,10 @@ void CPixelFormat_BGR555::getPixel(RGBPIXEL& pixel, uint32_t x, uint32_t y) | |||
| 17 | if (m_bitmap->getPixelData() == NULL) | 17 | if (m_bitmap->getPixelData() == NULL) |
| 18 | throw PixelFormatError("No pixelbuffer allocated."); | 18 | throw PixelFormatError("No pixelbuffer allocated."); |
| 19 | 19 | ||
| 20 | /* calc rowsize - boundary is 32 */ | ||
| 21 | uint32_t rowsize = 4 * static_cast<uint32_t>( | ||
| 22 | ((getBitCount() * m_bitmap->getWidth()) + 31) / 32 | ||
| 23 | ); | ||
| 24 | |||
| 25 | /* if the y-coordinates are mirrored */ | 20 | /* if the y-coordinates are mirrored */ |
| 26 | if (m_bitmap->isMirrored()) | 21 | if (m_bitmap->isMirrored()) |
| 27 | y = m_bitmap->getHeight() - y - 1; | 22 | y = m_bitmap->getHeight() - y - 1; |
| 28 | uint32_t offset = y * rowsize + x * (4 * getBitCount() / 32); | 23 | uint32_t offset = y * m_bitmap->getRowSize() + x * (4 * getBitCount() / 32); |
| 29 | 24 | ||
| 30 | /* boundary check */ | 25 | /* boundary check */ |
| 31 | if (offset + getBitCount()/8 > m_bitmap->getPixelDataSize()) | 26 | if (offset + getBitCount()/8 > m_bitmap->getPixelDataSize()) |
| @@ -45,15 +40,10 @@ void CPixelFormat_BGR555::setPixel(const RGBPIXEL& pixel, uint32_t x, uint32_t y | |||
| 45 | if (m_bitmap->getPixelData() == NULL) | 40 | if (m_bitmap->getPixelData() == NULL) |
| 46 | throw PixelFormatError("No pixelbuffer allocated."); | 41 | throw PixelFormatError("No pixelbuffer allocated."); |
| 47 | 42 | ||
| 48 | /* calc rowsize - boundary is 32 */ | ||
| 49 | uint32_t rowsize = 4 * static_cast<uint32_t>( | ||
| 50 | ((getBitCount() * m_bitmap->getWidth()) + 31) / 32 | ||
| 51 | ); | ||
| 52 | |||
| 53 | /* if the y-coordinates are mirrored */ | 43 | /* if the y-coordinates are mirrored */ |
| 54 | if (m_bitmap->isMirrored()) | 44 | if (m_bitmap->isMirrored()) |
| 55 | y = m_bitmap->getHeight() - y - 1; | 45 | y = m_bitmap->getHeight() - y - 1; |
| 56 | uint32_t offset = y * rowsize + x * (4 * getBitCount() / 32); | 46 | uint32_t offset = y * m_bitmap->getRowSize() + x * (4 * getBitCount() / 32); |
| 57 | 47 | ||
| 58 | /* boundary check */ | 48 | /* boundary check */ |
| 59 | if (offset + getBitCount()/8 > m_bitmap->getPixelDataSize()) | 49 | if (offset + getBitCount()/8 > m_bitmap->getPixelDataSize()) |
