Revert: "Cleanup: Give SetDirtyBlocks a more descriptive name."

This reverts commit 8652a4db76.
This is necessary to aid in the cherry-picking of commits from JGRPP.
This commit is contained in:
TechGeekNZ
2020-06-12 09:34:34 +12:00
parent b84d61ef6e
commit c9abf6ade6
6 changed files with 15 additions and 24 deletions

View File

@@ -1416,16 +1416,6 @@ void DrawMouseCursor()
_cursor.dirty = false; _cursor.dirty = false;
} }
/**
* Repaints a specific rectangle of the screen.
*
* @param left,top,right,bottom The area of the screen that needs repainting
* @pre The rectangle should have been previously marked dirty with \c AddDirtyBlock.
* @see AddDirtyBlock
* @see DrawDirtyBlocks
* @ingroup dirty
*
*/
void RedrawScreenRect(int left, int top, int right, int bottom) void RedrawScreenRect(int left, int top, int right, int bottom)
{ {
assert(right <= _screen.width && bottom <= _screen.height); assert(right <= _screen.width && bottom <= _screen.height);
@@ -1448,9 +1438,7 @@ void RedrawScreenRect(int left, int top, int right, int bottom)
/** /**
* Repaints the rectangle blocks which are marked as 'dirty'. * Repaints the rectangle blocks which are marked as 'dirty'.
* *
* @see AddDirtyBlock * @see SetDirtyBlocks
*
* @ingroup dirty
*/ */
void DrawDirtyBlocks() void DrawDirtyBlocks()
{ {
@@ -1553,18 +1541,21 @@ void DrawDirtyBlocks()
} }
/** /**
* Extend the internal _invalid_rect rectangle to contain the rectangle * This function extends the internal _invalid_rect rectangle as it
* defined by the given parameters. Note the point (0,0) is top left. * now contains the rectangle defined by the given parameters. Note
* the point (0,0) is top left.
* *
* @param left The left edge of the rectangle * @param left The left edge of the rectangle
* @param top The top edge of the rectangle * @param top The top edge of the rectangle
* @param right The right edge of the rectangle * @param right The right edge of the rectangle
* @param bottom The bottom edge of the rectangle * @param bottom The bottom edge of the rectangle
* @see DrawDirtyBlocks * @see DrawDirtyBlocks
* @ingroup dirty
* *
* @todo The name of the function should be called like @c AddDirtyBlock as
* it neither set a dirty rect nor add several dirty rects although
* the function name is in plural. (Progman)
*/ */
void AddDirtyBlock(int left, int top, int right, int bottom) void SetDirtyBlocks(int left, int top, int right, int bottom)
{ {
byte *b; byte *b;
int width; int width;
@@ -1609,7 +1600,7 @@ void AddDirtyBlock(int left, int top, int right, int bottom)
*/ */
void MarkWholeScreenDirty() void MarkWholeScreenDirty()
{ {
AddDirtyBlock(0, 0, _screen.width, _screen.height); SetDirtyBlocks(0, 0, _screen.width, _screen.height);
} }
/** /**

View File

@@ -131,7 +131,7 @@ Point GetCharPosInString(const char *str, const char *ch, FontSize start_fontsiz
const char *GetCharAtPosition(const char *str, int x, FontSize start_fontsize = FS_NORMAL); const char *GetCharAtPosition(const char *str, int x, FontSize start_fontsize = FS_NORMAL);
void DrawDirtyBlocks(); void DrawDirtyBlocks();
void AddDirtyBlock(int left, int top, int right, int bottom); void SetDirtyBlocks(int left, int top, int right, int bottom);
void MarkWholeScreenDirty(); void MarkWholeScreenDirty();
void GfxInitPalettes(); void GfxInitPalettes();

View File

@@ -571,7 +571,7 @@ private:
if (this->viewport != nullptr) this->viewport->top += newtop - this->top; if (this->viewport != nullptr) this->viewport->top += newtop - this->top;
this->top = newtop; this->top = newtop;
AddDirtyBlock(this->left, mintop, this->left + this->width, maxtop + this->height); SetDirtyBlocks(this->left, mintop, this->left + this->width, maxtop + this->height);
} }
StringID GetCompanyMessageString() const StringID GetCompanyMessageString() const

View File

@@ -1886,7 +1886,7 @@ static void MarkViewportDirty(const ViewPort *vp, int left, int top, int right,
if (top >= vp->virtual_height) return; if (top >= vp->virtual_height) return;
AddDirtyBlock( SetDirtyBlocks(
UnScaleByZoomLower(left, vp->zoom) + vp->left, UnScaleByZoomLower(left, vp->zoom) + vp->left,
UnScaleByZoomLower(top, vp->zoom) + vp->top, UnScaleByZoomLower(top, vp->zoom) + vp->top,
UnScaleByZoom(right, vp->zoom) + vp->left + 1, UnScaleByZoom(right, vp->zoom) + vp->left + 1,

View File

@@ -774,7 +774,7 @@ void NWidgetBase::SetDirty(const Window *w) const
{ {
int abs_left = w->left + this->pos_x; int abs_left = w->left + this->pos_x;
int abs_top = w->top + this->pos_y; int abs_top = w->top + this->pos_y;
AddDirtyBlock(abs_left, abs_top, abs_left + this->current_x, abs_top + this->current_y); SetDirtyBlocks(abs_left, abs_top, abs_left + this->current_x, abs_top + this->current_y);
} }
/** /**

View File

@@ -983,7 +983,7 @@ void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
*/ */
void Window::SetDirty() const void Window::SetDirty() const
{ {
AddDirtyBlock(this->left, this->top, this->left + this->width, this->top + this->height); SetDirtyBlocks(this->left, this->top, this->left + this->width, this->top + this->height);
} }
/** /**
@@ -3493,7 +3493,7 @@ static int PositionWindow(Window *w, WindowClass clss, int setting)
default: w->left = 0; break; default: w->left = 0; break;
} }
if (w->viewport != nullptr) w->viewport->left += w->left - old_left; if (w->viewport != nullptr) w->viewport->left += w->left - old_left;
AddDirtyBlock(0, w->top, _screen.width, w->top + w->height); // invalidate the whole row SetDirtyBlocks(0, w->top, _screen.width, w->top + w->height); // invalidate the whole row
return w->left; return w->left;
} }