From fea2665479fcc34e4f8c16f8f603af714ea4abc5 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 24 Jan 2014 10:39:37 +0000 Subject: clamp mosaic pixels --- rotord/src/nodes_drawing.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'rotord/src/nodes_drawing.h') diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index 7e7a178..f428fd8 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -215,19 +215,16 @@ namespace Rotor { ~Mosaic(){}; Mosaic* clone(map &_settings) { return new Mosaic(_settings);}; void vector_output(cairo_t * cr,const Frame_spec &frame){ - double vpix=max(parameters["pixels"]->value,1.0); + double vpix=min((double)frame.h,max(parameters["pixels"]->value,1.0)); double pixel_size=frame.h/vpix; int h_padded=ceil(vpix/2)*2; int w_padded=ceil((((vpix/frame.h)*frame.w))/2)*2; - Image *in1=image_inputs[0]->get(frame); if (in1){ Image in=*(in1); in.crop(w_padded*pixel_size,h_padded*pixel_size); in.resize(w_padded,h_padded); - int x_start=-((w_padded*pixel_size)/2); - int y_start=-((h_padded*pixel_size)/2); - cairo_translate(cr,x_start,y_start); + cairo_translate(cr,-((w_padded*pixel_size)/2),-((h_padded*pixel_size)/2)); for (int i=0;i