28 const T *src_pixel = src_pixels + y_range.
first() * size_x * channels;
30 for (
int y : y_range) {
31 for (
int x = 0;
x < size_x;
x++, src_pixel += channels) {
32 memcpy(&dst_pixels[(
y + ((size_x -
x - 1) * size_y)) * channels],
34 sizeof(
T) * channels);
39 for (
int y : y_range) {
40 for (
int x = 0;
x < size_x;
x++, src_pixel += channels) {
41 memcpy(&dst_pixels[(((size_y -
y - 1) * size_x) + (size_x -
x - 1)) * channels],
43 sizeof(
T) * channels);
48 for (
int y : y_range) {
49 for (
int x = 0;
x < size_x;
x++, src_pixel += channels) {
50 memcpy(&dst_pixels[((size_y -
y - 1) + (
x * size_y)) * channels],
52 sizeof(
T) * channels);
65 const int size_x = ibuf->
x;
66 const int size_y = ibuf->
y;
69 std::swap(ibuf->
x, ibuf->
y);
75 size_t(channels) *
size_t(size_x) *
size_t(size_y), __func__);
94 size_t x_size, y_size;
96 if (ibuf ==
nullptr) {
106 const size_t stride = x_size *
sizeof(int);
109 bottom =
top + ((y_size - 1) * x_size);
114 for (; y_size > 0; y_size--) {
115 memcpy(line,
top, stride);
116 memcpy(
top, bottom, stride);
117 memcpy(bottom, line, stride);
126 float *topf =
nullptr, *bottomf =
nullptr, *linef =
nullptr;
131 const size_t stride = x_size * 4 *
sizeof(
float);
134 bottomf = topf + 4 * ((y_size - 1) * x_size);
139 for (; y_size > 0; y_size--) {
140 memcpy(linef, topf, stride);
141 memcpy(topf, bottomf, stride);
142 memcpy(bottomf, linef, stride);
143 bottomf -= 4 * x_size;
153 int x,
y, xr, xl, yi;
156 if (ibuf ==
nullptr) {
165 for (yi =
y - 1; yi >= 0; yi--) {
166 const size_t x_offset = size_t(
x) * yi;
167 for (xr =
x - 1, xl = 0; xr >= xl; xr--, xl++) {
168 std::swap(rect[x_offset + xr], rect[x_offset + xl]);
175 for (yi =
y - 1; yi >= 0; yi--) {
176 const size_t x_offset = size_t(
x) * yi;
177 for (xr =
x - 1, xl = 0; xr >= xl; xr--, xl++) {
178 memcpy(&px_f, &rect_float[(x_offset + xr) * 4],
sizeof(
float[4]));
180 &rect_float[(x_offset + xr) * 4], &rect_float[(x_offset + xl) * 4],
sizeof(
float[4]));
181 memcpy(&rect_float[(x_offset + xl) * 4], &px_f,
sizeof(
float[4]));
void IMB_assign_float_buffer(ImBuf *ibuf, float *buffer_data, ImBufOwnership ownership)
void IMB_byte_from_float(ImBuf *ibuf)
void IMB_assign_byte_buffer(ImBuf *ibuf, uint8_t *buffer_data, ImBufOwnership ownership)
Read Guarded memory(de)allocation.
constexpr int64_t first() const
constexpr T degrees(T) RET
void IMB_flipy(ImBuf *ibuf)
void IMB_flipx(ImBuf *ibuf)
bool IMB_rotate_orthogonal(ImBuf *ibuf, int degrees)
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)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer