This commit is contained in:
Shyotl
2019-04-11 23:54:32 -05:00
25 changed files with 83 additions and 72 deletions

View File

@@ -57,10 +57,10 @@ public:
LLUUID(); LLUUID();
explicit LLUUID(const char *in_string); // Convert from string. explicit LLUUID(const char *in_string); // Convert from string.
explicit LLUUID(const std::string& in_string); // Convert from string. explicit LLUUID(const std::string& in_string); // Convert from string.
LLUUID(const LLUUID &in); LLUUID(const LLUUID &in) = default;
LLUUID &operator=(const LLUUID &rhs); LLUUID &operator=(const LLUUID &rhs) = default;
~LLUUID(); ~LLUUID() = default;
// //
// MANIPULATORS // MANIPULATORS
@@ -193,24 +193,6 @@ inline BOOL LLUUID::isNull() const
return !memcmp(mData, null.mData, sizeof(mData)); // <alchemy/> return !memcmp(mData, null.mData, sizeof(mData)); // <alchemy/>
} }
// Copy constructor
inline LLUUID::LLUUID(const LLUUID& rhs)
{
memcpy(mData, rhs.mData, sizeof(mData)); // <alchemy/>
}
inline LLUUID::~LLUUID()
{
}
// Assignment
inline LLUUID& LLUUID::operator=(const LLUUID& rhs)
{
memcpy(mData, rhs.mData, sizeof(mData)); // <alchemy/>
return *this;
}
inline LLUUID::LLUUID(const char *in_string) inline LLUUID::LLUUID(const char *in_string)
{ {
if (!in_string || in_string[0] == 0) if (!in_string || in_string[0] == 0)
@@ -289,6 +271,8 @@ inline U32 LLUUID::getCRC32() const
// </alchemy> // </alchemy>
} }
static_assert(std::is_trivially_copyable<LLUUID>{}, "LLUUID must be a trivially copyable type");
typedef std::vector<LLUUID> uuid_vec_t; typedef std::vector<LLUUID> uuid_vec_t;
typedef boost::unordered_set<LLUUID> uuid_set_t; typedef boost::unordered_set<LLUUID> uuid_set_t;

View File

@@ -127,4 +127,6 @@ public:
inline bool isOkRotation() const; inline bool isOkRotation() const;
} LL_ALIGN_POSTFIX(16); } LL_ALIGN_POSTFIX(16);
static_assert(std::is_trivially_copyable<LLMatrix3a>{}, "LLMatrix3a must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLRotation>{}, "LLRotation must be a trivially copyable type");
#endif #endif

View File

@@ -708,4 +708,6 @@ inline std::ostream& operator<<(std::ostream& s, const LLMatrix4a& m)
} }
void matMulBoundBox(const LLMatrix4a &a, const LLVector4a *in_extents, LLVector4a *out_extents); void matMulBoundBox(const LLMatrix4a &a, const LLVector4a *in_extents, LLVector4a *out_extents);
static_assert(std::is_trivially_copyable<LLMatrix4a>{}, "LLMatrix4a must be a trivially copyable type");
#endif #endif

View File

@@ -191,6 +191,8 @@ inline void LLQuaternion::setValue(const LLSD& sd)
mQ[3] = sd[3].asReal(); mQ[3] = sd[3].asReal();
} }
static_assert(std::is_trivially_copyable<LLQuaternion>{}, "LLQuaternion must be a trivially copyable type");
// checker // checker
inline BOOL LLQuaternion::isFinite() const inline BOOL LLQuaternion::isFinite() const
{ {

View File

@@ -105,4 +105,6 @@ protected:
} LL_ALIGN_POSTFIX(16); } LL_ALIGN_POSTFIX(16);
static_assert(std::is_trivially_copyable<LLQuaternion2>{}, "LLQuaternion2 must be a trivially copyable type");
#endif #endif

View File

