diff options
author | Merov Linden <merov@lindenlab.com> | 2015-03-16 09:49:57 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2015-03-16 09:49:57 -0700 |
commit | 9ba10bf1f2ee16eb082f4cb29b0b9f7172e7ce8e (patch) | |
tree | 9548ff32e0a1dc5b3f8a70b2a386827f72bf5284 /indra/llrender | |
parent | 184bf6a76fd3b52efa83c93f56164d2adce7ed3e (diff) | |
parent | d4a2e9fd9a0e7001a6c824ddd6cf37039a632b9d (diff) |
Merge lindenlab/viewer-tools-update
Diffstat (limited to 'indra/llrender')
-rwxr-xr-x | indra/llrender/CMakeLists.txt | 1 | ||||
-rwxr-xr-x | indra/llrender/llfontfreetype.cpp | 5 | ||||
-rwxr-xr-x | indra/llrender/llfontfreetype.h | 2 | ||||
-rwxr-xr-x | indra/llrender/llfontgl.cpp | 38 | ||||
-rwxr-xr-x | indra/llrender/llpostprocess.cpp | 9 | ||||
-rw-r--r-- | indra/llrender/llrender2dutils.cpp | 16 | ||||
-rw-r--r-- | indra/llrender/lluiimage.cpp | 4 |
7 files changed, 28 insertions, 47 deletions
diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index dba12d048e..331f988382 100755 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -121,7 +121,6 @@ target_link_libraries(llrender ${LLCOMMON_LIBRARIES} ${LLIMAGE_LIBRARIES} ${LLMATH_LIBRARIES} - ${LLRENDER_LIBRARIES} ${LLVFS_LIBRARIES} ${LLXML_LIBRARIES} ${LLVFS_LIBRARIES} diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 25b1c533c1..de26d19efc 100755 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -103,7 +103,6 @@ LLFontGlyphInfo::LLFontGlyphInfo(U32 index) LLFontFreetype::LLFontFreetype() : LLTrace::MemTrackable<LLFontFreetype>("LLFontFreetype"), mFontBitmapCachep(new LLFontBitmapCache), - mValid(FALSE), mAscender(0.f), mDescender(0.f), mLineHeight(0.f), @@ -184,8 +183,8 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v mDescender = -mFTFace->descender * pixels_per_unit; mLineHeight = mFTFace->height * pixels_per_unit; - S32 max_char_width = llround(0.5f + (x_max - x_min)); - S32 max_char_height = llround(0.5f + (y_max - y_min)); + S32 max_char_width = ll_round(0.5f + (x_max - x_min)); + S32 max_char_height = ll_round(0.5f + (y_max - y_min)); mFontBitmapCachep->init(components, max_char_width, max_char_height); claimMem(mFontBitmapCachep); diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h index 2963fbd43d..a5ece42b88 100755 --- a/indra/llrender/llfontfreetype.h +++ b/indra/llrender/llfontfreetype.h @@ -162,8 +162,6 @@ private: BOOL mIsFallback; font_vector_t mFallbackFonts; // A list of fallback fonts to look for glyphs in (for Unicode chars) - BOOL mValid; - typedef boost::unordered_map<llwchar, LLFontGlyphInfo*> char_glyph_info_map_t; mutable char_glyph_info_map_t mCharGlyphInfoMap; // Information about glyph location in bitmap diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 1d181b476a..53ca080d66 100755 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -61,12 +61,6 @@ LLCoordGL LLFontGL::sCurOrigin; F32 LLFontGL::sCurDepth; std::vector<std::pair<LLCoordGL, F32> > LLFontGL::sOriginStack; -const F32 EXT_X_BEARING = 1.f; -const F32 EXT_Y_BEARING = 0.f; -const F32 EXT_KERNING = 1.f; -const F32 PIXEL_BORDER_THRESHOLD = 0.0001f; -const F32 PIXEL_CORRECTION_DISTANCE = 0.01f; - const F32 PAD_UVY = 0.5f; // half of vertical padding between glyphs in the glyph texture const F32 DROP_SHADOW_SOFT_STRENGTH = 0.3f; @@ -217,10 +211,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons case LEFT: break; case RIGHT: - cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)); + cur_x -= llmin(scaled_max_pixels, ll_round(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)); break; case HCENTER: - cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)) / 2; + cur_x -= llmin(scaled_max_pixels, ll_round(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)) / 2; break; default: break; @@ -229,7 +223,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons cur_render_y = cur_y; cur_render_x = cur_x; - F32 start_x = (F32)llround(cur_x); + F32 start_x = (F32)ll_round(cur_x); const LLFontBitmapCache* font_bitmap_cache = mFontFreetype->getFontBitmapCache(); @@ -243,12 +237,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons if (use_ellipses) { // check for too long of a string - S32 string_width = llround(getWidthF32(wstr.c_str(), begin_offset, max_chars) * sScaleX); + S32 string_width = ll_round(getWidthF32(wstr.c_str(), begin_offset, max_chars) * sScaleX); if (string_width > scaled_max_pixels) { // use four dots for ellipsis width to generate padding const LLWString dots(utf8str_to_wstring(std::string("...."))); - scaled_max_pixels = llmax(0, scaled_max_pixels - llround(getWidthF32(dots.c_str()))); + scaled_max_pixels = llmax(0, scaled_max_pixels - ll_round(getWidthF32(dots.c_str()))); draw_ellipses = TRUE; } } @@ -313,10 +307,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons (fgi->mXBitmapOffset + fgi->mWidth) * inv_width, (fgi->mYBitmapOffset - PAD_UVY) * inv_height); // snap glyph origin to whole screen pixel - LLRectf screen_rect((F32)llround(cur_render_x + (F32)fgi->mXBearing), - (F32)llround(cur_render_y + (F32)fgi->mYBearing), - (F32)llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth, - (F32)llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight); + LLRectf screen_rect((F32)ll_round(cur_render_x + (F32)fgi->mXBearing), + (F32)ll_round(cur_render_y + (F32)fgi->mYBearing), + (F32)ll_round(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth, + (F32)ll_round(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight); if (glyph_count >= GLYPH_BATCH_SIZE) { @@ -347,8 +341,8 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons // Must do this to cur_x, not just to cur_render_x, otherwise you // will squish sub-pixel kerned characters too close together. // For example, "CCCCC" looks bad. - cur_x = (F32)llround(cur_x); - //cur_y = (F32)llround(cur_y); + cur_x = (F32)ll_round(cur_x); + //cur_y = (F32)ll_round(cur_y); cur_render_x = cur_x; cur_render_y = cur_y; @@ -458,7 +452,7 @@ S32 LLFontGL::getWidth(const std::string& utf8text, S32 begin_offset, S32 max_ch S32 LLFontGL::getWidth(const llwchar* wchars, S32 begin_offset, S32 max_chars) const { F32 width = getWidthF32(wchars, begin_offset, max_chars); - return llround(width); + return ll_round(width); } F32 LLFontGL::getWidthF32(const std::string& utf8text) const @@ -520,7 +514,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, S32 begin_offset, S32 max_chars cur_x += mFontFreetype->getXKerning(fgi, next_glyph); } // Round after kerning. - cur_x = (F32)llround(cur_x); + cur_x = (F32)ll_round(cur_x); } // add in extra pixels for last character's width past its xadvance @@ -628,7 +622,7 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch } // Round after kerning. - cur_x = (F32)llround(cur_x); + cur_x = (F32)ll_round(cur_x); } if( clip ) @@ -698,7 +692,7 @@ S32 LLFontGL::firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_ } // Round after kerning. - total_width = (F32)llround(total_width); + total_width = (F32)ll_round(total_width); } if (drawable_chars == 0) @@ -781,7 +775,7 @@ S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, S32 begin_offset, F32 t // Round after kerning. - cur_x = (F32)llround(cur_x); + cur_x = (F32)ll_round(cur_x); } return llmin(max_chars, pos - begin_offset); diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index a95bb7027b..b6ea5aa7f1 100755 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -49,17 +49,8 @@ static LLStaticHashedString sBlurWidth("blurWidth"); LLPostProcess * gPostProcess = NULL; - static const unsigned int NOISE_SIZE = 512; -/// CALCULATING LUMINANCE (Using NTSC lum weights) -/// http://en.wikipedia.org/wiki/Luma_%28video%29 -static const float LUMINANCE_R = 0.299f; -static const float LUMINANCE_G = 0.587f; -static const float LUMINANCE_B = 0.114f; - -static const char * const XML_FILENAME = "postprocesseffects.xml"; - LLPostProcess::LLPostProcess(void) : initialized(false), mAllEffects(LLSD::emptyMap()), diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index df5d79a436..4e2ebfd51e 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -433,8 +433,8 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex F32 image_width = image->getWidth(0); F32 image_height = image->getHeight(0); - S32 image_natural_width = llround(image_width * uv_width); - S32 image_natural_height = llround(image_height * uv_height); + S32 image_natural_width = ll_round(image_width * uv_width); + S32 image_natural_height = ll_round(image_height * uv_height); LLRectf draw_center_rect( uv_center_rect.mLeft * image_width, uv_center_rect.mTop * image_height, @@ -468,10 +468,10 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex draw_center_rect.setCenterAndSize(uv_center_rect.getCenterX() * width, uv_center_rect.getCenterY() * height, scaled_width, scaled_height); } - draw_center_rect.mLeft = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * ui_scale.mV[VX]); - draw_center_rect.mTop = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mTop * ui_scale.mV[VY]); - draw_center_rect.mRight = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mRight * ui_scale.mV[VX]); - draw_center_rect.mBottom = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * ui_scale.mV[VY]); + draw_center_rect.mLeft = ll_round(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * ui_scale.mV[VX]); + draw_center_rect.mTop = ll_round(ui_translation.mV[VY] + (F32)draw_center_rect.mTop * ui_scale.mV[VY]); + draw_center_rect.mRight = ll_round(ui_translation.mV[VX] + (F32)draw_center_rect.mRight * ui_scale.mV[VX]); + draw_center_rect.mBottom = ll_round(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * ui_scale.mV[VY]); LLRectf draw_outer_rect(ui_translation.mV[VX], ui_translation.mV[VY] + height * ui_scale.mV[VY], @@ -703,8 +703,8 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre ui_translation.mV[VY] += y; ui_translation.scaleVec(ui_scale); S32 index = 0; - S32 scaled_width = llround(width * ui_scale.mV[VX]); - S32 scaled_height = llround(height * ui_scale.mV[VY]); + S32 scaled_width = ll_round(width * ui_scale.mV[VX]); + S32 scaled_height = ll_round(height * ui_scale.mV[VY]); uv[index] = LLVector2(uv_rect.mRight, uv_rect.mTop); pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f); diff --git a/indra/llrender/lluiimage.cpp b/indra/llrender/lluiimage.cpp index 6f1fae92cd..5d8f92b2e6 100644 --- a/indra/llrender/lluiimage.cpp +++ b/indra/llrender/lluiimage.cpp @@ -149,13 +149,13 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c S32 LLUIImage::getWidth() const { // return clipped dimensions of actual image area - return llround((F32)mImage->getWidth(0) * mClipRegion.getWidth()); + return ll_round((F32)mImage->getWidth(0) * mClipRegion.getWidth()); } S32 LLUIImage::getHeight() const { // return clipped dimensions of actual image area - return llround((F32)mImage->getHeight(0) * mClipRegion.getHeight()); + return ll_round((F32)mImage->getHeight(0) * mClipRegion.getHeight()); } S32 LLUIImage::getTextureWidth() const |