Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-11-15 19:55:40 +0300
committerTon Roosendaal <ton@blender.org>2006-11-15 19:55:40 +0300
commit6cd62026b9503d1d2153af573b72eeb115d5d9be (patch)
treef9ae08f48fba3f2b8eed4e9e0a7a49151ed5d9d2
parent3959fbcf1f6eb36e908d238b4ff608eb88b59d03 (diff)
- 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
-rw-r--r--source/blender/blenkernel/intern/node_composite.c29
-rw-r--r--source/blender/src/drawnode.c18
2 files changed, 29 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/node_composite.c b/source/blender/blenkernel/intern/node_composite.c
index 21ca4b21824..48dd2654db8 100644
--- a/source/blender/blenkernel/intern/node_composite.c
+++ b/source/blender/blenkernel/intern/node_composite.c
@@ -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);
+
}
}
diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c
index 1e4f0d51bb5..8d4b44a0039 100644
--- a/source/blender/src/drawnode.c
+++ b/source/blender/src/drawnode.c
@@ -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 {