From 886ed5ff3e37582f248de0b4cff4c3725f72a780 Mon Sep 17 00:00:00 2001 From: Nick Dedekind Date: Thu, 29 Nov 2012 10:19:01 +0000 Subject: Updated dash animations. (bzr r2938.2.1) --- unity-shared/CoverArt.cpp | 21 +++++++++++--------- unity-shared/IconTexture.cpp | 10 ++++++++-- unity-shared/OverlayRenderer.cpp | 33 +++++++++++++++----------------- unity-shared/PlacesOverlayVScrollBar.cpp | 12 +++++++++++- unity-shared/PlacesOverlayVScrollBar.h | 1 + unity-shared/PreviewStyle.cpp | 6 ++++++ unity-shared/PreviewStyle.h | 1 + unity-shared/SearchBarSpinner.cpp | 26 +++++++++++++++++-------- unity-shared/UBusMessages.h | 2 -- 9 files changed, 72 insertions(+), 40 deletions(-) (limited to 'unity-shared') diff --git a/unity-shared/CoverArt.cpp b/unity-shared/CoverArt.cpp index 39435e60f..64fe9d8a1 100644 --- a/unity-shared/CoverArt.cpp +++ b/unity-shared/CoverArt.cpp @@ -378,7 +378,7 @@ void CoverArt::DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw) else if (IsFullRedraw()) { if (waiting_) - { + { nux::TexCoordXForm texxform; texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT); @@ -395,11 +395,15 @@ void CoverArt::DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw) int spin_offset_w = !(base.width % 2) ? 0 : 1; int spin_offset_h = !(base.height % 2) ? 0 : 1; - gfx_engine.PushModelViewMatrix(nux::Matrix4::TRANSLATE(-spin_geo.x - (spin_geo.width + spin_offset_w) / 2.0f, - -spin_geo.y - (spin_geo.height + spin_offset_h) / 2.0f, 0)); - gfx_engine.PushModelViewMatrix(rotate_matrix_); - gfx_engine.PushModelViewMatrix(nux::Matrix4::TRANSLATE(spin_geo.x + (spin_geo.width + spin_offset_w) / 2.0f, - spin_geo.y + (spin_geo.height + spin_offset_h) / 2.0f, 0)); + // we need to apply the rotation transformation first. + nux::Matrix4 matrix_texture; + matrix_texture = nux::Matrix4::TRANSLATE(-spin_geo.x - (spin_geo.width + spin_offset_w) / 2.0f, + -spin_geo.y - (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture; + matrix_texture = rotate_matrix_ * matrix_texture; + matrix_texture = nux::Matrix4::TRANSLATE(spin_geo.x + (spin_geo.width + spin_offset_w) / 2.0f, + spin_geo.y + (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture; + + gfx_engine.SetModelViewMatrix(gfx_engine.GetModelViewMatrix() * matrix_texture); gfx_engine.QRP_1Tex(spin_geo.x, spin_geo.y, @@ -409,9 +413,8 @@ void CoverArt::DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw) texxform, nux::color::White); - gfx_engine.PopModelViewMatrix(); - gfx_engine.PopModelViewMatrix(); - gfx_engine.PopModelViewMatrix(); + // revert to model view matrix stack + gfx_engine.ApplyModelViewMatrix(); if (!frame_timeout_) { diff --git a/unity-shared/IconTexture.cpp b/unity-shared/IconTexture.cpp index 0b7393545..c78fd844d 100644 --- a/unity-shared/IconTexture.cpp +++ b/unity-shared/IconTexture.cpp @@ -181,6 +181,12 @@ void IconTexture::IconLoaded(std::string const& icon_name, void IconTexture::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { + unsigned int current_alpha_blend; + unsigned int current_src_blend_factor; + unsigned int current_dest_blend_factor; + GfxContext.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); + GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + nux::Geometry geo = GetGeometry(); GfxContext.PushClippingRectangle(geo); @@ -243,11 +249,11 @@ void IconTexture::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) texxform, col); } - - } GfxContext.PopClippingRectangle(); + + GfxContext.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); } void IconTexture::GetTextureSize(int* width, int* height) diff --git a/unity-shared/OverlayRenderer.cpp b/unity-shared/OverlayRenderer.cpp index 8c858910a..a5c8a2a8a 100644 --- a/unity-shared/OverlayRenderer.cpp +++ b/unity-shared/OverlayRenderer.cpp @@ -456,20 +456,18 @@ void OverlayRendererImpl::Draw(nux::GraphicsEngine& gfx_context, nux::Geometry c nux::Geometry larger_content_geo = content_geo; larger_content_geo.OffsetSize(excess_border, excess_border); - nux::Geometry larger_geo(larger_content_geo); - nux::Geometry larger_absolute_geo = absolute_geo; larger_absolute_geo.OffsetSize(excess_border, excess_border); nux::TexCoordXForm texxform_absolute_bg; texxform_absolute_bg.flip_v_coord = true; texxform_absolute_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); - texxform_absolute_bg.uoffset = ((float) larger_content_geo.x) / larger_absolute_geo.width; - texxform_absolute_bg.voffset = ((float) larger_content_geo.y) / larger_absolute_geo.height; + texxform_absolute_bg.uoffset = 0.0f; + texxform_absolute_bg.voffset = 0.0f; texxform_absolute_bg.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); nux::Geometry blur_geo(larger_absolute_geo.x, larger_absolute_geo.y, larger_content_geo.width, larger_content_geo.height); - + if (BackgroundEffectHelper::blur_type != BLUR_NONE) { bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(blur_geo); @@ -481,9 +479,6 @@ void OverlayRendererImpl::Draw(nux::GraphicsEngine& gfx_context, nux::Geometry c if (bg_blur_texture_.IsValid()) { - nux::Geometry bg_clip = larger_geo; - gfx_context.PushClippingRectangle(bg_clip); - gfx_context.GetRenderStates().SetBlend(false); #ifndef NUX_OPENGLES_20 if (gfx_context.UsingGLSLCodePath()) @@ -503,9 +498,6 @@ void OverlayRendererImpl::Draw(nux::GraphicsEngine& gfx_context, nux::Geometry c bg_color_, nux::LAYER_BLEND_MODE_OVERLAY); #endif - gPainter.PopBackground(); - - gfx_context.PopClippingRectangle(); } //Draw the left and top lines. @@ -600,6 +592,9 @@ void OverlayRendererImpl::Draw(nux::GraphicsEngine& gfx_context, nux::Geometry c if (Settings::Instance().form_factor() != FormFactor::NETBOOK || force_edges) { + nux::Geometry geo_border(content_geo.x, content_geo.y, larger_absolute_geo.width - content_geo.x, larger_absolute_geo.height - content_geo.y); + gfx_context.PushClippingRectangle(geo_border); + // Paint the edges { gfx_context.GetRenderStates().SetColorMask(true, true, true, true); @@ -847,6 +842,8 @@ void OverlayRendererImpl::Draw(nux::GraphicsEngine& gfx_context, nux::Geometry c gfx_context.GetRenderStates().SetBlend(false); } + + gfx_context.PopClippingRectangle(); } } @@ -865,17 +862,18 @@ void OverlayRendererImpl::DrawContent(nux::GraphicsEngine& gfx_context, nux::Geo nux::Geometry larger_absolute_geo = absolute_geo; larger_absolute_geo.OffsetSize(excess_border, excess_border); - gfx_context.PushClippingRectangle(larger_geo); + unsigned int blend_alpha, blend_src, blend_dest = 0; + gfx_context.GetRenderStates().GetBlend(blend_alpha, blend_src, blend_dest); gfx_context.GetRenderStates().SetBlend(true); gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); nux::TexCoordXForm texxform_absolute_bg; texxform_absolute_bg.flip_v_coord = true; texxform_absolute_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); - texxform_absolute_bg.uoffset = ((float) larger_content_geo.x) / absolute_geo.width; - texxform_absolute_bg.voffset = ((float) larger_content_geo.y) / absolute_geo.height; + texxform_absolute_bg.uoffset = 0.0f; + texxform_absolute_bg.voffset = 0.0f; texxform_absolute_bg.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); nux::ROPConfig rop; @@ -960,15 +958,14 @@ void OverlayRendererImpl::DrawContent(nux::GraphicsEngine& gfx_context, nux::Geo nux::GetPainter().PushLayer(gfx_context, refine_geo, bg_refine_gradient_.get()); bgs++; + + gfx_context.GetRenderStates().SetBlend(blend_alpha, blend_src, blend_dest); + gfx_context.PopClippingRectangle(); } void OverlayRendererImpl::DrawContentCleanup(nux::GraphicsEngine& gfx_context, nux::Geometry content_geo, nux::Geometry absolute_geo, nux::Geometry geometry) { nux::GetPainter().PopBackground(bgs); - - gfx_context.GetRenderStates().SetBlend(false); - gfx_context.PopClippingRectangle(); - bgs = 0; } diff --git a/unity-shared/PlacesOverlayVScrollBar.cpp b/unity-shared/PlacesOverlayVScrollBar.cpp index e318cdf3c..7fffa42e0 100644 --- a/unity-shared/PlacesOverlayVScrollBar.cpp +++ b/unity-shared/PlacesOverlayVScrollBar.cpp @@ -54,6 +54,7 @@ PlacesOverlayVScrollBar::PlacesOverlayVScrollBar(NUX_FILE_LINE_DECL) _track->geometry_changed.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnTrackGeometryChanged)); OnVisibleChanged.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnVisibilityChanged)); + OnSensitiveChanged.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnSensitivityChanged)); } void PlacesOverlayVScrollBar::OnTrackGeometryChanged(nux::Area* /*area*/, nux::Geometry& /*geo*/) @@ -77,6 +78,15 @@ void PlacesOverlayVScrollBar::OnVisibilityChanged(nux::Area* /*area*/, bool visi } } +void PlacesOverlayVScrollBar::OnSensitivityChanged(nux::Area* /*area*/, bool sensitive) +{ + if (!sensitive) + { + overlay_window_->ResetStates(); + ResetConnector(); + } +} + void PlacesOverlayVScrollBar::StopAnimation() { if (animation_.CurrentState() != nux::animation::Animation::State::Stopped) @@ -144,7 +154,7 @@ bool PlacesOverlayVScrollBar::IsScrollBarVisible() const void PlacesOverlayVScrollBar::OnMouseNear(nux::Point const& mouse_pos) { - if (IsVisible() && IsScrollBarVisible()) + if (IsSensitive() && IsVisible() && IsScrollBarVisible()) { StopAnimation(); diff --git a/unity-shared/PlacesOverlayVScrollBar.h b/unity-shared/PlacesOverlayVScrollBar.h index f1b09403d..039f6ca5f 100644 --- a/unity-shared/PlacesOverlayVScrollBar.h +++ b/unity-shared/PlacesOverlayVScrollBar.h @@ -50,6 +50,7 @@ private: void OnTrackGeometryChanged(nux::Area* area, nux::Geometry& geo); void OnVisibilityChanged(nux::Area* area, bool visible); + void OnSensitivityChanged(nux::Area* area, bool sensitive); void OnMouseNear(nux::Point const& mouse_pos); void OnMouseBeyond(nux::Point const& mouse_pos); diff --git a/unity-shared/PreviewStyle.cpp b/unity-shared/PreviewStyle.cpp index 314d6bdbb..7b332176f 100644 --- a/unity-shared/PreviewStyle.cpp +++ b/unity-shared/PreviewStyle.cpp @@ -171,6 +171,12 @@ int Style::GetPreviewHeight() const return preview_height; } + +int Style::GetPreviewTopPadding() const +{ + return 100; +} + int Style::GetDetailsTopMargin() const { return 5; diff --git a/unity-shared/PreviewStyle.h b/unity-shared/PreviewStyle.h index fc823f36b..1a2eec4ac 100644 --- a/unity-shared/PreviewStyle.h +++ b/unity-shared/PreviewStyle.h @@ -62,6 +62,7 @@ public: int GetPreviewWidth() const; int GetPreviewHeight() const; + int GetPreviewTopPadding() const; int GetDetailsTopMargin() const; int GetDetailsBottomMargin() const; diff --git a/unity-shared/SearchBarSpinner.cpp b/unity-shared/SearchBarSpinner.cpp index 240118785..6e1dbaec2 100644 --- a/unity-shared/SearchBarSpinner.cpp +++ b/unity-shared/SearchBarSpinner.cpp @@ -60,6 +60,12 @@ SearchBarSpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) texxform.min_filter = nux::TEXFILTER_LINEAR; texxform.mag_filter = nux::TEXFILTER_LINEAR; + unsigned int current_alpha_blend; + unsigned int current_src_blend_factor; + unsigned int current_dest_blend_factor; + GfxContext.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); + GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + if (_state == STATE_READY) { GfxContext.QRP_1Tex(geo.x + ((geo.width - _magnify->GetWidth()) / 2), @@ -82,11 +88,14 @@ SearchBarSpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) int spin_offset_w = !(geo.width % 2) ? 0 : 1; int spin_offset_h = !(geo.height % 2) ? 0 : 1; - GfxContext.PushModelViewMatrix(nux::Matrix4::TRANSLATE(-spin_geo.x - (spin_geo.width + spin_offset_w) / 2.0f, - -spin_geo.y - (spin_geo.height + spin_offset_h) / 2.0f, 0)); - GfxContext.PushModelViewMatrix(_2d_rotate); - GfxContext.PushModelViewMatrix(nux::Matrix4::TRANSLATE(spin_geo.x + (spin_geo.width + spin_offset_w) / 2.0f, - spin_geo.y + (spin_geo.height + spin_offset_h) / 2.0f, 0)); + nux::Matrix4 matrix_texture; + matrix_texture = nux::Matrix4::TRANSLATE(-spin_geo.x - (spin_geo.width + spin_offset_w) / 2.0f, + -spin_geo.y - (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture; + matrix_texture = _2d_rotate * matrix_texture; + matrix_texture = nux::Matrix4::TRANSLATE(spin_geo.x + (spin_geo.width + spin_offset_w) / 2.0f, + spin_geo.y + (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture; + + GfxContext.SetModelViewMatrix(GfxContext.GetModelViewMatrix() * matrix_texture); GfxContext.QRP_1Tex(spin_geo.x, spin_geo.y, @@ -96,9 +105,8 @@ SearchBarSpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) texxform, nux::color::White); - GfxContext.PopModelViewMatrix(); - GfxContext.PopModelViewMatrix(); - GfxContext.PopModelViewMatrix(); + // revert to model view matrix stack + GfxContext.ApplyModelViewMatrix(); } else { @@ -120,6 +128,8 @@ SearchBarSpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) } GfxContext.PopClippingRectangle(); + GfxContext.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); + if (_state == STATE_SEARCHING && !_frame_timeout) { _frame_timeout.reset(new glib::Timeout(22, sigc::mem_fun(this, &SearchBarSpinner::OnFrameTimeout))); diff --git a/unity-shared/UBusMessages.h b/unity-shared/UBusMessages.h index cd7a85b92..9db421161 100644 --- a/unity-shared/UBusMessages.h +++ b/unity-shared/UBusMessages.h @@ -43,8 +43,6 @@ #define UBUS_REFINE_STATUS_FORMAT_STRING "(b)" #define UBUS_REFINE_STATUS "REFINE_STATUS" -#define UBUS_PLACE_VIEW_QUEUE_DRAW "PLACE_VIEW_QUEUE_DRAW" - // Signal send by Launcher/Quicklist when it wants to exit key-nav and wants to // get rid of keyboard-input-focus #define UBUS_LAUNCHER_START_KEY_NAV "LAUNCHER_START_KEY_NAV" -- cgit v1.2.3 From 729cac05fe59785c633ab5201dae469aa02dd6b1 Mon Sep 17 00:00:00 2001 From: Nick Dedekind Date: Thu, 13 Dec 2012 12:56:29 +0000 Subject: Fixed MP code comments. (bzr r2938.2.2) --- unity-shared/DashStyle.cpp | 15 +++++++++++++++ unity-shared/DashStyle.h | 3 +++ unity-shared/DashStyleInterface.h | 3 +++ 3 files changed, 21 insertions(+) (limited to 'unity-shared') diff --git a/unity-shared/DashStyle.cpp b/unity-shared/DashStyle.cpp index 7b22166dd..2966c959a 100755 --- a/unity-shared/DashStyle.cpp +++ b/unity-shared/DashStyle.cpp @@ -2362,6 +2362,11 @@ int Style::GetScrollbarWidth() const return 3; } +int Style::GetCategoryIconSize() const +{ + return 22; +} + int Style::GetCategoryHighlightHeight() const { return 24; @@ -2372,6 +2377,16 @@ int Style::GetPlacesGroupTopSpace() const return 7; } +int Style::GetPlacesGroupResultTopPadding() const +{ + return 2; +} + +int Style::GetPlacesGroupResultLeftPadding() const +{ + return 25; +} + int Style::GetCategoryHeaderLeftPadding() const { return 19; diff --git a/unity-shared/DashStyle.h b/unity-shared/DashStyle.h index 2273a7175..258345386 100755 --- a/unity-shared/DashStyle.h +++ b/unity-shared/DashStyle.h @@ -242,8 +242,11 @@ public: int GetScrollbarWidth() const; // Places Group + int GetCategoryIconSize() const; int GetCategoryHighlightHeight() const; int GetPlacesGroupTopSpace() const; + int GetPlacesGroupResultTopPadding() const; + int GetPlacesGroupResultLeftPadding() const; int GetCategoryHeaderLeftPadding() const; int GetCategorySeparatorLeftPadding() const; int GetCategorySeparatorRightPadding() const; diff --git a/unity-shared/DashStyleInterface.h b/unity-shared/DashStyleInterface.h index 43d488bc4..24e30f361 100644 --- a/unity-shared/DashStyleInterface.h +++ b/unity-shared/DashStyleInterface.h @@ -43,8 +43,11 @@ public: virtual nux::BaseTexture* GetGroupUnexpandIcon() = 0; virtual nux::BaseTexture* GetGroupExpandIcon() = 0; + virtual int GetCategoryIconSize() const = 0; virtual int GetCategoryHeaderLeftPadding() const = 0; virtual int GetPlacesGroupTopSpace() const = 0; + virtual int GetPlacesGroupResultTopPadding() const = 0; + virtual int GetPlacesGroupResultLeftPadding() const = 0; }; } -- cgit v1.2.3