-
- // Spawn Xvfb and set env variables so that Xlib will use it
- // Use 8 bits each for RGB components, which should translate into
- // "enough" bits for YUV components.
- FrameBuffer fb(frame_params.width, frame_params.height, 3 * 8);
- setenv("XAUTHORITY", fb.get_x_authority().c_str(), true);
- setenv("DISPLAY", fb.get_x_display().c_str(), true);
+
+ std::auto_ptr<FrameBuffer> fb;
+ if (!preview_mode)
+ {
+ // Spawn Xvfb and set env variables so that Xlib will use it
+ // Use 8 bits each for RGB components, which should translate into
+ // "enough" bits for YUV components.
+ fb.reset(new FrameBuffer(frame_params.width, frame_params.height,
+ 3 * 8));
+ setenv("XAUTHORITY", fb->get_x_authority().c_str(), true);
+ setenv("DISPLAY", fb->get_x_display().c_str(), true);
+ }