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:
Diffstat (limited to 'source/blender/blenkernel/intern/mask_rasterize.c')
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 92628387dc6..35207595103 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -841,8 +841,8 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
open_spline_ranges[open_spline_index].vertex_total_cap_tail = 0;
if (!is_cyclic) {
- float *fp_cent;
- float *fp_turn;
+ const float *fp_cent;
+ const float *fp_turn;
unsigned int k;
@@ -1434,6 +1434,10 @@ void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle,
const unsigned int width, const unsigned int height,
float *buffer)
{
+ const float x_inv = 1.0f / (float)width;
+ const float y_inv = 1.0f / (float)height;
+ const float x_px_ofs = x_inv * 0.5f;
+ const float y_px_ofs = y_inv * 0.5f;
#ifdef _MSC_VER
int y; /* msvc requires signed for some reason */
@@ -1449,9 +1453,9 @@ void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle,
unsigned int i = y * width;
unsigned int x;
float xy[2];
- xy[1] = (float)y / (float)height;
+ xy[1] = ((float)y * y_inv) + y_px_ofs;
for (x = 0; x < width; x++, i++) {
- xy[0] = (float)x / (float)width;
+ xy[0] = ((float)x * x_inv) + x_px_ofs;
buffer[i] = BKE_maskrasterize_handle_sample(mr_handle, xy);
}