All your codebase are belong to us.

This commit is contained in:
Drake Arconis
2014-08-22 00:15:09 -04:00
parent 2a64c07215
commit 948ebe5213
110 changed files with 661 additions and 611 deletions

View File

@@ -536,8 +536,8 @@ void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height)
overlay_height = mImageOverlay->getHeight();
F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f);
overlay_width = llround((F32)overlay_width * scale_factor);
overlay_height = llround((F32)overlay_height * scale_factor);
overlay_width = llmath::llround((F32)overlay_width * scale_factor);
overlay_height = llmath::llround((F32)overlay_height * scale_factor);
}
@@ -696,7 +696,7 @@ void LLButton::draw()
if (hasFocus())
{
F32 lerp_amt = gFocusMgr.getFocusFlashAmt();
drawBorder(imagep, gFocusMgr.getFocusColor() % alpha, llround(lerp(1.f, 3.f, lerp_amt)));
drawBorder(imagep, gFocusMgr.getFocusColor() % alpha, llmath::llround(lerp(1.f, 3.f, lerp_amt)));
}
if (use_glow_effect)
@@ -981,7 +981,7 @@ void LLButton::resize(LLUIString label)
{
S32 overlay_width = mImageOverlay->getWidth();
F32 scale_factor = (getRect().getHeight() - (mImageOverlayBottomPad + mImageOverlayTopPad)) / (F32)mImageOverlay->getHeight();
overlay_width = llround((F32)overlay_width * scale_factor);
overlay_width = llmath::llround((F32)overlay_width * scale_factor);
switch(mImageOverlayAlignment)
{

View File

@@ -83,7 +83,7 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect,
// Label (add a little space to make sure text actually renders)
const S32 FUDGE = 10;
S32 text_width = mFont->getWidth( label ) + FUDGE;
S32 text_height = llround(mFont->getLineHeight());
S32 text_height = llmath::llround(mFont->getLineHeight());
LLRect label_rect;
label_rect.setOriginAndSize(
LLCHECKBOXCTRL_HPAD + LLCHECKBOXCTRL_BTN_SIZE + LLCHECKBOXCTRL_SPACING,
@@ -187,7 +187,7 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
//stretch or shrink bounding rectangle of label when rebuilding UI at new scale
const S32 FUDGE = 10;
S32 text_width = mFont->getWidth( mLabel->getText() ) + FUDGE;
S32 text_height = llround(mFont->getLineHeight());
S32 text_height = llmath::llround(mFont->getLineHeight());
LLRect label_rect;
label_rect.setOriginAndSize(
LLCHECKBOXCTRL_HPAD + LLCHECKBOXCTRL_BTN_SIZE + LLCHECKBOXCTRL_SPACING,

View File

@@ -247,7 +247,7 @@ void LLDragHandleTop::reshapeTitleBox()
S32 title_width = font->getWidth( getTitleBox()->getText() ) + TITLE_PAD;
if (getMaxTitleWidth() > 0)
title_width = llmin(title_width, getMaxTitleWidth());
S32 title_height = llround(font->getLineHeight());
S32 title_height = llmath::llround(font->getLineHeight());
LLRect title_rect;
title_rect.setLeftTopAndSize(
LEFT_PAD,

View File

@@ -1449,7 +1449,7 @@ void LLFloater::draw()
}
gl_drop_shadow(left, top, right, bottom,
shadow_color,
llround(shadow_offset));
llmath::llround(shadow_offset));
// No transparent windows in simple UI
if (isBackgroundOpaque())
@@ -1629,16 +1629,16 @@ void LLFloater::updateButtons()
btn_rect.setLeftTopAndSize(
LLPANEL_BORDER_WIDTH,
getRect().getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count,
llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
llmath::llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
llmath::llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
}
else
{
btn_rect.setLeftTopAndSize(
getRect().getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count,
getRect().getHeight() - CLOSE_BOX_FROM_TOP,
llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
llmath::llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
llmath::llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
}
mButtons[i]->setRect(btn_rect);
@@ -1665,16 +1665,16 @@ void LLFloater::buildButtons()
btn_rect.setLeftTopAndSize(
LLPANEL_BORDER_WIDTH,
getRect().getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1),
llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
llmath::llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
llmath::llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
}
else
{
btn_rect.setLeftTopAndSize(
getRect().getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1),
getRect().getHeight() - CLOSE_BOX_FROM_TOP,
llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
llmath::llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
llmath::llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
}
LLButton* buttonp = new LLButton(

View File

@@ -94,7 +94,7 @@ public:
F32 getFocusTime() const { return mFocusFlashTimer.getElapsedTimeF32(); }
F32 getFocusFlashAmt() const;
S32 getFocusFlashWidth() const { return llround(lerp(1.f, 3.f, getFocusFlashAmt())); }
S32 getFocusFlashWidth() const { return llmath::llround(lerp(1.f, 3.f, getFocusFlashAmt())); }
LLColor4 getFocusColor() const;
void triggerFocusFlash();
BOOL getAppHasFocus() const { return mAppHasFocus; }

View File

@@ -122,7 +122,7 @@ F32 LLLayoutPanel::getVisibleAmount() const
S32 LLLayoutPanel::getLayoutDim() const
{
return llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
return llmath::llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
? getRect().getWidth()
: getRect().getHeight()));
}
@@ -149,7 +149,7 @@ void LLLayoutPanel::setTargetDim(S32 value)
S32 LLLayoutPanel::getVisibleDim() const
{
F32 min_dim = getRelevantMinDim();
return llround(mVisibleAmt
return llmath::llround(mVisibleAmt
* (min_dim
+ (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt))));
}
@@ -157,7 +157,7 @@ S32 LLLayoutPanel::getVisibleDim() const
void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientation )
{
mOrientation = orientation;
S32 layout_dim = llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
S32 layout_dim = llmath::llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
? getRect().getWidth()
: getRect().getHeight()));
@@ -374,14 +374,14 @@ void LLLayoutStack::updateLayout()
{
panelp->mTargetDim = panelp->getRelevantMinDim();
}
space_to_distribute -= panelp->getVisibleDim() + llround((F32)mPanelSpacing * panelp->getVisibleAmount());
space_to_distribute -= panelp->getVisibleDim() + llmath::llround((F32)mPanelSpacing * panelp->getVisibleAmount());
total_visible_fraction += panelp->mFractionalSize * panelp->getAutoResizeFactor();
}
llassert(total_visible_fraction < 1.05f);
// don't need spacing after last panel
space_to_distribute += panelp ? llround((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0;
space_to_distribute += panelp ? llmath::llround((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0;
S32 remaining_space = space_to_distribute;
F32 fraction_distributed = 0.f;
@@ -392,7 +392,7 @@ void LLLayoutStack::updateLayout()
if (panelp->mAutoResize)
{
F32 fraction_to_distribute = (panelp->mFractionalSize * panelp->getAutoResizeFactor()) / (total_visible_fraction);
S32 delta = llround((F32)space_to_distribute * fraction_to_distribute);
S32 delta = llmath::llround((F32)space_to_distribute * fraction_to_distribute);
fraction_distributed += fraction_to_distribute;
panelp->mTargetDim += delta;
remaining_space -= delta;
@@ -425,17 +425,17 @@ void LLLayoutStack::updateLayout()
LLRect panel_rect;
if (mOrientation == HORIZONTAL)
{
panel_rect.setLeftTopAndSize(llround(cur_pos),
panel_rect.setLeftTopAndSize(llmath::llround(cur_pos),
getRect().getHeight(),
llround(panel_dim),
llmath::llround(panel_dim),
getRect().getHeight());
}
else
{
panel_rect.setLeftTopAndSize(0,
llround(cur_pos),
llmath::llround(cur_pos),
getRect().getWidth(),
llround(panel_dim));
llmath::llround(panel_dim));
}
panelp->setIgnoreReshape(true);
panelp->setShape(panel_rect);
@@ -447,14 +447,14 @@ void LLLayoutStack::updateLayout()
if (mOrientation == HORIZONTAL)
{
resize_bar_rect.mLeft = panel_rect.mRight - mResizeBarOverlap;
resize_bar_rect.mRight = panel_rect.mRight + (S32)(llround(panel_spacing)) + mResizeBarOverlap;
resize_bar_rect.mRight = panel_rect.mRight + (S32)(llmath::llround(panel_spacing)) + mResizeBarOverlap;
cur_pos += panel_visible_dim + panel_spacing;
}
else //VERTICAL
{
resize_bar_rect.mTop = panel_rect.mBottom + mResizeBarOverlap;
resize_bar_rect.mBottom = panel_rect.mBottom - (S32)(llround(panel_spacing)) - mResizeBarOverlap;
resize_bar_rect.mBottom = panel_rect.mBottom - (S32)(llmath::llround(panel_spacing)) - mResizeBarOverlap;
cur_pos -= panel_visible_dim + panel_spacing;
}

View File

@@ -512,7 +512,7 @@ std::vector<S32> LLLineEditor::getMisspelledWordsPositions()
{
//misspelled word here, and you have just right clicked on it!
//get the center of this word..
//S32 center = llround( (wordEnd-wordStart)/2 ) + wordStart;
//S32 center = llmath::llround( (wordEnd-wordStart)/2 ) + wordStart;
//turn this cursor position into a pixel pos
//center = findPixelNearestPos(center-getCursor());
@@ -769,7 +769,7 @@ BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask)
// Scroll if mouse cursor outside of bounds
if (mScrollTimer.hasExpired())
{
S32 increment = llround(mScrollTimer.getElapsedTimeF32() / AUTO_SCROLL_TIME);
S32 increment = llmath::llround(mScrollTimer.getElapsedTimeF32() / AUTO_SCROLL_TIME);
mScrollTimer.reset(AUTO_SCROLL_TIME);
if( (x < mMinHPixels) && (mScrollHPos > 0 ) )
{
@@ -1929,7 +1929,7 @@ void LLLineEditor::draw()
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
select_left - mScrollHPos,
mMaxHPixels - llround(rendered_pixels_right),
mMaxHPixels - llmath::llround(rendered_pixels_right),
&rendered_pixels_right);
}
@@ -1938,8 +1938,8 @@ void LLLineEditor::draw()
LLColor4 color(1.f - bg_color.mV[0], 1.f - bg_color.mV[1], 1.f - bg_color.mV[2], alpha );
// selected middle
S32 width = mGLFont->getWidth(mText.getWString().c_str(), mScrollHPos + rendered_text, select_right - mScrollHPos - rendered_text);
width = llmin(width, mMaxHPixels - llround(rendered_pixels_right));
gl_rect_2d(llround(rendered_pixels_right), cursor_top, llround(rendered_pixels_right)+width, cursor_bottom, color);
width = llmin(width, mMaxHPixels - llmath::llround(rendered_pixels_right));
gl_rect_2d(llmath::llround(rendered_pixels_right), cursor_top, llmath::llround(rendered_pixels_right)+width, cursor_bottom, color);
LLColor4 tmp_color( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], alpha );
rendered_text += mGLFont->render(
@@ -1950,7 +1950,7 @@ void LLLineEditor::draw()
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
select_right - mScrollHPos - rendered_text,
mMaxHPixels - llround(rendered_pixels_right),
mMaxHPixels - llmath::llround(rendered_pixels_right),
&rendered_pixels_right);
}
@@ -1965,7 +1965,7 @@ void LLLineEditor::draw()
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
S32_MAX,
mMaxHPixels - llround(rendered_pixels_right),
mMaxHPixels - llmath::llround(rendered_pixels_right),
&rendered_pixels_right);
}
}
@@ -1979,7 +1979,7 @@ void LLLineEditor::draw()
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
S32_MAX,
mMaxHPixels - llround(rendered_pixels_right),
mMaxHPixels - llmath::llround(rendered_pixels_right),
&rendered_pixels_right);
}
#if 0 // for when we're ready for image art.
@@ -2047,7 +2047,7 @@ void LLLineEditor::draw()
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
S32_MAX,
mMaxHPixels - llround(rendered_pixels_right),
mMaxHPixels - llmath::llround(rendered_pixels_right),
&rendered_pixels_right, FALSE);
}
@@ -2072,7 +2072,7 @@ void LLLineEditor::draw()
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
S32_MAX,
mMaxHPixels - llround(rendered_pixels_right),
mMaxHPixels - llmath::llround(rendered_pixels_right),
&rendered_pixels_right, FALSE);
}
// Draw children (border)
@@ -3021,7 +3021,7 @@ void LLLineEditor::markAsPreedit(S32 position, S32 length)
S32 LLLineEditor::getPreeditFontSize() const
{
return llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
return llmath::llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
}
void LLLineEditor::setReplaceNewlinesWithSpaces(BOOL replace)