@@ -121,4 +121,7 @@ private:
LLQuad mQ; LLQuad mQ;
}; };
static_assert(std::is_trivially_copyable<LLBool32>{}, "LLBool32 must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLSimdScalar>{}, "LLSimdScalar must be a trivially copyable type");
#endif //LL_SIMD_TYPES_H #endif //LL_SIMD_TYPES_H

View File

@@ -96,12 +96,12 @@ public:
{ //DO NOT INITIALIZE -- The overhead is completely unnecessary { //DO NOT INITIALIZE -- The overhead is completely unnecessary
ll_assert_aligned(this,16); ll_assert_aligned(this,16);
} }
LLVector4a(F32 x, F32 y, F32 z, F32 w = 0.f) LLVector4a(F32 x, F32 y, F32 z, F32 w = 0.f)
{ {
set(x,y,z,w); set(x, y, z, w);
} }
LLVector4a(F32 x) LLVector4a(F32 x)
{ {
splat(x); splat(x);
@@ -320,9 +320,13 @@ public:
//////////////////////////////////// ////////////////////////////////////
// Do NOT add aditional operators without consulting someone with SSE experience // Do NOT add aditional operators without consulting someone with SSE experience
inline const LLVector4a& operator= ( const LLVector4a& rhs ); //inline const LLVector4a& operator= ( const LLVector4a& rhs );
//{
// mQ = rhs.mQ;
// return *this;
//}
inline const LLVector4a& operator= ( const LLQuad& rhs ); inline const LLVector4a& operator= (const LLQuad& rhs);
inline operator LLQuad() const; inline operator LLQuad() const;
@@ -341,4 +345,6 @@ inline std::ostream& operator<<(std::ostream& s, const LLVector4a& v)
s << "(" << v[0] << ", " << v[1] << ", " << v[2] << ", " << v[3] << ")"; s << "(" << v[0] << ", " << v[1] << ", " << v[2] << ", " << v[3] << ")";
return s; return s;
} }
static_assert(std::is_trivially_copyable<LLVector4a>{}, "LLVector4a must be a trivially copyable type");
#endif #endif

View File

@@ -605,13 +605,7 @@ inline bool LLVector4a::equals3(const LLVector4a& rhs, F32 tolerance ) const
//////////////////////////////////// ////////////////////////////////////
// Do NOT add aditional operators without consulting someone with SSE experience // Do NOT add aditional operators without consulting someone with SSE experience
inline const LLVector4a& LLVector4a::operator= ( const LLVector4a& rhs ) inline const LLVector4a& LLVector4a::operator= (const LLQuad& rhs)
{
mQ = rhs.mQ;
return *this;
}
inline const LLVector4a& LLVector4a::operator= ( const LLQuad& rhs )
{ {
mQ = rhs; mQ = rhs;
return *this; return *this;

View File

@@ -144,6 +144,8 @@ class LLMatrix3
friend std::ostream& operator<<(std::ostream& s, const LLMatrix3 &a); // Stream a friend std::ostream& operator<<(std::ostream& s, const LLMatrix3 &a); // Stream a
}; };
static_assert(std::is_trivially_copyable<LLMatrix3>{}, "LLMatrix3 must be a trivially copyable type");
inline LLMatrix3::LLMatrix3(void) inline LLMatrix3::LLMatrix3(void)
{ {
mMatrix[0][0] = 1.f; mMatrix[0][0] = 1.f;

View File

@@ -152,10 +152,6 @@ LLMatrix4::LLMatrix4(const F32 roll, const F32 pitch, const F32 yaw)
mMatrix[3][3] = 1.f; mMatrix[3][3] = 1.f;
} }
LLMatrix4::~LLMatrix4(void)
{
}
// Clear and Assignment Functions // Clear and Assignment Functions
const LLMatrix4& LLMatrix4::setZero() const LLMatrix4& LLMatrix4::setZero()

View File

