本文整理汇总了C++中LLPointer::getHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ LLPointer::getHeight方法的具体用法?C++ LLPointer::getHeight怎么用?C++ LLPointer::getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLPointer
的用法示例。
在下文中一共展示了LLPointer::getHeight方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateImageStats
void LLFloaterTexturePicker::updateImageStats()
{
if (mTexturep.notNull())
{
//RN: have we received header data for this image?
if (mTexturep->getWidth(0) > 0 && mTexturep->getHeight(0) > 0)
{
std::string formatted_dims = llformat("%d x %d", mTexturep->getWidth(0),mTexturep->getHeight(0));
mResolutionLabel->setTextArg("[DIMENSIONS]", formatted_dims);
}
else
{
mResolutionLabel->setTextArg("[DIMENSIONS]", std::string("[? x ?]"));
}
}
}
示例2:
// note: modifies the argument raw_image!!!!
LLPointer<LLImageJ2C> LLViewerImageList::convertToUploadFile(LLPointer<LLImageRaw> raw_image)
{
raw_image->biasedScaleToPowerOfTwo(LLViewerImage::MAX_IMAGE_SIZE_DEFAULT);
LLPointer<LLImageJ2C> compressedImage = new LLImageJ2C();
compressedImage->setRate(0.f);
if (gSavedSettings.getBOOL("LosslessJ2CUpload") &&
(raw_image->getWidth() * raw_image->getHeight() <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF))
compressedImage->setReversible(TRUE);
compressedImage->encode(raw_image, 0.0f);
return compressedImage;
}
示例3: updateImageStats
void LLFloaterTexturePicker::updateImageStats()
{
if (mTexturep.notNull())
{
//RN: have we received header data for this image?
if (mTexturep->getWidth(0) > 0 && mTexturep->getHeight(0) > 0)
{
std::string formatted_dims = llformat("%d x %d", mTexturep->getWidth(0),mTexturep->getHeight(0));
mResolutionLabel->setTextArg("[DIMENSIONS]", formatted_dims);
}
else
{
mResolutionLabel->setTextArg("[DIMENSIONS]", std::string("[? x ?]"));
}
if (gAgent.isGodlike())
{
std::string tstring = "Pick: ";
std::string image_id_string = mTexturep->getID().asString();
tstring = tstring + image_id_string.replace(24, 35, 12, '*'); // hide last segment to discourage theft
setTitle(tstring);
}
}
}
示例4: drawRotatedImage
// Draws image rotated by multiples of 90 degrees
void LLJoystickCameraRotate::drawRotatedImage( LLPointer<LLUIImage> image, S32 rotations )
{
S32 width = image->getWidth();
S32 height = image->getHeight();
LLTexture* texture = image->getImage();
/*
* Scale texture coordinate system
* to handle the different between image size and size of texture.
* If we will use default matrix,
* it may break texture mapping after rotation.
* see EXT-2023 Camera floater: arrows became shifted when pressed.
*/
F32 uv[][2] =
{
{ (F32)width/texture->getWidth(), (F32)height/texture->getHeight() },
{ 0.f, (F32)height/texture->getHeight() },
{ 0.f, 0.f },
{ (F32)width/texture->getWidth(), 0.f }
};
gGL.getTexUnit(0)->bind(texture);
gGL.color4fv(UI_VERTEX_COLOR.mV);
gGL.begin(LLRender::QUADS);
{
gGL.texCoord2fv( uv[ (rotations + 0) % 4]);
gGL.vertex2i(width, height );
gGL.texCoord2fv( uv[ (rotations + 1) % 4]);
gGL.vertex2i(0, height );
gGL.texCoord2fv( uv[ (rotations + 2) % 4]);
gGL.vertex2i(0, 0);
gGL.texCoord2fv( uv[ (rotations + 3) % 4]);
gGL.vertex2i(width, 0);
}
gGL.end();
}
示例5:
// note: modifies the argument raw_image!!!!
LLPointer<LLImageJ2C> LLViewerTextureList::convertToUploadFile(LLPointer<LLImageRaw> raw_image)
{
raw_image->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
LLPointer<LLImageJ2C> compressedImage = new LLImageJ2C();
compressedImage->setRate(0.f);
if (gSavedSettings.getBOOL("LosslessJ2CUpload") &&
(raw_image->getWidth() * raw_image->getHeight() <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF))
compressedImage->setReversible(TRUE);
compressedImage->encode(raw_image, 0.0f);
if (!compressedImage->encode(raw_image, 0.0f))
{
llinfos << "convertToUploadFile : encode returns with error!!" << llendl;
// Clear up the pointer so we don't leak that one
compressedImage = NULL;
}
return compressedImage;
}
示例6: createFromFile
bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip_only)
{
std::string name = filename;
size_t dotidx = name.rfind('.');
S8 codec = IMG_CODEC_INVALID;
std::string exten;
deleteData(); // delete any existing data
if (dotidx != std::string::npos)
{
exten = name.substr(dotidx+1);
LLStringUtil::toLower(exten);
codec = getCodecFromExtension(exten);
}
else
{
exten = find_file(name, &codec);
name = name + "." + exten;
}
if (codec == IMG_CODEC_INVALID)
{
return false; // format not recognized
}
llifstream ifs(name, llifstream::binary);
if (!ifs.is_open())
{
// SJB: changed from LL_INFOS() to LL_DEBUGS() to reduce spam
LL_DEBUGS() << "Unable to open image file: " << name << LL_ENDL;
return false;
}
ifs.seekg (0, std::ios::end);
int length = ifs.tellg();
if (j2c_lowest_mip_only && length > 2048)
{
length = 2048;
}
ifs.seekg (0, std::ios::beg);
if (!length)
{
LL_INFOS() << "Zero length file file: " << name << LL_ENDL;
return false;
}
LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec);
llassert(image.notNull());
U8 *buffer = image->allocateData(length);
ifs.read ((char*)buffer, length);
ifs.close();
BOOL success;
success = image->updateData();
if (success)
{
if (j2c_lowest_mip_only && codec == IMG_CODEC_J2C)
{
S32 width = image->getWidth();
S32 height = image->getHeight();
S32 discard_level = 0;
while (width > 1 && height > 1 && discard_level < MAX_DISCARD_LEVEL)
{
width >>= 1;
height >>= 1;
discard_level++;
}
((LLImageJ2C *)((LLImageFormatted*)image))->setDiscardLevel(discard_level);
}
success = image->decode(this, 100000.0f);
}
示例7: output_image_stats
void output_image_stats(LLPointer<LLImageFormatted> image, const std::string &filename)
{
// Print out some statistical data on the image
std::cout << "Image stats for : " << filename << ", extension : " << image->getExtension() << std::endl;
std::cout << " with : " << (int)(image->getWidth()) << ", height : " << (int)(image->getHeight()) << std::endl;
std::cout << " comp : " << (int)(image->getComponents()) << ", levels : " << (int)(image->getDiscardLevel()) << std::endl;
std::cout << " head : " << (int)(image->calcHeaderSize()) << ", data : " << (int)(image->getDataSize()) << std::endl;
return;
}
示例8: handleToolTip
//virtual
BOOL LLNameListCtrl::handleToolTip(S32 x, S32 y, MASK mask)
{
BOOL handled = FALSE;
S32 column_index = getColumnIndexFromOffset(x);
LLScrollListItem* hit_item = hitItem(x, y);
if (hit_item
&& column_index == mNameColumnIndex)
{
// ...this is the column with the avatar name
LLUUID avatar_id = hit_item->getUUID();
if (avatar_id.notNull())
{
// ...valid avatar id
LLScrollListCell* hit_cell = hit_item->getColumn(column_index);
if (hit_cell)
{
S32 row_index = getItemIndex(hit_item);
LLRect cell_rect = getCellRect(row_index, column_index);
// Convert rect local to screen coordinates
LLRect sticky_rect;
localRectToScreen(cell_rect, &sticky_rect);
// Spawn at right side of cell
LLPointer<LLUIImage> icon = LLUI::getUIImage("Info_Small");
LLCoordGL pos( sticky_rect.mRight - info_icon_size, sticky_rect.mTop - (sticky_rect.getHeight() - icon->getHeight())/2 );
// Should we show a group or an avatar inspector?
bool is_group = hit_item->getValue()["is_group"].asBoolean();
LLToolTip::Params params;
params.background_visible( false );
params.click_callback( boost::bind(&LLNameListCtrl::showInspector, this, avatar_id, is_group) );
params.delay_time(0.0f); // spawn instantly on hover
params.image( icon );
params.message("");
params.padding(0);
params.pos(pos);
params.sticky_rect(sticky_rect);
LLToolTipMgr::getInstance()->show(params);
handled = TRUE;
}
}
}
if (!handled)
{
handled = LLScrollListCtrl::handleToolTip(x, y, mask);
}
return handled;
}
示例9: draw
void LLTextureView::draw()
{
if (!mFreezeView)
{
// LLViewerObject *objectp;
// S32 te;
for_each(mTextureBars.begin(), mTextureBars.end(), DeletePointer());
mTextureBars.clear();
delete mGLTexMemBar;
mGLTexMemBar = 0;
typedef std::multiset<decode_pair_t, compare_decode_pair > display_list_t;
display_list_t display_image_list;
if (mPrintList)
{
llinfos << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << llendl;
}
for (LLViewerImageList::image_priority_list_t::iterator iter = gImageList.mImageList.begin();
iter != gImageList.mImageList.end(); )
{
LLPointer<LLViewerImage> imagep = *iter++;
S32 cur_discard = imagep->getDiscardLevel();
S32 desired_discard = imagep->mDesiredDiscardLevel;
if (mPrintList)
{
llinfos << imagep->getID()
<< "\t" << imagep->mTextureMemory
<< "\t" << imagep->getBoostLevel()
<< "\t" << imagep->getDecodePriority()
<< "\t" << imagep->getWidth()
<< "\t" << imagep->getHeight()
<< "\t" << cur_discard
<< llendl;
}
#if 0
if (imagep->getDontDiscard())
{
continue;
}
if (imagep->isMissingAsset())
{
continue;
}
#endif
#define HIGH_PRIORITY 100000000.f
F32 pri;
if (mOrderFetch)
{
pri = ((F32)imagep->mFetchPriority)/256.f;
}
else
{
pri = imagep->getDecodePriority();
}
if (sDebugImages.find(imagep) != sDebugImages.end())
{
pri += 4*HIGH_PRIORITY;
}
if (!mOrderFetch)
{
#if 1
if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance())
{
struct f : public LLSelectedTEFunctor
{
LLViewerImage* mImage;
f(LLViewerImage* image) : mImage(image) {}
virtual bool apply(LLViewerObject* object, S32 te)
{
return (mImage == object->getTEImage(te));
}
} func(imagep);
const bool firstonly = true;
bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly);
if (match)
{
pri += 3*HIGH_PRIORITY;
}
}
#endif
#if 1
if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard))
{
LLViewerObject *objectp = gHoverView->getLastHoverObject();
if (objectp)
{
S32 tex_count = objectp->getNumTEs();
for (S32 i = 0; i < tex_count; i++)
{
//.........这里部分代码省略.........
示例10: draw
void LLTextureView::draw()
{
if (!mFreezeView)
{
// LLViewerObject *objectp;
// S32 te;
for_each(mTextureBars.begin(), mTextureBars.end(), KillView());
mTextureBars.clear();
if (mGLTexMemBar)
{
removeChild(mGLTexMemBar);
mGLTexMemBar->die();
mGLTexMemBar = 0;
}
if (mAvatarTexBar)
{
removeChild(mAvatarTexBar);
mAvatarTexBar->die();
mAvatarTexBar = 0;
}
typedef std::multiset<decode_pair_t, compare_decode_pair > display_list_t;
display_list_t display_image_list;
if (mPrintList)
{
llinfos << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << llendl;
}
for (LLViewerTextureList::image_priority_list_t::iterator iter = gTextureList.mImageList.begin();
iter != gTextureList.mImageList.end(); )
{
LLPointer<LLViewerFetchedTexture> imagep = *iter++;
if(!imagep->hasFetcher())
{
continue ;
}
S32 cur_discard = imagep->getDiscardLevel();
S32 desired_discard = imagep->mDesiredDiscardLevel;
if (mPrintList)
{
S32 tex_mem = imagep->hasGLTexture() ? imagep->getTextureMemory() : 0 ;
llinfos << imagep->getID()
<< "\t" << tex_mem
<< "\t" << imagep->getBoostLevel()
<< "\t" << imagep->getDecodePriority()
<< "\t" << imagep->getWidth()
<< "\t" << imagep->getHeight()
<< "\t" << cur_discard
<< llendl;
}
if (imagep->getID() == LLAppViewer::getTextureFetch()->mDebugID)
{
static S32 debug_count = 0;
++debug_count; // for breakpoints
}
F32 pri;
if (mOrderFetch)
{
pri = ((F32)imagep->mFetchPriority)/256.f;
}
else
{
pri = imagep->getDecodePriority();
}
pri = llclamp(pri, 0.0f, HIGH_PRIORITY-1.f);
if (sDebugImages.find(imagep) != sDebugImages.end())
{
pri += 4*HIGH_PRIORITY;
}
if (!mOrderFetch)
{
if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance())
{
struct f : public LLSelectedTEFunctor
{
LLViewerFetchedTexture* mImage;
f(LLViewerFetchedTexture* image) : mImage(image) {}
virtual bool apply(LLViewerObject* object, S32 te)
{
return (mImage == object->getTEImage(te));
}
} func(imagep);
const bool firstonly = true;
bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly);
if (match)
{
pri += 3*HIGH_PRIORITY;
}
}
//.........这里部分代码省略.........
示例11: createFromFile
bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip_only)
{
std::string name = filename;
size_t dotidx = name.rfind('.');
S8 codec = IMG_CODEC_INVALID;
std::string exten;
deleteData(); // delete any existing data
if (dotidx != std::string::npos)
{
exten = name.substr(dotidx+1);
LLStringUtil::toLower(exten);
codec = getCodecFromExtension(exten);
}
else
{
exten = find_file(name, &codec);
name = name + "." + exten;
}
if (codec == IMG_CODEC_INVALID)
{
return false; // format not recognized
}
llifstream ifs(name, llifstream::binary);
if (!ifs.is_open())
{
// SJB: changed from llinfos to lldebugs to reduce spam
lldebugs << "Unable to open image file: " << name << llendl;
return false;
}
ifs.seekg (0, std::ios::end);
int length = ifs.tellg();
if (j2c_lowest_mip_only && length > 2048)
{
length = 2048;
}
ifs.seekg (0, std::ios::beg);
if (!length)
{
llinfos << "Zero length file file: " << name << llendl;
return false;
}
LLPointer<LLImageFormatted> image;
switch(codec)
{
//case IMG_CODEC_RGB:
case IMG_CODEC_BMP:
image = new LLImageBMP();
break;
case IMG_CODEC_TGA:
image = new LLImageTGA();
break;
case IMG_CODEC_JPEG:
image = new LLImageJPEG();
break;
case IMG_CODEC_J2C:
image = new LLImageJ2C();
break;
case IMG_CODEC_DXT:
image = new LLImageDXT();
break;
default:
return false;
}
llassert(image.notNull());
U8 *buffer = image->allocateData(length);
ifs.read ((char*)buffer, length); /* Flawfinder: ignore */
ifs.close();
image->updateData();
if (j2c_lowest_mip_only && codec == IMG_CODEC_J2C)
{
S32 width = image->getWidth();
S32 height = image->getHeight();
S32 discard_level = 0;
while (width > 1 && height > 1 && discard_level < MAX_DISCARD_LEVEL)
{
width >>= 1;
height >>= 1;
discard_level++;
}
((LLImageJ2C *)((LLImageFormatted*)image))->setDiscardLevel(discard_level);
}