diff options
| author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2012-10-12 15:15:58 +0000 |
|---|---|---|
| committer | Tarmac <> | 2012-10-12 15:15:58 +0000 |
| commit | 0e349031c376729671a280b7ca950a26d710094e (patch) | |
| tree | f01594fe40d2998c20910f8c74abe009863dcd0d /unity-shared | |
| parent | ff8d1ba3bbca92d6df65e7c32e95a23813046c71 (diff) | |
| parent | 68747396443df6b4c95f437d6c4cd64ed2b9f474 (diff) | |
Launcher: avoid copies in launcher rendering code-path. Approved by Andrea Azzarone.
(bzr r2832)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/BackgroundEffectHelper.cpp | 4 | ||||
| -rw-r--r-- | unity-shared/BackgroundEffectHelper.h | 6 | ||||
| -rw-r--r-- | unity-shared/IconRenderer.cpp | 40 | ||||
| -rw-r--r-- | unity-shared/IconRenderer.h | 14 |
4 files changed, 33 insertions, 31 deletions
diff --git a/unity-shared/BackgroundEffectHelper.cpp b/unity-shared/BackgroundEffectHelper.cpp index f9078b801..cda172e4a 100644 --- a/unity-shared/BackgroundEffectHelper.cpp +++ b/unity-shared/BackgroundEffectHelper.cpp @@ -129,7 +129,7 @@ void BackgroundEffectHelper::DirtyCache () owner()->QueueDraw(); } -nux::ObjectPtr<nux::IOpenGLBaseTexture> BackgroundEffectHelper::GetBlurRegion(nux::Geometry geo, bool force_update) +nux::ObjectPtr<nux::IOpenGLBaseTexture> BackgroundEffectHelper::GetBlurRegion(nux::Geometry const& geo, bool force_update) { bool should_update = force_update || cache_dirty; @@ -327,7 +327,7 @@ nux::ObjectPtr<nux::IOpenGLBaseTexture> BackgroundEffectHelper::GetBlurRegion(nu return blur_texture_; } -nux::ObjectPtr<nux::IOpenGLBaseTexture> BackgroundEffectHelper::GetRegion(nux::Geometry geo, bool force_update) +nux::ObjectPtr<nux::IOpenGLBaseTexture> BackgroundEffectHelper::GetRegion(nux::Geometry const& geo, bool force_update) { bool should_update = force_update || cache_dirty; diff --git a/unity-shared/BackgroundEffectHelper.h b/unity-shared/BackgroundEffectHelper.h index e6fa18030..996928f26 100644 --- a/unity-shared/BackgroundEffectHelper.h +++ b/unity-shared/BackgroundEffectHelper.h @@ -46,11 +46,11 @@ public: nux::Property<nux::View*> owner; nux::Property<bool> enabled; - nux::ObjectPtr<nux::IOpenGLBaseTexture> GetBlurRegion(nux::Geometry geo, bool force_update = false); + nux::ObjectPtr<nux::IOpenGLBaseTexture> GetBlurRegion(nux::Geometry const& geo, bool force_update = false); // We could add more functions here to get different types of effects based on the background texture - nux::ObjectPtr<nux::IOpenGLBaseTexture> GetPixelatedRegion(nux::Rect rect, int pixel_size, bool update); + // nux::ObjectPtr<nux::IOpenGLBaseTexture> GetPixelatedRegion(nux::Rect rect, int pixel_size, bool update); - nux::ObjectPtr<nux::IOpenGLBaseTexture> GetRegion(nux::Geometry geo, bool force_update = false); + nux::ObjectPtr<nux::IOpenGLBaseTexture> GetRegion(nux::Geometry const& geometry, bool force_update = false); void DirtyCache(); diff --git a/unity-shared/IconRenderer.cpp b/unity-shared/IconRenderer.cpp index 661048203..c2ffb91f0 100644 --- a/unity-shared/IconRenderer.cpp +++ b/unity-shared/IconRenderer.cpp @@ -246,11 +246,11 @@ void IconRenderer::PreprocessIcons(std::list<RenderArg>& args, nux::Geometry con GetInverseScreenPerspectiveMatrix(ViewMatrix, ProjectionMatrix, geo.width, geo.height, 0.1f, 1000.0f, DEGTORAD(90)); - nux::Matrix4 PremultMatrix = ProjectionMatrix * ViewMatrix; + nux::Matrix4 const& PremultMatrix = ProjectionMatrix * ViewMatrix; std::list<RenderArg>::iterator it; int i; - for (it = args.begin(), i = 0; it != args.end(); ++it, i++) + for (it = args.begin(), i = 0; it != args.end(); ++it, ++i) { IconTextureSource* launcher_icon = it->icon; @@ -343,19 +343,19 @@ void IconRenderer::PreprocessIcons(std::list<RenderArg>& args, nux::Geometry con } } -void IconRenderer::UpdateIconTransform(ui::IconTextureSource* icon, nux::Matrix4 ViewProjectionMatrix, nux::Geometry const& geo, +void IconRenderer::UpdateIconTransform(ui::IconTextureSource* icon, nux::Matrix4 const& ViewProjectionMatrix, nux::Geometry const& geo, float x, float y, float w, float h, float z, ui::IconTextureSource::TransformIndex index) { - UpdateIconSectionTransform (icon, ViewProjectionMatrix, geo, x, y, w, h, z, x, y, w, h, index); + UpdateIconSectionTransform(icon, ViewProjectionMatrix, geo, x, y, w, h, z, x, y, w, h, index); } -void IconRenderer::UpdateIconSectionTransform(ui::IconTextureSource* icon, nux::Matrix4 ViewProjectionMatrix, nux::Geometry const& geo, +void IconRenderer::UpdateIconSectionTransform(ui::IconTextureSource* icon, nux::Matrix4 const& ViewProjectionMatrix, nux::Geometry const& geo, float x, float y, float w, float h, float z, float xx, float yy, float ww, float hh, ui::IconTextureSource::TransformIndex index) { - nux::Vector4 v0 = nux::Vector4(x, y, z, 1.0f); - nux::Vector4 v1 = nux::Vector4(x, y + h, z, 1.0f); - nux::Vector4 v2 = nux::Vector4(x + w, y + h, z, 1.0f); - nux::Vector4 v3 = nux::Vector4(x + w, y, z, 1.0f); + nux::Vector4 v0(x, y, z, 1.0f); + nux::Vector4 v1(x, y + h, z, 1.0f); + nux::Vector4 v2(x + w, y + h, z, 1.0f); + nux::Vector4 v3(x + w, y, z, 1.0f); v0 = ViewProjectionMatrix * v0; v1 = ViewProjectionMatrix * v1; @@ -377,9 +377,7 @@ void IconRenderer::UpdateIconSectionTransform(ui::IconTextureSource* icon, nux:: v3.x = geo.width * (v3.x + 1.0f) / 2.0f - geo.width / 2.0f + xx + ww / 2.0f; v3.y = -geo.height * (v3.y - 1.0f) / 2.0f - geo.height / 2.0f + yy + hh / 2.0f; - std::vector<nux::Vector4>& vectors = icon->GetTransform(index, monitor); - vectors[0] = v0; vectors[1] = v1; vectors[2] = v2; @@ -705,23 +703,27 @@ nux::BaseTexture* IconRenderer::RenderCharToTexture(const char label, int width, void IconRenderer::RenderElement(nux::GraphicsEngine& GfxContext, RenderArg const& arg, - nux::ObjectPtr<nux::IOpenGLBaseTexture> icon, - nux::Color bkg_color, - nux::Color colorify, + nux::ObjectPtr<nux::IOpenGLBaseTexture> const& icon, + nux::Color const& bkg_color, + nux::Color const& colorify, float alpha, bool force_filter, - std::vector<nux::Vector4>& xform_coords) + std::vector<nux::Vector4> const& xform_coords) { if (icon.IsNull()) return; - if (nux::Abs(arg.x_rotation) < 0.01f && - nux::Abs(arg.y_rotation) < 0.01f && - nux::Abs(arg.z_rotation) < 0.01f && + if (std::abs(arg.x_rotation) < 0.01f && + std::abs(arg.y_rotation) < 0.01f && + std::abs(arg.z_rotation) < 0.01f && !force_filter) + { icon->SetFiltering(GL_NEAREST, GL_NEAREST); + } else + { icon->SetFiltering(GL_LINEAR, GL_LINEAR); + } nux::Vector4 const& v0 = xform_coords[0]; nux::Vector4 const& v1 = xform_coords[1]; @@ -969,7 +971,7 @@ void IconRenderer::RenderIndicators(nux::GraphicsEngine& GfxContext, } void IconRenderer::RenderProgressToTexture(nux::GraphicsEngine& GfxContext, - nux::ObjectPtr<nux::IOpenGLBaseTexture> texture, + nux::ObjectPtr<nux::IOpenGLBaseTexture> const& texture, float progress_fill, float bias) { diff --git a/unity-shared/IconRenderer.h b/unity-shared/IconRenderer.h index 4ee5013f1..d45fcd715 100644 --- a/unity-shared/IconRenderer.h +++ b/unity-shared/IconRenderer.h @@ -52,12 +52,12 @@ protected: void RenderElement(nux::GraphicsEngine& GfxContext, RenderArg const& arg, - nux::ObjectPtr<nux::IOpenGLBaseTexture> icon, - nux::Color bkg_color, - nux::Color colorify, + nux::ObjectPtr<nux::IOpenGLBaseTexture> const& icon, + nux::Color const& bkg_color, + nux::Color const& colorify, float alpha, bool force_filter, - std::vector<nux::Vector4>& xform_coords); + std::vector<nux::Vector4> const& xform_coords); void RenderIndicators(nux::GraphicsEngine& GfxContext, RenderArg const& arg, @@ -67,14 +67,14 @@ protected: nux::Geometry const& geo); void RenderProgressToTexture(nux::GraphicsEngine& GfxContext, - nux::ObjectPtr<nux::IOpenGLBaseTexture> texture, + nux::ObjectPtr<nux::IOpenGLBaseTexture> const& texture, float progress_fill, float bias); - void UpdateIconTransform(ui::IconTextureSource* icon, nux::Matrix4 ViewProjectionMatrix, nux::Geometry const& geo, + void UpdateIconTransform(ui::IconTextureSource* icon, nux::Matrix4 const& ViewProjectionMatrix, nux::Geometry const& geo, float x, float y, float w, float h, float z, ui::IconTextureSource::TransformIndex index); - void UpdateIconSectionTransform(ui::IconTextureSource* icon, nux::Matrix4 ViewProjectionMatrix, nux::Geometry const& geo, + void UpdateIconSectionTransform(ui::IconTextureSource* icon, nux::Matrix4 const& ViewProjectionMatrix, nux::Geometry const& geo, float x, float y, float w, float h, float z, float xx, float yy, float ww, float hh, ui::IconTextureSource::TransformIndex index); void GetInverseScreenPerspectiveMatrix(nux::Matrix4& ViewMatrix, nux::Matrix4& PerspectiveMatrix, |
