Compare commits

..

1 Commits

Author SHA1 Message Date
Simon Schneegans 38f67dc8cd 🎉 Add dominat color extractor
Checks / Check Clang-Format (push) Has been cancelled
Checks / Check Comment Percentage (push) Has been cancelled
Checks / Run ShellCheck (push) Has been cancelled
Checks / Run Tests (gnome-wayland-nested, 32) (push) Has been cancelled
Checks / Run Tests (gnome-wayland-nested, 33) (push) Has been cancelled
Checks / Run Tests (gnome-wayland-nested, 34) (push) Has been cancelled
Checks / Run Tests (gnome-wayland-nested, 35) (push) Has been cancelled
Checks / Run Tests (gnome-wayland-nested, 36) (push) Has been cancelled
2022-05-21 11:08:50 +02:00
5 changed files with 194 additions and 443 deletions
+3 -4
View File
@@ -2,14 +2,13 @@
## [Burn My Windows 16](https://github.com/schneegans/Burn-My-Windows/releases/tag/v16)
**Release Date:** 2022-05-21
**Release Date:** TBD
#### Enhancements
* Many translation updates, including a completely new Arabic, Finnish, Korean, and Swedish translation. A BIG THANKS to all translators!
* The shaders are now aware of the actual window size (e.g. excluding the area where the shadow is drawn). For instance, this **fixes the drawing of the effects outside the window bounds** for `libadwaita` apps.
* Refactored how the size and opacity transitions of the window actors are set up. Effects can now only specify a desired actor scale which will not change during the animation. All dynamic scaling and fading must be implemented in the shaders now.
* The standard uniforms of all shaders have been updated: The window size is now passed as a `vec2` and there is a new `bool uForOpening` which is set to `true` if a window-open animation is ongoing, to `false` otherwise.
* Refactored how the size and opacity transitions of the window actors are set up. Effects can now only specify a desired actor scale which will not change during the animation. All dynamic scaling and fading must be implemented in the shaders now.
* The shaders are now aware of the actual window size (e.g. excluding the area where the shadow is drawn). For instance, this fixes the drawing of the effects outside the window bounds for `libadwaita` apps.
#### Bug Fixes
-361
View File
@@ -1,361 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Simon Schneegans
# This file is distributed under the same license as the burn-my-windows package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: burn-my-windows\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-04-05 09:22+0200\n"
"PO-Revision-Date: 2022-05-21 10:15+0000\n"
"Last-Translator: Seong-ho Cho <darkcircle.0426@gmail.com>\n"
"Language-Team: Korean <https://hosted.weblate.org/projects/burn-my-windows/"
"core/ko/>\n"
"Language: ko\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 4.13-dev\n"
#: prefs.js:112
msgid "Effect Options"
msgstr "효과 옵션"
#: prefs.js:140
msgid "Go Back"
msgstr "뒤로 가기"
#: prefs.js:182
msgid "General Options"
msgstr "일반 옵션"
#: prefs.js:276
msgid "Gold Sponsors"
msgstr "골드 스폰서"
#: prefs.js:279
msgid "Silver Sponsors"
msgstr "실버 스폰서"
#: prefs.js:282
msgid "Bronze Sponsors"
msgstr "브론즈 스폰서"
#: prefs.js:285
msgid "Past Sponsors"
msgstr "이전 스폰서"
#. Translators: %s will be replaced by the effect's name.
#: prefs.js:510
#, javascript-format
msgid "Preview for %s"
msgstr "%s 미리 보기"
#: prefs.js:532
msgid "Close this Window to Preview the Effect!"
msgstr "이 창을 닫아 효과를 확인해보세요!"
#: src/BrokenGlass.js:57
msgid "Broken Glass"
msgstr "유리 깨짐"
#: src/TVEffect.js:56
msgid "TV Effect"
msgstr "TV 효과"
#: src/TRexAttack.js:56
msgid "T-Rex Attack"
msgstr "티라노 공격"
#: src/SnapOfDisintegration.js:60
msgid "Snap of Disintegration"
msgstr "해체 영상"
#: src/Wisps.js:55
msgid "Wisps"
msgstr "도깨비불"
#: src/Fire.js:58
msgid "Fire"
msgstr "화염"
#: src/Fire.js:130
msgid "Default Fire"
msgstr "기본 화염"
#: src/Fire.js:140
msgid "Hell Fire"
msgstr "지옥 화염"
#: src/Fire.js:150
msgid "Dark and Smutty"
msgstr "어둡고 찝찝함"
#: src/Fire.js:160
msgid "Cold Breeze"
msgstr "냉랭한 바람"
#: src/Fire.js:170
msgid "Santa is Coming"
msgstr "산타의 방문"
#: src/Hexagon.js:53
msgid "Hexagon"
msgstr "육각형"
#: src/EnergizeA.js:54
msgid "Energize A"
msgstr "에너자이즈 A"
#: src/Apparition.js:57
msgid "Apparition"
msgstr "혼령"
#: src/EnergizeB.js:54
msgid "Energize B"
msgstr "에너자이즈 B"
#: src/Matrix.js:58
msgid "Matrix"
msgstr "매트릭스"
#: resources/ui/common/main-menu.ui:6
msgid "Visit Homepage"
msgstr "홈페이지 방문"
#: resources/ui/common/main-menu.ui:10
msgid "View Changelog"
msgstr "변경 이력 보기"
#: resources/ui/common/main-menu.ui:16
msgid "Report a Bug"
msgstr "버그 보고"
#: resources/ui/common/main-menu.ui:20
msgid "Create an Effect"
msgstr "효과 만들기"
#: resources/ui/common/main-menu.ui:24
msgid "Translate"
msgstr "번역"
#: resources/ui/common/main-menu.ui:28
msgid "Donate"
msgstr "기부"
#: resources/ui/common/main-menu.ui:41
msgid "About Burn-My-Windows"
msgstr "Burn-My-Windows 정보"
#: resources/ui/gtk4/Matrix.ui:24 resources/ui/gtk4/BrokenGlass.ui:24
#: resources/ui/gtk4/Wisps.ui:24 resources/ui/gtk4/Fire.ui:49
#: resources/ui/gtk4/SnapOfDisintegration.ui:24
#: resources/ui/gtk4/TRexAttack.ui:24 resources/ui/gtk4/TVEffect.ui:24
#: resources/ui/gtk4/EnergizeA.ui:24 resources/ui/gtk4/Hexagon.ui:24
#: resources/ui/gtk4/EnergizeB.ui:24 resources/ui/gtk4/Apparition.ui:24
#: resources/ui/gtk3/Wisps.ui:42 resources/ui/gtk3/Fire.ui:93
#: resources/ui/gtk3/TVEffect.ui:35 resources/ui/gtk3/EnergizeA.ui:42
#: resources/ui/gtk3/Hexagon.ui:49 resources/ui/gtk3/EnergizeB.ui:42
#: resources/ui/gtk3/Apparition.ui:63
msgid "Animation Time [ms]"
msgstr "애니메이션 시간 [ms]"
#: resources/ui/gtk4/Matrix.ui:52 resources/ui/gtk4/Matrix.ui:98
#: resources/ui/gtk4/Matrix.ui:144 resources/ui/gtk4/Matrix.ui:190
#: resources/ui/gtk4/Matrix.ui:224 resources/ui/gtk4/Matrix.ui:258
#: resources/ui/gtk4/BrokenGlass.ui:52 resources/ui/gtk4/BrokenGlass.ui:98
#: resources/ui/gtk4/BrokenGlass.ui:144 resources/ui/gtk4/BrokenGlass.ui:190
#: resources/ui/gtk4/BrokenGlass.ui:244 resources/ui/gtk4/Wisps.ui:52
#: resources/ui/gtk4/Wisps.ui:98 resources/ui/gtk4/Wisps.ui:132
#: resources/ui/gtk4/Fire.ui:77 resources/ui/gtk4/Fire.ui:123
#: resources/ui/gtk4/Fire.ui:169 resources/ui/gtk4/Fire.ui:222
#: resources/ui/gtk4/Fire.ui:280 resources/ui/gtk4/TRexAttack.ui:52
#: resources/ui/gtk4/TRexAttack.ui:98 resources/ui/gtk4/TRexAttack.ui:144
#: resources/ui/gtk4/TRexAttack.ui:190 resources/ui/gtk4/TRexAttack.ui:224
#: resources/ui/gtk4/TVEffect.ui:52 resources/ui/gtk4/TVEffect.ui:86
#: resources/ui/gtk4/EnergizeA.ui:52 resources/ui/gtk4/EnergizeA.ui:98
#: resources/ui/gtk4/EnergizeA.ui:132 resources/ui/gtk4/Hexagon.ui:52
#: resources/ui/gtk4/Hexagon.ui:98 resources/ui/gtk4/Hexagon.ui:144
#: resources/ui/gtk4/Hexagon.ui:178 resources/ui/gtk4/Hexagon.ui:212
#: resources/ui/gtk4/Hexagon.ui:265 resources/ui/gtk4/EnergizeB.ui:52
#: resources/ui/gtk4/EnergizeB.ui:98 resources/ui/gtk4/EnergizeB.ui:132
#: resources/ui/gtk4/prefs.ui:166 resources/ui/gtk4/Apparition.ui:52
#: resources/ui/gtk4/Apparition.ui:98 resources/ui/gtk4/Apparition.ui:144
#: resources/ui/gtk4/Apparition.ui:190 resources/ui/gtk4/Apparition.ui:236
#: resources/ui/gtk3/Wisps.ui:68 resources/ui/gtk3/Wisps.ui:117
#: resources/ui/gtk3/Wisps.ui:160 resources/ui/gtk3/Fire.ui:119
#: resources/ui/gtk3/Fire.ui:167 resources/ui/gtk3/Fire.ui:215
#: resources/ui/gtk3/Fire.ui:277 resources/ui/gtk3/Fire.ui:345
#: resources/ui/gtk3/TVEffect.ui:61 resources/ui/gtk3/TVEffect.ui:104
#: resources/ui/gtk3/EnergizeA.ui:68 resources/ui/gtk3/EnergizeA.ui:117
#: resources/ui/gtk3/EnergizeA.ui:160 resources/ui/gtk3/Hexagon.ui:75
#: resources/ui/gtk3/Hexagon.ui:124 resources/ui/gtk3/Hexagon.ui:173
#: resources/ui/gtk3/Hexagon.ui:216 resources/ui/gtk3/Hexagon.ui:259
#: resources/ui/gtk3/Hexagon.ui:321 resources/ui/gtk3/EnergizeB.ui:68
#: resources/ui/gtk3/EnergizeB.ui:117 resources/ui/gtk3/EnergizeB.ui:160
#: resources/ui/gtk3/prefs.ui:219 resources/ui/gtk3/Apparition.ui:89
#: resources/ui/gtk3/Apparition.ui:138 resources/ui/gtk3/Apparition.ui:187
#: resources/ui/gtk3/Apparition.ui:236 resources/ui/gtk3/Apparition.ui:285
msgid "Reset to Default Value"
msgstr "기본값으로 초기화"
#: resources/ui/gtk4/Matrix.ui:70 resources/ui/gtk4/BrokenGlass.ui:70
#: resources/ui/gtk4/Wisps.ui:70 resources/ui/gtk4/Fire.ui:95
#: resources/ui/gtk4/SnapOfDisintegration.ui:70
#: resources/ui/gtk4/EnergizeA.ui:70 resources/ui/gtk4/Hexagon.ui:70
#: resources/ui/gtk4/EnergizeB.ui:70 resources/ui/gtk3/Wisps.ui:91
#: resources/ui/gtk3/Fire.ui:141 resources/ui/gtk3/EnergizeA.ui:91
#: resources/ui/gtk3/Hexagon.ui:98 resources/ui/gtk3/EnergizeB.ui:91
msgid "Scale"
msgstr "비율 조정"
#: resources/ui/gtk4/Matrix.ui:116 resources/ui/gtk4/Apparition.ui:70
#: resources/ui/gtk3/Apparition.ui:112
msgid "Randomness"
msgstr "임의성 지수"
#: resources/ui/gtk4/Matrix.ui:162
msgid "Vertical Overshooting"
msgstr "수직 오버슈팅"
#: resources/ui/gtk4/Matrix.ui:208
msgid "Trail Color"
msgstr "끌림 자국 색상"
#: resources/ui/gtk4/Matrix.ui:242
msgid "Tip Color"
msgstr "끄트머리 색상"
#: resources/ui/gtk4/BrokenGlass.ui:116
msgid "Gravity"
msgstr "중력계수"
#: resources/ui/gtk4/BrokenGlass.ui:162
msgid "Blow Force"
msgstr "타격 강도"
#: resources/ui/gtk4/BrokenGlass.ui:212
msgid "Shatter From Pointer Location"
msgstr "포인터 위치에서 깨짐"
#: resources/ui/gtk4/BrokenGlass.ui:221
msgid ""
"The shards will fly away from where your mouse pointer was when closing the "
"window."
msgstr "창을 닫을 때 마우스 포인터 위치에서 조각이 날아갑니다."
#: resources/ui/gtk4/Wisps.ui:116 resources/ui/gtk4/SnapOfDisintegration.ui:116
#: resources/ui/gtk4/TVEffect.ui:70 resources/ui/gtk4/EnergizeA.ui:116
#: resources/ui/gtk4/EnergizeB.ui:116 resources/ui/gtk3/Wisps.ui:139
#: resources/ui/gtk3/TVEffect.ui:83 resources/ui/gtk3/EnergizeA.ui:139
#: resources/ui/gtk3/EnergizeB.ui:139
msgid "Color"
msgstr "색상"
#: resources/ui/gtk4/Fire.ui:25 resources/ui/gtk3/Fire.ui:49
msgid "Presets"
msgstr "사전설정"
#: resources/ui/gtk4/Fire.ui:141 resources/ui/gtk3/Fire.ui:189
msgid "Speed"
msgstr "속도"
#: resources/ui/gtk4/Fire.ui:191 resources/ui/gtk3/Fire.ui:241
msgid "3D Noise"
msgstr "3차원 잡티"
#: resources/ui/gtk4/Fire.ui:200 resources/ui/gtk3/Fire.ui:250
msgid "Creates a more dynamic fire but requires more GPU power."
msgstr "좀 더 역동적인 화염을 만들지만 더 많은 GPU 성능이 필요합니다."
#: resources/ui/gtk4/Fire.ui:240 resources/ui/gtk3/Fire.ui:300
msgid "Gradient"
msgstr "그레디언트"
#: resources/ui/gtk4/TRexAttack.ui:70
msgid "Claw Scratch Scale"
msgstr "발톱 자국 크기 비율"
#: resources/ui/gtk4/TRexAttack.ui:116
msgid "Claw Scratch Count"
msgstr "발톱 자국 갯수"
#: resources/ui/gtk4/TRexAttack.ui:162
msgid "Warp Effect"
msgstr "왜곡 효과"
#: resources/ui/gtk4/TRexAttack.ui:208
msgid "Flash Color"
msgstr "번쩍임 색상"
#: resources/ui/gtk4/effectPage.ui:37 resources/ui/gtk3/effectPage.ui:37
msgid "Preview this Effect"
msgstr "이 효과 미리 보기"
#: resources/ui/gtk4/Hexagon.ui:116 resources/ui/gtk3/Hexagon.ui:147
msgid "Mesh Line Width"
msgstr "도형 선 굵기"
#: resources/ui/gtk4/Hexagon.ui:162 resources/ui/gtk3/Hexagon.ui:195
msgid "Line Color"
msgstr "선 색상"
#: resources/ui/gtk4/Hexagon.ui:196 resources/ui/gtk3/Hexagon.ui:238
msgid "Glow Color"
msgstr "불빛 색상"
#: resources/ui/gtk4/Hexagon.ui:234 resources/ui/gtk3/Hexagon.ui:285
msgid "Additive Blending"
msgstr "혼합 효과"
#: resources/ui/gtk4/Hexagon.ui:243 resources/ui/gtk3/Hexagon.ui:294
msgid "You may want to enable this for dark window themes."
msgstr "어두운 창 테마에서 사용하시면 좋습니다."
#: resources/ui/gtk4/prefs.ui:28 resources/ui/gtk3/prefs.ui:35
msgid "Welcome to Burn-My-Windows!"
msgstr "Burn-My-Windows 사용을 환영해요!"
#: resources/ui/gtk4/prefs.ui:39 resources/ui/gtk3/prefs.ui:46
msgid "If you like this extension, recommend it to your friends :)"
msgstr "이 확장이 맘에 든다면 친구에게 추천해주세요 :)"
#: resources/ui/gtk4/prefs.ui:66 resources/ui/gtk3/prefs.ui:74
msgid "Open Window Animation"
msgstr "창 열기 애니메이션"
#: resources/ui/gtk4/prefs.ui:75 resources/ui/gtk4/prefs.ui:119
#: resources/ui/gtk3/prefs.ui:83 resources/ui/gtk3/prefs.ui:147
msgid "If multiple are selected, one is chosen randomly."
msgstr "여러 항목을 선택하면 그 중 하나를 임의로 선택합니다."
#: resources/ui/gtk4/prefs.ui:90 resources/ui/gtk4/prefs.ui:134
#: resources/ui/gtk3/prefs.ui:104 resources/ui/gtk3/prefs.ui:168
msgid "Choose Effects"
msgstr "효과 선택"
#: resources/ui/gtk4/prefs.ui:110 resources/ui/gtk3/prefs.ui:138
msgid "Close Window Animation"
msgstr "창 닫기 애니메이션"
#: resources/ui/gtk4/prefs.ui:150 resources/ui/gtk3/prefs.ui:198
msgid "Also Add Effects to Dialogs"
msgstr "대화상자에도 효과 추가"
#: resources/ui/gtk4/Apparition.ui:116 resources/ui/gtk3/Apparition.ui:161
msgid "Twirl Intensity"
msgstr "회전 강도"
#: resources/ui/gtk4/Apparition.ui:162 resources/ui/gtk3/Apparition.ui:210
msgid "Shake Intensity"
msgstr "떨림 강도"
#: resources/ui/gtk4/Apparition.ui:208 resources/ui/gtk3/Apparition.ui:259
msgid "Suction Intensity"
msgstr "흡입 강도"
#: resources/ui/gtk3/Fire.ui:63
msgid "Choose a Preset"
msgstr "사전설정 선택"
+9 -70
View File
@@ -4,7 +4,7 @@
[
"epost@anotheragency.no",
"Allan Nordh\u00f8y",
50
3
]
]
},
@@ -13,40 +13,12 @@
[
"vistausss@fastmail.com",
"Heimen Stoffels",
76
]
]
},
{
"Swedish": [
[
"obslsessed@duck.com",
"obslsessed",
1
],
[
"swedishsailfishosuser@tutanota.com",
"Kristoffer Grundstr\u00f6m",
57
]
]
},
{
"Finnish": [
[
"jiri.gronroos@iki.fi",
"Jiri Gr\u00f6nroos",
57
65
]
]
},
{
"Russian": [
[
"eg.ermakov2016@yandex.ru",
"\u0415\u0433\u043e\u0440 \u0415\u0440\u043c\u0430\u043a\u043e\u0432",
31
],
[
"franigoyt@gmail.com",
"ANIGO R. (AR)",
@@ -63,21 +35,12 @@
]
]
},
{
"Arabic": [
[
"fawaz27000@hotmail.com",
"fawaz006",
79
]
]
},
{
"Turkish": [
[
"muhaaliss@pm.me",
"Muha Aliss",
61
57
]
]
},
@@ -91,7 +54,7 @@
[
"albano_battistella@hotmail.com",
"albanobattistella",
74
63
]
]
},
@@ -101,11 +64,6 @@
"lyuutau@outlook.com",
"\u5218\u97ec",
36
],
[
"poonsters6@gmail.com",
"merelymyself",
41
]
]
},
@@ -114,17 +72,12 @@
[
"code@simonschneegans.de",
"Simon Schneegans",
70
59
]
]
},
{
"French": [
[
"mathieu.bousquet2@gmail.com",
"Mathieu B.",
9
],
[
"redxxiii@zaclys.net",
"Reda",
@@ -133,36 +86,22 @@
[
"theo.remon+weblate@uswery.eu",
"Th\u00e9o Remon",
30
24
],
[
"bonnemainsnathan@gmail.com",
"Nathan",
45
]
]
},
{
"Korean": [
[
"darkcircle.0426@gmail.com",
"Seong-ho Cho",
72
42
]
]
},
{
"Spanish": [
[
"dev.n47os@aleeas.com",
"ulicesah@gmail.com",
"Ulices",
7
],
[
"andres.segarra.aparicio@gmail.com",
"Andres Segarra",
10
],
[
"fitojb@ubuntu.com",
"Adolfo Jayme Barrientos",
@@ -171,7 +110,7 @@
[
"oscfdezdz@tuta.io",
"\u00d3scar Fern\u00e1ndez D\u00edaz",
58
55
]
]
}
+177
View File
@@ -0,0 +1,177 @@
//////////////////////////////////////////////////////////////////////////////////////////
// ) ( //
// ( /( ( ( ) ( ( ( ( )\ ) ( ( //
// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( //
// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ //
// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) //
// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< //
// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ //
// |__/ //
// Copyright (c) 2021 Simon Schneegans //
// Released under the GPLv3 or later. See LICENSE file for details. //
//////////////////////////////////////////////////////////////////////////////////////////
'use strict';
//////////////////////////////////////////////////////////////////////////////////////////
// https://github.com/home-sweet-gnome/dash-to-panel/blob/master/utils.js#L669
// DominantColorExtractor is adapted from https://github.com/micheleg/dash-to-dock
//////////////////////////////////////////////////////////////////////////////////////////
let themeLoader = null;
let iconCacheMap = new Map();
const MAX_CACHED_ITEMS = 1000;
const BATCH_SIZE_TO_DELETE = 50;
const DOMINANT_COLOR_ICON_SIZE = 64;
var DominantColorExtractor = class {
constructor(app) {
this._app = app;
}
// Try to get the pixel buffer for the current icon, if not fail gracefully
_getIconPixBuf() {
let iconTexture = this._app.create_icon_texture(16);
if (themeLoader === null) {
let ifaceSettings = new Gio.Settings({schema: 'org.gnome.desktop.interface'});
themeLoader = new Gtk.IconTheme(),
themeLoader.set_custom_theme(
ifaceSettings.get_string('icon-theme')); // Make sure the correct theme is loaded
}
// Unable to load the icon texture, use fallback
if (iconTexture instanceof St.Icon === false) {
return null;
}
iconTexture = iconTexture.get_gicon();
// Unable to load the icon texture, use fallback
if (iconTexture === null) {
return null;
}
if (iconTexture instanceof Gio.FileIcon) {
// Use GdkPixBuf to load the pixel buffer from the provided file path
return GdkPixbuf.Pixbuf.new_from_file(iconTexture.get_file().get_path());
}
// Get the pixel buffer from the icon theme
if (iconTexture instanceof Gio.ThemedIcon) {
let icon_info =
themeLoader.lookup_icon(iconTexture.get_names()[0], DOMINANT_COLOR_ICON_SIZE, 0);
if (icon_info !== null) return icon_info.load_icon();
}
return null;
}
// The backlight color choosing algorithm was mostly ported to javascript from the
// Unity7 C++ source of Canonicals:
// https://bazaar.launchpad.net/~unity-team/unity/trunk/view/head:/launcher/LauncherIcon.cpp
// so it more or less works the same way.
_getColorPalette() {
if (iconCacheMap.get(this._app.get_id())) {
// We already know the answer
return iconCacheMap.get(this._app.get_id());
}
let pixBuf = this._getIconPixBuf();
if (pixBuf == null) return null;
let pixels = pixBuf.get_pixels(), offset = 0;
let total = 0, rTotal = 0, gTotal = 0, bTotal = 0;
let resample_y = 1, resample_x = 1;
// Resampling of large icons
// We resample icons larger than twice the desired size, as the resampling
// to a size s
// DOMINANT_COLOR_ICON_SIZE < s < 2*DOMINANT_COLOR_ICON_SIZE,
// most of the case exactly DOMINANT_COLOR_ICON_SIZE as the icon size is tipycally
// a multiple of it.
let width = pixBuf.get_width();
let height = pixBuf.get_height();
// Resample
if (height >= 2 * DOMINANT_COLOR_ICON_SIZE)
resample_y = Math.floor(height / DOMINANT_COLOR_ICON_SIZE);
if (width >= 2 * DOMINANT_COLOR_ICON_SIZE)
resample_x = Math.floor(width / DOMINANT_COLOR_ICON_SIZE);
if (resample_x !== 1 || resample_y !== 1)
pixels = this._resamplePixels(pixels, resample_x, resample_y);
// computing the limit outside the for (where it would be repeated at each iteration)
// for performance reasons
let limit = pixels.length;
for (let offset = 0; offset < limit; offset += 4) {
let r = pixels[offset], g = pixels[offset + 1], b = pixels[offset + 2],
a = pixels[offset + 3];
let saturation = (Math.max(r, g, b) - Math.min(r, g, b));
let relevance = 0.1 * 255 * 255 + 0.9 * a * saturation;
rTotal += r * relevance;
gTotal += g * relevance;
bTotal += b * relevance;
total += relevance;
}
total = total * 255;
let r = rTotal / total, g = gTotal / total, b = bTotal / total;
let hsv = ColorUtils.RGBtoHSV(r * 255, g * 255, b * 255);
if (hsv.s > 0.15) hsv.s = 0.65;
hsv.v = 0.90;
let rgb = ColorUtils.HSVtoRGB(hsv.h, hsv.s, hsv.v);
// Cache the result.
let backgroundColor = {
lighter: ColorUtils.colorLuminance(rgb.r, rgb.g, rgb.b, 0.2),
original: ColorUtils.colorLuminance(rgb.r, rgb.g, rgb.b, 0),
darker: ColorUtils.colorLuminance(rgb.r, rgb.g, rgb.b, -0.5)
};
if (iconCacheMap.size >= MAX_CACHED_ITEMS) {
// delete oldest cached values (which are in order of insertions)
let ctr = 0;
for (let key of iconCacheMap.keys()) {
if (++ctr > BATCH_SIZE_TO_DELETE) break;
iconCacheMap.delete(key);
}
}
iconCacheMap.set(this._app.get_id(), backgroundColor);
return backgroundColor;
}
// Downsample large icons before scanning for the backlight color to
// improve performance.
_resamplePixels(pixels, resampleX, resampleY) {
let resampledPixels = [];
// computing the limit outside the for (where it would be repeated at each iteration)
// for performance reasons
let limit = pixels.length / (resampleX * resampleY) / 4;
for (let i = 0; i < limit; i++) {
let pixel = i * resampleX * resampleY;
resampledPixels.push(pixels[pixel * 4]);
resampledPixels.push(pixels[pixel * 4 + 1]);
resampledPixels.push(pixels[pixel * 4 + 2]);
resampledPixels.push(pixels[pixel * 4 + 3]);
}
return resampledPixels;
}
};
+5 -8
View File
@@ -76,10 +76,6 @@ var Shader = GObject.registerClass(
// This is called once each time the shader is used.
beginAnimation(settings, forOpening, actor) {
// Reset progress values.
this._progress = 0;
this._time = 0;
// This is not necessarily symmetric, but I haven't figured out a way to
// get the actual values...
const padding = (actor.width - actor.meta_window.get_frame_rect().width) / 2;
@@ -93,8 +89,11 @@ var Shader = GObject.registerClass(
// This is called at each frame during the animation.
updateAnimation(progress, time) {
// Store the current time and progress values. The corresponding signal is emitted
// each frame in vfunc_paint_target.
this.set_uniform_float(this._uProgress, 1, [progress]);
this.set_uniform_float(this._uTime, 1, [time]);
// Store the current time and progress values. The corresponding signal is emitted a
// but later in vfunc_paint_target.
this._progress = progress;
this._time = time;
}
@@ -122,8 +121,6 @@ var Shader = GObject.registerClass(
// the handler. This could still be null if called from the updateAnimation() above.
vfunc_paint_target(...params) {
this.emit('update-animation', this._progress, this._time);
this.set_uniform_float(this._uProgress, 1, [this._progress]);
this.set_uniform_float(this._uTime, 1, [this._time]);
super.vfunc_paint_target(...params);
}