diff options
Diffstat (limited to 'src/XPM.cxx')
-rw-r--r-- | src/XPM.cxx | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/src/XPM.cxx b/src/XPM.cxx index 7188c2465..4dcf439f5 100644 --- a/src/XPM.cxx +++ b/src/XPM.cxx @@ -236,89 +236,6 @@ const char **XPM::LinesFormFromTextForm(const char *textForm) { return linesForm; } -// In future, may want to minimize search time by sorting and using a binary search. - -XPMSet::XPMSet() : set(0), len(0), maximum(0), height(-1), width(-1) { -} - -XPMSet::~XPMSet() { - Clear(); -} - -void XPMSet::Clear() { - for (int i = 0; i < len; i++) { - delete set[i]; - } - delete []set; - set = 0; - len = 0; - maximum = 0; - height = -1; - width = -1; -} - -void XPMSet::Add(int ident, const char *textForm) { - // Invalidate cached dimensions - height = -1; - width = -1; - - // Replace if this id already present - for (int i = 0; i < len; i++) { - if (set[i]->GetId() == ident) { - set[i]->Init(textForm); - return; - } - } - - // Not present, so add to end - XPM *pxpm = new XPM(textForm); - if (pxpm) { - pxpm->SetId(ident); - if (len == maximum) { - maximum += 64; - XPM **setNew = new XPM *[maximum]; - for (int i = 0; i < len; i++) { - setNew[i] = set[i]; - } - delete []set; - set = setNew; - } - set[len] = pxpm; - len++; - } -} - -XPM *XPMSet::Get(int ident) { - for (int i = 0; i < len; i++) { - if (set[i]->GetId() == ident) { - return set[i]; - } - } - return 0; -} - -int XPMSet::GetHeight() { - if (height < 0) { - for (int i = 0; i < len; i++) { - if (height < set[i]->GetHeight()) { - height = set[i]->GetHeight(); - } - } - } - return (height > 0) ? height : 0; -} - -int XPMSet::GetWidth() { - if (width < 0) { - for (int i = 0; i < len; i++) { - if (width < set[i]->GetWidth()) { - width = set[i]->GetWidth(); - } - } - } - return (width > 0) ? width : 0; -} - RGBAImage::RGBAImage(int width_, int height_, float scale_, const unsigned char *pixels_) : height(height_), width(width_), scale(scale_) { if (pixels_) { |