summaryrefslogtreecommitdiff
diff options
authorAndrea Cimitan <andrea.cimitan@canonical.com>2012-02-13 16:29:59 +0000
committerAndrea Cimitan <andrea.cimitan@canonical.com>2012-02-13 16:29:59 +0000
commit01ae251cf21e40a4dfae41dbd7a86fe04ba39710 (patch)
tree8186f2f27df127d7cdd05940f2aedd1ca127abe7
parent52e3ee467621ca851cb791c091fe1e5f3ceca8e9 (diff)
Added shadows on launcher icons and alt-tab icons, tweaked BFB edges, tweaked background tile color for wallpaper-colorized launcher icons (including BFB), added device and show-desktop launcher icons to the list of wallpaper-colorized launcher icons
(bzr r1945.1.2)
-rw-r--r--plugins/unityshell/resources/launcher_icon_shadow_200.pngbin0 -> 2719 bytes
-rw-r--r--plugins/unityshell/resources/launcher_icon_shadow_62.pngbin0 -> 612 bytes
-rw-r--r--plugins/unityshell/resources/squircle_edge_54.pngbin976 -> 1814 bytes
-rw-r--r--plugins/unityshell/resources/squircle_glow_62.png (renamed from plugins/unityshell/resources/squircle_glow_54.png)bin1565 -> 1565 bytes
-rw-r--r--plugins/unityshell/resources/squircle_shadow_62.pngbin0 -> 1006 bytes
-rw-r--r--plugins/unityshell/src/DesktopLauncherIcon.cpp12
-rw-r--r--plugins/unityshell/src/DesktopLauncherIcon.h3
-rw-r--r--plugins/unityshell/src/DeviceLauncherIcon.cpp10
-rw-r--r--plugins/unityshell/src/DeviceLauncherIcon.h2
-rw-r--r--plugins/unityshell/src/IconRenderer.cpp60
-rw-r--r--plugins/unityshell/src/Launcher.cpp6
11 files changed, 50 insertions, 43 deletions
diff --git a/plugins/unityshell/resources/launcher_icon_shadow_200.png b/plugins/unityshell/resources/launcher_icon_shadow_200.png
new file mode 100644
index 000000000..ff613dbda
--- /dev/null
+++ b/plugins/unityshell/resources/launcher_icon_shadow_200.png
Binary files differ
diff --git a/plugins/unityshell/resources/launcher_icon_shadow_62.png b/plugins/unityshell/resources/launcher_icon_shadow_62.png
new file mode 100644
index 000000000..28c2e9d64
--- /dev/null
+++ b/plugins/unityshell/resources/launcher_icon_shadow_62.png
Binary files differ
diff --git a/plugins/unityshell/resources/squircle_edge_54.png b/plugins/unityshell/resources/squircle_edge_54.png
index 286349e6e..f0e54a544 100644
--- a/plugins/unityshell/resources/squircle_edge_54.png
+++ b/plugins/unityshell/resources/squircle_edge_54.png
Binary files differ
diff --git a/plugins/unityshell/resources/squircle_glow_54.png b/plugins/unityshell/resources/squircle_glow_62.png
index 87411ed95..87411ed95 100644
--- a/plugins/unityshell/resources/squircle_glow_54.png
+++ b/plugins/unityshell/resources/squircle_glow_62.png
Binary files differ
diff --git a/plugins/unityshell/resources/squircle_shadow_62.png b/plugins/unityshell/resources/squircle_shadow_62.png
new file mode 100644
index 000000000..70713debf
--- /dev/null
+++ b/plugins/unityshell/resources/squircle_shadow_62.png
Binary files differ
diff --git a/plugins/unityshell/src/DesktopLauncherIcon.cpp b/plugins/unityshell/src/DesktopLauncherIcon.cpp
index b974b7233..64ad9efb0 100644
--- a/plugins/unityshell/src/DesktopLauncherIcon.cpp
+++ b/plugins/unityshell/src/DesktopLauncherIcon.cpp
@@ -42,18 +42,6 @@ DesktopLauncherIcon::~DesktopLauncherIcon()
{
}
-nux::Color
-DesktopLauncherIcon::BackgroundColor()
-{
- return nux::Color(0xFF333333);
-}
-
-nux::Color
-DesktopLauncherIcon::GlowColor()
-{
- return nux::Color(0xFF333333);
-}
-
void
DesktopLauncherIcon::ActivateLauncherIcon(ActionArg arg)
{
diff --git a/plugins/unityshell/src/DesktopLauncherIcon.h b/plugins/unityshell/src/DesktopLauncherIcon.h
index 975faf12a..de1ee83a8 100644
--- a/plugins/unityshell/src/DesktopLauncherIcon.h
+++ b/plugins/unityshell/src/DesktopLauncherIcon.h
@@ -34,9 +34,6 @@ public:
DesktopLauncherIcon();
~DesktopLauncherIcon();
- virtual nux::Color BackgroundColor();
- virtual nux::Color GlowColor();
-
void SetShowInSwitcher(bool show_in_switcher)
{
show_in_switcher_ = show_in_switcher;
diff --git a/plugins/unityshell/src/DeviceLauncherIcon.cpp b/plugins/unityshell/src/DeviceLauncherIcon.cpp
index d29c4b286..260d15c6a 100644
--- a/plugins/unityshell/src/DeviceLauncherIcon.cpp
+++ b/plugins/unityshell/src/DeviceLauncherIcon.cpp
@@ -81,16 +81,6 @@ DeviceLauncherIcon::CanEject()
return g_volume_can_eject(volume_);
}
-nux::Color DeviceLauncherIcon::BackgroundColor()
-{
- return nux::Color(0xFF333333);
-}
-
-nux::Color DeviceLauncherIcon::GlowColor()
-{
- return nux::Color(0xFF333333);
-}
-
std::list<DbusmenuMenuitem*> DeviceLauncherIcon::GetMenus()
{
std::list<DbusmenuMenuitem*> result;
diff --git a/plugins/unityshell/src/DeviceLauncherIcon.h b/plugins/unityshell/src/DeviceLauncherIcon.h
index e3ef262e4..e95e6d78f 100644
--- a/plugins/unityshell/src/DeviceLauncherIcon.h
+++ b/plugins/unityshell/src/DeviceLauncherIcon.h
@@ -38,8 +38,6 @@ class DeviceLauncherIcon : public SimpleLauncherIcon
public:
DeviceLauncherIcon(GVolume* volume);
- virtual nux::Color BackgroundColor();
- virtual nux::Color GlowColor();
void UpdateVisibility(int visibility = -1);
void OnRemoved();
bool CanEject();
diff --git a/plugins/unityshell/src/IconRenderer.cpp b/plugins/unityshell/src/IconRenderer.cpp
index 96b8fabd2..37a47abb0 100644
--- a/plugins/unityshell/src/IconRenderer.cpp
+++ b/plugins/unityshell/src/IconRenderer.cpp
@@ -193,12 +193,14 @@ nux::BaseTexture* squircle_base = 0;
nux::BaseTexture* squircle_base_selected = 0;
nux::BaseTexture* squircle_edge = 0;
nux::BaseTexture* squircle_glow = 0;
+nux::BaseTexture* squircle_shadow = 0;
nux::BaseTexture* squircle_shine = 0;
std::vector<nux::BaseTexture*> icon_background;
std::vector<nux::BaseTexture*> icon_selected_background;
std::vector<nux::BaseTexture*> icon_edge;
std::vector<nux::BaseTexture*> icon_glow;
+std::vector<nux::BaseTexture*> icon_shadow;
std::vector<nux::BaseTexture*> icon_shine;
nux::ObjectPtr<nux::IOpenGLBaseTexture> offscreen_progress_texture;
nux::ObjectPtr<nux::IOpenGLShaderProgram> shader_program_uv_persp_correction;
@@ -399,11 +401,13 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
nux::Color background_tile_colorify = arg.colorify;
float backlight_intensity = arg.backlight_intensity;
float glow_intensity = arg.glow_intensity;
+ float shadow_intensity = 0.6f;
nux::BaseTexture* background = local::icon_background[size];
nux::BaseTexture* edge = local::icon_edge[size];
nux::BaseTexture* glow = local::icon_glow[size];
nux::BaseTexture* shine = local::icon_shine[size];
+ nux::BaseTexture* shadow = local::icon_shadow[size];
bool force_filter = icon_size != background->GetWidth();
@@ -414,34 +418,58 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
edge_color = nux::color::White;
colorify = nux::color::White;
background_tile_colorify = nux::color::White;
- backlight_intensity = 0.95;
+ backlight_intensity = 0.95f;
glow_intensity = 1.0f;
+ shadow_intensity = 0.0f;
background = local::icon_selected_background[size];
}
+ else
+ {
+ colorify.red += (0.5f + 0.5f * arg.saturation) * (1.0f - colorify.red);
+ colorify.blue += (0.5f + 0.5f * arg.saturation) * (1.0f - colorify.blue);
+ colorify.green += (0.5f + 0.5f * arg.saturation) * (1.0f - colorify.green);
- colorify.red += (0.5f + 0.5f * arg.saturation) * (1.0f - colorify.red);
- colorify.blue += (0.5f + 0.5f * arg.saturation) * (1.0f - colorify.blue);
- colorify.green += (0.5f + 0.5f * arg.saturation) * (1.0f - colorify.green);
- background_tile_colorify.red += (0.5f + 0.5f * arg.saturation) * (1.0f - background_tile_colorify.red);
- background_tile_colorify.green += (0.5f + 0.5f * arg.saturation) * (1.0f - background_tile_colorify.green);
- background_tile_colorify.blue += (0.5f + 0.5f * arg.saturation) * (1.0f - background_tile_colorify.blue);
+ if (arg.colorify_background)
+ {
+ background_tile_colorify = background_tile_colorify * 0.7f;
+ }
+ else
+ {
+ background_tile_colorify.red += (0.5f + 0.5f * arg.saturation) * (1.0f - background_tile_colorify.red);
+ background_tile_colorify.green += (0.5f + 0.5f * arg.saturation) * (1.0f - background_tile_colorify.green);
+ background_tile_colorify.blue += (0.5f + 0.5f * arg.saturation) * (1.0f - background_tile_colorify.blue);
+ }
+ }
if (arg.system_item)
{
- backlight_intensity = (arg.keyboard_nav_hl) ? 0.95f : 0.8f ;
+ // 0.9f is BACKLIGHT_STRENGTH in Launcher.cpp
+ backlight_intensity = (arg.keyboard_nav_hl) ? 0.95f : 0.9f;
glow_intensity = (arg.keyboard_nav_hl) ? 1.0f : 0.0f ;
background = local::squircle_base_selected;
edge = local::squircle_edge;
glow = local::squircle_glow;
shine = local::squircle_shine;
+ shadow = local::squircle_shadow;
}
- if (arg.colorify_background && !arg.keyboard_nav_hl)
+ // draw shadow
+ if (shadow_intensity > 0)
{
- background_tile_colorify = arg.colorify;
- background_tile_colorify = background_tile_colorify * 0.6f;
+ nux::Color shadow_color = background_tile_colorify * 0.3f;
+
+ // FIXME it is using the same transformation of the glow,
+ // should have its own transformation.
+ RenderElement(GfxContext,
+ arg,
+ shadow->GetDeviceTexture(),
+ nux::color::White,
+ shadow_color,
+ shadow_intensity * arg.alpha,
+ force_filter,
+ arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_GLOW, monitor));
}
auto tile_transform = arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_TILE, monitor);
@@ -459,14 +487,14 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
tile_transform);
}
- edge_color = edge_color + ((background_tile_color - edge_color) * arg.backlight_intensity);
+ edge_color = edge_color + ((background_tile_color - edge_color) * backlight_intensity);
nux::Color edge_tile_colorify = background_tile_colorify;
if (arg.colorify_background && !arg.keyboard_nav_hl)
{
// Mix edge_tile_colorify with plain white (1.0f).
// Would be nicer to tweak value from HSV colorspace, instead.
- float mix_factor = 0.2f;
+ float mix_factor = (arg.system_item) ? 0.2f : 0.16f;
edge_tile_colorify.red = edge_tile_colorify.red * (1.0f - mix_factor) + 1.0f * mix_factor;
edge_tile_colorify.green = edge_tile_colorify.green * (1.0f - mix_factor) + 1.0f * mix_factor;
@@ -1170,6 +1198,9 @@ void generate_textures()
generate_textures(icon_glow,
PKGDATADIR"/launcher_icon_glow_200.png",
PKGDATADIR"/launcher_icon_glow_62.png");
+ generate_textures(icon_shadow,
+ PKGDATADIR"/launcher_icon_shadow_200.png",
+ PKGDATADIR"/launcher_icon_shadow_62.png");
generate_textures(icon_shine,
PKGDATADIR"/launcher_icon_shine_150.png",
PKGDATADIR"/launcher_icon_shine_54.png");
@@ -1177,7 +1208,8 @@ void generate_textures()
squircle_base = load_texture(PKGDATADIR"/squircle_base_54.png");
squircle_base_selected = load_texture(PKGDATADIR"/squircle_base_selected_54.png");
squircle_edge = load_texture(PKGDATADIR"/squircle_edge_54.png");
- squircle_glow = load_texture(PKGDATADIR"/squircle_glow_54.png");
+ squircle_glow = load_texture(PKGDATADIR"/squircle_glow_62.png");
+ squircle_shadow = load_texture(PKGDATADIR"/squircle_shadow_62.png");
squircle_shine = load_texture(PKGDATADIR"/squircle_shine_54.png");
pip_ltr = load_texture(PKGDATADIR"/launcher_pip_ltr.png");
diff --git a/plugins/unityshell/src/Launcher.cpp b/plugins/unityshell/src/Launcher.cpp
index e4852b558..716999dfe 100644
--- a/plugins/unityshell/src/Launcher.cpp
+++ b/plugins/unityshell/src/Launcher.cpp
@@ -893,8 +893,10 @@ void Launcher::SetupRenderArg(AbstractLauncherIcon* icon, struct timespec const&
arg.progress = CLAMP(icon->GetProgress(), 0.0f, 1.0f);
arg.draw_shortcut = _shortcuts_shown && !_hide_machine->GetQuirk(LauncherHideMachine::PLACES_VISIBLE);
arg.system_item = icon->Type() == AbstractLauncherIcon::TYPE_HOME;
- arg.colorify_background = icon->Type() == AbstractLauncherIcon::TYPE_HOME ||
- icon->Type() == AbstractLauncherIcon::TYPE_TRASH ||
+ arg.colorify_background = icon->Type() == AbstractLauncherIcon::TYPE_HOME ||
+ icon->Type() == AbstractLauncherIcon::TYPE_TRASH ||
+ icon->Type() == AbstractLauncherIcon::TYPE_DESKTOP ||
+ icon->Type() == AbstractLauncherIcon::TYPE_DEVICE ||
icon->Type() == AbstractLauncherIcon::TYPE_EXPO;
if (_dash_is_open)