File indexing completed on 2024-12-22 04:10:04
0001 /* 0002 * SPDX-FileCopyrightText: 2014 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef __KIS_FILL_INTERVAL_H 0008 #define __KIS_FILL_INTERVAL_H 0009 0010 0011 #include <boost/operators.hpp> 0012 #include "kis_global.h" 0013 0014 0015 class KisFillInterval : private boost::equality_comparable1<KisFillInterval> 0016 { 0017 public: 0018 KisFillInterval() 0019 : start(0), 0020 end(-1), 0021 row(-1) 0022 { 0023 } 0024 0025 KisFillInterval(int _start, int _end, int _row) 0026 : start(_start), 0027 end(_end), 0028 row(_row) 0029 { 0030 } 0031 0032 inline void invalidate() { 0033 end = start - 1; 0034 } 0035 0036 inline bool operator==(const KisFillInterval &rhs) const { 0037 return start == rhs.start && end == rhs.end && row == rhs.row; 0038 } 0039 0040 inline int width() const { 0041 return end - start + 1; 0042 } 0043 0044 inline bool isValid() const { 0045 return end >= start; 0046 } 0047 0048 int start; 0049 int end; 0050 int row; 0051 }; 0052 0053 #include <kis_debug.h> 0054 inline QDebug operator<<(QDebug dbg, const KisFillInterval& i) 0055 { 0056 #ifndef NODEBUG 0057 dbg.nospace() << "KisFillInterval(" << i.start << ".." << i.end << "; " << i.row << ")"; 0058 #endif 0059 return dbg; 0060 } 0061 0062 #endif /* __KIS_FILL_INTERVAL_H */