summaryrefslogtreecommitdiffstats
path: root/ue2/imgsynth2/cpixelformat_bgr555.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ue2/imgsynth2/cpixelformat_bgr555.cpp')
-rw-r--r--ue2/imgsynth2/cpixelformat_bgr555.cpp14
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())