Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2015-02-11 16:16:28 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2015-02-12 13:28:06 +0300
commit23d8b1ce16cfc93564cd36de3b0dc01b4c209c1e (patch)
treeb7196616651d547cb3a9895a2c17a1d225deb40e
parent2f04e2d2a3f291cf2ed1832ea614755cee2a046a (diff)
Expand Ptex paint redraw region to include filter border
-rw-r--r--source/blender/gpu/intern/gpu_draw.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index b025d3520f7..5cb2e1b4e30 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");