mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
fb_generic: use parameters as const ref, catch possible dimension error
This commit is contained in:
@@ -258,7 +258,7 @@ unsigned int CFrameBuffer::getStride() const
|
||||
return stride;
|
||||
}
|
||||
|
||||
unsigned int CFrameBuffer::getScreenWidth(bool real)
|
||||
unsigned int CFrameBuffer::getScreenWidth(const bool& real) const
|
||||
{
|
||||
if(real)
|
||||
return xRes;
|
||||
@@ -266,7 +266,7 @@ unsigned int CFrameBuffer::getScreenWidth(bool real)
|
||||
return g_settings.screen_EndX - g_settings.screen_StartX;
|
||||
}
|
||||
|
||||
unsigned int CFrameBuffer::getScreenHeight(bool real)
|
||||
unsigned int CFrameBuffer::getScreenHeight(const bool& real) const
|
||||
{
|
||||
if(real)
|
||||
return yRes;
|
||||
@@ -1528,11 +1528,17 @@ void CFrameBuffer::SaveScreen(int x, int y, int dx, int dy, fb_pixel_t * const m
|
||||
|
||||
}
|
||||
|
||||
void CFrameBuffer::RestoreScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp)
|
||||
void CFrameBuffer::RestoreScreen(const int& x, const int& y, const int& dx, const int& dy, fb_pixel_t * const memp)
|
||||
{
|
||||
if (!getActive())
|
||||
return;
|
||||
|
||||
if (dx > xRes || dy > yRes)
|
||||
{
|
||||
dprintf(DEBUG_NORMAL, "\033[31m[CFrameBuffer]\[%s - %d], dimension error dx [%d] dy [%d] \033[0m\n", __func__, __LINE__, dx, dy);
|
||||
return;
|
||||
}
|
||||
|
||||
checkFbArea(x, y, dx, dy, true);
|
||||
fb_pixel_t * fbpos = getFrameBufferPointer() + x + swidth * y;
|
||||
fb_pixel_t * bkpos = memp;
|
||||
@@ -1832,7 +1838,7 @@ void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32
|
||||
}
|
||||
}
|
||||
|
||||
void CFrameBuffer::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff)
|
||||
void CFrameBuffer::blitBox2FB(const fb_pixel_t* boxBuf, const uint32_t& width, const uint32_t& height, const uint32_t& xoff, const uint32_t& yoff)
|
||||
{
|
||||
if(width <1 || height <1 || !boxBuf )
|
||||
return;
|
||||
|
@@ -184,8 +184,8 @@ class CFrameBuffer : public sigc::trackable
|
||||
fb_pixel_t * getFrameBufferPointer() const; // pointer to framebuffer
|
||||
virtual fb_pixel_t * getBackBufferPointer() const; // pointer to backbuffer
|
||||
virtual unsigned int getStride() const; // size of a single line in the framebuffer (in bytes)
|
||||
unsigned int getScreenWidth(bool real = false);
|
||||
unsigned int getScreenHeight(bool real = false);
|
||||
unsigned int getScreenWidth(const bool& real = false) const;
|
||||
unsigned int getScreenHeight(const bool& real = false) const;
|
||||
unsigned int getWindowWidth(bool force_small = false);
|
||||
unsigned int getWindowHeight(bool force_small = false);
|
||||
unsigned int getScreenX();
|
||||
@@ -263,7 +263,7 @@ class CFrameBuffer : public sigc::trackable
|
||||
void paintBackground();
|
||||
|
||||
void SaveScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp);
|
||||
void RestoreScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp);
|
||||
void RestoreScreen(const int& x, const int& y, const int& dx, const int& dy, fb_pixel_t * const memp);
|
||||
|
||||
void Clear();
|
||||
|
||||
@@ -286,7 +286,7 @@ class CFrameBuffer : public sigc::trackable
|
||||
void displayRGB(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs, bool clearfb = true, int transp = 0xFF);
|
||||
virtual void fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y);
|
||||
virtual void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false);
|
||||
virtual void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff);
|
||||
virtual void blitBox2FB(const fb_pixel_t* boxBuf, const uint32_t& width, const uint32_t& height, const uint32_t& xoff, const uint32_t& yoff);
|
||||
|
||||
virtual void mark(int x, int y, int dx, int dy);
|
||||
/* Remove this when pu/fb-setmode branch is merged to master */
|
||||
|
Reference in New Issue
Block a user