[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
{
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