diff options
author | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
commit | 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch) | |
tree | bcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/llimage/llimage.h | |
parent | Second Life viewer sources 1.13.3.2 (diff) | |
download | meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2 meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz |
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/llimage/llimage.h')
-rw-r--r-- | linden/indra/llimage/llimage.h | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/linden/indra/llimage/llimage.h b/linden/indra/llimage/llimage.h index eb1805a..ef5496e 100644 --- a/linden/indra/llimage/llimage.h +++ b/linden/indra/llimage/llimage.h | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "lluuid.h" | 32 | #include "lluuid.h" |
33 | #include "llstring.h" | 33 | #include "llstring.h" |
34 | #include "llmemory.h" | 34 | #include "llmemory.h" |
35 | #include "llworkerthread.h" | 35 | #include "llthread.h" |
36 | 36 | ||
37 | const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2 | 37 | const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2 |
38 | const S32 MAX_IMAGE_MIP = 11; // 2048x2048 | 38 | const S32 MAX_IMAGE_MIP = 11; // 2048x2048 |
@@ -154,8 +154,6 @@ public: | |||
154 | /*virtual*/ U8* allocateData(S32 size = -1); | 154 | /*virtual*/ U8* allocateData(S32 size = -1); |
155 | /*virtual*/ U8* reallocateData(S32 size); | 155 | /*virtual*/ U8* reallocateData(S32 size); |
156 | 156 | ||
157 | BOOL copyData(U8 *data, U16 width, U16 height, S8 components); | ||
158 | |||
159 | BOOL resize(U16 width, U16 height, S8 components); | 157 | BOOL resize(U16 width, U16 height, S8 components); |
160 | 158 | ||
161 | U8 * getSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height) const; | 159 | U8 * getSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height) const; |
@@ -225,11 +223,10 @@ public: | |||
225 | 223 | ||
226 | // Compressed representation of image. | 224 | // Compressed representation of image. |
227 | // Subclass from this class for the different representations (J2C, bmp) | 225 | // Subclass from this class for the different representations (J2C, bmp) |
228 | class LLImageFormatted : public LLImageBase, public LLWorkerClass | 226 | class LLImageFormatted : public LLImageBase |
229 | { | 227 | { |
230 | public: | 228 | public: |
231 | static void initClass(bool threaded = true, bool run_always = true); | 229 | static LLImageFormatted* createFromType(S8 codec); |
232 | static void cleanupClass(); | ||
233 | static LLImageFormatted* createFromExtension(const LLString& instring); | 230 | static LLImageFormatted* createFromExtension(const LLString& instring); |
234 | 231 | ||
235 | protected: | 232 | protected: |
@@ -247,22 +244,11 @@ public: | |||
247 | /*virtual*/ void dump(); | 244 | /*virtual*/ void dump(); |
248 | /*virtual*/ void sanityCheck(); | 245 | /*virtual*/ void sanityCheck(); |
249 | 246 | ||
250 | // LLWorkerThread | ||
251 | public: | ||
252 | // called from WORKER THREAD, returns TRUE if done | ||
253 | /*virtual*/ bool doWork(S32 param); | ||
254 | private: | ||
255 | // called from MAIN THREAD | ||
256 | /*virtual*/ void startWork(S32 param); // called from addWork() | ||
257 | /*virtual*/ void endWork(S32 param, bool aborted); // called from doWork() | ||
258 | |||
259 | // New methods | 247 | // New methods |
260 | public: | 248 | public: |
261 | // calcHeaderSize() returns the maximum size of header; | 249 | // calcHeaderSize() returns the maximum size of header; |
262 | // 0 indicates we don't know have a header and have to lead the entire file | 250 | // 0 indicates we don't know have a header and have to lead the entire file |
263 | virtual S32 calcHeaderSize() { return 0; }; | 251 | virtual S32 calcHeaderSize() { return 0; }; |
264 | // readHeader() reads size bytes into mData, and sets width/height/ncomponents | ||
265 | virtual void readHeader(U8* data, S32 size); | ||
266 | // calcDataSize() returns how many bytes to read to load discard_level (including header) | 252 | // calcDataSize() returns how many bytes to read to load discard_level (including header) |
267 | virtual S32 calcDataSize(S32 discard_level); | 253 | virtual S32 calcDataSize(S32 discard_level); |
268 | // calcDiscardLevelBytes() returns the smallest valid discard level based on the number of input bytes | 254 | // calcDiscardLevelBytes() returns the smallest valid discard level based on the number of input bytes |
@@ -272,27 +258,16 @@ public: | |||
272 | 258 | ||
273 | BOOL load(const LLString& filename); | 259 | BOOL load(const LLString& filename); |
274 | BOOL save(const LLString& filename); | 260 | BOOL save(const LLString& filename); |
275 | // BOOL save(LLVFS *vfs, const LLUUID &uuid, const LLAssetType::EType type); | ||
276 | // Depricated to remove VFS dependency (see .cpp for replacement): | ||
277 | 261 | ||
278 | virtual BOOL updateData() = 0; // pure virtual | 262 | virtual BOOL updateData() = 0; // pure virtual |
279 | BOOL copyData(U8 *data, S32 size); // calls updateData() | 263 | void setData(U8 *data, S32 size); |
280 | BOOL setData(U8 *data, S32 size); // calls updateData() | 264 | void appendData(U8 *data, S32 size); |
281 | BOOL appendData(U8 *data, S32 size); // use if some data (e.g header) is already loaded, calls updateData() | ||
282 | 265 | ||
283 | // Loads first 4 channels. | 266 | // Loads first 4 channels. |
284 | virtual BOOL decode(LLImageRaw* raw_image, F32 decode_time=0.0) = 0; | 267 | virtual BOOL decode(LLImageRaw* raw_image, F32 decode_time=0.0) = 0; |
285 | // Subclasses that can handle more than 4 channels should override this function. | 268 | // Subclasses that can handle more than 4 channels should override this function. |
286 | virtual BOOL decode(LLImageRaw* raw_image, F32 decode_time, S32 first_channel, S32 max_channel); | 269 | virtual BOOL decode(LLImageRaw* raw_image, F32 decode_time, S32 first_channel, S32 max_channel); |
287 | 270 | ||
288 | // Decode methods to return a pointer to raw data for purposes of passing to | ||
289 | // opengl or such. This class tracks the decoded data and keeps it alive until | ||
290 | // destroyed or releaseDecodedData() is called. | ||
291 | virtual BOOL requestDecodedData(LLPointer<LLImageRaw>& raw, S32 discard = -1, F32 decode_time=0.0); | ||
292 | virtual BOOL requestDecodedAuxData(LLPointer<LLImageRaw>& raw, S32 channel, | ||
293 | S32 discard = -1, F32 decode_time=0.0); | ||
294 | virtual void releaseDecodedData(); | ||
295 | |||
296 | virtual BOOL encode(const LLImageRaw* raw_image, F32 encode_time=0.0) = 0; | 271 | virtual BOOL encode(const LLImageRaw* raw_image, F32 encode_time=0.0) = 0; |
297 | 272 | ||
298 | S8 getCodec() const; | 273 | S8 getCodec() const; |
@@ -302,16 +277,16 @@ public: | |||
302 | S8 getDiscardLevel() const { return mDiscardLevel; } | 277 | S8 getDiscardLevel() const { return mDiscardLevel; } |
303 | 278 | ||
304 | protected: | 279 | protected: |
280 | BOOL copyData(U8 *data, S32 size); // calls updateData() | ||
281 | |||
282 | protected: | ||
305 | S8 mCodec; | 283 | S8 mCodec; |
306 | S8 mDecoding; | 284 | S8 mDecoding; |
307 | S8 mDecoded; | 285 | S8 mDecoded; |
308 | S8 mDiscardLevel; | 286 | S8 mDiscardLevel; |
309 | 287 | ||
310 | LLPointer<LLImageRaw> mDecodedImage; | ||
311 | |||
312 | public: | 288 | public: |
313 | static S32 sGlobalFormattedMemory; | 289 | static S32 sGlobalFormattedMemory; |
314 | static LLWorkerThread* sWorkerThread; | ||
315 | }; | 290 | }; |
316 | 291 | ||
317 | #endif | 292 | #endif |