Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix delayed vector transformation rendering #1818

Merged
merged 2 commits into from
Apr 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions core_lib/src/canvaspainter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,20 +298,15 @@ void CanvasPainter::paintCurrentBitmapFrame(QPainter& painter, const QRect& blit
painter.setOpacity(paintedImage->getOpacity() - (1.0-painter.opacity()));
painter.setWorldMatrixEnabled(false);

currentBitmapPainter.drawImage(paintedImage->topLeft(), *paintedImage->image());

if (isCurrentLayer && isDrawing)
{
currentBitmapPainter.drawImage(paintedImage->topLeft(), *paintedImage->image());

currentBitmapPainter.setCompositionMode(mOptions.cmBufferBlendMode);
const auto tiles = mTiledBuffer->tiles();
for (const Tile* tile : tiles) {
currentBitmapPainter.drawPixmap(tile->posF(), tile->pixmap());
}
} else {
// When we're drawing using a tool, the surface will be painted by the tiled buffer,
// and thus we don't want to paint the current image again
// When we're on another layer though, the tiled buffer is not used
currentBitmapPainter.drawImage(paintedImage->topLeft(), *paintedImage->image());
}

// We do not wish to draw selection transformations on anything but the current layer
Expand All @@ -337,19 +332,19 @@ void CanvasPainter::paintCurrentVectorFrame(QPainter& painter, const QRect& blit

const bool isDrawing = mTiledBuffer->isValid();

if (mRenderTransform) {
vectorImage->setSelectionTransformation(mSelectionTransform);
}

// Paint existing vector image to the painter
vectorImage->paintImage(currentVectorPainter, *mObject, mOptions.bOutlines, mOptions.bThinLines, mOptions.bAntiAlias);

if (isCurrentLayer) {
if (isDrawing) {
currentVectorPainter.setCompositionMode(mOptions.cmBufferBlendMode);
if (isCurrentLayer && isDrawing) {
currentVectorPainter.setCompositionMode(mOptions.cmBufferBlendMode);

const auto tiles = mTiledBuffer->tiles();
for (const Tile* tile : tiles) {
currentVectorPainter.drawPixmap(tile->posF(), tile->pixmap());
}
} else if (mRenderTransform) {
vectorImage->setSelectionTransformation(mSelectionTransform);
const auto tiles = mTiledBuffer->tiles();
for (const Tile* tile : tiles) {
currentVectorPainter.drawPixmap(tile->posF(), tile->pixmap());
}
}

Expand Down
Loading