summaryrefslogtreecommitdiff
path: root/indra/newview/lljoystickbutton.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-11-06 18:31:52 -0500
committerLoren Shih <seraph@lindenlab.com>2009-11-06 18:31:52 -0500
commit9c048d12fdd9fd9c95cc93223fc731ee7b548294 (patch)
tree4d6e91028b4ab48b6600c34f9cf126610fbce690 /indra/newview/lljoystickbutton.cpp
parent2aa981ac23bbdf2fd609e04434179be0cfec79ce (diff)
parentf3bbcfb9d41b41f8c4b144ae9a1173fc7719b88c (diff)
merge
--HG-- branch : avatar-pipeline
Diffstat (limited to 'indra/newview/lljoystickbutton.cpp')
-rw-r--r--indra/newview/lljoystickbutton.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp
index 4fd3b7bddc..bd6702a0b2 100644
--- a/indra/newview/lljoystickbutton.cpp
+++ b/indra/newview/lljoystickbutton.cpp
@@ -517,43 +517,52 @@ void LLJoystickCameraRotate::draw()
LLGLSUIDefault gls_ui;
getImageUnselected()->draw( 0, 0 );
+ LLPointer<LLUIImage> image = getImageSelected();
if( mInTop )
{
- drawRotatedImage( getImageSelected()->getImage(), 0 );
+ drawRotatedImage( getImageSelected(), 0 );
}
if( mInRight )
{
- drawRotatedImage( getImageSelected()->getImage(), 1 );
+ drawRotatedImage( getImageSelected(), 1 );
}
if( mInBottom )
{
- drawRotatedImage( getImageSelected()->getImage(), 2 );
+ drawRotatedImage( getImageSelected(), 2 );
}
if( mInLeft )
{
- drawRotatedImage( getImageSelected()->getImage(), 3 );
+ drawRotatedImage( getImageSelected(), 3 );
}
}
// Draws image rotated by multiples of 90 degrees
-void LLJoystickCameraRotate::drawRotatedImage( LLTexture* image, S32 rotations )
+void LLJoystickCameraRotate::drawRotatedImage( LLPointer<LLUIImage> image, S32 rotations )
{
S32 width = image->getWidth();
S32 height = image->getHeight();
-
+ LLTexture* texture = image->getImage();
+
+ /*
+ * Scale texture coordinate system
+ * to handle the different between image size and size of texture.
+ * If we will use default matrix,
+ * it may break texture mapping after rotation.
+ * see EXT-2023 Camera floater: arrows became shifted when pressed.
+ */
F32 uv[][2] =
{
- { 1.f, 1.f },
- { 0.f, 1.f },
+ { (F32)width/texture->getWidth(), (F32)height/texture->getHeight() },
+ { 0.f, (F32)height/texture->getHeight() },
{ 0.f, 0.f },
- { 1.f, 0.f }
+ { (F32)width/texture->getWidth(), 0.f }
};
- gGL.getTexUnit(0)->bind(image);
+ gGL.getTexUnit(0)->bind(texture);
gGL.color4fv(UI_VERTEX_COLOR.mV);