@@ -117,7 +117,7 @@ public:
const LLVector4 &pos); // Initializes Matrix with Euler angles const LLVector4 &pos); // Initializes Matrix with Euler angles
LLMatrix4(const F32 roll, const F32 pitch, const F32 yaw); // Initializes Matrix with Euler angles LLMatrix4(const F32 roll, const F32 pitch, const F32 yaw); // Initializes Matrix with Euler angles
~LLMatrix4(void); // Destructor ~LLMatrix4() = default; // Destructor
LLSD getValue() const; LLSD getValue() const;
void setValue(const LLSD&); void setValue(const LLSD&);
@@ -246,6 +246,8 @@ public:
friend std::ostream& operator<<(std::ostream& s, const LLMatrix4 &a); // Stream a friend std::ostream& operator<<(std::ostream& s, const LLMatrix4 &a); // Stream a
}; };
static_assert(std::is_trivially_copyable<LLMatrix4>{}, "LLMatrix4 must be a trivially copyable type");
inline const LLMatrix4& LLMatrix4::setIdentity() inline const LLMatrix4& LLMatrix4::setIdentity()
{ {
mMatrix[0][0] = 1.f; mMatrix[0][0] = 1.f;

View File

@@ -110,6 +110,7 @@ class LLVector2
friend std::ostream& operator<<(std::ostream& s, const LLVector2 &a); // Stream a friend std::ostream& operator<<(std::ostream& s, const LLVector2 &a); // Stream a
}; };
static_assert(std::is_trivially_copyable<LLVector2>{}, "LLVector2 must be a trivially copyable type");
// Non-member functions // Non-member functions

View File

@@ -140,6 +140,8 @@ public:
inline void exp(); // Do an exponential on the color inline void exp(); // Do an exponential on the color
}; };
static_assert(std::is_trivially_copyable<LLColor3>{}, "LLColor3 must be a trivially copyable type");
LLColor3 lerp(const LLColor3 &a, const LLColor3 &b, F32 u); LLColor3 lerp(const LLColor3 &a, const LLColor3 &b, F32 u);

View File

@@ -130,6 +130,8 @@ class LLVector3d
}; };
static_assert(std::is_trivially_copyable<LLVector3d>{}, "LLVector3d must be a trivially copyable type");
typedef LLVector3d LLGlobalVec; typedef LLVector3d LLGlobalVec;
inline const LLVector3d &LLVector3d::set(const LLVector3 &vec) inline const LLVector3d &LLVector3d::set(const LLVector3 &vec)

View File

@@ -149,6 +149,8 @@ class LLVector3
static BOOL parseVector3(const std::string& buf, LLVector3* value); static BOOL parseVector3(const std::string& buf, LLVector3* value);
}; };
static_assert(std::is_trivially_copyable<LLVector3>{}, "LLVector3 must be a trivially copyable type");
typedef LLVector3 LLSimLocalVec; typedef LLVector3 LLSimLocalVec;
// Non-member functions // Non-member functions

View File

@@ -222,6 +222,7 @@ class LLColor4
inline void clamp(); inline void clamp();
}; };
static_assert(std::is_trivially_copyable<LLColor4>{}, "LLColor4 must be a trivially copyable type");
// Non-member functions // Non-member functions
F32 distVec(const LLColor4 &a, const LLColor4 &b); // Returns distance between a and b F32 distVec(const LLColor4 &a, const LLColor4 &b); // Returns distance between a and b

View File

@@ -139,6 +139,7 @@ public:
static LLColor4U blue; static LLColor4U blue;
}; };
static_assert(std::is_trivially_copyable<LLColor4U>{}, "LLColor4U must be a trivially copyable type");
// Non-member functions // Non-member functions
F32 distVec(const LLColor4U &a, const LLColor4U &b); // Returns distance between a and b F32 distVec(const LLColor4U &a, const LLColor4U &b); // Returns distance between a and b

View File

@@ -137,6 +137,8 @@ class LLVector4
friend LLVector4 operator-(const LLVector4 &a); // Return vector -a friend LLVector4 operator-(const LLVector4 &a); // Return vector -a
}; };
static_assert(std::is_trivially_copyable<LLVector4>{}, "LLVector4 must be a trivially copyable type");
// Non-member functions // Non-member functions
F32 angle_between(const LLVector4 &a, const LLVector4 &b); // Returns angle (radians) between a and b F32 angle_between(const LLVector4 &a, const LLVector4 &b); // Returns angle (radians) between a and b
BOOL are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns TRUE if a and b are very close to parallel BOOL are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns TRUE if a and b are very close to parallel

