diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index a0322846a..30b0ed429 100644
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -98,9 +98,7 @@ LLFontGlyphInfo::LLFontGlyphInfo(U32 index)
mYBitmapOffset(0), // Offset to the origin in the bitmap
mXBearing(0), // Distance from baseline to left in pixels
mYBearing(0), // Distance from baseline to top in pixels
- mBitmapNum(0), // Which bitmap in the bitmap cache contains this glyph
- mIsRendered(FALSE),
- mMetricsValid(FALSE)
+ mBitmapNum(0) // Which bitmap in the bitmap cache contains this glyph
{
}
@@ -239,16 +237,12 @@ F32 LLFontFreetype::getXAdvance(const llwchar wch) const
if (mFTFace == NULL)
return 0.0;
- llassert(!mIsFallback);
- //U32 glyph_index;
-
// Return existing info only if it is current
LLFontGlyphInfo* gi = getGlyphInfo(wch);
- if (gi && gi->mMetricsValid)
+ if (gi)
{
return gi->mXAdvance;
}
- //new
else
{
char_glyph_info_map_t::iterator found_it = mCharGlyphInfoMap.find((llwchar)0);
@@ -257,73 +251,29 @@ F32 LLFontFreetype::getXAdvance(const llwchar wch) const
return found_it->second->mXAdvance;
}
}
- /*const LLFontFreetype* fontp = this;
-
- // Initialize char to glyph map
- glyph_index = FT_Get_Char_Index(mFTFace, wch);
- if (glyph_index == 0)
- {
- font_vector_t::const_iterator iter;
- for(iter = mFallbackFonts.begin(); iter != mFallbackFonts.end(); iter++)
- {
- glyph_index = FT_Get_Char_Index((*iter)->mFTFace, wch);
- if (glyph_index)
- {
- fontp = *iter;
- }
- }
- }
-
- if (glyph_index)
- {
- // This font has this glyph
- fontp->renderGlyph(glyph_index);
-
- // Create the entry if it's not there
- char_glyph_info_map_t::iterator iter2 = mCharGlyphInfoMap.find(wch);
- if (iter2 == mCharGlyphInfoMap.end())
- {
- gi = new LLFontGlyphInfo(glyph_index);
- insertGlyphInfo(wch, gi);
- }
- else
- {
- gi = iter2->second;
- }
-
- gi->mWidth = fontp->mFTFace->glyph->bitmap.width;
- gi->mHeight = fontp->mFTFace->glyph->bitmap.rows;
-
- // Convert these from 26.6 units to float pixels.
- gi->mXAdvance = fontp->mFTFace->glyph->advance.x / 64.f;
- gi->mYAdvance = fontp->mFTFace->glyph->advance.y / 64.f;
- gi->mMetricsValid = TRUE;
- //gi->mIsRendered = TRUE;
- return gi->mXAdvance;
- }
- else
- {
- gi = get_if_there(mCharGlyphInfoMap, (llwchar)0, (LLFontGlyphInfo*)NULL);
- if (gi)
- {
- return gi->mXAdvance;
- }
- }*/
// Last ditch fallback - no glyphs defined at all.
return (F32)mFontBitmapCachep->getMaxCharWidth();
}
-F32 LLFontFreetype::getXKerning(const llwchar char_left, const llwchar char_right) const
+F32 LLFontFreetype::getXAdvance(const LLFontGlyphInfo* glyph) const
{
if (mFTFace == NULL)
return 0.0;
- llassert(!mIsFallback);
- LLFontGlyphInfo* left_glyph_info = get_if_there(mCharGlyphInfoMap, char_left, (LLFontGlyphInfo*)NULL);
+ return glyph->mXAdvance;
+}
+
+F32 LLFontFreetype::getXKerning(llwchar char_left, llwchar char_right) const
+{
+ if (mFTFace == NULL)
+ return 0.0;
+
+ //llassert(!mIsFallback);
+ LLFontGlyphInfo* left_glyph_info = getGlyphInfo(char_left);;
U32 left_glyph = left_glyph_info ? left_glyph_info->mGlyphIndex : 0;
// Kern this puppy.
- LLFontGlyphInfo* right_glyph_info = get_if_there(mCharGlyphInfoMap, char_right, (LLFontGlyphInfo*)NULL);
+ LLFontGlyphInfo* right_glyph_info = getGlyphInfo(char_right);
U32 right_glyph = right_glyph_info ? right_glyph_info->mGlyphIndex : 0;
FT_Vector delta;
@@ -333,22 +283,28 @@ F32 LLFontFreetype::getXKerning(const llwchar char_left, const llwchar char_righ
return delta.x*(1.f/64.f);
}
-BOOL LLFontFreetype::hasGlyph(const llwchar wch) const
+F32 LLFontFreetype::getXKerning(const LLFontGlyphInfo* left_glyph_info, const LLFontGlyphInfo* right_glyph_info) const
+{
+ if (mFTFace == NULL)
+ return 0.0;
+
+ U32 left_glyph = left_glyph_info ? left_glyph_info->mGlyphIndex : 0;
+ U32 right_glyph = right_glyph_info ? right_glyph_info->mGlyphIndex : 0;
+
+ FT_Vector delta;
+
+ llverify(!FT_Get_Kerning(mFTFace, left_glyph, right_glyph, ft_kerning_unfitted, &delta));
+
+ return delta.x*(1.f/64.f);
+}
+
+BOOL LLFontFreetype::hasGlyph(llwchar wch) const
{
llassert(!mIsFallback);
return(mCharGlyphInfoMap.find(wch) != mCharGlyphInfoMap.end());
- /*const LLFontGlyphInfo* gi = getGlyphInfo(wch);
- if (gi && gi->mIsRendered)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }*/
}
-BOOL LLFontFreetype::addGlyph(const llwchar wch) const
+LLFontGlyphInfo* LLFontFreetype::addGlyph(llwchar wch) const
{
if (mFTFace == NULL)
return FALSE;
@@ -369,24 +325,23 @@ BOOL LLFontFreetype::addGlyph(const llwchar wch) const
glyph_index = FT_Get_Char_Index((*iter)->mFTFace, wch);
if (glyph_index)
{
- addGlyphFromFont(*iter, wch, glyph_index);
- return TRUE;
+ return addGlyphFromFont(*iter, wch, glyph_index);
}
}
}
char_glyph_info_map_t::iterator iter = mCharGlyphInfoMap.find(wch);
- if (iter == mCharGlyphInfoMap.end() || !(iter->second->mIsRendered))
+ if (iter == mCharGlyphInfoMap.end())
{
return addGlyphFromFont(this, wch, glyph_index);
}
- return FALSE;
+ return NULL;
}
-BOOL LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, const llwchar wch, const U32 glyph_index) const
+LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, llwchar wch, U32 glyph_index) const
{
if (mFTFace == NULL)
- return FALSE;
+ return NULL;
//llassert(!mIsFallback);
fontp->renderGlyph(glyph_index);
@@ -409,8 +364,6 @@ BOOL LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, const llwchar
// Convert these from 26.6 units to float pixels.
gi->mXAdvance = fontp->mFTFace->glyph->advance.x / 64.f;
gi->mYAdvance = fontp->mFTFace->glyph->advance.y / 64.f;
- gi->mIsRendered = TRUE;
- gi->mMetricsValid = TRUE;
insertGlyphInfo(wch, gi);
@@ -481,31 +434,25 @@ BOOL LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, const llwchar
// omit it from the font-image.
}
- //new
LLImageGL *image_gl = mFontBitmapCachep->getImageGL(bitmap_num);
LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num);
image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight());
- return TRUE;
+ return gi;
}
-LLFontGlyphInfo* LLFontFreetype::getGlyphInfo(const llwchar wch) const
+LLFontGlyphInfo* LLFontFreetype::getGlyphInfo(llwchar wch) const
{
char_glyph_info_map_t::iterator iter = mCharGlyphInfoMap.find(wch);
if (iter != mCharGlyphInfoMap.end())
{
return iter->second;
}
- else if(addGlyph(wch))//new
+ else
{
// this glyph doesn't yet exist, so render it and return the result
- char_glyph_info_map_t::iterator iter = mCharGlyphInfoMap.find(wch);
- if (iter != mCharGlyphInfoMap.end())
- {
- return iter->second;
- }
+ return addGlyph(wch);
}
- return NULL;
}
void LLFontFreetype::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const
@@ -536,7 +483,6 @@ void LLFontFreetype::renderGlyph(const U32 glyph_index) const
void LLFontFreetype::reset(F32 vert_dpi, F32 horz_dpi)
{
- //new
resetBitmapCache();
loadFace(mName,mPointSize,vert_dpi,horz_dpi,mFontBitmapCachep->getNumComponents(),mIsFallback);
if (!mIsFallback)
@@ -557,21 +503,10 @@ void LLFontFreetype::reset(F32 vert_dpi, F32 horz_dpi)
}
}
}
- //resetBitmapCache();
}
void LLFontFreetype::resetBitmapCache()
{
- // Iterate through glyphs and clear the mIsRendered flag
- /*for (char_glyph_info_map_t::iterator iter = mCharGlyphInfoMap.begin();
- iter != mCharGlyphInfoMap.end(); ++iter)
- {
- iter->second->mIsRendered = FALSE;
- //FIXME: this is only strictly necessary when resetting the entire font,
- //not just flushing the bitmap
- iter->second->mMetricsValid = FALSE;
- }*/
- //new
for_each(mCharGlyphInfoMap.begin(), mCharGlyphInfoMap.end(), DeletePairedPointer());
mCharGlyphInfoMap.clear();
diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h
index 5e29e3fbb..948445835 100644
--- a/indra/llrender/llfontfreetype.h
+++ b/indra/llrender/llfontfreetype.h
@@ -27,7 +27,7 @@
#ifndef LL_LLFONTFREETYPE_H
#define LL_LLFONTFREETYPE_H
-#include
diff --git a/indra/newview/hippogridmanager.cpp b/indra/newview/hippogridmanager.cpp
index f4bda53ac..9057109d2 100644
--- a/indra/newview/hippogridmanager.cpp
+++ b/indra/newview/hippogridmanager.cpp
@@ -57,6 +57,7 @@ HippoGridInfo::HippoGridInfo(const std::string& gridName) :
mRenderCompat(true),
mInvLinks(false),
mAutoUpdate(false),
+ mLocked(false),
mMaxAgentGroups(-1),
mCurrencySymbol("OS$"),
mCurrencyText("OS Dollars"),
@@ -174,10 +175,12 @@ void HippoGridInfo::setLoginUri(const std::string& loginUri)
{
mIsInProductionGrid = true;
useHttps();
+ setPlatform(PLATFORM_SECONDLIFE);
}
if (utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.aditi.lindenlab.com")
{
useHttps();
+ setPlatform(PLATFORM_SECONDLIFE);
}
if (utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.avination.com" ||
utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.avination.net")
@@ -654,11 +657,6 @@ bool HippoGridInfo::getAutoUpdate()
return mAutoUpdate;
}
-void HippoGridInfo::setAutoUpdate(bool b)
-{
- mAutoUpdate = b;
-}
-
bool HippoGridInfo::getUPCSupported()
{
if(isSecondLife())
@@ -1014,7 +1012,8 @@ void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer)
if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]);
if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]);
if (gridMap.has("inventory_links")) grid->setSupportsInvLinks(gridMap["inventory_links"]);
- if (gridMap.has("auto_update")) grid->setAutoUpdate(gridMap["auto_update"]);
+ if (gridMap.has("auto_update")) grid->mAutoUpdate = gridMap["auto_update"];
+ if (gridMap.has("locked")) grid->mLocked = gridMap["locked"];
if (newGrid) addGrid(grid);
}
}
@@ -1051,6 +1050,7 @@ void HippoGridManager::saveFile()
gridInfo[i]["render_compat"] = grid->isRenderCompat();
gridInfo[i]["inventory_links"] = grid->supportsInvLinks();
gridInfo[i]["auto_update"] = grid->getAutoUpdate();
+ gridInfo[i]["locked"] = grid->getLocked();
}
// write client grid info file
diff --git a/indra/newview/hippogridmanager.h b/indra/newview/hippogridmanager.h
index 089b381f9..4416e8598 100644
--- a/indra/newview/hippogridmanager.h
+++ b/indra/newview/hippogridmanager.h
@@ -22,6 +22,7 @@ class LLSD;
class HippoGridInfo
{
+ friend class HippoGridManager;
public:
enum Platform {
PLATFORM_OTHER = 0,
@@ -96,7 +97,7 @@ public:
bool supportsInvLinks();
void setSupportsInvLinks(bool b);
bool getAutoUpdate();
- void setAutoUpdate(bool b);
+ bool getLocked() { return mLocked; }
void getGridInfo();
@@ -124,6 +125,7 @@ private:
bool mRenderCompat;
bool mInvLinks;
bool mAutoUpdate;
+ bool mLocked;
bool mUPCSupported;
int mMaxAgentGroups;
diff --git a/indra/newview/hippopanelgrids.cpp b/indra/newview/hippopanelgrids.cpp
index d09d75fab..4057fb1a7 100644
--- a/indra/newview/hippopanelgrids.cpp
+++ b/indra/newview/hippopanelgrids.cpp
@@ -61,6 +61,7 @@ class HippoPanelGridsImpl : public HippoPanelGrids
enum State { NORMAL, ADD_NEW, ADD_COPY };
State mState;
std::string mCurGrid;
+ bool mIsEditable;
void loadCurGrid();
bool saveCurGrid();
@@ -78,6 +79,8 @@ class HippoPanelGridsImpl : public HippoPanelGrids
static void onClickGridInfo(void *data);
static void onClickHelpRenderCompat(void *data);
static void onClickAdvanced(void *data);
+
+ void enableEditing(bool);
};
@@ -103,7 +106,7 @@ HippoPanelGrids *HippoPanelGrids::create()
HippoPanelGridsImpl::HippoPanelGridsImpl() :
- mState(NORMAL)
+ mState(NORMAL), mIsEditable(true)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_grids.xml");
}
@@ -194,27 +197,10 @@ void HippoPanelGridsImpl::refresh()
childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " ");
- childSetEnabled("btn_delete", (selectIndex >= 0));
+ childSetEnabled("btn_delete", (selectIndex >= 0) && mIsEditable );
childSetEnabled("btn_copy", (mState == NORMAL) && (selectIndex >= 0));
childSetEnabled("btn_default", (mState == NORMAL) && (selectIndex > 0));
- childSetEnabled("gridname", (mState == ADD_NEW) || (mState == ADD_COPY));
-
- if (childGetValue("platform").asString() == "SecondLife") {
- // disable platform selector, if logged into the grid edited and it is SL
- // so object export restrictions cannot be circumvented by changing the platform
- bool enablePlatform = (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) ||
- (mCurGrid != gHippoGridManager->getConnectedGrid()->getGridName());
- childSetEnabled("platform", enablePlatform);
- childSetEnabled("search", false);
- childSetText("search", LLStringExplicit(""));
- childSetEnabled("render_compat", false);
- childSetValue("render_compat", false);
- } else {
- childSetEnabled("platform", true);
- childSetEnabled("search", true);
- childSetText("search", gHippoGridManager->getConnectedGrid()->getSearchUrl());
- childSetEnabled("render_compat", true);
- }
+ childSetEnabled("gridname", (mState == ADD_NEW) || (mState == ADD_COPY));
}
@@ -256,9 +242,11 @@ void HippoPanelGridsImpl::loadCurGrid()
childSetText("helperuri", gridInfo->getHelperUri());
childSetText("website", gridInfo->getWebSite());
childSetText("support", gridInfo->getSupportUrl());
+ childSetText("search", gridInfo->getSearchUrl());
childSetText("register", gridInfo->getRegisterUrl());
childSetText("password", gridInfo->getPasswordUrl());
childSetValue("render_compat", gridInfo->isRenderCompat());
+ enableEditing(!gridInfo->getLocked());
} else {
std::string empty = "";
LLComboBox *platform = getChild("platform");
@@ -269,10 +257,11 @@ void HippoPanelGridsImpl::loadCurGrid()
childSetText("helperuri", empty);
childSetText("website", empty);
childSetText("support", empty);
+ childSetText("search", empty);
childSetText("register", empty);
childSetText("password", empty);
- childSetEnabled("render_compat", true);
childSetValue("render_compat", true);
+ enableEditing(true);
}
if (mState == ADD_NEW) {
@@ -281,6 +270,7 @@ void HippoPanelGridsImpl::loadCurGrid()
childSetText("loginuri", required);
} else if (mState == ADD_COPY) {
childSetText("gridname", std::string(""));
+ enableEditing(true);
} else if (mState != NORMAL) {
llwarns << "Illegal state " << mState << '.' << llendl;
}
@@ -574,3 +564,31 @@ void HippoPanelGridsImpl::onClickHelpRenderCompat(void *data)
{
LLNotificationsUtil::add("HelpRenderCompat");
}
+
+
+void HippoPanelGridsImpl::enableEditing(bool b)
+{
+ static const char * elements [] = {
+ "platform",
+ "gridname",
+ "loginuri",
+ "loginpage",
+ "helperuri",
+ "website",
+ "support",
+ "register",
+ "password",
+ "search",
+ "btn_delete",
+ "btn_gridinfo",
+ "render_compat",
+ "gridmessage",
+ 0
+ };
+
+ for(int i = 0; elements[i]; ++i ) {
+ this->childSetEnabled(elements[i], b);
+ }
+
+ mIsEditable = b;
+}
diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp
index 6fc0ab438..d681dbd69 100644
--- a/indra/newview/llphysicsmotion.cpp
+++ b/indra/newview/llphysicsmotion.cpp
@@ -45,7 +45,8 @@ typedef std::map controller_map_t;
typedef std::map default_controller_map_t;
#define MIN_REQUIRED_PIXEL_AREA_AVATAR_PHYSICS_MOTION 0.f
-#define TIME_ITERATION_STEP 0.1f
+#define TIME_ITERATION_STEP 0.05f
+#define MINIMUM_UPDATE_TIMESTEP 0.025f
inline F64 llsgn(const F64 a)
{
@@ -592,7 +593,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
const F32 time_delta = time - mLastTime;
// Don't update too frequently, to avoid precision errors from small time slices.
- if (time_delta <= .01)
+ if (time_delta <= MINIMUM_UPDATE_TIMESTEP)
{
return FALSE;
}
@@ -889,4 +890,4 @@ void LLPhysicsMotion::reset()
mCharacter->setVisualParamWeight((*iter).mParam,(*iter).mParam->getDefaultWeight());
}
}
-}
\ No newline at end of file
+}