Code refactor: move OIIO image buffer writing outside session, into callback.
Original patch by Guillaume, modifications by Brecht. Differential Revision: https://developer.blender.org/D3102
This commit is contained in:

committed by
Brecht Van Lommel

parent
41149ca134
commit
e56fd59f22
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "util/util_foreach.h"
|
||||
#include "util/util_hash.h"
|
||||
#include "util/util_image.h"
|
||||
#include "util/util_math.h"
|
||||
#include "util/util_opengl.h"
|
||||
#include "util/util_time.h"
|
||||
@@ -448,37 +447,5 @@ bool DisplayBuffer::draw_ready()
|
||||
return (draw_width != 0 && draw_height != 0);
|
||||
}
|
||||
|
||||
void DisplayBuffer::write(const string& filename)
|
||||
{
|
||||
int w = draw_width;
|
||||
int h = draw_height;
|
||||
|
||||
if(w == 0 || h == 0)
|
||||
return;
|
||||
|
||||
if(half_float)
|
||||
return;
|
||||
|
||||
/* read buffer from device */
|
||||
uchar4 *pixels = rgba_byte.copy_from_device(0, w, h);
|
||||
|
||||
/* write image */
|
||||
ImageOutput *out = ImageOutput::create(filename);
|
||||
ImageSpec spec(w, h, 4, TypeDesc::UINT8);
|
||||
|
||||
out->open(filename, spec);
|
||||
|
||||
/* conversion for different top/bottom convention */
|
||||
out->write_image(TypeDesc::UINT8,
|
||||
(uchar*)(pixels + (h-1)*w),
|
||||
AutoStride,
|
||||
-w*sizeof(uchar4),
|
||||
AutoStride);
|
||||
|
||||
out->close();
|
||||
|
||||
delete out;
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
Reference in New Issue
Block a user