#include "ColorCache.h"
#include "FontLoader.h"
-#include "debug.h"
#include "language.h"
#include "LColor.h"
{
}
+
QLPainter::QLPainter(GuiWorkArea * qwa)
: Painter(), qwa_(qwa)
{
void QLPainter::start()
{
qp_.reset(new QPainter(qwa_->paintDevice()));
+ // new QPainter has default QPen:
+ current_color_ = LColor::black;
+ current_ls_ = line_solid;
+ current_lw_ = line_thin;
}
return qwa_->viewport()->height();
}
-void QLPainter::setQPainterPen(QPainter & qp, LColor_color col,
+void QLPainter::setQPainterPen(LColor_color col,
Painter::line_style ls, Painter::line_width lw)
{
if (col == current_color_ && ls == current_ls_ && lw == current_lw_)
current_ls_ = ls;
current_lw_ = lw;
- QPen pen = qp.pen();
+ QPen pen = qp_.get()->pen();
pen.setColor(lcolorcache.get(col));
case line_thick: pen.setWidth(3); break;
}
- qp.setPen(pen);
+ qp_.get()->setPen(pen);
}
+
void QLPainter::point(int x, int y, LColor_color col)
{
- setQPainterPen(*qp_.get(), col);
+ setQPainterPen(col);
qp_->drawPoint(x, y);
}
line_style ls,
line_width lw)
{
- setQPainterPen(*qp_.get(), col, ls, lw);
+ setQPainterPen(col, ls, lw);
qp_->drawLine(x1, y1, x2, y2);
}
points[i].setY(yp[i]);
}
- setQPainterPen(*qp_.get(), col, ls, lw);
+ setQPainterPen(col, ls, lw);
qp_->drawPolyline(points.get(), np);
}
line_style ls,
line_width lw)
{
- setQPainterPen(*qp_.get(), col, ls, lw);
+ setQPainterPen(col, ls, lw);
qp_->drawRect(x, y, w, h);
}
points[i].setY(yp[i]);
}
- setQPainterPen(*qp_.get(), col);
+ setQPainterPen(col);
qp_->setBrush(lcolorcache.get(col));
qp_->drawPolygon(points.get(), np);
qp_->setBrush(Qt::NoBrush);
int a1, int a2, LColor_color col)
{
// LyX usings 1/64ths degree, Qt usings 1/16th
- setQPainterPen(*qp_.get(), col);
+ setQPainterPen(col);
qp_->drawArc(x, y, w, h, a1 / 4, a2 / 4);
}
QFontMetrics const & qfontm = QFontMetrics(qfont);
QFontMetrics const & qsmallfontm = QFontMetrics(qsmallfont);
- setQPainterPen(*qp_.get(), f.realColor());
+ setQPainterPen(f.realColor());
int tmpx = x;
size_t ls = s.length();
for (size_t i = 0; i < ls; ++i) {
str = ' ' + str;
if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
- setQPainterPen(*qp_.get(), f.realColor());
+ setQPainterPen(f.realColor());
qp_->setFont(fontloader.get(f));
// We need to draw the text as LTR as we use our own bidi code.
qp_->setLayoutDirection(Qt::LeftToRight);
}
}
-/// draw a pixmap from the image cache
+
+
void QLPainter::drawPixmap(int x, int y, QPixmap const & pixmap)
{
qp_->drawPixmap(x, y, pixmap);
}
+
void QLPainter::drawImage(int x, int y, QImage const & image)
{
qp_->drawImage(x, y, image);