Added const in XImage

This commit is contained in:
jief 2020-02-25 23:57:23 +03:00
parent a0b40c06dc
commit 9ac41a3c9d
2 changed files with 13 additions and 12 deletions

View File

@ -21,22 +21,22 @@ XImage::~XImage()
Xfree(PixelData);
}
EFI_GRAPHICS_OUTPUT_BLT_PIXEL* XImage::GetData()
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL* XImage::GetData() const
{
return PixelData;
}
UINTN XImage::GetWidth()
UINTN XImage::GetWidth() const
{
return Width;
}
UINTN XImage::GetHeight()
UINTN XImage::GetHeight() const
{
return Height;
}
UINTN XImage::GetSize()
UINTN XImage::GetSize() const
{
return Width * Height * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
}
@ -59,13 +59,14 @@ void XImage::FillArea(EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color, const EgRect& Rect)
void XImage::Compose(int PosX, int PosY, XImage& TopImage, bool Lowest) //lowest image is opaque
void XImage::Compose(int PosX, int PosY, const XImage& TopImage, bool Lowest) //lowest image is opaque
{
UINT32 TopAlpha;
UINT32 RevAlpha;
UINT32 FinalAlpha;
UINT32 Temp;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *TopPtr, *CompPtr;
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL *TopPtr;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *CompPtr;
for (UINTN y = PosY; y < Height && (y - PosY) < TopImage.GetHeight(); y++) {
TopPtr = TopImage.GetData();

View File

@ -5,7 +5,7 @@ This class will replace EG_IMAGE structure and methods
#if !defined(__XSTRINGW_H__)
#define __XSTRINGW_H__
#include "XToolsCommon.h"
#include "../cpp_foundation/XToolsCommon.h"
#include <Platform.h>
/*
@ -44,17 +44,17 @@ public:
~XImage();
protected:
UINTN GetSize(); //in bytes
UINTN GetSize() const; //in bytes
public:
EFI_GRAPHICS_OUTPUT_BLT_PIXEL* GetData();
UINTN GetWidth();
UINTN GetHeight();
const EFI_GRAPHICS_OUTPUT_BLT_PIXEL* GetData() const;
UINTN GetWidth() const;
UINTN GetHeight() const;
void Fill(EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color = { 0, 0, 0, 0 });
void FillArea(EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color, const EgRect& Rect);
void Compose(int PosX, int PosY, XImage& TopImage, bool Lowest);
void Compose(int PosX, int PosY, const XImage& TopImage, bool Lowest);
};
#endif //__XSTRINGW_H__