- Previews for composite nodes didn't scale correct for portrait sized

images (should make it narrow then)

- Forgot to press 'save' for changes in Juho's flip node, previous commit
This commit is contained in:
Ton Roosendaal 2006-11-15 16:55:40 +00:00
parent 3959fbcf1f
commit 6cd62026b9
2 changed files with 29 additions and 18 deletions

@ -3034,8 +3034,7 @@ static void node_composit_exec_flip(void *data, bNode *node, bNodeStack **in, bN
} }
out[0]->data= stackbuf; out[0]->data= stackbuf;
if(cbuf!=in[0]->data)
free_compbuf(cbuf);
} }
} }

@ -1529,7 +1529,8 @@ static void socket_circle_draw(float x, float y, float size, int type, int selec
/* not a callback */ /* not a callback */
static void node_draw_preview(bNodePreview *preview, rctf *prv) static void node_draw_preview(bNodePreview *preview, rctf *prv)
{ {
float scale= (prv->xmax-prv->xmin)/((float)preview->xsize); float xscale= (prv->xmax-prv->xmin)/((float)preview->xsize);
float yscale= (prv->ymax-prv->ymin)/((float)preview->ysize);
float centx= prv->xmin + 0.5*(prv->xmax-prv->xmin); float centx= prv->xmin + 0.5*(prv->xmax-prv->xmin);
float centy= prv->ymin + 0.5*(prv->ymax-prv->ymin); float centy= prv->ymin + 0.5*(prv->ymax-prv->ymin);
@ -1552,7 +1553,7 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
glVertex2f(centx, centy); glVertex2f(centx, centy);
glEnd(); glEnd();
glPixelZoom(scale, scale); glPixelZoom(xscale, yscale);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ); /* premul graphics */ glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ); /* premul graphics */
@ -1648,7 +1649,18 @@ static void node_update(bNode *node)
dy-= NODE_DYS/2; dy-= NODE_DYS/2;
node->prvr.ymax= dy; node->prvr.ymax= dy;
if(aspect <= 1.0f)
node->prvr.ymin= dy - aspect*(node->width-NODE_DY); node->prvr.ymin= dy - aspect*(node->width-NODE_DY);
else {
float dx= (node->width - NODE_DYS) - (node->width- NODE_DYS)/aspect; /* width correction of image */
node->prvr.ymin= dy - (node->width-NODE_DY);
node->prvr.xmin+= 0.5*dx;
node->prvr.xmax-= 0.5*dx;
}
dy= node->prvr.ymin - NODE_DYS/2; dy= node->prvr.ymin - NODE_DYS/2;
} }
else { else {