* feat: change selection-background-color

* feat: mac need more width

* feat: mac enable keymap

* fix: mac full screen

* fix: tool from move bug

Close #78

* fix: fullscreen bug on ubuntu

* feat: load keymap on ubuntu

* chore: add linux build script

* chore: add ubuntu build script

* chore: fix build on ubuntu

* fix: opengl set on application before

* feat: set opengl version 2.0

* fix: build on ubuntu

* chore: update workflows

* feat: change covert yuv to rgb param

Close #46

* docs: update todo
This commit is contained in:
Barry 2020-02-29 12:33:55 +08:00 committed by GitHub
parent a86c5bc37c
commit f563d76d75
7 changed files with 57 additions and 38 deletions

View file

@ -4,7 +4,7 @@ on:
paths:
- 'QtScrcpy/**'
- '!QtScrcpy/res/**'
- '.github/workflows/**'
- '.github/workflows/macos.yml'
pull_request:
paths:
- 'QtScrcpy/**'

View file

@ -5,11 +5,12 @@ on:
paths:
- 'QtScrcpy/**'
- '!QtScrcpy/res/**'
- '.github/workflows/**'
- '.github/workflows/ubuntu.yml'
pull_request:
paths:
- 'QtScrcpy/**'
- '!QtScrcpy/res/**'
- '.github/workflows/ubuntu.yml'
jobs:
build:
name: Build
@ -47,5 +48,5 @@ jobs:
fetch-depth: 1
- name: Build Ubuntu
run: |
export ENV_QT_GCC=${{env.Qt5_Dir}}
export ENV_QT_GCC=$(pwd)/${{env.Qt5_Dir}}
ci/linux/build_for_ubuntu.sh release

View file

@ -5,7 +5,7 @@ on:
paths:
- 'QtScrcpy/**'
- '!QtScrcpy/res/**'
- '.github/workflows/**'
- '.github/workflows/windows.yml'
# pull_request时触发workflow
pull_request:
paths:

View file

@ -50,14 +50,18 @@ static QString s_fragShader = R"(
{
vec3 yuv;
vec3 rgb;
// SDL2-2.0.10\src\render\opengl\SDL_shaders_gl.c BT709_SHADER_CONSTANTS
const vec3 Rcoeff = vec3(1.1644, 0.000, 1.7927);
const vec3 Gcoeff = vec3(1.1644, -0.2132, -0.5329);
const vec3 Bcoeff = vec3(1.1644, 2.1124, 0.000);
// 根据指定的纹理textureY和坐标textureOut来采样
yuv.x = texture2D(textureY, textureOut).r;
yuv.y = texture2D(textureU, textureOut).r - 0.5;
yuv.z = texture2D(textureV, textureOut).r - 0.5;
// 采样完转为rgb
rgb = mat3(1.0, 1.0, 1.0,
0.0, -0.39465, 2.03211,
1.13983, -0.58060, 0.0) * yuv;
rgb.r = dot(yuv, Rcoeff);
rgb.g = dot(yuv, Gcoeff);
rgb.b = dot(yuv, Bcoeff);
// 输出颜色值
gl_FragColor = vec4(rgb, 1.0);
}

View file

