summaryrefslogtreecommitdiff
path: root/indra/llimage/llimagej2c.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2016-07-21 16:49:02 -0400
committerNat Goodspeed <nat@lindenlab.com>2016-07-21 16:49:02 -0400
commit71b593e88b1e601db84cd3c399865a0bfd8164cf (patch)
tree62b2dc11ffc0c4b910a958ddb106c929cad362db /indra/llimage/llimagej2c.h
parentf09a92f1f32179ae24f150670851bf63aad204c4 (diff)
MAINT-6584: Streamline static LLImageJ2C implementation API.
Specifically, remove unused function pointer types CreateLLImageJ2CFunction, DestroyLLImageJ2CFunction and EngineInfoLLImageJ2CFunction. Also eliminate static fallbackDestroyLLImageJ2CImpl() and fallbackEngineInfoLLImageJ2CImpl(), leaving only static fallbackCreateLLImageJ2CImpl(). We do need a factory function to instantiate the appropriate LLImageJ2CImpl subclass, so leave the fallbackCreateLLImageJ2CImpl() link seam in place. However, given that every known LLImageJ2CImpl subclass is cheap to instantiate, make getEngineInfo() a pure virtual method on that subclass: the static LLImageJ2C::getEngineInfo() method can temporarily construct an instance to query. While we're at it, make getEngineInfo() return std::string like LLImageJ2C::getEngineInfo(). It's ridiculous that fallbackEngineInfoLLImageJ2CImpl() implementations constructed a static std::string and returned its c_str(), only to have LLImageJ2C::getEngineInfo() construct ANOTHER std::string from the returned const char*. fallbackDestroyLLImageJ2CImpl() never did anything useful: it merely deleted the passed LLImageJ2CImpl subclass pointer as the specific subclass type. But since LLImageJ2CImpl's destructor is virtual, LLImageJ2C's destructor could simply delete the stored LLImageJ2CImpl*. In fact, make mImpl a boost::scoped_ptr<LLImageJ2CImpl> so we don't even have to delete it manually.
Diffstat (limited to 'indra/llimage/llimagej2c.h')
-rw-r--r--indra/llimage/llimagej2c.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h
index ce8195940d..bfaccdfd05 100644
--- a/indra/llimage/llimagej2c.h
+++ b/indra/llimage/llimagej2c.h
@@ -30,6 +30,7 @@
#include "llimage.h"
#include "llassettype.h"
#include "llmetricperformancetester.h"
+#include <boost/scoped_ptr.hpp>
// JPEG2000 : compression rate used in j2c conversion.
const F32 DEFAULT_COMPRESSION_RATE = 1.f/8.f;
@@ -94,7 +95,7 @@ protected:
S8 mRawDiscardLevel;
F32 mRate;
BOOL mReversible;
- LLImageJ2CImpl *mImpl;
+ boost::scoped_ptr<LLImageJ2CImpl> mImpl;
std::string mLastError;
// Image compression/decompression tester
@@ -124,11 +125,11 @@ protected:
virtual BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL) = 0;
virtual BOOL initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0) = 0;
+ virtual std::string getEngineInfo() const = 0;
+
friend class LLImageJ2C;
};
-#define LINDEN_J2C_COMMENT_PREFIX "LL_"
-
//
// This class is used for performance data gathering only.
// Tracks the image compression / decompression data,