summaryrefslogtreecommitdiff
diff options
-rw-r--r--resources/progress_bar_fill_150.pngbin362 -> 0 bytes
-rw-r--r--resources/progress_bar_fill_42.pngbin192 -> 0 bytes
-rw-r--r--resources/progress_bar_trough.svg58
-rw-r--r--resources/progress_bar_trough_150.pngbin1666 -> 0 bytes
-rw-r--r--resources/progress_bar_trough_54.pngbin517 -> 0 bytes
-rw-r--r--unity-shared/IconRenderer.cpp47
-rw-r--r--unity-shared/IconRenderer.h2
7 files changed, 59 insertions, 48 deletions
diff --git a/resources/progress_bar_fill_150.png b/resources/progress_bar_fill_150.png
deleted file mode 100644
index 1876e579a..000000000
--- a/resources/progress_bar_fill_150.png
+++ /dev/null
Binary files differ
diff --git a/resources/progress_bar_fill_42.png b/resources/progress_bar_fill_42.png
deleted file mode 100644
index f08e03410..000000000
--- a/resources/progress_bar_fill_42.png
+++ /dev/null
Binary files differ
diff --git a/resources/progress_bar_trough.svg b/resources/progress_bar_trough.svg
index 1be24e6ed..c41cb4ac0 100644
--- a/resources/progress_bar_trough.svg
+++ b/resources/progress_bar_trough.svg
@@ -92,34 +92,34 @@
</marker>
<filter
inkscape:collect="always"
- id="filter5171"
- x="-0.054393096"
- width="1.1087862"
- y="-0.40838875"
- height="1.8167775">
+ id="filter6680"
+ x="-0.056347826"
+ width="1.1126957"
+ y="-0.324"
+ height="1.648">
<feGaussianBlur
inkscape:collect="always"
- stdDeviation="0.99355515"
- id="feGaussianBlur5173" />
+ stdDeviation="1.08"
+ id="feGaussianBlur6682" />
</filter>
</defs>
<sodipodi:namedview
id="base"
- pagecolor="#12f82b"
+ pagecolor="#5277f0"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
- inkscape:zoom="7.9195959"
- inkscape:cx="47.76404"
- inkscape:cy="27.178915"
+ inkscape:zoom="11.962963"
+ inkscape:cx="27"
+ inkscape:cy="27"
inkscape:document-units="px"
- inkscape:current-layer="layer2"
+ inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1450"
inkscape:window-height="793"
- inkscape:window-x="551"
- inkscape:window-y="125"
+ inkscape:window-x="503"
+ inkscape:window-y="97"
inkscape:window-maximized="0" />
<metadata
id="metadata7">
@@ -129,7 +129,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
+ <dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@@ -143,19 +143,17 @@
y="346.57648"
x="413.71429"
id="image3023"
- xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAABHNCSVQICAgIfAhkiAAAAAxJREFU
-CJljYCAZAAAAMwAB0kOx4wAAAABJRU5ErkJggg==
-"
+ xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAABHNCSVQICAgIfAhkiAAAAAxJREFU CJljYCAZAAAAMwAB0kOx4wAAAABJRU5ErkJggg== "
height="3"
width="4" />
<rect
- style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:18.70000076;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;filter:url(#filter5171)"
+ style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:18.70000076000000178;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;opacity:0.555;filter:url(#filter6680)"
id="rect5033-0"
- width="43.838879"
- height="5.8388786"
- x="5.0805607"
- y="1022.4428"
- ry="2.1012185"
+ width="46"
+ height="8"
+ x="4"
+ y="1021.3622"
+ ry="2.8789341"
inkscape:export-filename="/tmp/progress.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
@@ -167,13 +165,13 @@ CJljYCAZAAAAMwAB0kOx4wAAAABJRU5ErkJggg==
style="display:inline"
transform="translate(0,-998.36218)">
<rect
- style="fill:#838383;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+ style="fill:#838383;fill-opacity:1;stroke:#ffffff;stroke-width:2.02898455;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="rect5033"
- width="43.821442"
- height="5.8214412"
- x="5.0892797"
- y="1022.4514"
- ry="2.0949435"
+ width="43.971016"
+ height="5.9710155"
+ x="5.0144925"
+ y="1022.3766"
+ ry="2.1487703"
inkscape:export-filename="/tmp/progress.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
diff --git a/resources/progress_bar_trough_150.png b/resources/progress_bar_trough_150.png
deleted file mode 100644
index 327a02d73..000000000
--- a/resources/progress_bar_trough_150.png
+++ /dev/null
Binary files differ
diff --git a/resources/progress_bar_trough_54.png b/resources/progress_bar_trough_54.png
deleted file mode 100644
index 85dc6dcc8..000000000
--- a/resources/progress_bar_trough_54.png
+++ /dev/null
Binary files differ
diff --git a/unity-shared/IconRenderer.cpp b/unity-shared/IconRenderer.cpp
index 5bd14ee25..bfdfe5a21 100644
--- a/unity-shared/IconRenderer.cpp
+++ b/unity-shared/IconRenderer.cpp
@@ -28,6 +28,7 @@
#include <UnityCore/GLibWrapper.h>
#include <NuxGraphics/CairoGraphics.h>
#include "unity-shared/CairoTexture.h"
+#include "unity-shared/TextureCache.h"
#include "GraphicsUtils.h"
#include <gtk/gtk.h>
@@ -227,8 +228,6 @@ struct IconRenderer::TexturesPool
BaseTexturePtr icon_glow[local::IconSize::SIZE];
BaseTexturePtr icon_shadow[local::IconSize::SIZE];
BaseTexturePtr icon_shine[local::IconSize::SIZE];
- BaseTexturePtr progress_bar_trough[local::IconSize::SIZE];
- BaseTexturePtr progress_bar_fill[local::IconSize::SIZE];
nux::ObjectPtr<nux::IOpenGLBaseTexture> offscreen_progress_texture;
nux::ObjectPtr<nux::IOpenGLShaderProgram> shader_program_uv_persp_correction;
@@ -263,19 +262,38 @@ private:
void SetupShaders();
};
+struct IconRenderer::LocalTextures
+{
+ void ReloadIconSizedTextures(int icon_size, int image_size)
+ {
+ auto& cache = TextureCache::GetDefault();
+ progress_bar_trough = cache.FindTexture("progress_bar_trough.svg", icon_size, icon_size);
+ progress_bar_fill = cache.FindTexture("progress_bar_fill.svg", image_size - (icon_size - image_size));
+ }
+
+ BaseTexturePtr progress_bar_trough;
+ BaseTexturePtr progress_bar_fill;
+};
+
IconRenderer::IconRenderer()
: icon_size(0)
, image_size(0)
, spacing(0)
, textures_(TexturesPool::Get())
+ , local_textures_(std::make_shared<LocalTextures>())
{
pip_style = OUTSIDE_TILE;
}
void IconRenderer::SetTargetSize(int tile_size, int image_size_, int spacing_)
{
- icon_size = tile_size;
- image_size = image_size_;
+ if (icon_size != tile_size || image_size != image_size_)
+ {
+ icon_size = tile_size;
+ image_size = image_size_;
+ local_textures_->ReloadIconSizedTextures(icon_size, image_size);
+ }
+
spacing = spacing_;
}
@@ -1058,14 +1076,13 @@ void IconRenderer::RenderProgressToTexture(nux::GraphicsEngine& GfxContext,
int width = texture->GetWidth();
int height = texture->GetHeight();
- int progress_width = icon_size;
- int progress_height = icon_size;
+ int progress_width = local_textures_->progress_bar_trough->GetHeight();
+ int progress_height = local_textures_->progress_bar_trough->GetWidth();
int fill_width = image_size - (icon_size - image_size);
- int fill_height = std::round(textures_->progress_bar_fill[local::IconSize::SMALL]->GetHeight() * scale());
+ int fill_height = local_textures_->progress_bar_fill->GetHeight();
int fill_offset = static_cast<float>(image_size) * fill_offset_ratio;
- auto tex_size = icon_size > 100 ? local::IconSize::BIG : local::IconSize::SMALL;
// We need to perform a barn doors effect to acheive the slide in and out
@@ -1098,10 +1115,10 @@ void IconRenderer::RenderProgressToTexture(nux::GraphicsEngine& GfxContext,
// left door
GfxContext.PushClippingRectangle(nux::Geometry(left_edge, 0, half_size, height));
GfxContext.QRP_1Tex(left_edge, progress_y, progress_width, progress_height,
- textures_->progress_bar_trough[tex_size]->GetDeviceTexture(), texxform,
+ local_textures_->progress_bar_trough->GetDeviceTexture(), texxform,
nux::color::White);
GfxContext.QRP_1Tex(left_edge + fill_offset, fill_y, fill_width, fill_height,
- textures_->progress_bar_fill[tex_size]->GetDeviceTexture(), texxform,
+ local_textures_->progress_bar_fill->GetDeviceTexture(), texxform,
nux::color::White);
GfxContext.PopClippingRectangle();
@@ -1109,11 +1126,11 @@ void IconRenderer::RenderProgressToTexture(nux::GraphicsEngine& GfxContext,
GfxContext.PushClippingRectangle(nux::Geometry(left_edge + half_size, 0, half_size, height));
GfxContext.QRP_1Tex(right_edge - progress_width, progress_y,
progress_width, progress_height,
- textures_->progress_bar_trough[tex_size]->GetDeviceTexture(), texxform,
+ local_textures_->progress_bar_trough->GetDeviceTexture(), texxform,
nux::color::White);
GfxContext.QRP_1Tex(right_edge - progress_width + fill_offset, fill_y,
fill_width, fill_height,
- textures_->progress_bar_fill[tex_size]->GetDeviceTexture(), texxform,
+ local_textures_->progress_bar_fill->GetDeviceTexture(), texxform,
nux::color::White);
GfxContext.PopClippingRectangle();
@@ -1261,12 +1278,6 @@ IconRenderer::TexturesPool::TexturesPool()
GenerateTextures(icon_shine,
PKGDATADIR"/launcher_icon_shine_150.png",
PKGDATADIR"/launcher_icon_shine_54.png");
- GenerateTextures(progress_bar_trough,
- PKGDATADIR"/progress_bar_trough_150.png",
- PKGDATADIR"/progress_bar_trough_54.png");
- GenerateTextures(progress_bar_fill,
- PKGDATADIR"/progress_bar_fill_150.png",
- PKGDATADIR"/progress_bar_fill_42.png");
SetupShaders();
}
diff --git a/unity-shared/IconRenderer.h b/unity-shared/IconRenderer.h
index dce7886d5..733f9a1cf 100644
--- a/unity-shared/IconRenderer.h
+++ b/unity-shared/IconRenderer.h
@@ -88,6 +88,8 @@ private:
struct TexturesPool;
std::shared_ptr<TexturesPool> textures_;
+ struct LocalTextures;
+ std::shared_ptr<LocalTextures> local_textures_;
nux::Matrix4 stored_projection_matrix_;
};