summaryrefslogtreecommitdiff
diff options
authorNick Dedekind <nicholas.dedekind@gmail.com>2012-08-28 06:15:19 -0400
committerTarmac <>2012-08-28 06:15:19 -0400
commitb108910526313f15514f4cd8ed3f361b5761c209 (patch)
tree02a2ff98d64d5fcfc110d68884784a4836c51cd6
parent0016fa87072fee56ce7dc92a656d3c1eb828a4a7 (diff)
parent5a3da4458b5168afa1c32eb9bee24937062c6ffe (diff)
Updated background layer for preview cover-art and details panels to be 10% low-light.. Fixes: . Approved by Andrea Azzarone.
(bzr r2634)
-rw-r--r--dash/previews/ApplicationPreview.cpp6
-rw-r--r--dash/previews/GenericPreview.cpp6
-rw-r--r--dash/previews/MoviePreview.cpp6
-rw-r--r--dash/previews/MusicPreview.cpp6
-rw-r--r--unity-shared/CoverArt.cpp43
-rw-r--r--unity-shared/CoverArt.h3
-rw-r--r--unity-shared/PreviewStyle.cpp11
-rw-r--r--unity-shared/PreviewStyle.h3
8 files changed, 50 insertions, 34 deletions
diff --git a/dash/previews/ApplicationPreview.cpp b/dash/previews/ApplicationPreview.cpp
index 5d870e628..b32c5421d 100644
--- a/dash/previews/ApplicationPreview.cpp
+++ b/dash/previews/ApplicationPreview.cpp
@@ -135,11 +135,7 @@ void ApplicationPreview::AddProperties(GVariantBuilder* builder)
void ApplicationPreview::SetupBackground()
{
- nux::ROPConfig rop;
- rop.Blend = true;
- rop.SrcBlend = GL_ONE;
- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
- details_bg_layer_.reset(new nux::ColorLayer(nux::Color(0.03f, 0.03f, 0.03f, 0.0f), true, rop));
+ details_bg_layer_.reset(dash::previews::Style::Instance().GetBackgroundLayer());
}
void ApplicationPreview::SetupViews()
diff --git a/dash/previews/GenericPreview.cpp b/dash/previews/GenericPreview.cpp
index 426c24540..b48ba6c13 100644
--- a/dash/previews/GenericPreview.cpp
+++ b/dash/previews/GenericPreview.cpp
@@ -130,11 +130,7 @@ void GenericPreview::AddProperties(GVariantBuilder* builder)
void GenericPreview::SetupBackground()
{
- nux::ROPConfig rop;
- rop.Blend = true;
- rop.SrcBlend = GL_ONE;
- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
- details_bg_layer_.reset(new nux::ColorLayer(nux::Color(0.03f, 0.03f, 0.03f, 0.0f), true, rop));
+ details_bg_layer_.reset(dash::previews::Style::Instance().GetBackgroundLayer());
}
void GenericPreview::SetupViews()
diff --git a/dash/previews/MoviePreview.cpp b/dash/previews/MoviePreview.cpp
index 66ce7aa10..261bdc4a9 100644
--- a/dash/previews/MoviePreview.cpp
+++ b/dash/previews/MoviePreview.cpp
@@ -139,11 +139,7 @@ void MoviePreview::OnNavigateOut()
void MoviePreview::SetupBackground()
{
- nux::ROPConfig rop;
- rop.Blend = true;
- rop.SrcBlend = GL_ONE;
- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
- details_bg_layer_.reset(new nux::ColorLayer(nux::Color(0.03f, 0.03f, 0.03f, 0.0f), true, rop));
+ details_bg_layer_.reset(dash::previews::Style::Instance().GetBackgroundLayer());
}
void MoviePreview::SetupView()
diff --git a/dash/previews/MusicPreview.cpp b/dash/previews/MusicPreview.cpp
index 19fb7b023..039b74152 100644
--- a/dash/previews/MusicPreview.cpp
+++ b/dash/previews/MusicPreview.cpp
@@ -122,11 +122,7 @@ void MusicPreview::AddProperties(GVariantBuilder* builder)
void MusicPreview::SetupBackground()
{
- nux::ROPConfig rop;
- rop.Blend = true;
- rop.SrcBlend = GL_ONE;
- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
- details_bg_layer_.reset(new nux::ColorLayer(nux::Color(0.03f, 0.03f, 0.03f, 0.0f), true, rop));
+ details_bg_layer_.reset(dash::previews::Style::Instance().GetBackgroundLayer());
}
void MusicPreview::SetupViews()
diff --git a/unity-shared/CoverArt.cpp b/unity-shared/CoverArt.cpp
index f05666461..000be4dd2 100644
--- a/unity-shared/CoverArt.cpp
+++ b/unity-shared/CoverArt.cpp
@@ -28,6 +28,7 @@
#include <Nux/VLayout.h>
#include "DashStyle.h"
#include "IconLoader.h"
+#include "PreviewStyle.h"
namespace unity
{
@@ -294,16 +295,34 @@ void CoverArt::Draw(nux::GraphicsEngine& gfx_engine, bool force_draw)
gfx_engine.PushClippingRectangle(base);
nux::GetPainter().PaintBackground(gfx_engine, base);
+ if (bg_layer_)
+ {
+ unsigned int alpha, src, dest = 0;
+ gfx_engine.GetRenderStates().GetBlend(alpha, src, dest);
+ gfx_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+ bg_layer_->SetGeometry(base);
+ nux::GetPainter().RenderSinglePaintLayer(gfx_engine, bg_layer_->GetGeometry(), bg_layer_.get());
+
+ gfx_engine.GetRenderStates().SetBlend(alpha, src, dest);
+ }
+
+ gfx_engine.PopClippingRectangle();
+}
+
+
+void CoverArt::DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw)
+{
+ nux::Geometry const& base = GetGeometry();
+ gfx_engine.PushClippingRectangle(base);
+
+ if (!IsFullRedraw())
+ nux::GetPainter().PushLayer(gfx_engine, bg_layer_->GetGeometry(), bg_layer_.get());
+
unsigned int alpha, src, dest = 0;
gfx_engine.GetRenderStates().GetBlend(alpha, src, dest);
gfx_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- gfx_engine.QRP_Color(base.x,
- base.y,
- base.GetWidth(),
- base.GetHeight(),
- nux::Color(0.03f, 0.03f, 0.03f, 0.0f));
-
if (texture_screenshot_)
{
nux::Geometry imageDest = base;
@@ -393,17 +412,12 @@ void CoverArt::Draw(nux::GraphicsEngine& gfx_engine, bool force_draw)
gfx_engine.GetRenderStates().SetBlend(alpha, src, dest);
- gfx_engine.PopClippingRectangle();
-}
-
-void CoverArt::DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw)
-{
- nux::Geometry const& base = GetGeometry();
- gfx_engine.PushClippingRectangle(base);
-
if (GetLayout())
GetLayout()->ProcessDraw(gfx_engine, force_draw);
+ if (!IsFullRedraw())
+ nux::GetPainter().PopBackground();
+
gfx_engine.PopClippingRectangle();
}
@@ -427,6 +441,7 @@ void CoverArt::SetupViews()
rotate_matrix_.Identity();
rotate_matrix_.Rotate_z(0.0);
+ bg_layer_.reset(dash::previews::Style::Instance().GetBackgroundLayer());
}
void CoverArt::SetFont(std::string const& font)
diff --git a/unity-shared/CoverArt.h b/unity-shared/CoverArt.h
index 12215fe0b..747633d1d 100644
--- a/unity-shared/CoverArt.h
+++ b/unity-shared/CoverArt.h
@@ -96,6 +96,9 @@ private:
glib::Source::UniquePtr frame_timeout_;
nux::Matrix4 rotate_matrix_;
float rotation_;
+
+ typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
+ LayerPtr bg_layer_;
};
}
diff --git a/unity-shared/PreviewStyle.cpp b/unity-shared/PreviewStyle.cpp
index 56e55bb4a..9d44dc539 100644
--- a/unity-shared/PreviewStyle.cpp
+++ b/unity-shared/PreviewStyle.cpp
@@ -24,6 +24,8 @@
#include <NuxCore/Logger.h>
#include <NuxGraphics/GLTextureResourceManager.h>
+#include <Nux/PaintLayer.h>
+
#include <UnityCore/GLibWrapper.h>
#include "config.h"
@@ -138,6 +140,15 @@ Style& Style::Instance()
return *style_instance;
}
+nux::AbstractPaintLayer* Style::GetBackgroundLayer() const
+{
+ nux::ROPConfig rop;
+ rop.Blend = true;
+ rop.SrcBlend = GL_ONE;
+ rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
+ return new nux::ColorLayer(nux::Color(0.0f, 0.0f, 0.0f, 0.1f), true, rop);
+}
+
int Style::GetNavigatorWidth() const
{
return 42;
diff --git a/unity-shared/PreviewStyle.h b/unity-shared/PreviewStyle.h
index 23c9ba2f8..3bfff9fd6 100644
--- a/unity-shared/PreviewStyle.h
+++ b/unity-shared/PreviewStyle.h
@@ -32,6 +32,7 @@
namespace nux
{
class BaseTexture;
+ class AbstractPaintLayer;
}
namespace unity
@@ -88,6 +89,8 @@ public:
std::string subtitle_size_font() const;
std::string description_font() const;
+ nux::AbstractPaintLayer* GetBackgroundLayer() const;
+
////////////////////////////////
// Application Preview
std::string app_license_font() const;