Finnally fixed windows comments
This commit is contained in:
@@ -156,7 +156,6 @@ private:
|
||||
|
||||
public:
|
||||
S16 mMemType; // debug
|
||||
std::string decodedImageComment; //lol comment decoding haha
|
||||
static BOOL sSizeOverride;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,9 +36,7 @@
|
||||
#include "lldir.h"
|
||||
#include "llimagej2c.h"
|
||||
#include "llmemtype.h"
|
||||
// <edit>
|
||||
#include "llimagemetadatareader.h"
|
||||
// </edit>
|
||||
|
||||
typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)();
|
||||
typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*);
|
||||
typedef const char* (*EngineInfoLLImageJ2CFunction)();
|
||||
@@ -299,9 +297,6 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir
|
||||
// Update the raw discard level
|
||||
updateRawDiscardLevel();
|
||||
mDecoding = TRUE;
|
||||
// <edit>
|
||||
raw_imagep->decodedImageComment = LLImageMetaDataReader::ExtractEncodedComment(getData(),getDataSize());
|
||||
// </edit>
|
||||
res = mImpl->decodeImpl(*this, *raw_imagep, decode_time, first_channel, max_channel_count);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ std::vector<U8> LLJ2cParser::GetNextComment()
|
||||
//static
|
||||
std::string LLImageMetaDataReader::ExtractEncodedComment(U8* data,int data_size)
|
||||
{
|
||||
LLJ2cParser* parser = new LLJ2cParser(data,data_size);
|
||||
LLJ2cParser parser = LLJ2cParser(data,data_size);
|
||||
while(1)
|
||||
{
|
||||
std::vector<U8> comment = parser->GetNextComment();
|
||||
std::vector<U8> comment = parser.GetNextComment();
|
||||
if (comment.empty()) break; //exit loop
|
||||
if (comment[1] == 0x00 && comment.size() == 130)
|
||||
{
|
||||
@@ -118,12 +118,10 @@ std::string LLImageMetaDataReader::ExtractEncodedComment(U8* data,int data_size)
|
||||
if(i < 4) break;
|
||||
std::string result(payload.begin()+4,payload.begin()+i);
|
||||
//llinfos << "FOUND COMMENT: " << result << llendl;
|
||||
delete parser;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
//end of loop
|
||||
delete parser;
|
||||
return "";
|
||||
}
|
||||
// </edit>
|
||||
|
||||
@@ -27,10 +27,11 @@ std::vector<LLFloaterExport*> LLFloaterExport::instances;
|
||||
class CacheReadResponder : public LLTextureCache::ReadResponder
|
||||
{
|
||||
public:
|
||||
CacheReadResponder(const LLUUID& id, LLImageFormatted* image,const std::string& filename)
|
||||
: mFormattedImage(image), mID(id)
|
||||
CacheReadResponder(const LLUUID& id, const std::string& filename)
|
||||
: mID(id)
|
||||
{
|
||||
setImage(image);
|
||||
mFormattedImage = new LLImageJ2C;
|
||||
setImage(mFormattedImage);
|
||||
mFilename = filename;
|
||||
}
|
||||
void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal)
|
||||
@@ -738,8 +739,7 @@ void LLFloaterExport::onClickSaveAs(void* user_data)
|
||||
LLViewerImage* img = gImageList.getImage(textures.front(), MIPMAP_TRUE, FALSE);
|
||||
img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAX_LEVEL);
|
||||
|
||||
LLImageJ2C * mFormattedImage = new LLImageJ2C;
|
||||
CacheReadResponder* responder = new CacheReadResponder(textures.front(), mFormattedImage,std::string(path + textures.front().asString() + ".j2c"));
|
||||
CacheReadResponder* responder = new CacheReadResponder(textures.front(), std::string(path + textures.front().asString() + ".j2c"));
|
||||
LLAppViewer::getTextureCache()->readFromCache(textures.front(),LLWorkerThread::PRIORITY_HIGH,0,999999,responder);
|
||||
textures.pop_front();
|
||||
}
|
||||
|
||||
@@ -61,6 +61,11 @@
|
||||
#include "llappviewer.h"
|
||||
#include "llface.h"
|
||||
#include "llviewercamera.h"
|
||||
|
||||
// <edit>
|
||||
#include "llimagemetadatareader.h"
|
||||
#include "lltexturecache.h"
|
||||
// </edit>
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// statics
|
||||
@@ -96,6 +101,63 @@ BOOL LLViewerImage::sFreezeImageScalingDown = FALSE ;
|
||||
//debug use
|
||||
S32 LLViewerImage::sLLViewerImageCount = 0 ;
|
||||
|
||||
// <edit>
|
||||
class CommentCacheReadResponder : public LLTextureCache::ReadResponder
|
||||
{
|
||||
public:
|
||||
CommentCacheReadResponder(LLPointer<LLViewerImage> image)
|
||||
: mViewerImage(image)
|
||||
{
|
||||
mID = image->getID();
|
||||
mFormattedImage = new LLImageJ2C;
|
||||
setImage(mFormattedImage);
|
||||
}
|
||||
void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal)
|
||||
{
|
||||
if(imageformat==IMG_CODEC_TGA && mFormattedImage->getCodec()==IMG_CODEC_J2C)
|
||||
{
|
||||
//llwarns<<"Bleh its a tga not saving"<<llendl;
|
||||
mFormattedImage=NULL;
|
||||
mImageSize=0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mFormattedImage.notNull())
|
||||
{
|
||||
llassert_always(mFormattedImage->getCodec() == imageformat);
|
||||
mFormattedImage->appendData(data, datasize);
|
||||
}
|
||||
else
|
||||
{
|
||||
mFormattedImage = LLImageFormatted::createFromType(imageformat);
|
||||
mFormattedImage->setData(data,datasize);
|
||||
}
|
||||
mImageSize = imagesize;
|
||||
mImageLocal = imagelocal;
|
||||
}
|
||||
|
||||
virtual void completed(bool success)
|
||||
{
|
||||
if(success && (mFormattedImage.notNull()) && mImageSize>0 && mViewerImage.notNull())
|
||||
{
|
||||
|
||||
//llinfos << "SUCCESS getting texture "<<mID<< llendl;
|
||||
mViewerImage->decodedComment = LLImageMetaDataReader::ExtractEncodedComment(mFormattedImage->getData(),mFormattedImage->getDataSize());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!success)
|
||||
llwarns << "FAIL NOT SUCCESSFUL getting texture "<<mID<< llendl;
|
||||
}
|
||||
}
|
||||
private:
|
||||
LLPointer<LLImageFormatted> mFormattedImage;
|
||||
LLPointer<LLViewerImage> mViewerImage;
|
||||
LLUUID mID;
|
||||
};
|
||||
// </edit>
|
||||
|
||||
// static
|
||||
void LLViewerImage::initClass()
|
||||
{
|
||||
@@ -523,7 +585,7 @@ BOOL LLViewerImage::createTexture(S32 usename/*= 0*/)
|
||||
|
||||
U32 raw_width = mRawImage->getWidth() << mRawDiscardLevel;
|
||||
U32 raw_height = mRawImage->getHeight() << mRawDiscardLevel;
|
||||
decodedComment = mRawImage->decodedImageComment;
|
||||
|
||||
if( raw_width > MAX_IMAGE_SIZE || raw_height > MAX_IMAGE_SIZE )
|
||||
{
|
||||
llinfos << "Width or height is greater than " << MAX_IMAGE_SIZE << ": (" << raw_width << "," << raw_height << ")" << llendl;
|
||||
@@ -546,7 +608,12 @@ BOOL LLViewerImage::createTexture(S32 usename/*= 0*/)
|
||||
destroyRawImage();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
// <edit>
|
||||
CommentCacheReadResponder* responder = new CommentCacheReadResponder(this);
|
||||
LLAppViewer::getTextureCache()->readFromCache(getID(),LLWorkerThread::PRIORITY_HIGH,0,999999,responder);
|
||||
// </edit>
|
||||
|
||||
res = LLImageGL::createGLTexture(mRawDiscardLevel, mRawImage, usename);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user