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:
authorJoseph Eagar <joeedh@gmail.com>2008-02-19 02:50:12 +0300
committerJoseph Eagar <joeedh@gmail.com>2008-02-19 02:50:12 +0300
commitccac67d3eae4684e86b2a8a4858e9b173f520270 (patch)
tree1e645fc6b61e352b3436b8610676ed66ae640980 /source/blender/nodes
parent05a28c8521c04e86accfd5999c3cf5b7dbb07929 (diff)
Further work on the premul option for ton. This option
(which basically tells the renderer and compositor to expect a key image) is now done at the image user level. This does have some caveats, as image users don't always work the way I thought they would/should (for example, the same image user structure is apparently used in the uv image editor for all images, which is kindof odd). The UV image editor also now smartly detects if the premul option is set and draws the image using key alpha, instead of premul The subversion level was upped to convert the old premul flag, which was at the image level, to the new one, which is at the image user level.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_image.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c
index 06c3b90e828..5df649d6808 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c
@@ -58,7 +58,7 @@ static bNodeSocketType cmp_node_rlayers_out[]= {
static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *iuser)
{
ImBuf *ibuf;
- CompBuf *stackbuf;
+ CompBuf *stackbuf, *old;
int type;
ibuf= BKE_image_get_ibuf(ima, iuser);
@@ -79,10 +79,11 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
stackbuf->rect= ibuf->rect_float;
}
- /*code to respect the premul flag of images; I'm
- not sure if this is a good idea for multilayer images,
- since it never worked before for them.
- if (type==CB_RGBA && ima->flag & IMA_DO_PREMUL) {
+ old = stackbuf;
+ stackbuf = dupalloc_compbuf(stackbuf);
+ free_compbuf(old);
+
+ if (type==CB_RGBA && iuser && (iuser->flag & IMA_DO_PREMUL)) {
//premul the image
int i;
float *pixel = stackbuf->rect;
@@ -93,7 +94,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
pixel[2] *= pixel[3];
}
}
- */
+
return stackbuf;
};
@@ -202,27 +203,6 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **in, b
else {
stackbuf= node_composit_get_image(rd, ima, iuser);
- /*respect image premul option*/
- if (stackbuf->type==CB_RGBA && ima->flag & IMA_DO_PREMUL) {
- int i;
- float *pixel;
-
- /*first duplicate stackbuf->rect, since it's just a pointer
- to the source imbuf, and we don't want to change that.*/
- stackbuf->rect = MEM_dupallocN(stackbuf->rect);
-
- /*flag that we can free the buffer.*/
- stackbuf->malloc = 1;
-
- /*premul the image*/
- pixel = stackbuf->rect;
- for (i=0; i<stackbuf->x*stackbuf->y; i++, pixel += 4) {
- pixel[0] *= pixel[3];
- pixel[1] *= pixel[3];
- pixel[2] *= pixel[3];
- }
- }
-
/* put image on stack */
out[0]->data= stackbuf;