From ae77ffdbdb2df1e90fc52660776867103cbb0aab Mon Sep 17 00:00:00 2001 From: wuyize Date: Wed, 29 Mar 2023 15:04:17 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E7=94=BB=E5=B8=83=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E5=90=8E=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Editor/PreviewWindow.cpp | 2 +- .../src/Renderer/Painting/BaseStyle.cpp | 12 +++++++----- .../src/Renderer/Preview/ElementRenderer.cpp | 4 ++-- svg/T.svg | 1 + 4 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 svg/T.svg diff --git a/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp b/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp index fbe64c8..98f693d 100644 --- a/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp +++ b/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp @@ -72,7 +72,7 @@ void PreviewWindow::paintGL() glClearColor(backgroundColor.redF(), backgroundColor.greenF(), backgroundColor.blueF(), backgroundColor.alphaF()); glClear(GL_COLOR_BUFFER_BIT); painter->begin(this); - painter->setWindow(0, 0, actualSize.width() * devicePixelRatioF(), actualSize.height() * devicePixelRatioF()); + painter->setWindow(0, 0, referSize.width() * devicePixelRatioF(), referSize.height() * devicePixelRatioF()); painter->setRenderHint(QPainter::Antialiasing); painter->setRenderHint(QPainter::HighQualityAntialiasing); layerManager->paint(painter, this->size(), currentLayer); diff --git a/ArchitectureColoredPainting/src/Renderer/Painting/BaseStyle.cpp b/ArchitectureColoredPainting/src/Renderer/Painting/BaseStyle.cpp index a462dd3..30c076a 100644 --- a/ArchitectureColoredPainting/src/Renderer/Painting/BaseStyle.cpp +++ b/ArchitectureColoredPainting/src/Renderer/Painting/BaseStyle.cpp @@ -66,14 +66,16 @@ std::unique_ptr Renderer::MaterialStyle::decoded(const std::vecto std::unique_ptr materialStroke; std::map widthMap; uint widthMapSize = floatBitsToUint(encoded[1]); - for (int i = 0; i < widthMapSize; i++) - { - glm::vec2 v = glm::unpackUnorm2x16(glm::floatBitsToUint(encoded[2 + i])); - widthMap.emplace(v.x, v.y); - } + uint headIndex = widthMapSize + 2; if (encoded[1] < 0) headIndex = 1; /// ¼æÈݾɰæ±àÂë + else + for (int i = 0; i < widthMapSize; i++) + { + glm::vec2 v = glm::unpackUnorm2x16(glm::floatBitsToUint(encoded[2 + i])); + widthMap.emplace(v.x, v.y); + } uint headUint = floatBitsToUint(encoded[headIndex]); vec4 head = unpackUnorm4x8(headUint); StrokeType strokeType = (StrokeType)floor(head.b * 10); diff --git a/ArchitectureColoredPainting/src/Renderer/Preview/ElementRenderer.cpp b/ArchitectureColoredPainting/src/Renderer/Preview/ElementRenderer.cpp index c2e6341..9ad8b7a 100644 --- a/ArchitectureColoredPainting/src/Renderer/Preview/ElementRenderer.cpp +++ b/ArchitectureColoredPainting/src/Renderer/Preview/ElementRenderer.cpp @@ -83,7 +83,7 @@ std::vector generatePathBuffer(const QPainterPath& path) pathBuffer.push_back(end); pathBuffer.emplace_back(lengths[j][k] / lengths[j].back(), lengths[j][k+1] / lengths[j].back()); k++; - qDebug() << pathBuffer.back().x << pathBuffer.back().y; + //qDebug() << pathBuffer.back().x << pathBuffer.back().y; lastPoint = end; break; } @@ -105,7 +105,7 @@ std::vector generatePathBuffer(const QPainterPath& path) pathBuffer.push_back(p3); pathBuffer.emplace_back(lengths[j][k] / lengths[j].back(), lengths[j][k+1] / lengths[j].back()); k++; - qDebug() << pathBuffer.back().x << pathBuffer.back().y; + //qDebug() << pathBuffer.back().x << pathBuffer.back().y; lastPoint = p3; } break; diff --git a/svg/T.svg b/svg/T.svg new file mode 100644 index 0000000..365c75c --- /dev/null +++ b/svg/T.svg @@ -0,0 +1 @@ + \ No newline at end of file