fixes
This commit is contained in:
1 parent
b936f85ded
commit
552d65bd5a
10 files changed
+341
-5
No files matched your search
@@ -0,0 +1,137 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 8921996..64ae5ee 100755
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -80,7 +80,6 @@ find_package(Wayland REQUIRED COMPONENTS Client)
|
||||
find_package(PlasmaWaylandProtocols REQUIRED)
|
||||
find_package(LayerShellQt REQUIRED)
|
||||
find_package(KPipeWire)
|
||||
-find_package(OpenCV REQUIRED core imgproc)
|
||||
|
||||
set_package_properties(KPipeWire PROPERTIES DESCRIPTION
|
||||
"Used to record pipewire streams into a file"
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 66fda75..2565192 100755
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -89,11 +89,6 @@ ki18n_wrap_ui(spectacle
|
||||
Gui/SettingsDialog/VideoSaveOptions.ui
|
||||
)
|
||||
|
||||
-# Needed to compile with OpenCV
|
||||
-target_compile_options (spectacle PRIVATE -fexceptions)
|
||||
-
|
||||
-target_include_directories(spectacle PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ${OpenCV_INCLUDE_DIRS})
|
||||
-
|
||||
target_link_libraries(spectacle PRIVATE
|
||||
Qt::Concurrent
|
||||
Qt::DBus
|
||||
@@ -121,7 +116,6 @@ target_link_libraries(spectacle PRIVATE
|
||||
K::KPipeWireRecord
|
||||
Wayland::Client
|
||||
LayerShellQt::Interface
|
||||
- ${OpenCV_LIBRARIES}
|
||||
)
|
||||
|
||||
set_source_files_properties(Gui/QmlUtils.qml PROPERTIES
|
||||
diff --git a/src/QtCV.h b/src/QtCV.h
|
||||
deleted file mode 100755
|
||||
index 2b87599..0000000
|
||||
--- a/src/QtCV.h
|
||||
+++ /dev/null
|
||||
@@ -1,95 +0,0 @@
|
||||
-/* SPDX-FileCopyrightText: 2024 Noah Davis <noahadvs@gmail.com>
|
||||
- * SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
- */
|
||||
-
|
||||
-#pragma once
|
||||
-
|
||||
-#include <QImage>
|
||||
-#include <opencv2/opencv.hpp>
|
||||
-
|
||||
-/**
|
||||
- * Convenience functions for using OpenCV with Qt APIs.
|
||||
- */
|
||||
-namespace QtCV
|
||||
-{
|
||||
-static constexpr int INVALID_MAT_TYPE = -1;
|
||||
-static_assert(CV_8U == 0);
|
||||
-static_assert(std::same_as<decltype(CV_8U), int>);
|
||||
-
|
||||
-inline constexpr int matType(QPixelFormat::TypeInterpretation typeInterpretation)
|
||||
-{
|
||||
- switch (typeInterpretation) {
|
||||
- case QPixelFormat::UnsignedByte:
|
||||
- return CV_8U;
|
||||
- case QPixelFormat::UnsignedShort:
|
||||
- return CV_16U;
|
||||
- case QPixelFormat::FloatingPoint:
|
||||
- return CV_32F;
|
||||
- default:
|
||||
- return INVALID_MAT_TYPE;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-inline constexpr int matType(QPixelFormat pixelFormat)
|
||||
-{
|
||||
- const auto baseType = matType(pixelFormat.typeInterpretation());
|
||||
- if (baseType == INVALID_MAT_TYPE) {
|
||||
- return INVALID_MAT_TYPE;
|
||||
- }
|
||||
- return CV_MAKETYPE(baseType, pixelFormat.channelCount());
|
||||
-}
|
||||
-
|
||||
-// Get a cv::Mat that reuses the data of a QImage.
|
||||
-// Use cv::Mat::clone() if the owner of the data might be destroyed before you're done using it.
|
||||
-// Expects an image with the right format. If the image has an ARGB32 format (premultiplied or not),
|
||||
-// it needs to be converted to BGRA. RGBX8888 and RGBA8888 formats shouldn't need to be converted.
|
||||
-inline cv::Mat qImageToMat(QImage &image)
|
||||
-{
|
||||
- const auto type = matType(image.pixelFormat());
|
||||
- if (type == INVALID_MAT_TYPE) {
|
||||
- return {};
|
||||
- }
|
||||
- // Use the constructor with cv::Size as the first arg to avoid type ambiguity in the args.
|
||||
- return cv::Mat(cv::Size{image.width(), image.height()}, type, image.bits(), image.bytesPerLine());
|
||||
-}
|
||||
-
|
||||
-// Same as qImageToMat, but with cv::Ptr (subclass of std::shared_ptr).
|
||||
-inline cv::Ptr<cv::Mat> qImageToMatPtr(QImage &image)
|
||||
-{
|
||||
- const auto type = matType(image.pixelFormat());
|
||||
- if (type == INVALID_MAT_TYPE) {
|
||||
- return nullptr;
|
||||
- }
|
||||
- return cv::makePtr<cv::Mat>(cv::Size{image.width(), image.height()}, type, image.bits(), image.bytesPerLine());
|
||||
-}
|
||||
-
|
||||
-// For use with filters that require odd kernel dimensions.
|
||||
-template<typename Number>
|
||||
-inline auto sigmaToKSize(Number value)
|
||||
-{
|
||||
- return cvRound(value + 1) | 1;
|
||||
-}
|
||||
-
|
||||
-// Stack blur looks like Gaussian blur, but doesn't become as slow with larger kernel sizes.
|
||||
-// Stack blur is unavailable in OpenCV versions before 4.7.
|
||||
-// We need this because of the FreeBSD 14 CI pipeline. FreeBSD 14 is only on OpenCV 4.6.
|
||||
-inline void stackOrGaussianBlurCompatibility(cv::InputArray &in, cv::OutputArray &out, cv::Size ksize, double sigmaX, double sigmaY = 0, [[maybe_unused]] int borderType = cv::BORDER_DEFAULT)
|
||||
-{
|
||||
-#if CV_MAJOR_VERSION > 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION >= 7)
|
||||
- // Replicate the behavior of cv::GaussianBlur with automatic kernel size.
|
||||
- const auto gaussianKSizeFactor = (in.depth() == CV_8U ? 3 : 4) * 2;
|
||||
- if( ksize.width <= 0 && sigmaX > 0 ) {
|
||||
- ksize.width = sigmaToKSize(sigmaX * gaussianKSizeFactor);
|
||||
- }
|
||||
- if( ksize.height <= 0 && sigmaY > 0 ) {
|
||||
- ksize.height = sigmaToKSize(sigmaY * gaussianKSizeFactor);
|
||||
- }
|
||||
- cv::stackBlur(in, out, ksize);
|
||||
-#else
|
||||
- cv::GaussianBlur(in, out, ksize, sigmaX, sigmaY, borderType);
|
||||
-#endif
|
||||
-}
|
||||
-}
|
||||
-
|
||||
-
|
||||
-
|
||||
@@ -0,0 +1,86 @@
|
||||
diff --git a/src/Gui/Annotations/EffectUtils.cpp b/src/Gui/Annotations/EffectUtils.cpp
|
||||
index 7d505a5..674a24f 100755
|
||||
--- a/src/Gui/Annotations/EffectUtils.cpp
|
||||
+++ b/src/Gui/Annotations/EffectUtils.cpp
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include "EffectUtils.h"
|
||||
-#include "QtCV.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
@@ -147,11 +146,8 @@ QImage shapeShadow(const Traits::OptTuple &traits, qreal devicePixelRatio)
|
||||
p.drawText(geometryTrait->path.boundingRect(), textTrait->textFlags(), textTrait->text());
|
||||
}
|
||||
p.end();
|
||||
- auto mat = QtCV::qImageToMat(shadow);
|
||||
const qreal sigma = Traits::Shadow::radius * devicePixelRatio;
|
||||
- const int ksize = QtCV::sigmaToKSize(sigma);
|
||||
// Do this before converting to Alpha8 because stackBlur gets distorted with Alpha8.
|
||||
- QtCV::stackOrGaussianBlurCompatibility(mat, mat, {ksize, ksize}, sigma, sigma);
|
||||
// We only want black shadows with opacity, so we only need black and 8 bits of alpha.
|
||||
// If we don't do this, color emojis won't have black semi-transparent shadows.
|
||||
shadow.convertTo(QImage::Format_Alpha8);
|
||||
diff --git a/src/Gui/Annotations/Traits.cpp b/src/Gui/Annotations/Traits.cpp
|
||||
index 396d341..807dbc1 100755
|
||||
--- a/src/Gui/Annotations/Traits.cpp
|
||||
+++ b/src/Gui/Annotations/Traits.cpp
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "Traits.h"
|
||||
#include "Geometry.h"
|
||||
-#include "QtCV.h"
|
||||
#include "settings.h"
|
||||
#include <QLocale>
|
||||
#include <QUuid>
|
||||
@@ -87,7 +86,6 @@ QImage Traits::ImageEffects::Blur::image(const std::function<QImage()> &getImage
|
||||
}
|
||||
// RGBA is better for use with OpenCV
|
||||
m_backingStoreCache.convertTo(QImage::Format_RGBA8888_Premultiplied);
|
||||
- auto mat = QtCV::qImageToMat(m_backingStoreCache);
|
||||
// Below this, the effect is nearly invisible.
|
||||
static const qreal min = 0.5;
|
||||
// Above this, glitches with color splotches happen.
|
||||
@@ -96,7 +94,6 @@ QImage Traits::ImageEffects::Blur::image(const std::function<QImage()> &getImage
|
||||
const qreal dynamicMin = 1 * dpr;
|
||||
const qreal dynamicMax = 16 * dpr;
|
||||
const qreal sigma = std::clamp(m_strength * (dynamicMax - dynamicMin) + dynamicMin, min, max);
|
||||
- QtCV::stackOrGaussianBlurCompatibility(mat, mat, {}, sigma, sigma);
|
||||
m_backingStoreCache.setDevicePixelRatio(dpr);
|
||||
m_backingStoreCache.setText(strengthKey, strengthString(m_strength));
|
||||
}
|
||||
diff --git a/src/Platforms/ImagePlatformKWin.cpp b/src/Platforms/ImagePlatformKWin.cpp
|
||||
index 237130c..69fd9d2 100755
|
||||
--- a/src/Platforms/ImagePlatformKWin.cpp
|
||||
+++ b/src/Platforms/ImagePlatformKWin.cpp
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "ImagePlatformKWin.h"
|
||||
#include "ExportManager.h"
|
||||
#include "Geometry.h"
|
||||
-#include "QtCV.h"
|
||||
#include "DebugUtils.h"
|
||||
#include "ImageMetaData.h"
|
||||
|
||||
@@ -107,21 +106,6 @@ QImage combinedImage(const QList<QImage> &images)
|
||||
// Not sure what to do if we end up having different formats for different screens.
|
||||
QImage finalImage{imageRect.size().toSize() * finalDpr, finalFormat};
|
||||
finalImage.fill(Qt::transparent);
|
||||
- auto mainMat = QtCV::qImageToMat(finalImage);
|
||||
- for (auto &image : images) {
|
||||
- auto rgbaImage = image.format() == finalImage.format() ? image : image.convertedTo(finalFormat);
|
||||
- const auto mat = QtCV::qImageToMat(rgbaImage);
|
||||
- // Region Of Interest to put the image in the main image.
|
||||
- const auto pos = ImageMetaData::logicalXY(rgbaImage) * finalDpr;
|
||||
- const auto size = rgbaImage.deviceIndependentSize() * finalDpr;
|
||||
- // Truncate to ints instead of rounding to prevent ROI from going out of bounds.
|
||||
- const cv::Rect rect(pos.x(), pos.y(), size.width(), size.height());
|
||||
- const auto imageDpr = image.devicePixelRatio();
|
||||
- const bool hasIntDpr = static_cast<int>(imageDpr) == imageDpr;
|
||||
- const auto interpolation = hasIntDpr ? cv::INTER_AREA : cv::INTER_LANCZOS4;
|
||||
- // Will just copy if there's no difference in size
|
||||
- cv::resize(mat, mainMat(rect), rect.size(), 0, 0, interpolation);
|
||||
- }
|
||||
finalImage.setDevicePixelRatio(finalDpr);
|
||||
ImageMetaData::setSubGeometryList(finalImage, geometryList);
|
||||
return finalImage;
|
||||
@@ -0,0 +1,30 @@
|
||||
From 7f0a1cc0e8afb1589fb6f37e17a80c824f17a52f Mon Sep 17 00:00:00 2001
|
||||
From: Harald Sitter <sitter@kde.org>
|
||||
Date: Tue, 15 Oct 2024 10:13:51 +0200
|
||||
Subject: [PATCH] work around bugged qmlcachegen
|
||||
|
||||
BUG: 494281
|
||||
---
|
||||
CMakeLists.txt | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 41297b6f..9290cf52 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -58,6 +58,12 @@ find_package(
|
||||
)
|
||||
qt_policy(SET QTP0001 NEW)
|
||||
|
||||
+if(Qt6_VERSION VERSION_EQUAL 6.8.0)
|
||||
+ # https://bugreports.qt.io/browse/QTBUG-129797
|
||||
+ message(NOTICE "Qt6_VERSION: ${Qt6_VERSION} detected. Enabling CAST_FROM_ASCII")
|
||||
+ remove_definitions(-DQT_NO_CAST_FROM_ASCII)
|
||||
+endif()
|
||||
+
|
||||
find_package(
|
||||
KF6 ${KF_MIN_VERSION} REQUIRED
|
||||
CoreAddons
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -4,5 +4,6 @@ Comment=Start spectacle DBus service
|
||||
Type=Application
|
||||
Exec=/usr/bin/spectacle --dbus
|
||||
TryExec=/usr/bin/spectacle
|
||||
OnlyShowIn=KDE;
|
||||
Terminal=false
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
name='spectacle'
|
||||
release='4'
|
||||
release='2'
|
||||
version='24.08.2'
|
||||
url='https://kde.org/applications/utilities/org.kde.spectacle'
|
||||
description='Application for capturing desktop screenshots'
|
||||
@@ -8,16 +8,31 @@ email='osman.coskun95@gmail.com'
|
||||
maintainer='mergin'
|
||||
license=('GPLv3')
|
||||
source=("https://download.kde.org/stable/release-service/$version/src/spectacle-$version.tar.xz"
|
||||
000-no-opencv.patch
|
||||
001-no-opencv.patch
|
||||
002-fix-qmlcache.patch
|
||||
spectacle.desktop)
|
||||
depends=(qt6-base kwayland kpipewire)
|
||||
makedepends=(extra-cmake-modules ki18n kdoctools)
|
||||
sha256sums=('3f90f8cfe3359ad94f5bb0025a9251805a092c5892cd2a891965c21a0984cbdf'
|
||||
'SKIP'
|
||||
'SKIP'
|
||||
'SKIP'
|
||||
'SKIP')
|
||||
group=(kde.apps)
|
||||
uses=()
|
||||
arch=('x86_64')
|
||||
|
||||
cd $name-$version
|
||||
export PATH=$PATH:/usr/lib64/qt6/libexec/rcc
|
||||
|
||||
export LANG=en_US.UTF-8
|
||||
|
||||
prepare(){
|
||||
patch -Np1 -i ../000-no-opencv.patch
|
||||
patch -Np1 -i ../001-no-opencv.patch
|
||||
patch -Np1 -i ../002-fix-qmlcache.patch
|
||||
}
|
||||
|
||||
setup(){
|
||||
cmake -B build -G Ninja \
|
||||
@@ -39,4 +54,3 @@ package(){
|
||||
# install autostart file
|
||||
install -Dm644 ../spectacle.desktop -t "$DESTDIR"/etc/xdg/autostart/
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ email='aliriza.keskin@pardus.org.tr'
|
||||
maintainer='aliriza'
|
||||
license=('GPLv3')
|
||||
source=("https://download.kde.org/stable/frameworks/${version%.*}/prison-${version}.tar.xz")
|
||||
depends=(qt6-base libdmtx qrencode qt6-multimedia)
|
||||
depends=(qt6-base libdmtx qrencode qt6-multimedia zxing-cpp)
|
||||
makedepends=(extra-cmake-modules qt6-tools doxygen)
|
||||
sha256sums=('0a053a80beae232cef5da3f6525b14ee649b275cea64de0c0ffad41c3f2ec260')
|
||||
group=(kde.frameworks)
|
||||
|
||||
@@ -8,7 +8,7 @@ email='brkt8khn@gmail.com'
|
||||
maintainer='brkt8khn'
|
||||
license=('GPLv3')
|
||||
source=("https://download.kde.org/stable/frameworks/${version%.*}/sonnet-${version}.tar.xz")
|
||||
depends=(qt6-base)
|
||||
depends=(qt6-base hunspell)
|
||||
makedepends=(extra-cmake-modules qt6-declarative qt6-tools doxygen)
|
||||
sha256sums=('2f970d490effd668e64dd93ffef344a80db7e63130bb23df4fa0d6b14150e588')
|
||||
group=(kde.frameworks)
|
||||
|
||||
@@ -10,7 +10,8 @@ license=('GPLv3')
|
||||
source=("https://download.kde.org/stable/plasma/$version/plasma-workspace-$version.tar.xz")
|
||||
depends=(accountsservice kactivitymanagerd kded kio
|
||||
kquickcharts kwin milou pipewire phonon
|
||||
plasma-integration qt6-base xdotool qcoro-qt6)
|
||||
plasma-integration qt6-base xdotool qcoro-qt6
|
||||
plasma5support plasma-activities-stats)
|
||||
makedepends=(qt6-tools)
|
||||
sha256sums=('2d4268cbae757631be57d69d34fc02c8d0204762515370c9679ecb2aa2afdf33')
|
||||
group=(kde.plasma)
|
||||
|
||||
Reference in new issue
Block a user