Files
CoCoSmash/DirtyRectList.h
T

62 lines
1.7 KiB
C

/* DirtyRectList.h
Copyright (C) 2026 Pierre Sarrazin <http://sarrazip.com/>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _H_DirtyRectList
#define _H_DirtyRectList
#include "DirtyRect.h"
enum
{
DirtyRectList_MAX_DIRTY_RECTS = 24, // must be <= 255
};
typedef struct DirtyRectList
{
byte count;
byte peak;
DirtyRect rects[DirtyRectList_MAX_DIRTY_RECTS];
} DirtyRectList;
void DirtyRectList_init(DirtyRectList *self);
// Remembers that the rectangle whose top-left byte is scrnAddr
// is now "dirty" in the given "dirty list", which is supposed to
// correspond with the current screen page.
//
// Each dirty rectangle is DIRTY_RECT_WIDTH bytes wide.
// Returns FALSE if there is no room for the new dirty rectangle
// in 'dirtyList' (re: DirtyRectList_MAX_DIRTY_RECTS).
//
// Increments the count field in the given dirty list.
// Updates self->peak if NDEBUG is not defined.
//
BOOL DirtyRectList_add(DirtyRectList *self, byte *addr, byte numRows);
// Calls DirtyRect_clean() for every dirty rectangle in the list,
// then clears that list.
//
void DirtyRectList_clean(DirtyRectList *self);
#endif /* _H_DirtyRectList */