View File

@@ -56,15 +56,6 @@ LLMaterialID::LLMaterialID(const void* pMemory)
set(pMemory); set(pMemory);
} }
LLMaterialID::LLMaterialID(const LLMaterialID& pOtherMaterialID)
{
copyFromOtherMaterialID(pOtherMaterialID);
}
LLMaterialID::~LLMaterialID()
{
}
bool LLMaterialID::operator == (const LLMaterialID& pOtherMaterialID) const bool LLMaterialID::operator == (const LLMaterialID& pOtherMaterialID) const
{ {
return (compareToOtherMaterialID(pOtherMaterialID) == 0); return (compareToOtherMaterialID(pOtherMaterialID) == 0);
@@ -95,12 +86,6 @@ bool LLMaterialID::operator >= (const LLMaterialID& pOtherMaterialID) const
return (compareToOtherMaterialID(pOtherMaterialID) >= 0); return (compareToOtherMaterialID(pOtherMaterialID) >= 0);
} }
LLMaterialID& LLMaterialID::operator = (const LLMaterialID& pOtherMaterialID)
{
copyFromOtherMaterialID(pOtherMaterialID);
return (*this);
}
bool LLMaterialID::isNull() const bool LLMaterialID::isNull() const
{ {
return (compareToOtherMaterialID(LLMaterialID::null) == 0); return (compareToOtherMaterialID(LLMaterialID::null) == 0);
@@ -116,12 +101,12 @@ void LLMaterialID::set(const void* pMemory)
llassert(pMemory != NULL); llassert(pMemory != NULL);
// assumes that the required size of memory is available // assumes that the required size of memory is available
memcpy(mID, pMemory, MATERIAL_ID_SIZE * sizeof(U8)); memcpy(mID, pMemory, sizeof(mID));
} }
void LLMaterialID::clear() void LLMaterialID::clear()
{ {
memset(mID, 0, MATERIAL_ID_SIZE * sizeof(U8)); memset(mID, 0, sizeof(mID));
} }
LLSD LLMaterialID::asLLSD() const LLSD LLMaterialID::asLLSD() const
@@ -156,18 +141,12 @@ std::ostream& operator<<(std::ostream& s, const LLMaterialID &material_id)
return s; return s;
} }
void LLMaterialID::parseFromBinary (const LLSD::Binary& pMaterialID) void LLMaterialID::parseFromBinary (const LLSD::Binary& pMaterialID)
{ {
llassert(pMaterialID.size() == (MATERIAL_ID_SIZE * sizeof(U8))); llassert(pMaterialID.size() == (MATERIAL_ID_SIZE * sizeof(U8)));
memcpy(mID, &pMaterialID[0], MATERIAL_ID_SIZE * sizeof(U8)); memcpy(mID, &pMaterialID[0], MATERIAL_ID_SIZE * sizeof(U8));
} }
void LLMaterialID::copyFromOtherMaterialID(const LLMaterialID& pOtherMaterialID)
{
memcpy(mID, pOtherMaterialID.get(), MATERIAL_ID_SIZE * sizeof(U8));
}
int LLMaterialID::compareToOtherMaterialID(const LLMaterialID& pOtherMaterialID) const int LLMaterialID::compareToOtherMaterialID(const LLMaterialID& pOtherMaterialID) const
{ {
int retVal = 0; int retVal = 0;

View File

@@ -39,8 +39,8 @@ public:
LLMaterialID(const LLSD& pMaterialID); LLMaterialID(const LLSD& pMaterialID);
LLMaterialID(const LLSD::Binary& pMaterialID); LLMaterialID(const LLSD::Binary& pMaterialID);
LLMaterialID(const void* pMemory); LLMaterialID(const void* pMemory);
LLMaterialID(const LLMaterialID& pOtherMaterialID); LLMaterialID(const LLMaterialID& pOtherMaterialID) = default;
~LLMaterialID(); ~LLMaterialID() = default;
bool operator == (const LLMaterialID& pOtherMaterialID) const; bool operator == (const LLMaterialID& pOtherMaterialID) const;
bool operator != (const LLMaterialID& pOtherMaterialID) const; bool operator != (const LLMaterialID& pOtherMaterialID) const;
@@ -50,7 +50,7 @@ public:
bool operator > (const LLMaterialID& pOtherMaterialID) const; bool operator > (const LLMaterialID& pOtherMaterialID) const;
bool operator >= (const LLMaterialID& pOtherMaterialID) const; bool operator >= (const LLMaterialID& pOtherMaterialID) const;
LLMaterialID& operator = (const LLMaterialID& pOtherMaterialID); LLMaterialID& operator = (const LLMaterialID& pOtherMaterialID) = default;
bool isNull() const; bool isNull() const;
@@ -67,11 +67,13 @@ public:
private: private:
void parseFromBinary(const LLSD::Binary& pMaterialID); void parseFromBinary(const LLSD::Binary& pMaterialID);
void copyFromOtherMaterialID(const LLMaterialID& pOtherMaterialID);
int compareToOtherMaterialID(const LLMaterialID& pOtherMaterialID) const; int compareToOtherMaterialID(const LLMaterialID& pOtherMaterialID) const;
U8 mID[MATERIAL_ID_SIZE]; U8 mID[MATERIAL_ID_SIZE];
} ; } ;
static_assert(sizeof(LLMaterialID) == MATERIAL_ID_SIZE, "LLMaterialID must be sizeof(mID)");
static_assert(std::is_trivially_copyable<LLMaterialID>{}, "LLMaterialID must be a trivially copyable type");
#endif // LL_LLMATERIALID_H #endif // LL_LLMATERIALID_H

