fb_generic: use parameters as const ref, catch possible dimension error

Origin commit data
------------------
Branch: ni/coolstream
Commit: 304b93955a
Author: Thilo Graf <dbt@novatux.de>
Date: 2019-11-09 (Sat, 09 Nov 2019)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
2019-11-09 12:07:41 +01:00
committed by vanhofen
parent 81a84841a0
commit 749b0d648c
2 changed files with 14 additions and 8 deletions

View File

@@ -253,7 +253,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;
@@ -261,7 +261,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;
@@ -1520,11 +1520,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;
@@ -1830,7 +1836,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;

View File

@@ -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, uint32_t unscaled_w = 0, uint32_t unscaled_h = 0); //NI
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 */