diff options
author | Øyvind Kolås <pippin@gimp.org> | 2015-05-23 21:31:32 +0200 |
---|---|---|
committer | Øyvind Kolås <pippin@gimp.org> | 2015-05-23 21:31:32 +0200 |
commit | 68d0d1e6fa9926f4cd8f3f3df3510edf31c1b9da (patch) | |
tree | b712b8e46e3f1efcff22fcfcff453dc3aaff6ba5 /gegl | |
parent | 9f16d0010932c10d9564f20bc2cd064967ca95db (diff) |
buffer: make _gegl_sampler_compute_rectangle simpler and dumber
To fix rendering bugs for nohalo/lohalo and possibly other samplers.
Diffstat (limited to 'gegl')
-rw-r--r-- | gegl/buffer/gegl-sampler.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/gegl/buffer/gegl-sampler.c b/gegl/buffer/gegl-sampler.c index 59788bf1..cb91aba6 100644 --- a/gegl/buffer/gegl-sampler.c +++ b/gegl/buffer/gegl-sampler.c @@ -269,6 +269,27 @@ GeglRectangle _gegl_sampler_compute_rectangle (GeglSampler *sampler, level->last_x = x; level->last_y = y; + rectangle.width = level->context_rect.width + 2; + rectangle.height = level->context_rect.height + 2; + + rectangle.x = x + level->context_rect.x; + rectangle.y = y + level->context_rect.y; + + /* grow area slightly, maybe getting a couple of extra + hits out of cour cache + */ + rectangle.x -= 2; + rectangle.y -= 2; + rectangle.width += 4; + rectangle.height += 4; + +#if 0 + /* XXX: FIXME: grow cached area based on sampling pattern profiling + * information, possibly with much bigger wins than the marginal wins the + * increase in size by 2 in each dir does. + */ + + if (level->x_magnitude > 0.001 || level->y_magnitude > 0.001) { gfloat magnitude = sqrtf (level->x_magnitude * level->x_magnitude + @@ -295,7 +316,6 @@ GeglRectangle _gegl_sampler_compute_rectangle (GeglSampler *sampler, */ - /* align rectangle corner we've likely entered with sampled pixel */ if (level->x_delta >=0) @@ -312,16 +332,7 @@ GeglRectangle _gegl_sampler_compute_rectangle (GeglSampler *sampler, rectangle.y = y + level->context_rect.y - (rectangle.height - level->context_rect.height) * 9/10; } - else - { - rectangle.width = level->context_rect.width + 2; - rectangle.height = level->context_rect.height + 2; - - rectangle.x = x + level->context_rect.x - - (rectangle.width - level->context_rect.x)/4; - rectangle.y = y + level->context_rect.y - - (rectangle.height - level->context_rect.y)/4; - } +#endif if (rectangle.width >= GEGL_SAMPLER_MAXIMUM_WIDTH) rectangle.width = GEGL_SAMPLER_MAXIMUM_WIDTH; |