View File

@@ -342,7 +342,7 @@ void LLMenuItemGL::setJumpKey(KEY key)
// virtual
U32 LLMenuItemGL::getNominalHeight( void ) const
{
return llround(mFont->getLineHeight()) + MENU_ITEM_PADDING;
return llmath::llround(mFont->getLineHeight()) + MENU_ITEM_PADDING;
}
//virtual
@@ -1826,7 +1826,7 @@ void LLMenuItemBranchDownGL::draw( void )
std::string::size_type offset = upper_case_label.find(getJumpKey());
if (offset != std::string::npos)
{
S32 x_offset = llround((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f);
S32 x_offset = llmath::llround((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f);
S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, offset);
S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, offset + 1);
gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS);
@@ -2660,7 +2660,7 @@ void LLMenuGL::arrange( void )
// *FIX: create the item first and then ask for its dimensions?
S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::getFontSansSerif()->getWidth( std::string("More") ); // *TODO: Translate
S32 spillover_item_height = llround(LLFontGL::getFontSansSerif()->getLineHeight()) + MENU_ITEM_PADDING;
S32 spillover_item_height = llmath::llround(LLFontGL::getFontSansSerif()->getLineHeight()) + MENU_ITEM_PADDING;
// Scrolling support
item_list_t::iterator first_visible_item_iter;
@@ -3588,8 +3588,8 @@ BOOL LLMenuGL::handleHover( S32 x, S32 y, MASK mask )
LLVector2 mouse_avg_dir((F32)mMouseVelX, (F32)mMouseVelY);
mouse_avg_dir.normVec();
F32 interp = 0.5f * (llclamp(mouse_dir * mouse_avg_dir, 0.f, 1.f));
mMouseVelX = llround(lerp((F32)mouse_delta_x, (F32)mMouseVelX, interp));
mMouseVelY = llround(lerp((F32)mouse_delta_y, (F32)mMouseVelY, interp));
mMouseVelX = llmath::llround(lerp((F32)mouse_delta_x, (F32)mMouseVelX, interp));
mMouseVelY = llmath::llround(lerp((F32)mouse_delta_y, (F32)mMouseVelY, interp));
mLastMouseX = x;
mLastMouseY = y;

