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
This commit is contained in:
parent
00a3533429
commit
703dff333c
Notes:
blender-bot
2023-02-14 08:45:12 +01:00
Referenced by issue #99459, GPencil: Fill tool on the surface will not be fill in correct place.
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue