#include "GraphicsParams.h"
#include "ColorHandler.h"
#include "debug.h"
-#include "frontends/GUIRunTime.h" // x11Display
+#include "frontends/GUIRunTime.h" // x11Display, x11Screen
#include "support/filetools.h" // IsFileReadable
#include "support/lstrings.h"
#include "Lsstream.h"
GImageXPM::GImageXPM(GImageXPM const & other)
: GImage(other),
image_(other.image_),
- pixmap_(other.pixmap_),
- pixmap_status_(other.pixmap_status_)
+ pixmap_(0),
+ pixmap_status_(PIXMAP_UNINITIALISED)
{}
GImageXPM::~GImageXPM()
{
- if (pixmap_ && pixmap_status_ == PIXMAP_SUCCESS)
+ if (pixmap_)
XFreePixmap(GUIRunTime::x11Display(), pixmap_);
}
break;
case XpmNoMemory:
- lyxerr[Debug::GRAPHICS]
+ lyxerr[Debug::GRAPHICS]
<< "Insufficient memory to read in XPM file"
<< std::endl;
break;
delete xpm_image;
lyxerr[Debug::GRAPHICS]
- << "Error reading XPM file '"
+ << "Error reading XPM file '"
<< XpmGetErrorString(success) << "'"
<< std::endl;
} else {
// Load up the pixmap
XpmImage xpm_image = image_.get();
int const status =
- XpmCreatePixmapFromXpmImage(display,
- XRootWindowOfScreen(screen),
- &xpm_image,
+ XpmCreatePixmapFromXpmImage(display,
+ XRootWindowOfScreen(screen),
+ &xpm_image,
&pixmap, &mask, &attrib);
XpmFreeAttributes(&attrib);
if (status != XpmSuccess) {
- lyxerr << "Error creating pixmap from xpm_image '"
+ lyxerr << "Error creating pixmap from xpm_image '"
<< XpmGetErrorString(status) << "'"
<< std::endl;
pixmap_status_ = PIXMAP_FAILED;
max_y = std::max(max_y, y_rot); min_y = std::min(min_y, y_rot);
typedef unsigned int dimension;
-
+
dimension const new_width = 1 + int(max_x - min_x); // round up!
dimension const new_height = 1 + int(max_y - min_y);
string const unique_color_string(XpmImage const & image);
-// create a copy (using malloc and strcpy). If (!in) return 0;
+// create a copy (using malloc and strcpy). If (!in) return 0;
char * clone_c_string(char const * in);
// Given a string of the form #ff0571 create appropriate grayscale and
if (!in)
return 0;
- // Don't forget the '\0'
+ // Don't forget the '\0'
char * out = static_cast<char *>(malloc(strlen(in) + 1));
return strcpy(out, in);
}