View File

@@ -292,7 +292,7 @@ void LLModalDialog::draw()
void LLModalDialog::centerOnScreen()
{
LLVector2 window_size = LLUI::getWindowSize();
centerWithin(LLRect(0, 0, llround(window_size.mV[VX]), llround(window_size.mV[VY])));
centerWithin(LLRect(0, 0, llmath::llround(window_size.mV[VX]), llmath::llround(window_size.mV[VY])));
}

View File

@@ -84,7 +84,7 @@ void LLProgressBar::draw()
bar_bg_imagep->draw(getLocalRect(), background_color % alpha);
LLRect progress_rect = getLocalRect();
progress_rect.mRight = llround(getRect().getWidth() * (mPercentDone / 100.f));
progress_rect.mRight = llmath::llround(getRect().getWidth() * (mPercentDone / 100.f));
bar_fg_imagep->draw(progress_rect, LLColor4::white % alpha);
}

View File

@@ -299,7 +299,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y)
// clip rect against root view
inner_rect_local.intersectWith(screen_local_extents);
S32 auto_scroll_speed = llround(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32());
S32 auto_scroll_speed = llmath::llround(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32());
// autoscroll region should take up no more than one third of visible scroller area
S32 auto_scroll_region_width = llmin(inner_rect_local.getWidth() / 3, 10);
S32 auto_scroll_region_height = llmin(inner_rect_local.getHeight() / 3, 10);

