Skip to content

Commit 83dccd1

Browse files
committed
Use Qt Quick scale for the pen layer
Resolves: #88
1 parent 7759191 commit 83dccd1

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

src/ProjectPlayer.qml

+6-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@ ProjectScene {
136136
PenLayer {
137137
id: projectPenLayer
138138
engine: loader.engine
139-
anchors.fill: parent
139+
anchors.top: parent.top
140+
anchors.left: parent.left
141+
width: stageWidth
142+
height: stageHeight
143+
scale: stageScale
144+
transformOrigin: Item.TopLeft
140145
visible: !priv.loading
141146
}
142147

src/penlayer.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ PenLayer::PenLayer(QNanoQuickItem *parent) :
1313
{
1414
m_fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
1515
m_fboFormat.setSamples(m_antialiasingEnabled ? 4 : 0);
16+
setSmooth(false);
1617
}
1718

1819
PenLayer::~PenLayer()

src/penlayerpainter.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ void PenLayerPainter::paint(QNanoPainter *painter)
2727
QOpenGLFramebufferObjectFormat format;
2828
format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
2929

30-
// Blit the FBO to a temporary FBO first (multisampled FBOs can only be blitted to FBOs with the same size)
31-
QOpenGLFramebufferObject tmpFbo(m_fbo->size(), format);
32-
QOpenGLFramebufferObject::blitFramebuffer(&tmpFbo, m_fbo);
33-
QOpenGLFramebufferObject::blitFramebuffer(targetFbo, &tmpFbo);
30+
// Blit the FBO to the item FBO
31+
QOpenGLFramebufferObject::blitFramebuffer(targetFbo, m_fbo);
3432
}
3533

3634
void PenLayerPainter::synchronize(QNanoQuickItem *item)

test/penlayer/penlayer_test.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ TEST_F(PenLayerTest, Constructors)
4444
PenLayer penLayer2(&penLayer1);
4545
ASSERT_EQ(penLayer2.parent(), &penLayer1);
4646
ASSERT_EQ(penLayer2.parentItem(), &penLayer1);
47+
ASSERT_FALSE(penLayer1.smooth());
4748
}
4849

4950
TEST_F(PenLayerTest, Engine)

0 commit comments

Comments
 (0)