Merge branch 'main' into dev-LayerStyle
commit
9984dd23f8
|
@ -15,7 +15,7 @@ vector<vector<Point>> PainterPathUtil::transformToLines(const QPainterPath& pai
|
||||||
for (int elementIndex = 0; elementIndex < painterPath.elementCount(); elementIndex++) {
|
for (int elementIndex = 0; elementIndex < painterPath.elementCount(); elementIndex++) {
|
||||||
auto element = painterPath.elementAt(elementIndex);
|
auto element = painterPath.elementAt(elementIndex);
|
||||||
point = element;
|
point = element;
|
||||||
qDebug() << element;
|
//qDebug() << element;
|
||||||
if (element.isMoveTo()) {
|
if (element.isMoveTo()) {
|
||||||
if (line.size() >= 2) {
|
if (line.size() >= 2) {
|
||||||
lines.push_back(line);
|
lines.push_back(line);
|
||||||
|
@ -43,7 +43,7 @@ vector<vector<Point>> PainterPathUtil::transformToLines(const QPainterPath& pai
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainterPath PainterPathUtil::monotonization(QPainterPath& painterPath) {
|
QPainterPath PainterPathUtil::monotonization(const QPainterPath& painterPath) {
|
||||||
QPainterPath resPath;
|
QPainterPath resPath;
|
||||||
vector<vector<Point> > lines = transformToLines(painterPath);
|
vector<vector<Point> > lines = transformToLines(painterPath);
|
||||||
vector<shared_ptr<Line>> linePtrVector;
|
vector<shared_ptr<Line>> linePtrVector;
|
||||||
|
|
|
@ -7,7 +7,7 @@ class PainterPathUtil
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::vector<std::vector<Renderer::Point>> transformToLines(const QPainterPath& painterPath);
|
static std::vector<std::vector<Renderer::Point>> transformToLines(const QPainterPath& painterPath);
|
||||||
static QPainterPath monotonization(QPainterPath& painterPath);
|
static QPainterPath monotonization(const QPainterPath& painterPath);
|
||||||
static std::pair<QPainterPath, float> normalized(const QPainterPath& path, float width = 0);
|
static std::pair<QPainterPath, float> normalized(const QPainterPath& path, float width = 0);
|
||||||
static std::pair<std::vector<std::vector<Renderer::Point>>, float> toNormalizedLines(const QPainterPath& path, float width = 0);
|
static std::pair<std::vector<std::vector<Renderer::Point>>, float> toNormalizedLines(const QPainterPath& path, float width = 0);
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,7 +59,7 @@ std::vector<GLfloat> Renderer::StrokeRadialGradient::encoded() const
|
||||||
v.y = pair.first;
|
v.y = pair.first;
|
||||||
result.push_back(glm::uintBitsToFloat(glm::packUnorm2x16(v)));
|
result.push_back(glm::uintBitsToFloat(glm::packUnorm2x16(v)));
|
||||||
result.push_back(glm::uintBitsToFloat(glm::packUnorm4x8(color)));
|
result.push_back(glm::uintBitsToFloat(glm::packUnorm4x8(color)));
|
||||||
qDebug() << pair.first;
|
//qDebug() << pair.first;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "../Painting/Element.h"
|
#include "../Painting/Element.h"
|
||||||
#include "../Painting/Painting.h"
|
#include "../Painting/Painting.h"
|
||||||
#include "../Painting/MaterialStyleStroke.h"
|
#include "../Painting/MaterialStyleStroke.h"
|
||||||
|
#include <util/PainterPathUtil.h>
|
||||||
using namespace Renderer;
|
using namespace Renderer;
|
||||||
|
|
||||||
std::vector<glm::vec2> generatePathBuffer(const QPainterPath& path)
|
std::vector<glm::vec2> generatePathBuffer(const QPainterPath& path)
|
||||||
|
@ -78,7 +79,7 @@ std::vector<GLfloat> generateStyleBuffer(const std::vector<BaseStyle>& styles)
|
||||||
|
|
||||||
auto encoded = style.material->encoded();
|
auto encoded = style.material->encoded();
|
||||||
styleBuffer.insert(styleBuffer.end(), encoded.begin(), encoded.end());
|
styleBuffer.insert(styleBuffer.end(), encoded.begin(), encoded.end());
|
||||||
qDebug() << "style size" << styleBuffer.size();
|
//qDebug() << "style size" << styleBuffer.size();
|
||||||
}
|
}
|
||||||
return styleBuffer;
|
return styleBuffer;
|
||||||
}
|
}
|
||||||
|
@ -199,7 +200,8 @@ std::pair<QImage, QPointF> Renderer::ElementRenderer::drawElement(const QPainter
|
||||||
std::unique_lock<std::mutex> lock(drawMutex);
|
std::unique_lock<std::mutex> lock(drawMutex);
|
||||||
draw.wait(lock, [&] {return drawFinished; });
|
draw.wait(lock, [&] {return drawFinished; });
|
||||||
drawFinished = false;
|
drawFinished = false;
|
||||||
this->path = &path;
|
QPainterPath monotonized = PainterPathUtil::monotonization(path);
|
||||||
|
this->path = &monotonized;
|
||||||
this->style = &style;
|
this->style = &style;
|
||||||
this->pixelRatio = pixelRatio;
|
this->pixelRatio = pixelRatio;
|
||||||
needDraw = true;
|
needDraw = true;
|
||||||
|
|
|
@ -49,6 +49,7 @@ int main(int argc, char* argv[])
|
||||||
//QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
//QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
Q_INIT_RESOURCE(resources);
|
||||||
//FramelessHelper::Core::setApplicationOSThemeAware();
|
//FramelessHelper::Core::setApplicationOSThemeAware();
|
||||||
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
|
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
|
||||||
//FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
//FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||||
|
|
Loading…
Reference in New Issue