View File

@@ -254,7 +254,7 @@ BOOL LLScrollListText::getVisible() const
//virtual
S32 LLScrollListText::getHeight() const
{
return llround(mFont->getLineHeight());
return llmath::llround(mFont->getLineHeight());
}
@@ -326,7 +326,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
break;
}
LLRect highlight_rect(left - 2,
llround(mFont->getLineHeight()) + 1,
llmath::llround(mFont->getLineHeight()) + 1,
left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1,
1);
mRoundedRectImage->draw(highlight_rect, highlight_color);

View File

@@ -602,7 +602,7 @@ bool LLScrollListCtrl::updateColumnWidths()
S32 new_width = column->getWidth();
if (column->mRelWidth >= 0)
{
new_width = (S32)llround(column->mRelWidth*mItemListRect.getWidth());
new_width = (S32)llmath::llround(column->mRelWidth*mItemListRect.getWidth());
}
else if (column->mDynamicWidth)
{
@@ -2829,7 +2829,7 @@ void LLScrollListCtrl::addColumn(const LLScrollListColumn::Params& column_params
}
if (new_column->mRelWidth >= 0)
{
new_column->setWidth((S32)llround(new_column->mRelWidth*mItemListRect.getWidth()));
new_column->setWidth((S32)llmath::llround(new_column->mRelWidth*mItemListRect.getWidth()));
}
else if(new_column->mDynamicWidth)
{

View File

@@ -147,7 +147,7 @@ F32 clamp_precision(F32 value, S32 decimal_precision)
for (S32 i = 0; i < decimal_precision; i++)
clamped_value *= 10.0;
clamped_value = llround((F32)clamped_value);
clamped_value = llmath::llround((F32)clamped_value);
for (S32 i = 0; i < decimal_precision; i++)
clamped_value /= 10.0;
@@ -161,13 +161,13 @@ F32 get_increment(F32 inc, S32 decimal_precision) //CF: finetune increments
if(gKeyboard->getKeyDown(KEY_ALT))
inc = inc * 10.f;
else if(gKeyboard->getKeyDown(KEY_CONTROL)) {
if (llround(inc * 1000.f) == 25) // 0.025 gets 0.05 here
if (llmath::llround(inc * 1000.f) == 25) // 0.025 gets 0.05 here
inc = inc * 0.2f;
else
inc = inc * 0.1f;
}
else if(gKeyboard->getKeyDown(KEY_SHIFT)) {
if (decimal_precision == 2 && llround(inc) == 1) // for rotations, finest step is 0.05
if (decimal_precision == 2 && llmath::llround(inc) == 1) // for rotations, finest step is 0.05
inc = inc * 0.05f;
else
inc = inc * 0.01f;

View File

@@ -120,7 +120,7 @@ void LLStatGraph::draw()
color = mThresholdColors[i];
gGL.color4fv(color.mV);
gl_rect_2d(1, llround(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, TRUE);
gl_rect_2d(1, llmath::llround(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, TRUE);
}
void LLStatGraph::setValue(const LLSD& value)

View File

@@ -312,7 +312,7 @@ LLTextEditor::LLTextEditor(
updateTextRect();
S32 line_height = llround( mGLFont->getLineHeight() );
S32 line_height = llmath::llround( mGLFont->getLineHeight() );
S32 page_size = mTextRect.getHeight() / line_height;
// Init the scrollbar
@@ -970,7 +970,7 @@ S32 LLTextEditor::getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL rou
// Figure out which line we're nearest to.
S32 total_lines = getLineCount();
S32 line_height = llround( mGLFont->getLineHeight() );
S32 line_height = llmath::llround( mGLFont->getLineHeight() );
S32 max_visible_lines = mTextRect.getHeight() / line_height;
S32 scroll_lines = mScrollbar->getDocPos();
S32 visible_lines = llmin( total_lines - scroll_lines, max_visible_lines ); // Lines currently visible
@@ -2927,7 +2927,7 @@ void LLTextEditor::drawSelectionBackground()
const S32 text_len = getLength();
std::queue<S32> line_endings;
S32 line_height = llround( mGLFont->getLineHeight() );
S32 line_height = llmath::llround( mGLFont->getLineHeight() );
S32 selection_left = llmin( mSelectionStart, mSelectionEnd );
S32 selection_right = llmax( mSelectionStart, mSelectionEnd );
@@ -3122,7 +3122,7 @@ void LLTextEditor::drawMisspelled()
S32 line_end = 0;
// Determine if the cursor is visible and if so what its coordinates are.
while( (mTextRect.mBottom <= llround(text_y)) && (search_pos < num_lines))
while( (mTextRect.mBottom <= llmath::llround(text_y)) && (search_pos < num_lines))
{
line_end = text_len + 1;
S32 next_line = -1;
@@ -3197,7 +3197,7 @@ void LLTextEditor::drawCursor()
S32 line_end = 0;
// Determine if the cursor is visible and if so what its coordinates are.
while( (mTextRect.mBottom <= llround(text_y)) && (cur_pos < num_lines))
while( (mTextRect.mBottom <= llmath::llround(text_y)) && (cur_pos < num_lines))
{
line_end = text_len + 1;
S32 next_line = -1;
@@ -3316,7 +3316,7 @@ void LLTextEditor::drawPreeditMarker()
return;
}
const S32 line_height = llround( mGLFont->getLineHeight() );
const S32 line_height = llmath::llround( mGLFont->getLineHeight() );
S32 line_start = getLineStart(cur_line);
S32 line_y = mTextRect.mTop - line_height;
@@ -3436,7 +3436,7 @@ void LLTextEditor::drawText()
if (seg_iter == mSegments.end() || (*seg_iter)->getStart() > line_start) --seg_iter;
LLTextSegment* cur_segment = *seg_iter;
S32 line_height = llround( mGLFont->getLineHeight() );
S32 line_height = llmath::llround( mGLFont->getLineHeight() );
F32 text_y = (F32)(mTextRect.mTop - line_height);
while((mTextRect.mBottom <= text_y) && (cur_line < num_lines))
{
@@ -3461,7 +3461,7 @@ void LLTextEditor::drawText()
if( mShowLineNumbers && !cur_line_is_continuation)
{
const LLFontGL *num_font = LLFontGL::getFontMonospace();
F32 y_top = text_y + ((F32)llround(num_font->getLineHeight()) / 2);
F32 y_top = text_y + ((F32)llmath::llround(num_font->getLineHeight()) / 2);
const LLWString ltext = utf8str_to_wstring(llformat("%*d", UI_TEXTEDITOR_LINE_NUMBER_DIGITS, cur_line_num ));
BOOL is_cur_line = getCurrentLine() == cur_line_num;
const U8 style = is_cur_line ? LLFontGL::BOLD : LLFontGL::NORMAL;
@@ -3505,7 +3505,7 @@ void LLTextEditor::drawText()
S32 style_image_height = style->mImageHeight;
S32 style_image_width = style->mImageWidth;
LLUIImagePtr image = style->getImage();
image->draw(llround(text_x), llround(text_y)+line_height-style_image_height,
image->draw(llmath::llround(text_x), llmath::llround(text_y)+line_height-style_image_height,
style_image_width, style_image_height);
}
@@ -3592,7 +3592,7 @@ void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32
}
}
F32 y_top = y + (F32)llround(font->getLineHeight());
F32 y_top = y + (F32)llmath::llround(font->getLineHeight());
if( selection_left > seg_start )
{
@@ -3995,7 +3995,7 @@ void LLTextEditor::reshape(S32 width, S32 height, BOOL called_from_parent)
// propagate shape information to scrollbar
mScrollbar->setDocSize( getLineCount() );
S32 line_height = llround( mGLFont->getLineHeight() );
S32 line_height = llmath::llround( mGLFont->getLineHeight() );
S32 page_lines = mTextRect.getHeight() / line_height;
mScrollbar->setPageSize( page_lines );
}
@@ -5162,7 +5162,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
}
const llwchar * const text = mWText.c_str();
const S32 line_height = llround(mGLFont->getLineHeight());
const S32 line_height = llmath::llround(mGLFont->getLineHeight());
if (coord)
{
@@ -5265,7 +5265,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length)
S32 LLTextEditor::getPreeditFontSize() const
{
return llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
return llmath::llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
}
void LLTextEditor::setKeystrokeCallback(const keystroke_signal_t::slot_type& callback)

View File

@@ -158,8 +158,8 @@ void LLUI::cleanupClass()
void LLUI::setMousePositionScreen(S32 x, S32 y)
{
S32 screen_x, screen_y;
screen_x = llround((F32)x * getScaleFactor().mV[VX]);
screen_y = llround((F32)y * getScaleFactor().mV[VY]);
screen_x = llmath::llround((F32)x * getScaleFactor().mV[VX]);
screen_y = llmath::llround((F32)y * getScaleFactor().mV[VY]);
LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert());
}
@@ -170,8 +170,8 @@ void LLUI::getMousePositionScreen(S32 *x, S32 *y)
LLCoordWindow cursor_pos_window;
getWindow()->getCursorPosition(&cursor_pos_window);
LLCoordGL cursor_pos_gl(cursor_pos_window.convert());
*x = llround((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]);
*y = llround((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]);
*x = llmath::llround((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]);
*y = llmath::llround((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]);
}
//static
@@ -262,15 +262,15 @@ LLVector2 LLUI::getWindowSize()
//static
void LLUI::screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y)
{
*gl_x = llround((F32)screen_x * getScaleFactor().mV[VX]);
*gl_y = llround((F32)screen_y * getScaleFactor().mV[VY]);
*gl_x = llmath::llround((F32)screen_x * getScaleFactor().mV[VX]);
*gl_y = llmath::llround((F32)screen_y * getScaleFactor().mV[VY]);
}
//static
void LLUI::glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y)
{
*screen_x = llround((F32)gl_x / getScaleFactor().mV[VX]);
*screen_y = llround((F32)gl_y / getScaleFactor().mV[VY]);
*screen_x = llmath::llround((F32)gl_x / getScaleFactor().mV[VX]);
*screen_y = llmath::llround((F32)gl_y / getScaleFactor().mV[VY]);
}
//static

View File

@@ -821,9 +821,9 @@ void LLUrlEntryParcel::processParcelInfo(const LLParcelData& parcel_data)
// If parcel name is empty use Sim_name (x, y, z) for parcel label.
else if (!parcel_data.sim_name.empty())
{
S32 region_x = llround(parcel_data.global_x) % REGION_WIDTH_UNITS;
S32 region_y = llround(parcel_data.global_y) % REGION_WIDTH_UNITS;
S32 region_z = llround(parcel_data.global_z);
S32 region_x = llmath::llround(parcel_data.global_x) % REGION_WIDTH_UNITS;
S32 region_y = llmath::llround(parcel_data.global_y) % REGION_WIDTH_UNITS;
S32 region_z = llmath::llround(parcel_data.global_z);
label = llformat("%s (%d, %d, %d)",
parcel_data.sim_name.c_str(), region_x, region_y, region_z);