✨ Apply clang-format
This commit is contained in:
@@ -53,7 +53,7 @@ export default class Effect {
|
|||||||
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
|
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
|
||||||
// Create the texture in the first call.
|
// Create the texture in the first call.
|
||||||
if (!this._shardTexture) {
|
if (!this._shardTexture) {
|
||||||
this._shardTexture = utils.getImageResource('/img/shards.png');
|
this._shardTexture = utils.getImageResource('/img/shards.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store all uniform locations.
|
// Store all uniform locations.
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export default class Effect {
|
|||||||
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
|
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
|
||||||
// Create the texture in the first call.
|
// Create the texture in the first call.
|
||||||
if (!this._brushTexture) {
|
if (!this._brushTexture) {
|
||||||
this._brushTexture = utils.getImageResource('/img/brush.png', true);
|
this._brushTexture = utils.getImageResource('/img/brush.png', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store uniform locations of newly created shaders.
|
// Store uniform locations of newly created shaders.
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export default class Effect {
|
|||||||
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
|
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
|
||||||
// Create the texture in the first call.
|
// Create the texture in the first call.
|
||||||
if (!this._dustTexture) {
|
if (!this._dustTexture) {
|
||||||
this._dustTexture = utils.getImageResource('/img/dust.png');
|
this._dustTexture = utils.getImageResource('/img/dust.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store uniform locations of newly created shaders.
|
// Store uniform locations of newly created shaders.
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export default class Effect {
|
|||||||
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
|
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
|
||||||
// Create the texture in the first call.
|
// Create the texture in the first call.
|
||||||
if (!this._clawTexture) {
|
if (!this._clawTexture) {
|
||||||
this._clawTexture = utils.getImageResource('/img/claws.png');
|
this._clawTexture = utils.getImageResource('/img/claws.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store uniform locations of newly created shaders.
|
// Store uniform locations of newly created shaders.
|
||||||
|
|||||||
+10
-14
@@ -21,9 +21,9 @@ import GLib from 'gi://GLib';
|
|||||||
// as in the GNOME Shell process. Some modules are only available or required in one of
|
// as in the GNOME Shell process. Some modules are only available or required in one of
|
||||||
// these processes.
|
// these processes.
|
||||||
const GdkPixbuf = await importInShellOnly('gi://GdkPixbuf');
|
const GdkPixbuf = await importInShellOnly('gi://GdkPixbuf');
|
||||||
const Clutter = await importInShellOnly('gi://Clutter');
|
const Clutter = await importInShellOnly('gi://Clutter');
|
||||||
const Cogl = await importInShellOnly('gi://Cogl');
|
const Cogl = await importInShellOnly('gi://Cogl');
|
||||||
const St = await importInShellOnly('gi://St');
|
const St = await importInShellOnly('gi://St');
|
||||||
|
|
||||||
// We import the Config module. This is done differently in the GNOME Shell process and in
|
// We import the Config module. This is done differently in the GNOME Shell process and in
|
||||||
// the preferences process.
|
// the preferences process.
|
||||||
@@ -121,23 +121,19 @@ export function getStringResource(path) {
|
|||||||
|
|
||||||
// Reads the contents of an image file contained in the global resources archive. The data
|
// Reads the contents of an image file contained in the global resources archive. The data
|
||||||
// is returned as a St.ImageContent.
|
// is returned as a St.ImageContent.
|
||||||
export function getImageResource(path, premultiplied=false) {
|
export function getImageResource(path, premultiplied = false) {
|
||||||
const data = GdkPixbuf.Pixbuf.new_from_resource(path);
|
const data = GdkPixbuf.Pixbuf.new_from_resource(path);
|
||||||
const texture = St.ImageContent.new_with_preferred_size(data.width, data.height);
|
const texture = St.ImageContent.new_with_preferred_size(data.width, data.height);
|
||||||
const format = data.has_alpha ? (premultiplied ? Cogl.PixelFormat.RGBA_8888_PRE : Cogl.PixelFormat.RGBA_8888) : Cogl.PixelFormat.RGB_888;
|
const format = data.has_alpha ?
|
||||||
|
(premultiplied ? Cogl.PixelFormat.RGBA_8888_PRE : Cogl.PixelFormat.RGBA_8888) :
|
||||||
|
Cogl.PixelFormat.RGB_888;
|
||||||
|
|
||||||
// https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/44b84e458a22046fedb85701ea25ad08ecc0d43f
|
// https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/44b84e458a22046fedb85701ea25ad08ecc0d43f
|
||||||
if (shellVersionIsAtLeast(48, 'beta')) {
|
if (shellVersionIsAtLeast(48, 'beta')) {
|
||||||
texture.set_data(
|
texture.set_data(global.stage.context.get_backend().get_cogl_context(),
|
||||||
global.stage.context.get_backend().get_cogl_context(),
|
data.get_pixels(), format, data.width, data.height, data.rowstride);
|
||||||
data.get_pixels(),
|
|
||||||
format,
|
|
||||||
data.width, data.height, data.rowstride);
|
|
||||||
} else {
|
} else {
|
||||||
texture.set_data(
|
texture.set_data(data.get_pixels(), format, data.width, data.height, data.rowstride);
|
||||||
data.get_pixels(),
|
|
||||||
format,
|
|
||||||
data.width, data.height, data.rowstride);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
|
|||||||
Reference in New Issue
Block a user