isCellValid method
Whether cell (x, y) is valid and inside the current active clip bounds.
Implementation
bool isCellValid(int x, int y) {
if (x < 0 || x >= width || y < 0 || y >= height) return false;
if (_clipStack.isEmpty) return true;
return _clipStack.last.contains(x, y);
}