Fix build errors
From rBd5cb425b8745
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
* Interface for accessing gpu-related methods for selection. The semantics are
|
||||
* similar to glRenderMode(GL_SELECT) from older OpenGL versions.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "GPU_select.h"
|
||||
@@ -31,6 +32,8 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_rect.h"
|
||||
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
@@ -211,3 +214,37 @@ const uint *GPU_select_buffer_near(const uint *buffer, int hits)
|
||||
}
|
||||
return buffer_near;
|
||||
}
|
||||
|
||||
/* Part of the solution copied from `rect_subregion_stride_calc`. */
|
||||
void GPU_select_buffer_stride_realign(
|
||||
const rcti *src, const rcti *dst, uint *r_buf)
|
||||
{
|
||||
const int src_x = BLI_rcti_size_x(src);
|
||||
// const int src_y = BLI_rcti_size_y(src);
|
||||
int dst_x = BLI_rcti_size_x(dst);
|
||||
int dst_y = BLI_rcti_size_y(dst);
|
||||
int x = dst->xmin - src->xmin;
|
||||
int y = dst->ymin - src->ymin;
|
||||
|
||||
BLI_assert(src->xmin <= dst->xmin && src->ymin <= dst->ymin &&
|
||||
src->xmax >= dst->xmax && src->ymax >= dst->ymax);
|
||||
BLI_assert(x >= 0 && y >= 0);
|
||||
|
||||
int last_px_written = dst_x * dst_y - 1;
|
||||
int last_px_id = src_x * (y + dst_y - 1) + (x + dst_x - 1);
|
||||
|
||||
int skip = src_x - dst_x;
|
||||
while (dst_y--) {
|
||||
int i;
|
||||
for (i = dst_x; i--;) {
|
||||
r_buf[last_px_id--] = r_buf[last_px_written--];
|
||||
}
|
||||
if (last_px_written < 0) {
|
||||
break;
|
||||
}
|
||||
for (i = skip; i--;) {
|
||||
r_buf[last_px_id--] = 0u;
|
||||
}
|
||||
}
|
||||
memset(r_buf, 0, (last_px_id + 1) * sizeof(*r_buf));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user