https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6b692020160ae9a925af9ae0b73f31229a107863

commit 6b692020160ae9a925af9ae0b73f31229a107863
Author:     Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
AuthorDate: Sat Sep 9 20:20:22 2023 +0900
Commit:     GitHub <nore...@github.com>
CommitDate: Sat Sep 9 20:20:22 2023 +0900

    [ATL] CImage: Simplify GetBits/GetPixelAddress (#5671)
    
    CORE-19008
---
 sdk/lib/atl/atlimage.h | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/sdk/lib/atl/atlimage.h b/sdk/lib/atl/atlimage.h
index 84bfe64fc76..874ef0f60e8 100644
--- a/sdk/lib/atl/atlimage.h
+++ b/sdk/lib/atl/atlimage.h
@@ -285,13 +285,7 @@ public:
 
     const void *GetBits() const noexcept
     {
-        ATLASSERT(IsDIBSection());
-        const BYTE *pb = (const BYTE *)m_bm.bmBits;
-        if (m_eOrientation == DIBOR_BOTTOMUP)
-        {
-            pb += m_bm.bmWidthBytes * (m_bm.bmHeight - 1);
-        }
-        return pb;
+        return const_cast<CImage*>(this)->GetBits();
     }
 
     int GetBPP() const noexcept
@@ -363,11 +357,7 @@ public:
 
     const void* GetPixelAddress(int x, int y) const noexcept
     {
-        ATLASSERT(IsDIBSection());
-        const BYTE *pb = (const BYTE *)GetBits();
-        pb += GetPitch() * y;
-        pb += (GetBPP() * x) / 8;
-        return pb;
+        return const_cast<CImage*>(this)->GetPixelAddress(x, y);
     }
 
     COLORREF GetTransparentColor() const noexcept

Reply via email to