[Bf-blender-cvs] [23d8b1c] cycles-ptex-49: Expand Ptex paint redraw region to include filter border
Nicholas Bishop
noreply at git.blender.org
Thu Feb 12 14:16:47 CET 2015
Commit: 23d8b1ce16cfc93564cd36de3b0dc01b4c209c1e
Author: Nicholas Bishop
Date: Wed Feb 11 14:16:28 2015 +0100
Branches: cycles-ptex-49
https://developer.blender.org/rB23d8b1ce16cfc93564cd36de3b0dc01b4c209c1e
Expand Ptex paint redraw region to include filter border
===================================================================
M source/blender/gpu/intern/gpu_draw.c
===================================================================
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index b025d35..5cb2e1b 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1030,6 +1030,23 @@ static bool GPU_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x,
return false;
}
+/* If this is a Ptex ImBuf, expand update area to include filter
+ * borders */
+static void gpu_ptex_paint_update_rect(const ImBuf *ibuf, int *x, int *y,
+ int *w, int *h)
+{
+ /* Pixel size of Ptex border */
+ const int border = 1;
+
+ if (ibuf->num_ptex_regions > 0) {
+ *x = MAX2((*x) - border, 0);
+ *y = MAX2((*y) - border, 0);
+
+ *w = MIN2((*w) + border * 2, ibuf->x - (*x));
+ *h = MIN2((*h) + border * 2, ibuf->y - (*y));
+ }
+}
+
void GPU_paint_update_image(Image *ima, int x, int y, int w, int h)
{
ImBuf *ibuf;
@@ -1047,6 +1064,10 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h)
* which is much quicker for painting */
GLint row_length, skip_pixels, skip_rows;
+ /* TODO(nicholasbishop): not sure yet this will belong here, could
+ * move to texpaint instead */
+ gpu_ptex_paint_update_rect(ibuf, &x, &y, &w, &h);
+
/* if color correction is needed, we must update the part that needs updating. */
if (ibuf->rect_float) {
float *buffer = MEM_mallocN(w * h * sizeof(float) * 4, "temp_texpaint_float_buf");
More information about the Bf-blender-cvs
mailing list