Fix build errors
From rBd5cb425b8745
This commit is contained in:
parent
7b62c61d6e
commit
fbfa5890bf
@ -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));
|
||||
}
|
||||
|
@ -90,30 +90,6 @@ static void rect_subregion_stride_calc(const rcti *src, const rcti *dst, SubRect
|
||||
r_sub->skip = (uint)(src_x - dst_x);
|
||||
}
|
||||
|
||||
void GPU_select_buffer_stride_realign(
|
||||
const rcti *src, const rcti *dst, uint *r_buf)
|
||||
{
|
||||
SubRectStride sub;
|
||||
rect_subregion_stride_calc(src, dst, &sub);
|
||||
|
||||
int last_px_written = sub.span * sub.span_len - 1;
|
||||
int last_px_id = sub.start + last_px_written + (sub.span_len - 1) * sub.skip;
|
||||
|
||||
while (sub.span_len--) {
|
||||
int i;
|
||||
for (i = sub.span; i--;) {
|
||||
r_buf[last_px_id--] = r_buf[last_px_written--];
|
||||
}
|
||||
if (last_px_written < 0) {
|
||||
break;
|
||||
}
|
||||
for (i = sub.skip; i--;) {
|
||||
r_buf[last_px_id--] = 0u;
|
||||
}
|
||||
}
|
||||
memset(r_buf, 0, (last_px_id + 1) * sizeof(*r_buf));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignore depth clearing as a change,
|
||||
* only check if its been changed _and_ filled in (ignore clearing since XRAY does this).
|
||||
|
Loading…
Reference in New Issue
Block a user