forked from bartvdbraak/blender
- 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:
parent
3959fbcf1f
commit
6cd62026b9
@ -2998,7 +2998,7 @@ static void node_composit_exec_flip(void *data, bNode *node, bNodeStack **in, bN
|
||||
if(in[0]->data) {
|
||||
CompBuf *cbuf= in[0]->data;
|
||||
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1); /* note, this returns zero'd image */
|
||||
int i, src_pix, src_width,src_height,srcydelt,outydelt, x, y;
|
||||
int i, src_pix, src_width, src_height, srcydelt, outydelt, x, y;
|
||||
float *srcfp, *outfp;
|
||||
|
||||
src_pix= cbuf->type;
|
||||
@ -3009,33 +3009,32 @@ static void node_composit_exec_flip(void *data, bNode *node, bNodeStack **in, bN
|
||||
srcydelt= src_width*src_pix;
|
||||
outydelt= srcydelt;
|
||||
|
||||
if(node->custom1){ /*set up output pointer for y flip*/
|
||||
if(node->custom1) { /*set up output pointer for y flip*/
|
||||
outfp+= (src_height-1)*outydelt;
|
||||
outydelt= -outydelt;
|
||||
}
|
||||
|
||||
for(y=0; y<src_height; y++){
|
||||
if(node->custom1 == 1){ /* no x flip so just copy line*/
|
||||
for(y=0; y<src_height; y++) {
|
||||
if(node->custom1 == 1) { /* no x flip so just copy line*/
|
||||
memcpy(outfp, srcfp, sizeof(float) * src_pix * src_width);
|
||||
srcfp+=srcydelt;
|
||||
}
|
||||
else{
|
||||
outfp+=(src_width-1)*src_pix;
|
||||
for(x=0;x<src_width;x++){
|
||||
for(i=0; i<src_pix; i++){
|
||||
outfp[i]=srcfp[i];
|
||||
else {
|
||||
outfp += (src_width-1)*src_pix;
|
||||
for(x=0; x<src_width; x++) {
|
||||
for(i=0; i<src_pix; i++) {
|
||||
outfp[i]= srcfp[i];
|
||||
}
|
||||
outfp-=src_pix;
|
||||
srcfp+=src_pix;
|
||||
outfp -= src_pix;
|
||||
srcfp += src_pix;
|
||||
}
|
||||
outfp+=src_pix;
|
||||
outfp += src_pix;
|
||||
}
|
||||
outfp+=outydelt;
|
||||
outfp += outydelt;
|
||||
}
|
||||
|
||||
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 */
|
||||
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 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);
|
||||
glEnd();
|
||||
|
||||
glPixelZoom(scale, scale);
|
||||
glPixelZoom(xscale, yscale);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ); /* premul graphics */
|
||||
|
||||
@ -1648,7 +1649,18 @@ static void node_update(bNode *node)
|
||||
|
||||
dy-= NODE_DYS/2;
|
||||
node->prvr.ymax= dy;
|
||||
node->prvr.ymin= dy - aspect*(node->width-NODE_DY);
|
||||
|
||||
if(aspect <= 1.0f)
|
||||
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;
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user