PagePainter: Don't draw Arrow/Line annotations with multipyl

Otherwise they will be transparent when they shouldn't

BUGS: 425075
This commit is contained in:
Albert Astals Cid 2020-08-07 00:35:00 +02:00
parent 2c70ec41ad
commit 389c7b0235
2 changed files with 10 additions and 10 deletions

View file

@ -1105,14 +1105,14 @@ void LineAnnotPainter::draw(QImage &image) const
void LineAnnotPainter::drawMainLine(QImage &image) const
{
// draw the line as normalized path into image
PagePainter::drawShapeOnImage(image, transformPath(la->transformedLinePoints(), toNormalizedImage), la->lineClosed(), linePen, fillBrush, pageScale, PagePainter::Multiply);
PagePainter::drawShapeOnImage(image, transformPath(la->transformedLinePoints(), toNormalizedImage), la->lineClosed(), linePen, fillBrush, pageScale);
}
void LineAnnotPainter::drawShortenedLine(double mainSegmentLength, double size, QImage &image, const QTransform &toNormalizedPage) const
{
const QTransform combinedTransform {toNormalizedPage * toNormalizedImage};
const QList<Okular::NormalizedPoint> path {{shortenForArrow(size, la->lineStartStyle()), 0}, {mainSegmentLength - shortenForArrow(size, la->lineEndStyle()), 0}};
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), la->lineClosed(), linePen, fillBrush, pageScale, PagePainter::Multiply);
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), la->lineClosed(), linePen, fillBrush, pageScale);
}
void LineAnnotPainter::drawLineEnds(double mainSegmentLength, double size, QImage &image, const QTransform &transform) const
@ -1189,7 +1189,7 @@ void LineAnnotPainter::drawLineEndArrow(double xEndPos, double size, double flip
{xEndPos, 0},
{xEndPos - size * flipX, -size / 2.},
};
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), close, linePen, fillBrush, pageScale, PagePainter::Multiply);
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), close, linePen, fillBrush, pageScale);
}
void LineAnnotPainter::drawLineEndButt(double xEndPos, double size, const QTransform &toNormalizedPage, QImage &image) const
@ -1200,7 +1200,7 @@ void LineAnnotPainter::drawLineEndButt(double xEndPos, double size, const QTrans
{xEndPos, halfSize},
{xEndPos, -halfSize},
};
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), true, linePen, fillBrush, pageScale, PagePainter::Multiply);
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), true, linePen, fillBrush, pageScale);
}
void LineAnnotPainter::drawLineEndCircle(double xEndPos, double size, const QTransform &toNormalizedPage, QImage &image) const
@ -1216,21 +1216,21 @@ void LineAnnotPainter::drawLineEndCircle(double xEndPos, double size, const QTra
};
/* then transform bounding rect with toNormalizedImage */
PagePainter::drawEllipseOnImage(image, transformPath(path, toNormalizedImage), linePen, fillBrush, pageScale, PagePainter::Multiply);
PagePainter::drawEllipseOnImage(image, transformPath(path, toNormalizedImage), linePen, fillBrush, pageScale);
}
void LineAnnotPainter::drawLineEndSquare(double xEndPos, double size, const QTransform &toNormalizedPage, QImage &image) const
{
const QTransform combinedTransform {toNormalizedPage * toNormalizedImage};
const QList<Okular::NormalizedPoint> path {{xEndPos, size / 2.}, {xEndPos - size, size / 2.}, {xEndPos - size, -size / 2.}, {xEndPos, -size / 2.}};
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), true, linePen, fillBrush, pageScale, PagePainter::Multiply);
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), true, linePen, fillBrush, pageScale);
}
void LineAnnotPainter::drawLineEndDiamond(double xEndPos, double size, const QTransform &toNormalizedPage, QImage &image) const
{
const QTransform combinedTransform {toNormalizedPage * toNormalizedImage};
const QList<Okular::NormalizedPoint> path {{xEndPos, 0}, {xEndPos - size / 2., size / 2.}, {xEndPos - size, 0}, {xEndPos - size / 2., -size / 2.}};
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), true, linePen, fillBrush, pageScale, PagePainter::Multiply);
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), true, linePen, fillBrush, pageScale);
}
void LineAnnotPainter::drawLineEndSlash(double xEndPos, double size, const QTransform &toNormalizedPage, QImage &image) const
@ -1242,7 +1242,7 @@ void LineAnnotPainter::drawLineEndSlash(double xEndPos, double size, const QTran
{xEndPos - xOffset, halfSize},
{xEndPos + xOffset, -halfSize},
};
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), true, linePen, fillBrush, pageScale, PagePainter::Multiply);
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), true, linePen, fillBrush, pageScale);
}
void LineAnnotPainter::drawLeaderLine(double xEndPos, QImage &image, const QTransform &toNormalizedPage) const
@ -1262,7 +1262,7 @@ void LineAnnotPainter::drawLeaderLine(double xEndPos, QImage &image, const QTran
path.append({xEndPos, 0});
}
}
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), false, linePen, fillBrush, pageScale, PagePainter::Multiply);
PagePainter::drawShapeOnImage(image, transformPath(path, combinedTransform), false, linePen, fillBrush, pageScale);
}
double LineAnnotPainter::shortenForArrow(double size, Okular::LineAnnotation::TermStyle endStyle)

View file

@ -91,7 +91,7 @@ private:
static void drawShapeOnImage(QImage &image, const NormalizedPath &normPath, bool closeShape, const QPen &pen, const QBrush &brush = QBrush(), double penWidthMultiplier = 1.0, RasterOperation op = Normal
// float antiAliasRadius = 1.0
);
static void drawEllipseOnImage(QImage &image, const NormalizedPath &rect, const QPen &pen, const QBrush &brush, double penWidthMultiplier, RasterOperation op);
static void drawEllipseOnImage(QImage &image, const NormalizedPath &rect, const QPen &pen, const QBrush &brush, double penWidthMultiplier, RasterOperation op = Normal);
friend class LineAnnotPainter;
};