summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRichard Nelson <none@none>2010-07-30 17:41:41 -0700
committerRichard Nelson <none@none>2010-07-30 17:41:41 -0700
commitcba6943b27d447719f88bc9515da773eb3aea288 (patch)
tree6c89ae6edaced8f2e69e2048494dca6bc54e20b1 /indra/llui
parent81817394716c2666d373f0ea71796c0176c5c27f (diff)
optimizations in button rendering
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp12
-rw-r--r--indra/llui/llbutton.h1
2 files changed, 8 insertions, 5 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index aeedf62379..5a4f0515fc 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -120,6 +120,7 @@ LLButton::LLButton(const LLButton::Params& p)
mFlashing( FALSE ),
mCurGlowStrength(0.f),
mNeedsHighlight(FALSE),
+ mMouseOver(false),
mUnselectedLabel(p.label()),
mSelectedLabel(p.label_selected()),
mGLFont(p.font),
@@ -504,7 +505,11 @@ void LLButton::onMouseEnter(S32 x, S32 y, MASK mask)
LLUICtrl::onMouseEnter(x, y, mask);
if (isInEnabledChain())
+ {
mNeedsHighlight = TRUE;
+ }
+
+ mMouseOver = true;
}
void LLButton::onMouseLeave(S32 x, S32 y, MASK mask)
@@ -512,6 +517,7 @@ void LLButton::onMouseLeave(S32 x, S32 y, MASK mask)
LLUICtrl::onMouseLeave(x, y, mask);
mNeedsHighlight = FALSE;
+ mMouseOver = true;
}
void LLButton::setHighlight(bool b)
@@ -565,14 +571,10 @@ void LLButton::draw()
}
// Unselected image assignments
- S32 local_mouse_x;
- S32 local_mouse_y;
- LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
-
bool enabled = isInEnabledChain();
bool pressed = pressed_by_keyboard
- || (hasMouseCapture() && pointInView(local_mouse_x, local_mouse_y))
+ || (hasMouseCapture() && mMouseOver)
|| mForcePressedState;
bool selected = getToggleState();
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index f4af19b696..5f25084b35 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -356,6 +356,7 @@ private:
BOOL mCommitOnReturn;
BOOL mFadeWhenDisabled;
bool mForcePressedState;
+ bool mMouseOver;
LLFrameTimer mFlashingTimer;
};