From 446852f3610b7390f6ca4376f6661aa4bf1b2f88 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 2 May 2013 15:41:05 +1000 Subject: Removing XPMSet class as no longer used. --- src/XPM.cxx | 83 ------------------------------------------------------------- src/XPM.h | 24 ------------------ 2 files changed, 107 deletions(-) (limited to 'src') 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_) { diff --git a/src/XPM.h b/src/XPM.h index e047ca8ad..5deeffa48 100644 --- a/src/XPM.h +++ b/src/XPM.h @@ -47,30 +47,6 @@ public: static const char **LinesFormFromTextForm(const char *textForm); }; -/** - * A collection of pixmaps indexed by integer id. - */ -class XPMSet { - XPM **set; ///< The stored XPMs. - int len; ///< Current number of XPMs. - int maximum; ///< Current maximum number of XPMs, increased by steps if reached. - int height; ///< Memorize largest height of the set. - int width; ///< Memorize largest width of the set. -public: - XPMSet(); - ~XPMSet(); - /// Remove all XPMs. - void Clear(); - /// Add a XPM. - void Add(int ident, const char *textForm); - /// Get XPM by id. - XPM *Get(int ident); - /// Give the largest height of the set. - int GetHeight(); - /// Give the largest width of the set. - int GetWidth(); -}; - /** * An translucent image stoed as a sequence of RGBA bytes. */ -- cgit v1.2.3