FIX: setWindow参数设置错误

dev-wuyize
wuyize 2023-03-21 12:24:42 +08:00
parent 793402e3c5
commit 35e7648206
3 changed files with 45 additions and 33 deletions

View File

@ -51,7 +51,7 @@ void PreviewWindow::paintGL()
glClearColor(backgroundColor.redF(), backgroundColor.greenF(), backgroundColor.blueF(), backgroundColor.alphaF()); glClearColor(backgroundColor.redF(), backgroundColor.greenF(), backgroundColor.blueF(), backgroundColor.alphaF());
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
painter->begin(this); painter->begin(this);
painter->setWindow(0, 0, logicalSize.width(), logicalSize.height()); painter->setWindow(0, 0, logicalSize.width() *devicePixelRatioF(), logicalSize.height() * devicePixelRatioF());
painter->setRenderHint(QPainter::Antialiasing); painter->setRenderHint(QPainter::Antialiasing);
painter->setRenderHint(QPainter::HighQualityAntialiasing); painter->setRenderHint(QPainter::HighQualityAntialiasing);
layerManager->paint(painter,this->size(),currentLayer); layerManager->paint(painter,this->size(),currentLayer);

View File

@ -84,7 +84,7 @@ FolderLayerWrapper* PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTr
//qDebug() << leafLayer<<"------" << painterPath; //qDebug() << leafLayer<<"------" << painterPath;
// transform to -1£¬ 1 // transform to -1£¬ 1
QTransform trans; QTransform trans;
double maxLen = std::max(bound.width(), bound.height()); double maxLen = std::max(bound.width(), bound.height()) * 1.00001;
qDebug() << maxLen << bound; qDebug() << maxLen << bound;
trans.scale(1 / maxLen, 1 / maxLen); trans.scale(1 / maxLen, 1 / maxLen);
trans.translate(-bound.center().x(), -bound.center().y()); trans.translate(-bound.center().x(), -bound.center().y());

View File

@ -29,30 +29,6 @@
"children": [ "children": [
{ {
"children": [ "children": [
{
"element": 0,
"is-folder": false,
"name": "Leaf1",
"styles": [
{
"enableEachSideIndependent": false,
"left": "AACgQAEAIZwAf///AZ5X/w==",
"right": "AADgQAAACJw=",
"type": "stroke"
}
],
"transform": {
"offset": {
"x": 0,
"y": 0
},
"rotation": 0,
"scale": {
"x": 1,
"y": 1
}
}
},
{ {
"element": 0, "element": 0,
"is-folder": false, "is-folder": false,
@ -61,14 +37,14 @@
{ {
"enableEachSideIndependent": false, "enableEachSideIndependent": false,
"left": "AABAQAEAIZwAf///AFqe/w==", "left": "AABAQAEAIZwAf///AFqe/w==",
"right": "AADgQAAACJw=", "right": "AABAQAEACJwAf////1UA/w==",
"type": "stroke" "type": "stroke"
} }
], ],
"transform": { "transform": {
"offset": { "offset": {
"x": 150, "x": 501,
"y": 0 "y": -3
}, },
"rotation": 0, "rotation": 0,
"scale": { "scale": {
@ -96,15 +72,51 @@
{ {
"element": 1, "element": 1,
"is-folder": false, "is-folder": false,
"name": "ReferencingGroupLayer", "name": "子图层-2",
"styles": [ "styles": [
], ],
"transform": { "transform": {
"offset": { "offset": {
"x": 100, "x": -2,
"y": 0 "y": 515
}, },
"rotation": 45, "rotation": 0,
"scale": {
"x": 1,
"y": 1
}
}
},
{
"element": 1,
"is-folder": false,
"name": "子图层-3",
"styles": [
],
"transform": {
"offset": {
"x": -503,
"y": -1
},
"rotation": 0,
"scale": {
"x": 1,
"y": 1
}
}
},
{
"element": 1,
"is-folder": false,
"name": "子图层-4",
"styles": [
],
"transform": {
"offset": {
"x": -503,
"y": 511
},
"rotation": 0,
"scale": { "scale": {
"x": 1, "x": 1,
"y": 1 "y": 1