[ATL] CImage: Simplify GetBits/GetPixelAddress (#5671)

CORE-19008
This commit is contained in:
Katayama Hirofumi MZ 2023-09-09 20:20:22 +09:00 committed by GitHub
parent 9666f00572
commit 6b69202016
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -285,13 +285,7 @@ public:
const void *GetBits() const noexcept const void *GetBits() const noexcept
{ {
ATLASSERT(IsDIBSection()); return const_cast<CImage*>(this)->GetBits();
const BYTE *pb = (const BYTE *)m_bm.bmBits;
if (m_eOrientation == DIBOR_BOTTOMUP)
{
pb += m_bm.bmWidthBytes * (m_bm.bmHeight - 1);
}
return pb;
} }
int GetBPP() const noexcept int GetBPP() const noexcept
@ -363,11 +357,7 @@ public:
const void* GetPixelAddress(int x, int y) const noexcept const void* GetPixelAddress(int x, int y) const noexcept
{ {
ATLASSERT(IsDIBSection()); return const_cast<CImage*>(this)->GetPixelAddress(x, y);
const BYTE *pb = (const BYTE *)GetBits();
pb += GetPitch() * y;
pb += (GetBPP() * x) / 8;
return pb;
} }
COLORREF GetTransparentColor() const noexcept COLORREF GetTransparentColor() const noexcept