View File

@@ -1592,6 +1592,11 @@ BOOL LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
return TRUE; return TRUE;
} }
bool always_underline_links()
{
static const LLUICachedControl<bool> always_underline("SinguAlwaysUnderlineLinks");
return always_underline;
}
BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
{ {
@@ -1684,7 +1689,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
if (old_hover != mHoverSegment) if (old_hover != mHoverSegment)
{ {
if (old_hover) if (old_hover && !always_underline_links())
old_hover->underlineOnHover(false); old_hover->underlineOnHover(false);
if (mHoverSegment) if (mHoverSegment)
mHoverSegment->underlineOnHover(true); mHoverSegment->underlineOnHover(true);
@@ -1699,7 +1704,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
void LLTextEditor::onMouseLeave(S32 x, S32 y, MASK mask) void LLTextEditor::onMouseLeave(S32 x, S32 y, MASK mask)
{ {
if (mHoverSegment) if (mHoverSegment && !always_underline_links())
{ {
mHoverSegment->underlineOnHover(false); mHoverSegment->underlineOnHover(false);
mHoverSegment = nullptr; mHoverSegment = nullptr;
@@ -4308,7 +4313,9 @@ void LLTextEditor::appendTextImpl(const std::string &new_text, const LLStyleSP s
} }
// Hack around colors looking bad on some backgrounds by allowing setting link color for this editor // Hack around colors looking bad on some backgrounds by allowing setting link color for this editor
if (mLinkColor) link_style->setColor(*mLinkColor); if (mLinkColor) link_style->setColor(*mLinkColor);
appendAndHighlightText(link, part, link_style, true/*match.underlineOnHoverOnly()*/); const auto always_underline(always_underline_links());
if (always_underline) link_style->mUnderline = true;
appendAndHighlightText(link, part, link_style, !always_underline/*match.underlineOnHoverOnly()*/);
}; };
const auto&& cb = force_replace_links ? boost::bind(&LLTextEditor::replaceUrl, this, _1, _2, _3) : LLUrlLabelCallback::slot_function_type(); const auto&& cb = force_replace_links ? boost::bind(&LLTextEditor::replaceUrl, this, _1, _2, _3) : LLUrlLabelCallback::slot_function_type();
while (!text.empty() && LLUrlRegistry::instance().findUrl(text, match, cb)) while (!text.empty() && LLUrlRegistry::instance().findUrl(text, match, cb))

View File

@@ -32,6 +32,7 @@
#include "linden_common.h" #include "linden_common.h"
#include "lluistring.h" #include "lluistring.h"
#include "llfasttimer.h"
#include "llsd.h" #include "llsd.h"
#include "lltrans.h" #include "lltrans.h"

View File

@@ -1131,6 +1131,17 @@ Changing this setting only affects new text.</string>
<key>Value</key> <key>Value</key>
<integer>0</integer> <integer>0</integer>
</map> </map>
<key>SinguAlwaysUnderlineLinks</key>
<map>
<key>Comment</key>
<string>Enable to always underline new links in text editors (and any you hover over after enabling this)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SingularitySplashPagePrefix</key> <key>SingularitySplashPagePrefix</key>
<map> <map>
<key>Comment</key> <key>Comment</key>

View File

@@ -771,21 +771,21 @@ namespace action_give_inventory
std::string items; std::string items;
build_items_string(inventory_selected_uuids, items); build_items_string(inventory_selected_uuids, items);
bool folders_count = false; // Singu Note: Was a count, but break right after == 1, so bool. auto folders_count = 0;
//traverse through selected inventory items and count folders among them //traverse through selected inventory items and count folders among them
for (const auto& id : inventory_selected_uuids) for (const auto& id : inventory_selected_uuids)
{ {
if (gInventory.getCategory(id)) if (gInventory.getCategory(id))
{ {
folders_count = true; if (++folders_count == 2)
break; break;
} }
} }
// EXP-1599 // EXP-1599
// In case of sharing multiple folders, make the confirmation // In case of sharing multiple folders, make the confirmation
// dialog contain a warning that only one folder can be shared at a time. // dialog contain a warning that only one folder can be shared at a time.
std::string notification = folders_count ? "ShareFolderConfirmation" : "ShareItemsConfirmation"; std::string notification = folders_count == 2 ? "ShareFolderConfirmation" : "ShareItemsConfirmation";
LLSD substitutions; LLSD substitutions;
substitutions["RESIDENTS"] = residents; substitutions["RESIDENTS"] = residents;
substitutions["ITEMS"] = items; substitutions["ITEMS"] = items;

View File

@@ -423,6 +423,7 @@ viewer_media_t LLViewerMedia::newMediaImpl(
media_impl->mMediaAutoScale = media_auto_scale; media_impl->mMediaAutoScale = media_auto_scale;
media_impl->mMediaLoop = media_loop; media_impl->mMediaLoop = media_loop;
} }
media_impl->setPageZoomFactor(media_impl->mZoomFactor);
return media_impl; return media_impl;
} }
@@ -1711,6 +1712,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
media_source->setTarget(target); media_source->setTarget(target);
media_source->setSize(default_width, default_height); media_source->setSize(default_width, default_height);
media_source->setZoomFactor(zoom_factor); media_source->setZoomFactor(zoom_factor);
media_source->set_page_zoom_factor(zoom_factor);
return media_source; return media_source;
} }
@@ -2700,6 +2702,9 @@ bool LLViewerMediaImpl::handleKeyHere(KEY key, MASK mask)
case 'C': mMediaSource->copy(); break; case 'C': mMediaSource->copy(); break;
case 'V': mMediaSource->paste(); break; case 'V': mMediaSource->paste(); break;
case 'X': mMediaSource->cut(); break; case 'X': mMediaSource->cut(); break;
case '=': setPageZoomFactor(mZoomFactor + .1); break;
case '-': setPageZoomFactor(mZoomFactor - .1); break;
case '0': setPageZoomFactor(1.0); break;
default: result = false; break; default: result = false; break;
} }