@ -4,6 +4,7 @@
#include <QTcpServer>
#include <QTranslator>
#include <QFile>
#include <QSurfaceFormat>
#include "dialog.h"
#include "stream.h"
@ -18,8 +19,50 @@ void installTranslator();
int main(int argc, char *argv[])
{
// set env
#ifdef Q_OS_WIN32
qputenv("QTSCRCPY_ADB_PATH", "../../../../third_party/adb/win/adb.exe");
qputenv("QTSCRCPY_SERVER_PATH", "../../../../third_party/scrcpy-server");
qputenv("QTSCRCPY_KEYMAP_PATH", "../../../../keymap");
qputenv("QTSCRCPY_CONFIG_PATH", "../../../../config");
#endif
#ifdef Q_OS_OSX
qputenv("QTSCRCPY_KEYMAP_PATH", "../../../../../../keymap");
#endif
#ifdef Q_OS_LINUX
qputenv("QTSCRCPY_ADB_PATH", "../../../third_party/adb/linux/adb");
qputenv("QTSCRCPY_SERVER_PATH", "../../../third_party/scrcpy-server");
qputenv("QTSCRCPY_CONFIG_PATH", "../../../config");
qputenv("QTSCRCPY_KEYMAP_PATH", "../../../keymap");
#endif
// set on QApplication before
int opengl = Config::getInstance().getDesktopOpenGL();
if (0 == opengl) {
QApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
} else if (1 == opengl){
QApplication::setAttribute(Qt::AA_UseOpenGLES);
} else if (2 == opengl) {
QApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
}
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QSurfaceFormat varFormat = QSurfaceFormat::defaultFormat();
varFormat.setVersion(2, 0);
varFormat.setProfile(QSurfaceFormat::NoProfile);
/*
varFormat.setSamples(4);
varFormat.setAlphaBufferSize(8);
varFormat.setBlueBufferSize(8);
varFormat.setRedBufferSize(8);
varFormat.setGreenBufferSize(8);
varFormat.setDepthBufferSize(24);
*/
QSurfaceFormat::setDefaultFormat(varFormat);
g_oldMessageHandler = qInstallMessageHandler(myMessageOutput);
Stream::init();
QApplication a(argc, argv);
@ -41,24 +84,6 @@ int main(int argc, char *argv[])
MouseTap::getInstance()->initMouseEventTap();
#endif
#ifdef Q_OS_WIN32
qputenv("QTSCRCPY_ADB_PATH", "../../../../third_party/adb/win/adb.exe");
qputenv("QTSCRCPY_SERVER_PATH", "../../../../third_party/scrcpy-server");
qputenv("QTSCRCPY_KEYMAP_PATH", "../../../../keymap");
qputenv("QTSCRCPY_CONFIG_PATH", "../../../../config");
#endif
#ifdef Q_OS_OSX
qputenv("QTSCRCPY_KEYMAP_PATH", "../../../../../../keymap");
#endif
#ifdef Q_OS_LINUX
qputenv("QTSCRCPY_ADB_PATH", "../../../third_party/adb/linux/adb");
qputenv("QTSCRCPY_SERVER_PATH", "../../../third_party/scrcpy-server");
qputenv("QTSCRCPY_CONFIG_PATH", "../../../config");
qputenv("QTSCRCPY_KEYMAP_PATH", "../../../keymap");
#endif
//加载样式表
QFile file(":/qss/psblack.css");
if (file.open(QFile::ReadOnly)) {
@ -69,15 +94,6 @@ int main(int argc, char *argv[])
file.close();
}
int opengl = Config::getInstance().getDesktopOpenGL();
if (0 == opengl) {
QApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
} else if (1 == opengl){
QApplication::setAttribute(Qt::AA_UseOpenGLES);
} else if (2 == opengl) {
QApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
}
g_mainDlg = new Dialog;
g_mainDlg->setWindowTitle(Config::getInstance().getTitle());
g_mainDlg->show();

View file

@ -69,7 +69,8 @@ const QString& Config::getConfigPath()
s_configPath = QString::fromLocal8Bit(qgetenv("QTSCRCPY_CONFIG_PATH"));
QFileInfo fileInfo(s_configPath);
if (s_configPath.isEmpty() || !fileInfo.isDir()) {
s_configPath = QCoreApplication::applicationDirPath() + "/config";
// default application dir
s_configPath = "config";
}
}
return s_configPath;

View file

@ -7,14 +7,11 @@
- text转换 https://github.com/Genymobile/scrcpy/commit/c916af0984f72a60301d13fa8ef9a85112f54202?tdsourcetag=s_pctim_aiomsg
## 中优先级
- mac自动打包脚本
- 脚本
- 群控
- 竖屏全屏不拉伸画面
- 软解
- opengles 3.0
- github action
- 打包版本截图无效?
## 高优先级
- linux打包以及版本号