00001 00032 #ifndef LL_LLIMAGEWORKER_H 00033 #define LL_LLIMAGEWORKER_H 00034 00035 #include "llimage.h" 00036 #include "llworkerthread.h" 00037 00038 class LLImageWorker : public LLWorkerClass 00039 { 00040 public: 00041 static void initClass(LLWorkerThread* workerthread); 00042 static void cleanupClass(); 00043 static LLWorkerThread* getWorkerThread() { return sWorkerThread; } 00044 00045 // LLWorkerThread 00046 public: 00047 LLImageWorker(LLImageFormatted* image, U32 priority, S32 discard, 00048 LLPointer<LLResponder> responder); 00049 ~LLImageWorker(); 00050 00051 // called from WORKER THREAD, returns TRUE if done 00052 /*virtual*/ bool doWork(S32 param); 00053 00054 BOOL requestDecodedData(LLPointer<LLImageRaw>& raw, S32 discard = -1); 00055 BOOL requestDecodedAuxData(LLPointer<LLImageRaw>& raw, S32 channel, S32 discard = -1); 00056 void releaseDecodedData(); 00057 void cancelDecode(); 00058 00059 private: 00060 // called from MAIN THREAD 00061 /*virtual*/ void startWork(S32 param); // called from addWork() 00062 /*virtual*/ void endWork(S32 param, bool aborted); // called from doWork() 00063 00064 protected: 00065 LLPointer<LLImageFormatted> mFormattedImage; 00066 LLPointer<LLImageRaw> mDecodedImage; 00067 S32 mDecodedType; 00068 S32 mDiscardLevel; 00069 00070 private: 00071 U32 mPriority; 00072 LLPointer<LLResponder> mResponder; 00073 00074 protected: 00075 static LLWorkerThread* sWorkerThread; 00076 00077 public: 00078 static S32 sCount; 00079 }; 00080 00081 #endif