Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package hyprgraphics for openSUSE:Factory checked in at 2026-05-10 16:47:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hyprgraphics (Old) and /work/SRC/openSUSE:Factory/.hyprgraphics.new.1966 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "hyprgraphics" Sun May 10 16:47:40 2026 rev:6 rq:1352204 version:0.5.1 Changes: -------- --- /work/SRC/openSUSE:Factory/hyprgraphics/hyprgraphics.changes 2026-01-08 15:29:08.025314224 +0100 +++ /work/SRC/openSUSE:Factory/.hyprgraphics.new.1966/hyprgraphics.changes 2026-05-10 16:48:18.768751024 +0200 @@ -1,0 +2,11 @@ +Sat May 9 14:47:23 UTC 2026 - Florian "spirit" <[email protected]> + +- Update to version 0.5.1: + + A new patch release + + Changes: + - Add missing #include + - feat: add isImageFile() static utility method + - egl: add egl formats and helpers + - Fix missing include for span + +------------------------------------------------------------------- Old: ---- hyprgraphics-0.5.0.tar.xz New: ---- hyprgraphics-0.5.1.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hyprgraphics.spec ++++++ --- /var/tmp/diff_new_pack.VA4rJ9/_old 2026-05-10 16:48:19.244770506 +0200 +++ /var/tmp/diff_new_pack.VA4rJ9/_new 2026-05-10 16:48:19.244770506 +0200 @@ -20,17 +20,20 @@ %define sover 4 Name: hyprgraphics -Version: 0.5.0 +Version: 0.5.1 Release: 0 Summary: Hyprland graphics / resource utilities License: BSD-3-Clause URL: https://github.com/hyprwm/hyprgraphics Source0: %{name}-%{version}.tar.xz +BuildRequires: Mesa-libGL-devel +BuildRequires: Mesa-libGLESv3-devel BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: pkg-config BuildRequires: pkgconfig(cairo) BuildRequires: pkgconfig(hyprutils) >= 0.8.0 +BuildRequires: pkgconfig(libdrm) BuildRequires: pkgconfig(libjpeg) BuildRequires: pkgconfig(libjxl) BuildRequires: pkgconfig(libjxl_cms) ++++++ hyprgraphics-0.5.0.tar.xz -> hyprgraphics-0.5.1.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/.github/workflows/arch.yml new/hyprgraphics-0.5.1/.github/workflows/arch.yml --- old/hyprgraphics-0.5.0/.github/workflows/arch.yml 2025-12-28 19:25:35.000000000 +0100 +++ new/hyprgraphics-0.5.1/.github/workflows/arch.yml 2026-04-06 01:14:16.000000000 +0200 @@ -17,7 +17,7 @@ run: | sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf pacman --noconfirm --noprogressbar -Syyu - pacman --noconfirm --noprogressbar -Sy gcc base-devel cmake clang libc++ pango pixman cairo hyprutils libjpeg-turbo libjxl libwebp libpng ttf-dejavu librsvg + pacman --noconfirm --noprogressbar -Sy gcc base-devel cmake clang libc++ pango pixman cairo hyprutils libdrm libglvnd libjpeg-turbo libjxl libwebp libpng ttf-dejavu librsvg - name: Build hyprgraphics with gcc run: | @@ -44,7 +44,7 @@ run: | sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf pacman --noconfirm --noprogressbar -Syyu - pacman --noconfirm --noprogressbar -Sy gcc base-devel cmake clang libc++ pango pixman cairo hyprutils libjpeg-turbo libjxl libwebp libpng ttf-dejavu librsvg + pacman --noconfirm --noprogressbar -Sy gcc base-devel cmake clang libc++ pango pixman cairo hyprutils libdrm libglvnd libjpeg-turbo libjxl libwebp libpng ttf-dejavu librsvg - name: Build hyprgraphics with clang run: | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/CMakeLists.txt new/hyprgraphics-0.5.1/CMakeLists.txt --- old/hyprgraphics-0.5.0/CMakeLists.txt 2025-12-28 19:25:35.000000000 +0100 +++ new/hyprgraphics-0.5.1/CMakeLists.txt 2026-04-06 01:14:16.000000000 +0200 @@ -47,11 +47,15 @@ file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp" "include/*.hpp") file(GLOB_RECURSE PUBLIC_HEADERS CONFIGURE_DEPENDS "include/*.hpp") +set(GLES_VERSION "GLES3") +find_package(OpenGL REQUIRED COMPONENTS ${GLES_VERSION}) + find_package(PkgConfig REQUIRED) pkg_check_modules( deps REQUIRED IMPORTED_TARGET + libdrm pixman-1 cairo pangocairo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/VERSION new/hyprgraphics-0.5.1/VERSION --- old/hyprgraphics-0.5.0/VERSION 2025-12-28 19:25:35.000000000 +0100 +++ new/hyprgraphics-0.5.1/VERSION 2026-04-06 01:14:16.000000000 +0200 @@ -1 +1 @@ -0.5.0 +0.5.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/flake.lock new/hyprgraphics-0.5.1/flake.lock --- old/hyprgraphics-0.5.0/flake.lock 2025-12-28 19:25:35.000000000 +0100 +++ new/hyprgraphics-0.5.1/flake.lock 2026-04-06 01:14:16.000000000 +0200 @@ -10,11 +10,11 @@ ] }, "locked": { - "lastModified": 1756117388, - "narHash": "sha256-oRDel6pNl/T2tI+nc/USU9ZP9w08dxtl7hiZxa0C/Wc=", + "lastModified": 1772459870, + "narHash": "sha256-xxkK2Cvqxpf/4UGcJ/TyCwrvmiNWsKsJfFzHMp2bxis=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "b2ae3204845f5f2f79b4703b441252d8ad2ecfd0", + "rev": "e63f3a79334dec49f8eb1691f66f18115df04085", "type": "github" }, "original": { @@ -25,11 +25,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1757745802, - "narHash": "sha256-hLEO2TPj55KcUFUU1vgtHE9UEIOjRcH/4QbmfHNF820=", + "lastModified": 1772198003, + "narHash": "sha256-I45esRSssFtJ8p/gLHUZ1OUaaTaVLluNkABkk6arQwE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c23193b943c6c689d70ee98ce3128239ed9e32d1", + "rev": "dd9b079222d43e1943b6ebd802f04fd959dc8e61", "type": "github" }, "original": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/flake.nix new/hyprgraphics-0.5.1/flake.nix --- old/hyprgraphics-0.5.0/flake.nix 2025-12-28 19:25:35.000000000 +0100 +++ new/hyprgraphics-0.5.1/flake.nix 2026-04-06 01:14:16.000000000 +0200 @@ -12,46 +12,32 @@ }; }; - outputs = { - self, - nixpkgs, - systems, - ... - } @ inputs: let - inherit (nixpkgs) lib; - eachSystem = lib.genAttrs (import systems); - pkgsFor = eachSystem (system: - import nixpkgs { - localSystem.system = system; - overlays = with self.overlays; [hyprgraphics]; + outputs = + { + self, + nixpkgs, + systems, + ... + }@inputs: + let + inherit (nixpkgs) lib; + eachSystem = lib.genAttrs (import systems); + pkgsFor = eachSystem ( + system: + import nixpkgs { + localSystem.system = system; + overlays = with self.overlays; [ hyprgraphics-with-deps ]; + } + ); + in + { + overlays = import ./nix/overlays.nix { inherit inputs lib self; }; + + packages = eachSystem (system: { + default = self.packages.${system}.hyprgraphics; + inherit (pkgsFor.${system}) hyprgraphics hyprgraphics-with-tests; }); - mkDate = longDate: (lib.concatStringsSep "-" [ - (builtins.substring 0 4 longDate) - (builtins.substring 4 2 longDate) - (builtins.substring 6 2 longDate) - ]); - version = lib.removeSuffix "\n" (builtins.readFile ./VERSION); - in { - overlays = { - default = self.overlays.hyprgraphics; - hyprgraphics = lib.composeManyExtensions [ - inputs.hyprutils.overlays.default - (final: prev: { - hyprgraphics = final.callPackage ./nix/default.nix { - stdenv = final.gcc15Stdenv; - version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); - }; - hyprgraphics-with-tests = final.hyprgraphics.override {doCheck = true;}; - }) - ]; + formatter = eachSystem (system: pkgsFor.${system}.nixfmt-tree); }; - - packages = eachSystem (system: { - default = self.packages.${system}.hyprgraphics; - inherit (pkgsFor.${system}) hyprgraphics hyprgraphics-with-tests; - }); - - formatter = eachSystem (system: pkgsFor.${system}.alejandra); - }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/include/hyprgraphics/egl/Egl.hpp new/hyprgraphics-0.5.1/include/hyprgraphics/egl/Egl.hpp --- old/hyprgraphics-0.5.0/include/hyprgraphics/egl/Egl.hpp 1970-01-01 01:00:00.000000000 +0100 +++ new/hyprgraphics-0.5.1/include/hyprgraphics/egl/Egl.hpp 2026-04-06 01:14:16.000000000 +0200 @@ -0,0 +1,47 @@ +#pragma once + +#include <array> +#include <cstdint> +#include <GLES3/gl32.h> +#include <optional> +#include <hyprutils/math/Vector2D.hpp> + +namespace Hyprgraphics::Egl { + inline constexpr std::array<GLint, 4> SWIZZLE_A1GB{GL_ALPHA, GL_ONE, GL_GREEN, GL_BLUE}; + inline constexpr std::array<GLint, 4> SWIZZLE_ABG1{GL_ALPHA, GL_BLUE, GL_GREEN, GL_ONE}; + inline constexpr std::array<GLint, 4> SWIZZLE_ABGR{GL_ALPHA, GL_BLUE, GL_GREEN, GL_RED}; + inline constexpr std::array<GLint, 4> SWIZZLE_ARGB{GL_ALPHA, GL_RED, GL_GREEN, GL_BLUE}; + inline constexpr std::array<GLint, 4> SWIZZLE_B1RG{GL_BLUE, GL_ONE, GL_RED, GL_GREEN}; + inline constexpr std::array<GLint, 4> SWIZZLE_BARG{GL_BLUE, GL_ALPHA, GL_RED, GL_GREEN}; + inline constexpr std::array<GLint, 4> SWIZZLE_BGR1{GL_BLUE, GL_GREEN, GL_RED, GL_ONE}; + inline constexpr std::array<GLint, 4> SWIZZLE_BGRA{GL_BLUE, GL_GREEN, GL_RED, GL_ALPHA}; + inline constexpr std::array<GLint, 4> SWIZZLE_G1AB{GL_GREEN, GL_ONE, GL_ALPHA, GL_BLUE}; + inline constexpr std::array<GLint, 4> SWIZZLE_GBA1{GL_GREEN, GL_BLUE, GL_ALPHA, GL_ONE}; + inline constexpr std::array<GLint, 4> SWIZZLE_GBAR{GL_GREEN, GL_BLUE, GL_ALPHA, GL_RED}; + inline constexpr std::array<GLint, 4> SWIZZLE_GRAB{GL_GREEN, GL_RED, GL_ALPHA, GL_BLUE}; + inline constexpr std::array<GLint, 4> SWIZZLE_R001{GL_RED, GL_ZERO, GL_ZERO, GL_ONE}; + inline constexpr std::array<GLint, 4> SWIZZLE_R1BG{GL_RED, GL_ONE, GL_BLUE, GL_GREEN}; + inline constexpr std::array<GLint, 4> SWIZZLE_RABG{GL_RED, GL_ALPHA, GL_BLUE, GL_GREEN}; + inline constexpr std::array<GLint, 4> SWIZZLE_RG01{GL_RED, GL_GREEN, GL_ZERO, GL_ONE}; + inline constexpr std::array<GLint, 4> SWIZZLE_GR01{GL_GREEN, GL_RED, GL_ZERO, GL_ONE}; + inline constexpr std::array<GLint, 4> SWIZZLE_RGB1{GL_RED, GL_GREEN, GL_BLUE, GL_ONE}; + inline constexpr std::array<GLint, 4> SWIZZLE_RGBA{GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA}; + + struct SPixelFormat { + uint32_t drmFormat = 0; /* DRM_FORMAT_INVALID */ + int glInternalFormat = 0; + int glFormat = 0; + int glType = 0; + bool withAlpha = true; + uint32_t alphaStripped = 0; /* DRM_FORMAT_INVALID */ + uint32_t bytesPerBlock = 0; + Hyprutils::Math::Vector2D blockSize; + std::optional<std::array<GLint, 4>> swizzle = std::nullopt; + }; + + const SPixelFormat* getPixelFormatFromDRM(uint32_t drmFormat); + const SPixelFormat* getPixelFormatFromGL(uint32_t glFormat, uint32_t glType, bool alpha); + bool isDrmFormatOpaque(uint32_t drmFormat); + int pixelsPerBlock(const SPixelFormat* const fmt); + int minStride(const SPixelFormat* const fmt, int32_t width); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/include/hyprgraphics/image/Image.hpp new/hyprgraphics-0.5.1/include/hyprgraphics/image/Image.hpp --- old/hyprgraphics-0.5.0/include/hyprgraphics/image/Image.hpp 2025-12-28 19:25:35.000000000 +0100 +++ new/hyprgraphics-0.5.1/include/hyprgraphics/image/Image.hpp 2026-04-06 01:14:16.000000000 +0200 @@ -37,6 +37,8 @@ Hyprutils::Memory::CSharedPointer<CCairoSurface> cairoSurface(); + static bool isImageFile(const std::string& path); + private: std::string lastError, filepath, mime; Hyprutils::Math::Vector2D m_svgSize; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/include/hyprgraphics/resource/resources/ImageResource.hpp new/hyprgraphics-0.5.1/include/hyprgraphics/resource/resources/ImageResource.hpp --- old/hyprgraphics-0.5.0/include/hyprgraphics/resource/resources/ImageResource.hpp 2025-12-28 19:25:35.000000000 +0100 +++ new/hyprgraphics-0.5.1/include/hyprgraphics/resource/resources/ImageResource.hpp 2026-04-06 01:14:16.000000000 +0200 @@ -1,11 +1,13 @@ #pragma once #include <string> +#include <span> #include <hyprutils/math/Vector2D.hpp> #include "./AsyncResource.hpp" #include "../../color/Color.hpp" #include <optional> +#include <span> namespace Hyprgraphics { class CImageResource : public IAsyncResource { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/include/hyprgraphics/resource/resources/StaticImageResource.hpp new/hyprgraphics-0.5.1/include/hyprgraphics/resource/resources/StaticImageResource.hpp --- old/hyprgraphics-0.5.0/include/hyprgraphics/resource/resources/StaticImageResource.hpp 2025-12-28 19:25:35.000000000 +0100 +++ new/hyprgraphics-0.5.1/include/hyprgraphics/resource/resources/StaticImageResource.hpp 2026-04-06 01:14:16.000000000 +0200 @@ -5,6 +5,7 @@ #include "hyprgraphics/image/Image.hpp" #include <optional> +#include <span> #include <hyprutils/math/Vector2D.hpp> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/nix/default.nix new/hyprgraphics-0.5.1/nix/default.nix --- old/hyprgraphics-0.5.0/nix/default.nix 2025-12-28 19:25:35.000000000 +0100 +++ new/hyprgraphics-0.5.1/nix/default.nix 2026-04-06 01:14:16.000000000 +0200 @@ -7,6 +7,8 @@ cairo, file, hyprutils, + libGL, + libdrm, libheif, libjpeg, libjxl, @@ -18,7 +20,8 @@ version ? "git", doCheck ? false, debug ? false, -}: let +}: +let inherit (builtins) foldl'; inherit (lib.lists) flatten; inherit (lib.sources) cleanSource cleanSourceWith; @@ -31,48 +34,52 @@ customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters; in - customStdenv.mkDerivation { - pname = "hyprgraphics"; - inherit version doCheck; - - src = cleanSourceWith { - filter = name: _type: let +customStdenv.mkDerivation { + pname = "hyprgraphics"; + inherit version doCheck; + + src = cleanSourceWith { + filter = + name: _type: + let baseName = baseNameOf (toString name); in - ! (hasSuffix ".nix" baseName); - src = cleanSource ../.; - }; - - nativeBuildInputs = [ - cmake - pkg-config - ]; - - buildInputs = [ - cairo - file - hyprutils - libheif - libjpeg - libjxl - librsvg - libspng - libwebp - pango - pixman - ]; - - outputs = ["out" "dev"]; - - cmakeBuildType = - if debug - then "Debug" - else "RelWithDebInfo"; - - meta = with lib; { - homepage = "https://github.com/hyprwm/hyprgraphics"; - description = "Small C++ library with graphics / resource related utilities used across the hypr* ecosystem"; - license = licenses.bsd3; - platforms = platforms.linux; - }; - } + !(hasSuffix ".nix" baseName); + src = cleanSource ../.; + }; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + buildInputs = [ + cairo + file + hyprutils + libGL + libdrm + libheif + libjpeg + libjxl + librsvg + libspng + libwebp + pango + pixman + ]; + + outputs = [ + "out" + "dev" + ]; + + cmakeBuildType = if debug then "Debug" else "RelWithDebInfo"; + + meta = with lib; { + homepage = "https://github.com/hyprwm/hyprgraphics"; + description = "Small C++ library with graphics / resource related utilities used across the hypr* ecosystem"; + license = licenses.bsd3; + platforms = platforms.linux; + }; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/nix/overlays.nix new/hyprgraphics-0.5.1/nix/overlays.nix --- old/hyprgraphics-0.5.0/nix/overlays.nix 1970-01-01 01:00:00.000000000 +0100 +++ new/hyprgraphics-0.5.1/nix/overlays.nix 2026-04-06 01:14:16.000000000 +0200 @@ -0,0 +1,39 @@ +{ + lib, + self, + inputs, + ... +}: +let + + mkDate = + longDate: + (lib.concatStringsSep "-" [ + (builtins.substring 0 4 longDate) + (builtins.substring 4 2 longDate) + (builtins.substring 6 2 longDate) + ]); + + version = lib.removeSuffix "\n" (builtins.readFile ../VERSION); +in +{ + default = self.overlays.hyprgraphics; + + hyprgraphics-with-deps = lib.composeManyExtensions [ + inputs.hyprutils.overlays.default + self.overlays.hyprgraphics + ]; + + hyprgraphics = final: prev: { + hyprgraphics = final.callPackage ./default.nix { + stdenv = final.gcc15Stdenv; + version = + version + + "+date=" + + (mkDate (self.lastModifiedDate or "19700101")) + + "_" + + (self.shortRev or "dirty"); + }; + hyprgraphics-with-tests = final.hyprgraphics.override { doCheck = true; }; + }; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/src/egl/Egl.cpp new/hyprgraphics-0.5.1/src/egl/Egl.cpp --- old/hyprgraphics-0.5.0/src/egl/Egl.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/hyprgraphics-0.5.1/src/egl/Egl.cpp 2026-04-06 01:14:16.000000000 +0200 @@ -0,0 +1,262 @@ +#include <cmath> +#include <hyprgraphics/egl/Egl.hpp> +#include <hyprutils/memory/Casts.hpp> +#include <vector> +#include <GLES3/gl32.h> +#include <xf86drm.h> +#include <drm_fourcc.h> + +using namespace Hyprutils::Memory; + +namespace Hyprgraphics::Egl { + static inline const std::vector<SPixelFormat> GLES3_FORMATS = { + { + .drmFormat = DRM_FORMAT_ARGB8888, + .glInternalFormat = GL_RGBA8, + .glFormat = GL_RGBA, + .glType = GL_UNSIGNED_BYTE, + .withAlpha = true, + .alphaStripped = DRM_FORMAT_XRGB8888, + .bytesPerBlock = 4, + .swizzle = {SWIZZLE_BGRA}, + }, + { + .drmFormat = DRM_FORMAT_XRGB8888, + .glInternalFormat = GL_RGBA8, + .glFormat = GL_RGBA, + .glType = GL_UNSIGNED_BYTE, + .withAlpha = false, + .alphaStripped = DRM_FORMAT_XRGB8888, + .bytesPerBlock = 4, + .swizzle = {SWIZZLE_BGR1}, + }, + { + .drmFormat = DRM_FORMAT_XBGR8888, + .glInternalFormat = GL_RGBA8, + .glFormat = GL_RGBA, + .glType = GL_UNSIGNED_BYTE, + .withAlpha = false, + .alphaStripped = DRM_FORMAT_XBGR8888, + .bytesPerBlock = 4, + .swizzle = {SWIZZLE_RGB1}, + }, + { + .drmFormat = DRM_FORMAT_ABGR8888, + .glInternalFormat = GL_RGBA8, + .glFormat = GL_RGBA, + .glType = GL_UNSIGNED_BYTE, + .withAlpha = true, + .alphaStripped = DRM_FORMAT_XBGR8888, + .bytesPerBlock = 4, + .swizzle = {SWIZZLE_RGBA}, + }, + { + .drmFormat = DRM_FORMAT_BGR888, + .glInternalFormat = GL_RGB8, + .glFormat = GL_RGB, + .glType = GL_UNSIGNED_BYTE, + .withAlpha = false, + .alphaStripped = DRM_FORMAT_BGR888, + .bytesPerBlock = 3, + .swizzle = {SWIZZLE_RGB1}, + }, + { + .drmFormat = DRM_FORMAT_RGBX4444, + .glInternalFormat = GL_RGBA4, + .glFormat = GL_RGBA, + .glType = GL_UNSIGNED_SHORT_4_4_4_4, + .withAlpha = false, + .alphaStripped = DRM_FORMAT_RGBX4444, + .bytesPerBlock = 2, + .swizzle = {SWIZZLE_RGB1}, + }, + { + .drmFormat = DRM_FORMAT_RGBA4444, + .glInternalFormat = GL_RGBA4, + .glFormat = GL_RGBA, + .glType = GL_UNSIGNED_SHORT_4_4_4_4, + .withAlpha = true, + .alphaStripped = DRM_FORMAT_RGBX4444, + .bytesPerBlock = 2, + .swizzle = {SWIZZLE_RGBA}, + }, + { + .drmFormat = DRM_FORMAT_RGBX5551, + .glInternalFormat = GL_RGB5_A1, + .glFormat = GL_RGBA, + .glType = GL_UNSIGNED_SHORT_5_5_5_1, + .withAlpha = false, + .alphaStripped = DRM_FORMAT_RGBX5551, + .bytesPerBlock = 2, + .swizzle = {SWIZZLE_RGB1}, + }, + { + .drmFormat = DRM_FORMAT_RGBA5551, + .glInternalFormat = GL_RGB5_A1, + .glFormat = GL_RGBA, + .glType = GL_UNSIGNED_SHORT_5_5_5_1, + .withAlpha = true, + .alphaStripped = DRM_FORMAT_RGBX5551, + .bytesPerBlock = 2, + .swizzle = {SWIZZLE_RGBA}, + }, + { + .drmFormat = DRM_FORMAT_RGB565, + .glInternalFormat = GL_RGB565, + .glFormat = GL_RGB, + .glType = GL_UNSIGNED_SHORT_5_6_5, + .withAlpha = false, + .alphaStripped = DRM_FORMAT_RGB565, + .bytesPerBlock = 2, + .swizzle = {SWIZZLE_RGB1}, + }, + { + .drmFormat = DRM_FORMAT_XBGR2101010, + .glInternalFormat = GL_RGB10_A2, + .glFormat = GL_RGBA, + .glType = GL_UNSIGNED_INT_2_10_10_10_REV, + .withAlpha = false, + .alphaStripped = DRM_FORMAT_XBGR2101010, + .bytesPerBlock = 4, + .swizzle = {SWIZZLE_RGB1}, + }, + { + .drmFormat = DRM_FORMAT_ABGR2101010, + .glInternalFormat = GL_RGB10_A2, + .glFormat = GL_RGBA, + .glType = GL_UNSIGNED_INT_2_10_10_10_REV, + .withAlpha = true, + .alphaStripped = DRM_FORMAT_XBGR2101010, + .bytesPerBlock = 4, + .swizzle = {SWIZZLE_RGBA}, + }, + { + .drmFormat = DRM_FORMAT_XRGB2101010, + .glInternalFormat = GL_RGB10_A2, + .glFormat = GL_RGBA, + .glType = GL_UNSIGNED_INT_2_10_10_10_REV, + .withAlpha = false, + .alphaStripped = DRM_FORMAT_XRGB2101010, + .bytesPerBlock = 4, + .swizzle = {SWIZZLE_BGR1}, + }, + { + .drmFormat = DRM_FORMAT_ARGB2101010, + .glInternalFormat = GL_RGB10_A2, + .glFormat = GL_RGBA, + .glType = GL_UNSIGNED_INT_2_10_10_10_REV, + .withAlpha = true, + .alphaStripped = DRM_FORMAT_XRGB2101010, + .bytesPerBlock = 4, + .swizzle = {SWIZZLE_BGRA}, + }, + { + .drmFormat = DRM_FORMAT_XBGR16161616F, + .glInternalFormat = GL_RGBA16F, + .glFormat = GL_RGBA, + .glType = GL_HALF_FLOAT, + .withAlpha = false, + .alphaStripped = DRM_FORMAT_XBGR16161616F, + .bytesPerBlock = 8, + .swizzle = {SWIZZLE_RGB1}, + }, + { + .drmFormat = DRM_FORMAT_ABGR16161616F, + .glInternalFormat = GL_RGBA16F, + .glFormat = GL_RGBA, + .glType = GL_HALF_FLOAT, + .withAlpha = true, + .alphaStripped = DRM_FORMAT_XBGR16161616F, + .bytesPerBlock = 8, + .swizzle = {SWIZZLE_RGBA}, + }, + { + .drmFormat = DRM_FORMAT_XBGR16161616, + .glInternalFormat = GL_RGBA16UI, + .glFormat = GL_RGBA_INTEGER, + .glType = GL_UNSIGNED_SHORT, + .withAlpha = false, + .alphaStripped = DRM_FORMAT_XBGR16161616, + .bytesPerBlock = 8, + .swizzle = {SWIZZLE_RGBA}, + }, + { + .drmFormat = DRM_FORMAT_ABGR16161616, + .glInternalFormat = GL_RGBA16UI, + .glFormat = GL_RGBA_INTEGER, + .glType = GL_UNSIGNED_SHORT, + .withAlpha = true, + .alphaStripped = DRM_FORMAT_XBGR16161616, + .bytesPerBlock = 8, + .swizzle = {SWIZZLE_RGBA}, + }, + { + .drmFormat = DRM_FORMAT_YVYU, + .bytesPerBlock = 4, + .blockSize = {2, 1}, + }, + { + .drmFormat = DRM_FORMAT_VYUY, + .bytesPerBlock = 4, + .blockSize = {2, 1}, + }, + { + .drmFormat = DRM_FORMAT_R8, + .glInternalFormat = GL_R8, + .glFormat = GL_RED, + .glType = GL_UNSIGNED_BYTE, + .bytesPerBlock = 1, + .swizzle = {SWIZZLE_R001}, + }, + { + .drmFormat = DRM_FORMAT_GR88, + .glInternalFormat = GL_RG8, + .glFormat = GL_RG, + .glType = GL_UNSIGNED_BYTE, + .bytesPerBlock = 2, + .swizzle = {SWIZZLE_RG01}, + }, + { + .drmFormat = DRM_FORMAT_RGB888, + .glInternalFormat = GL_RGB8, + .glFormat = GL_RGB, + .glType = GL_UNSIGNED_BYTE, + .bytesPerBlock = 3, + .swizzle = {SWIZZLE_BGR1}, + }, + }; + + const SPixelFormat* getPixelFormatFromDRM(uint32_t drmFormat) { + for (auto const& fmt : GLES3_FORMATS) { + if (fmt.drmFormat == drmFormat) + return &fmt; + } + + return nullptr; + } + + const SPixelFormat* getPixelFormatFromGL(uint32_t glFormat, uint32_t glType, bool alpha) { + for (auto const& fmt : GLES3_FORMATS) { + if (fmt.glFormat == sc<int>(glFormat) && fmt.glType == sc<int>(glType) && fmt.withAlpha == alpha) + return &fmt; + } + + return nullptr; + } + + bool isDrmFormatOpaque(uint32_t drmFormat) { + const auto FMT = getPixelFormatFromDRM(drmFormat); + if (!FMT) + return false; + + return !FMT->withAlpha; + } + + int pixelsPerBlock(const SPixelFormat* const fmt) { + return fmt->blockSize.x * fmt->blockSize.y > 0 ? fmt->blockSize.x * fmt->blockSize.y : 1; + } + + int minStride(const SPixelFormat* const fmt, int32_t width) { + return std::ceil((width * fmt->bytesPerBlock) / pixelsPerBlock(fmt)); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/src/image/Image.cpp new/hyprgraphics-0.5.1/src/image/Image.cpp --- old/hyprgraphics-0.5.0/src/image/Image.cpp 2025-12-28 19:25:35.000000000 +0100 +++ new/hyprgraphics-0.5.1/src/image/Image.cpp 2026-04-06 01:14:16.000000000 +0200 @@ -123,3 +123,7 @@ std::string Hyprgraphics::CImage::getMime() { return mime; } + +bool Hyprgraphics::CImage::isImageFile(const std::string& path) { + return formatFromFile(path) != IMAGE_FORMAT_ERROR; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprgraphics-0.5.0/src/image/formats/Svg.hpp new/hyprgraphics-0.5.1/src/image/formats/Svg.hpp --- old/hyprgraphics-0.5.0/src/image/formats/Svg.hpp 2025-12-28 19:25:35.000000000 +0100 +++ new/hyprgraphics-0.5.1/src/image/formats/Svg.hpp 2026-04-06 01:14:16.000000000 +0200 @@ -3,6 +3,7 @@ #include <cairo/cairo.h> #include <string> #include <expected> +#include <span> #include <png.h> #include <hyprutils/math/Vector2D.hpp>
