diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-07-07 19:41:39 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-07-07 19:41:39 +0200 |
| commit | 5b4ab05bbfb7abd8e85d113d0f1883dc4079fc70 (patch) | |
| tree | 1613eb32d58f33ab7d63a476352e0648714e8c18 /unity-shared | |
| parent | 3aaa806b2470b7383357e86a4765c8220a033530 (diff) | |
IconTexture: use view geometry if drawing in STRETCH_WITH_ASPECT mode
(bzr r3830.3.19)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/IconTexture.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/unity-shared/IconTexture.cpp b/unity-shared/IconTexture.cpp index 82530a765..bfcfccdb3 100644 --- a/unity-shared/IconTexture.cpp +++ b/unity-shared/IconTexture.cpp @@ -226,22 +226,18 @@ void IconTexture::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) if (_draw_mode == DrawMode::STRETCH_WITH_ASPECT) { nux::Geometry imageDest = geo; - - float geo_apsect = float(geo.GetWidth()) / geo.GetHeight(); + + float geo_apsect = float(geo.width) / geo.width; float image_aspect = float(_texture_cached->GetWidth()) / _texture_cached->GetHeight(); if (image_aspect > geo_apsect) { imageDest.SetHeight(float(imageDest.GetWidth()) / image_aspect); - } + } if (image_aspect < geo_apsect) { imageDest.SetWidth(image_aspect * imageDest.GetHeight()); } - else - { - imageDest = nux::Geometry(0, 0, _texture_cached->GetWidth(), _texture_cached->GetHeight()); - } texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_SCALE_COORD); texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER); |
