Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1408)

Unified Diff: source/blender/nodes/composite/nodes/node_composite_image.c

Issue 5285047: Camera tracking integration Base URL: https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Patch Set: Updated to tomato rev41255 Created 12 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: source/blender/nodes/composite/nodes/node_composite_image.c
===================================================================
--- source/blender/nodes/composite/nodes/node_composite_image.c (revision 41254)
+++ source/blender/nodes/composite/nodes/node_composite_image.c (working copy)
@@ -58,7 +58,37 @@
{ -1, 0, "" }
};
+/* float buffer from the image with matching color management */
+float *node_composit_get_float_buffer(RenderData *rd, ImBuf *ibuf, int *alloc)
+{
+ float *rect;
+ *alloc= FALSE;
+
+ if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
+ if(ibuf->profile != IB_PROFILE_NONE) {
+ rect= ibuf->rect_float;
+ }
+ else {
+ rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
+ srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
+ *alloc= TRUE;
+ }
+ }
+ else {
+ if(ibuf->profile == IB_PROFILE_NONE) {
+ rect= ibuf->rect_float;
+ }
+ else {
+ rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
+ linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
+ *alloc= TRUE;
+ }
+ }
+
+ return rect;
+}
+
/* note: this function is used for multilayer too, to ensure uniform
handling with BKE_image_get_ibuf() */
static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *iuser)
@@ -82,26 +112,7 @@
/* now we need a float buffer from the image with matching color management */
/* XXX weak code, multilayer is excluded from this */
if(ibuf->channels == 4 && ima->rr==NULL) {
- if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
- if(ibuf->profile != IB_PROFILE_NONE) {
- rect= ibuf->rect_float;
- }
- else {
- rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
- srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
- alloc= TRUE;
- }
- }
- else {
- if(ibuf->profile == IB_PROFILE_NONE) {
- rect= ibuf->rect_float;
- }
- else {
- rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
- linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
- alloc= TRUE;
- }
- }
+ rect= node_composit_get_float_buffer(rd, ibuf, &alloc);
}
else {
/* non-rgba passes can't use color profiles */

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b