mirror of
https://github.com/eclipse/upm.git
synced 2025-07-08 12:51:18 +03:00
lol: Added exception when invalid argument is passed to method
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
fcb36276b7
commit
500e14663b
@ -168,20 +168,22 @@ unsigned char* LoL::getFramebuffer() {
|
||||
return framebuffer;
|
||||
}
|
||||
|
||||
unsigned char LoL::setPixel(int x, int y, unsigned char pixel)
|
||||
void LoL::setPixel(int x, int y, bool pixel)
|
||||
{
|
||||
if (x < 0 || y < 0 || x >= LOL_X || y >= LOL_Y)
|
||||
return -1;
|
||||
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||
": pixel coordinates out of bounds");
|
||||
|
||||
framebuffer[x + LOL_X*y] = (pixel == 0) ? 0 : 1;
|
||||
return 0;
|
||||
framebuffer[x + LOL_X*y] = (pixel) ? 1 : 0;
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char LoL::getPixel(int x, int y)
|
||||
bool LoL::getPixel(int x, int y)
|
||||
{
|
||||
if (x < 0 || y < 0 || x >= LOL_X || y >= LOL_Y)
|
||||
return -1;
|
||||
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||
": pixel coordinates out of bounds");
|
||||
|
||||
return (framebuffer[x + LOL_X*y] == 0) ? 0 : 1;
|
||||
return (framebuffer[x + LOL_X*y] == 0) ? false : true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user