|
@@ -65,51 +65,49 @@ ZoomLevelByte _font_zoom; ///< Font Zoom
|
|
|
*
|
|
|
* This rectangle defines the area which should be repaint by the video driver.
|
|
|
*
|
|
|
* @ingroup dirty
|
|
|
*/
|
|
|
static Rect _invalid_rect;
|
|
|
static const byte *_colour_remap_ptr;
|
|
|
static byte _string_colourremap[3]; ///< Recoloursprite for stringdrawing. The grf loader ensures that #ST_FONT sprites only use colours 0 to 2.
|
|
|
|
|
|
static const uint DIRTY_BLOCK_HEIGHT = 8;
|
|
|
static const uint DIRTY_BLOCK_WIDTH = 64;
|
|
|
|
|
|
static uint _dirty_bytes_per_line = 0;
|
|
|
static byte *_dirty_blocks = NULL;
|
|
|
extern uint _dirty_block_colour;
|
|
|
|
|
|
void GfxScroll(int left, int top, int width, int height, int xo, int yo)
|
|
|
{
|
|
|
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
|
|
|
|
|
|
if (xo == 0 && yo == 0) return;
|
|
|
|
|
|
if (_cursor.visible) UndrawMouseCursor();
|
|
|
|
|
|
#ifdef ENABLE_NETWORK
|
|
|
if (_networking) NetworkUndrawChatMessage();
|
|
|
#endif /* ENABLE_NETWORK */
|
|
|
|
|
|
blitter->ScrollBuffer(_screen.dst_ptr, left, top, width, height, xo, yo);
|
|
|
/* This part of the screen is now dirty. */
|
|
|
VideoDriver::GetInstance()->MakeDirty(left, top, width, height);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
|
|
|
*
|
|
|
* @pre dpi->zoom == ZOOM_LVL_NORMAL, right >= left, bottom >= top
|
|
|
* @param left Minimum X (inclusive)
|
|
|
* @param top Minimum Y (inclusive)
|
|
|
* @param right Maximum X (inclusive)
|
|
|
* @param bottom Maximum Y (inclusive)
|
|
|
* @param colour A 8 bit palette index (FILLRECT_OPAQUE and FILLRECT_CHECKER) or a recolour spritenumber (FILLRECT_RECOLOUR)
|
|
|
* @param mode
|
|
|
* FILLRECT_OPAQUE: Fill the rectangle with the specified colour
|
|
|
* FILLRECT_CHECKER: Like FILLRECT_OPAQUE, but only draw every second pixel (used to grey out things)
|
|
|
* FILLRECT_RECOLOUR: Apply a recolour sprite to every pixel in the rectangle currently on screen
|
|
|
*/
|
|
|
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
|
|
|
{
|
|
|
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
|
|
@@ -1267,51 +1265,49 @@ void DrawMouseCursor()
|
|
|
/* Draw cursor on screen */
|
|
|
_cur_dpi = &_screen;
|
|
|
for (uint i = 0; i < _cursor.sprite_count; ++i) {
|
|
|
DrawSprite(_cursor.sprite_seq[i].sprite, _cursor.sprite_seq[i].pal, _cursor.pos.x + _cursor.sprite_pos[i].x, _cursor.pos.y + _cursor.sprite_pos[i].y);
|
|
|
}
|
|
|
|
|
|
VideoDriver::GetInstance()->MakeDirty(_cursor.draw_pos.x, _cursor.draw_pos.y, _cursor.draw_size.x, _cursor.draw_size.y);
|
|
|
|
|
|
_cursor.visible = true;
|
|
|
_cursor.dirty = false;
|
|
|
}
|
|
|
|
|
|
void RedrawScreenRect(int left, int top, int right, int bottom)
|
|
|
{
|
|
|
assert(right <= _screen.width && bottom <= _screen.height);
|
|
|
if (_cursor.visible) {
|
|
|
if (right > _cursor.draw_pos.x &&
|
|
|
left < _cursor.draw_pos.x + _cursor.draw_size.x &&
|
|
|
bottom > _cursor.draw_pos.y &&
|
|
|
top < _cursor.draw_pos.y + _cursor.draw_size.y) {
|
|
|
UndrawMouseCursor();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#ifdef ENABLE_NETWORK
|
|
|
if (_networking) NetworkUndrawChatMessage();
|
|
|
#endif /* ENABLE_NETWORK */
|
|
|
|
|
|
DrawOverlappedWindowForAll(left, top, right, bottom);
|
|
|
|
|
|
VideoDriver::GetInstance()->MakeDirty(left, top, right - left, bottom - top);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Repaints the rectangle blocks which are marked as 'dirty'.
|
|
|
*
|
|
|
* @see SetDirtyBlocks
|
|
|
*/
|
|
|
void DrawDirtyBlocks()
|
|
|
{
|
|
|
byte *b = _dirty_blocks;
|
|
|
const int w = Align(_screen.width, DIRTY_BLOCK_WIDTH);
|
|
|
const int h = Align(_screen.height, DIRTY_BLOCK_HEIGHT);
|
|
|
int x;
|
|
|
int y;
|
|
|
|
|
|
if (HasModalProgress()) {
|
|
|
/* We are generating the world, so release our rights to the map and
|
|
|
* painting while we are waiting a bit. */
|
|
|
_modal_progress_paint_mutex->EndCritical();
|
|
|
_modal_progress_work_mutex->EndCritical();
|