mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-27 12:15:19 +01:00
Fix XImage assignment operator in case other is empty.
This commit is contained in:
parent
35103e3126
commit
cdf5913c24
@ -59,10 +59,13 @@ EFI_STATUS XImage::FromEGImage(const EG_IMAGE* egImage)
|
||||
|
||||
XImage& XImage::operator= (const XImage& other)
|
||||
{
|
||||
// Width = other.GetWidth();
|
||||
// Height = other.GetHeight();
|
||||
// &other.PixelData[0] won't work if other is empty. So we check.
|
||||
if ( other.isEmpty() ) {
|
||||
setEmpty();
|
||||
}else{
|
||||
setSizeInPixels(other.GetWidth(), other.GetHeight()); // change the size, ie the number of element in the array. Reaalocate buffer if needed
|
||||
CopyMem(&PixelData[0], &other.PixelData[0], GetSizeInBytes());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user