Commit 6335dfe5 authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: changed GlowDraw to always use double buffering.

parent d80213b8
...@@ -1071,7 +1071,7 @@ int FlowDrawQt::arc_helper(FlowCtx* ctx, int painter_type, int size, int x, ...@@ -1071,7 +1071,7 @@ int FlowDrawQt::arc_helper(FlowCtx* ctx, int painter_type, int size, int x,
QPainter* painter = get_painter(painter_type, size, nav); QPainter* painter = get_painter(painter_type, size, nav);
painter->setBrush(Qt::NoBrush); painter->setBrush(Qt::NoBrush);
// debug_print("arrow [%d, %d, %d, %d], %d, %d\n", x, y, width, height, angle1, angle2); // debug_print("arc [%d, %d, %d, %d], %d, %d\n", x, y, width, height, angle1, angle2);
painter->drawArc(x, y, width, height, angle1 * 16, angle2 * 16); painter->drawArc(x, y, width, height, angle1 * 16, angle2 * 16);
delete painter; delete painter;
......
...@@ -1469,11 +1469,7 @@ void GlowDrawQt::clear(GlowWind* wind) ...@@ -1469,11 +1469,7 @@ void GlowDrawQt::clear(GlowWind* wind)
} }
DrawWindQt* w = (DrawWindQt*)wind->window; DrawWindQt* w = (DrawWindQt*)wind->window;
if (!w->double_buffer_on) {
QPainter(w->buffer).eraseRect(w->buffer->rect());
} else {
buffer_background(w, 0); buffer_background(w, 0);
}
} }
void GlowDrawQt::copy_buffer( void GlowDrawQt::copy_buffer(
...@@ -2013,7 +2009,7 @@ void GlowDrawQt::buffer_background(DrawWind* wind, GlowCtx* cctx) ...@@ -2013,7 +2009,7 @@ void GlowDrawQt::buffer_background(DrawWind* wind, GlowCtx* cctx)
subwindow_y = ctx->navw.subwindow_y; subwindow_y = ctx->navw.subwindow_y;
} }
if (!w->double_buffer_on || !window_width) { if (!window_width) {
return; return;
} }
...@@ -2064,18 +2060,12 @@ void GlowDrawQt::buffer_background(DrawWind* wind, GlowCtx* cctx) ...@@ -2064,18 +2060,12 @@ void GlowDrawQt::buffer_background(DrawWind* wind, GlowCtx* cctx)
int GlowDrawQt::export_image(char* filename) int GlowDrawQt::export_image(char* filename)
{ {
DrawWindQt* w = m_wind; DrawWindQt* w = m_wind;
QImage image; QImage* image = w->buffer;
if (image->isNull()) {
if (w->double_buffer_on) {
image = *(w->buffer);
} else {
image = QPixmap::grabWidget(w->window).toImage();
}
if (image.isNull()) {
return 0; return 0;
} }
bool sts = image.save(filename, "PNG", 0); bool sts = image->save(filename, "PNG", 0);
if (sts) { if (sts) {
return 0; return 0;
} }
...@@ -2105,15 +2095,8 @@ int GlowDrawQt::print(char* filename, double x0, double x1, int end) ...@@ -2105,15 +2095,8 @@ int GlowDrawQt::print(char* filename, double x0, double x1, int end)
x = ps_cLeftMargin; x = ps_cLeftMargin;
y = ps_cPageHeight - ps_cTopMargin; y = ps_cPageHeight - ps_cTopMargin;
QImage image; QImage* image = w->buffer;
if (image->isNull()) {
if (w->double_buffer_on) {
image = *(w->buffer);
} else {
image = QPixmap::grabWidget(w->window).toImage();
}
if (image.isNull()) {
return 0; return 0;
} }
...@@ -2125,8 +2108,8 @@ int GlowDrawQt::print(char* filename, double x0, double x1, int end) ...@@ -2125,8 +2108,8 @@ int GlowDrawQt::print(char* filename, double x0, double x1, int end)
y = ps->y; y = ps->y;
} }
width = image.width(); width = image->width();
height = image.height(); height = image->height();
if (!feq(x0, 0.0) || !feq(x1, 0.0)) { if (!feq(x0, 0.0) || !feq(x1, 0.0)) {
double total_width = width / (x1 - x0); double total_width = width / (x1 - x0);
...@@ -2188,7 +2171,7 @@ int GlowDrawQt::print(char* filename, double x0, double x1, int end) ...@@ -2188,7 +2171,7 @@ int GlowDrawQt::print(char* filename, double x0, double x1, int end)
j = 0; j = 0;
for (k = 0; k < height; k++) { for (k = 0; k < height; k++) {
for (i = 0; i < width; i++) { for (i = 0; i < width; i++) {
QColor pixel = QColor(image.pixel(i, k)); QColor pixel = QColor(image->pixel(i, k));
if (!colorimage) { if (!colorimage) {
if (!pixel.alpha()) { if (!pixel.alpha()) {
grey = 255; grey = 255;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment