[Bf-blender-cvs] [703dff333ce] master: Fix T99459: GPencil: Fill tool on the surface not in the correct place

Germano Cavalcante noreply at git.blender.org
Mon Jul 25 19:14:03 CEST 2022


Commit: 703dff333ce6cbc25c990042858a0c40f9a212cb
Author: Germano Cavalcante
Date:   Mon Jul 25 13:41:35 2022 -0300
Branches: master
https://developer.blender.org/rB703dff333ce6cbc25c990042858a0c40f9a212cb

Fix T99459: GPencil: Fill tool on the surface not in the correct place

There is a 1 pixel error in the size registered for the buffer
dimensions.

NOTE: This issue indicates that the texture scale is different from the
region, so the mouse-based coordinates used are actually misaligned.
This misalignment will be fixed in another commit.

Regression probably introduced in rB1d49293b8044 + rB45f167237f0c8

===================================================================

M	source/blender/editors/space_view3d/view3d_draw.c

===================================================================

diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 5405867be56..df5ff163cf2 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2247,16 +2247,16 @@ void view3d_depths_rect_create(ARegion *region, rcti *rect, ViewDepths *r_d)
 static ViewDepths *view3d_depths_create(ARegion *region)
 {
   ViewDepths *d = MEM_callocN(sizeof(ViewDepths), "ViewDepths");
-  d->w = region->winx;
-  d->h = region->winy;
 
   {
     GPUViewport *viewport = WM_draw_region_get_viewport(region);
     GPUTexture *depth_tx = GPU_viewport_depth_texture(viewport);
     uint32_t *int_depths = GPU_texture_read(depth_tx, GPU_DATA_UINT_24_8, 0);
+    d->w = GPU_texture_width(depth_tx);
+    d->h = GPU_texture_height(depth_tx);
     d->depths = (float *)int_depths;
     /* Convert in-place. */
-    int pixel_count = GPU_texture_width(depth_tx) * GPU_texture_height(depth_tx);
+    int pixel_count = d->w * d->h;
     for (int i = 0; i < pixel_count; i++) {
       d->depths[i] = (int_depths[i] >> 8u) / (float)0xFFFFFF;
     }



More information about the Bf-blender-cvs mailing list