13 template<
typename T>
class BufferAreaIterator;
37 :
rcti(
area), buffer_(
buffer), buffer_width_(buffer_width), elem_stride_(elem_stride)
45 : buffer_(
buffer), buffer_width_(buffer_width), elem_stride_(elem_stride)
78 return begin_iterator<Iterator>();
83 return end_iterator<Iterator>();
88 return begin_iterator<ConstIterator>();
93 return end_iterator<ConstIterator>();
97 template<
typename TIterator> constexpr TIterator begin_iterator()
const
99 T *end_ptr = get_end_ptr();
100 if (elem_stride_ == 0) {
102 return TIterator(buffer_, end_ptr, 1, 1, 1);
105 T *begin_ptr = buffer_ + (
intptr_t)this->
ymin * buffer_width_ * elem_stride_ +
107 return TIterator(begin_ptr, end_ptr, buffer_width_,
BLI_rcti_size_x(
this), elem_stride_);
110 template<
typename TIterator> constexpr TIterator end_iterator()
const
112 T *end_ptr = get_end_ptr();
113 if (elem_stride_ == 0) {
115 return TIterator(end_ptr, end_ptr, 1, 1, 1);
118 return TIterator(end_ptr, end_ptr, buffer_width_,
BLI_rcti_size_x(
this), elem_stride_);
121 T *get_end_ptr()
const
123 if (elem_stride_ == 0) {
126 return buffer_ + (
intptr_t)(this->
ymax - 1) * buffer_width_ * elem_stride_ +
152 T *current,
const T *end,
int buffer_width,
int area_width,
int elem_stride = 1)
153 : elem_stride_(elem_stride),
154 row_stride_(buffer_width * elem_stride),
155 rows_gap_(row_stride_ - area_width * elem_stride),
157 row_end_(current + area_width * elem_stride),
164 current_ += elem_stride_;
166 if (current_ == row_end_) {
168 if (current_ == end_) {
171 current_ += rows_gap_;
172 row_end_ += row_stride_;
181 return copied_iterator;
186 return a.current_ !=
b.current_;
191 return a.current_ ==
b.current_;
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
bool BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
std::ptrdiff_t difference_type
constexpr friend bool operator==(const BufferAreaIterator &a, const BufferAreaIterator &b)
constexpr BufferAreaIterator(T *current, const T *end, int buffer_width, int area_width, int elem_stride=1)
constexpr BufferAreaIterator operator++(int) const
constexpr BufferAreaIterator & operator++()
constexpr T * operator*() const
constexpr BufferAreaIterator()=default
std::input_iterator_tag iterator_category
constexpr friend bool operator!=(const BufferAreaIterator &a, const BufferAreaIterator &b)
constexpr BufferArea(T *buffer, int buffer_width, const rcti &area, int elem_stride=1)
constexpr int height() const
constexpr const rcti & get_rect() const
constexpr Iterator begin()
constexpr BufferArea(T *buffer, int buffer_width, int buffer_height, int elem_stride=1)
constexpr ConstIterator begin() const
constexpr BufferArea()=default
constexpr friend bool operator==(const BufferArea &a, const BufferArea &b)
constexpr int width() const
constexpr ConstIterator end() const
ccl_global float * buffer
static void area(int d1, int d2, int e1, int e2, float weights[2])
static const pxr::TfToken b("b", pxr::TfToken::Immortal)