29 const T *src_pixel = src_pixels + y_range.
first() * size_x * channels;
31 for (
int y : y_range) {
32 for (
int x = 0;
x < size_x;
x++, src_pixel += channels) {
33 memcpy(&dst_pixels[(
y + ((size_x -
x - 1) * size_y)) * channels],
35 sizeof(
T) * channels);
40 for (
int y : y_range) {
41 for (
int x = 0;
x < size_x;
x++, src_pixel += channels) {
42 memcpy(&dst_pixels[(((size_y -
y - 1) * size_x) + (size_x -
x - 1)) * channels],
44 sizeof(
T) * channels);
49 for (
int y : y_range) {
50 for (
int x = 0;
x < size_x;
x++, src_pixel += channels) {
51 memcpy(&dst_pixels[((size_y -
y - 1) + (
x * size_y)) * channels],
53 sizeof(
T) * channels);
66 const int size_x = ibuf->
x;
67 const int size_y = ibuf->
y;
70 std::swap(ibuf->
x, ibuf->
y);
76 size_t(channels) *
size_t(size_x) *
size_t(size_y), __func__);
96 size_t x_size, y_size;
98 if (ibuf ==
nullptr) {
103 uint *top, *bottom, *line;
108 const size_t stride = x_size *
sizeof(int);
111 bottom = top + ((y_size - 1) * x_size);
116 for (; y_size > 0; y_size--) {
117 memcpy(line, top, stride);
118 memcpy(top, bottom, stride);
119 memcpy(bottom, line, stride);
128 float *topf =
nullptr, *bottomf =
nullptr, *linef =
nullptr;
133 const size_t stride = x_size * 4 *
sizeof(
float);
136 bottomf = topf + 4 * ((y_size - 1) * x_size);
141 for (; y_size > 0; y_size--) {
142 memcpy(linef, topf, stride);
143 memcpy(topf, bottomf, stride);
144 memcpy(bottomf, linef, stride);
145 bottomf -= 4 * x_size;
155 int x,
y, xr, xl, yi;
158 if (ibuf ==
nullptr) {
167 for (yi =
y - 1; yi >= 0; yi--) {
168 const size_t x_offset = size_t(
x) * yi;
169 for (xr =
x - 1, xl = 0; xr >= xl; xr--, xl++) {
170 std::swap(rect[x_offset + xr], rect[x_offset + xl]);
177 for (yi =
y - 1; yi >= 0; yi--) {
178 const size_t x_offset = size_t(
x) * yi;
179 for (xr =
x - 1, xl = 0; xr >= xl; xr--, xl++) {
180 memcpy(&px_f, &rect_float[(x_offset + xr) * 4],
sizeof(
float[4]));
182 &rect_float[(x_offset + xr) * 4], &rect_float[(x_offset + xl) * 4],
sizeof(
float[4]));
183 memcpy(&rect_float[(x_offset + xl) * 4], &px_f,
sizeof(
float[4]));
Read Blender memory allocation and freeing.
constexpr int64_t first() const
constexpr IndexRange()=default
constexpr T degrees(T) RET
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
bool IMB_rotate_orthogonal(ImBuf *ibuf, int degrees)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void IMB_flipx(ImBuf *ibuf)
void IMB_flipy(ImBuf *ibuf)
void IMB_byte_from_float(ImBuf *ibuf)
static void rotate_pixels(const int degrees, const int size_x, const int size_y, const T *src_pixels, T *dst_pixels, const int channels)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
const uint8_t * byte_data() const
uint8_t * byte_data_for_write()
const float * float_data() const
void assign_byte_data(uint8_t *data)
float * float_data_for_write()
void assign_float_data(float *data)