From 9ac41a3c9d67627f00f16d8a32082f3114fe0225 Mon Sep 17 00:00:00 2001 From: jief Date: Tue, 25 Feb 2020 23:57:23 +0300 Subject: [PATCH] Added const in XImage --- rEFIt_UEFI/libeg/XImage.cpp | 13 +++++++------ rEFIt_UEFI/libeg/XImage.h | 12 ++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/rEFIt_UEFI/libeg/XImage.cpp b/rEFIt_UEFI/libeg/XImage.cpp index f26686ce5..be5f5014a 100644 --- a/rEFIt_UEFI/libeg/XImage.cpp +++ b/rEFIt_UEFI/libeg/XImage.cpp @@ -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(); diff --git a/rEFIt_UEFI/libeg/XImage.h b/rEFIt_UEFI/libeg/XImage.h index e549a2fa0..d82c98ab2 100644 --- a/rEFIt_UEFI/libeg/XImage.h +++ b/rEFIt_UEFI/libeg/XImage.h @@ -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 /* @@ -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__