summaryrefslogtreecommitdiffstats
path: root/ue2/imgsynth2/cpixelformat_bgr24.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ue2/imgsynth2/cpixelformat_bgr24.cpp')
-rw-r--r--ue2/imgsynth2/cpixelformat_bgr24.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/ue2/imgsynth2/cpixelformat_bgr24.cpp b/ue2/imgsynth2/cpixelformat_bgr24.cpp
index e7476d7..bc95ab9 100644
--- a/ue2/imgsynth2/cpixelformat_bgr24.cpp
+++ b/ue2/imgsynth2/cpixelformat_bgr24.cpp
@@ -16,15 +16,10 @@ void CPixelFormat_BGR24::getPixel(RGBPIXEL& pixel, uint32_t x, uint32_t y)
16 if (m_bitmap->getPixelData() == NULL) 16 if (m_bitmap->getPixelData() == NULL)
17 throw PixelFormatError("No pixelbuffer allocated."); 17 throw PixelFormatError("No pixelbuffer allocated.");
18 18
19 /* calc rowsize - boundary is 32 */
20 uint32_t rowsize = 4 * static_cast<uint32_t>(
21 ((getBitCount() * m_bitmap->getWidth()) + 31) / 32
22 );
23
24 /* if the y-coordinates are mirrored */ 19 /* if the y-coordinates are mirrored */
25 if (m_bitmap->isMirrored()) 20 if (m_bitmap->isMirrored())
26 y = m_bitmap->getHeight() - y - 1; 21 y = m_bitmap->getHeight() - y - 1;
27 uint32_t offset = y * rowsize + x * (4 * getBitCount() / 32); 22 uint32_t offset = y * m_bitmap->getRowSize() + x * (4 * getBitCount() / 32);
28 23
29 /* boundary check */ 24 /* boundary check */
30 if (offset + getBitCount()/8 > m_bitmap->getPixelDataSize()) 25 if (offset + getBitCount()/8 > m_bitmap->getPixelDataSize())
@@ -43,15 +38,10 @@ void CPixelFormat_BGR24::setPixel(const RGBPIXEL& pixel, uint32_t x, uint32_t y)
43 if (m_bitmap->getPixelData() == NULL) 38 if (m_bitmap->getPixelData() == NULL)
44 throw PixelFormatError("No pixelbuffer allocated."); 39 throw PixelFormatError("No pixelbuffer allocated.");
45 40
46 /* calc rowsize - boundary is 32 */
47 uint32_t rowsize = 4 * static_cast<uint32_t>(
48 ((getBitCount() * m_bitmap->getWidth()) + 31) / 32
49 );
50
51 /* if the y-coordinates are mirrored */ 41 /* if the y-coordinates are mirrored */
52 if (m_bitmap->isMirrored()) 42 if (m_bitmap->isMirrored())
53 y = m_bitmap->getHeight() - y - 1; 43 y = m_bitmap->getHeight() - y - 1;
54 uint32_t offset = y * rowsize + x * (4 * getBitCount() / 32); 44 uint32_t offset = y * m_bitmap->getRowSize() + x * (4 * getBitCount() / 32);
55 45
56 /* boundary check */ 46 /* boundary check */
57 if (offset + getBitCount()/8 > m_bitmap->getPixelDataSize()) 47 if (offset + getBitCount()/8 > m_bitmap->getPixelDataSize())