aboutsummaryrefslogtreecommitdiff
path: root/evc/src/refsampler.rs
diff options
context:
space:
mode:
Diffstat (limited to 'evc/src/refsampler.rs')
-rw-r--r--evc/src/refsampler.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/evc/src/refsampler.rs b/evc/src/refsampler.rs
index ad02332..16a0600 100644
--- a/evc/src/refsampler.rs
+++ b/evc/src/refsampler.rs
@@ -9,6 +9,7 @@ use crate::{
#[derive(Debug, Clone)]
pub struct Sampler<'a> {
pub view: View<&'a Frame>,
+ pub halfsize: Vec2<f32>,
pub translation: Vec2<f32>,
pub transform: Mat2<f32>,
@@ -20,8 +21,8 @@ impl<'a> Sampler<'a> {
#[inline]
pub fn sample(&self, p: Vec2<f32>) -> Pixel {
self.view
- .sample(self.translation + p) // self.transform.transform(p))
- // .scale(self.value_scale)
+ .sample(self.translation + self.transform.transform(p + self.halfsize) - self.halfsize)
+ // .scale(self.value_scale)
}
pub fn from_refblock(
view: View<&'a Frame>,
@@ -38,6 +39,7 @@ impl<'a> Sampler<'a> {
c: map_scalar8(transform.c),
d: map_scalar8(transform.d),
},
+ halfsize: Into::<Vec2<f32>>::into(view.size).scale(0.5),
translation: Vec2 {
x: map_scalar8(translation.x),
y: map_scalar8(translation.y),