Commit 43473b1d authored by Christoffer Ackelman's avatar Christoffer Ackelman

Removed selective redrawing: This should fix those rendering artifacts.

parent d08e0554
......@@ -1853,48 +1853,6 @@ int FlowDrawGtk::get_text_extent_pango(FlowCtx* ctx, const char* text, int len,
return 1;
}
void FlowDrawGtk::copy_area(FlowCtx* ctx, int x, int y)
{
GdkGC* gc;
if (ctx->nodraw)
return;
gc = gcs[flow_eDrawType_Line][3];
if (x >= 0 && y >= 0) {
gdk_draw_drawable(window, gc, window, 0, 0, x, y, ctx->window_width - x,
ctx->window_height - y);
if (x)
gdk_window_clear_area(window, 0, 0, x, ctx->window_height);
if (y)
gdk_window_clear_area(window, x, 0, ctx->window_width, y);
} else if (x <= 0 && y <= 0) {
gdk_draw_drawable(window, gc, window, -x, -y, 0, 0, ctx->window_width + x,
ctx->window_height + y);
if (x)
gdk_window_clear_area(window, ctx->window_width + x, 0, ctx->window_width,
ctx->window_height);
if (y)
gdk_window_clear_area(window, 0, ctx->window_height + y,
ctx->window_width + x, ctx->window_height);
} else if (x <= 0 && y >= 0) {
gdk_draw_drawable(window, gc, window, -x, 0, 0, y, ctx->window_width + x,
ctx->window_height - y);
if (x)
gdk_window_clear_area(window, ctx->window_width + x, 0, ctx->window_width,
ctx->window_height);
if (y)
gdk_window_clear_area(window, 0, 0, ctx->window_width + x, y);
} else {
gdk_draw_drawable(window, gc, window, 0, -y, x, 0, ctx->window_width - x,
ctx->window_height + y);
if (x)
gdk_window_clear_area(window, 0, 0, x, ctx->window_height);
if (y)
gdk_window_clear_area(window, x, ctx->window_height + y,
ctx->window_width, ctx->window_height);
}
}
void FlowDrawGtk::set_inputfocus(FlowCtx* ctx)
{
gdk_window_focus(((FlowDrawGtk*)ctx->fdraw)->window, GDK_CURRENT_TIME);
......
......@@ -162,7 +162,6 @@ public:
void set_nav_cursor(FlowCtx* ctx, draw_eCursor cursor);
int get_text_extent(FlowCtx* ctx, const char* text, int len,
flow_eDrawType gc_type, int idx, int* width, int* height, double size);
void copy_area(FlowCtx* ctx, int x, int y);
int create_input(FlowCtx* ctx, int x, int y, char* text, int len, int idx,
int width, int height, void* node, int number, void** data)
{
......
......@@ -1604,57 +1604,6 @@ int FlowDrawQt::get_text_extent_pango(FlowCtx* ctx, const char* text, int len,
return 1;
}
void FlowDrawQt::copy_area(FlowCtx* ctx, int x, int y)
{
if (ctx->nodraw) {
return;
}
QPixmap screenShot = QPixmap::grabWidget(window);
unique_ptr<QPainter> painter = get_painter(flow_eDrawType_Line, 3);
if (x >= 0 && y >= 0) {
painter->drawPixmap(
x, y, screenShot, 0, 0, ctx->window_width - x, ctx->window_height - y);
if (x) {
painter->eraseRect(0, 0, x, ctx->window_height);
}
if (y) {
painter->eraseRect(x, 0, ctx->window_width, y);
}
} else if (x <= 0 && y <= 0) {
painter->drawPixmap(0, 0, screenShot, -x, -y, ctx->window_width + x,
ctx->window_height + y);
if (x) {
painter->eraseRect(
ctx->window_width + x, 0, ctx->window_width, ctx->window_height);
}
if (y) {
painter->eraseRect(
0, ctx->window_height + y, ctx->window_width + x, ctx->window_height);
}
} else if (x <= 0 && y >= 0) {
painter->drawPixmap(
0, y, screenShot, -x, 0, ctx->window_width + x, ctx->window_height - y);
if (x) {
painter->eraseRect(
ctx->window_width + x, 0, ctx->window_width, ctx->window_height);
}
if (y) {
painter->eraseRect(0, 0, ctx->window_width + x, y);
}
} else {
painter->drawPixmap(
x, 0, screenShot, 0, -y, ctx->window_width - x, ctx->window_height + y);
if (x) {
painter->eraseRect(0, 0, x, ctx->window_height);
}
if (y) {
painter->eraseRect(
x, ctx->window_height + y, ctx->window_width, ctx->window_height);
}
}
}
void FlowDrawQt::set_inputfocus(FlowCtx* ctx)
{
window->setFocus(Qt::OtherFocusReason);
......
......@@ -174,8 +174,6 @@ public:
int get_text_extent(FlowCtx* ctx, const char* text, int len,
flow_eDrawType gc_type, int idx, int* width, int* height, double size);
void copy_area(FlowCtx* ctx, int x, int y);
int create_input(FlowCtx* ctx, int x, int y, char* text, int len, int idx,
int width, int height, void* node, int number, void** data)
{
......
......@@ -1450,37 +1450,9 @@ int FlowCtx::event_handler_nav(flow_eEvent event, int x, int y)
offset_y -= mainwind_delta_y;
a.traverse(mainwind_delta_x, mainwind_delta_y);
fdraw->copy_area(this, mainwind_delta_x, mainwind_delta_y);
// clear();
if (!unobscured)
draw(0, 0, window_width, window_height);
else {
if (mainwind_delta_x >= 0 && mainwind_delta_y >= 0) {
if (mainwind_delta_x)
draw(0, 0, mainwind_delta_x, window_height);
if (mainwind_delta_y)
draw(mainwind_delta_x, 0, window_width, mainwind_delta_y);
} else if (mainwind_delta_x <= 0 && mainwind_delta_y <= 0) {
if (mainwind_delta_x)
draw(window_width + mainwind_delta_x, 0, window_width,
window_height);
if (mainwind_delta_y)
draw(0, window_height + mainwind_delta_y,
window_width + mainwind_delta_x, window_height);
} else if (mainwind_delta_x <= 0 && mainwind_delta_y >= 0) {
if (mainwind_delta_x)
draw(window_width + mainwind_delta_x, 0, window_width,
window_height);
if (mainwind_delta_y)
draw(0, 0, window_width + mainwind_delta_x, mainwind_delta_y);
} else {
if (mainwind_delta_x)
draw(0, 0, mainwind_delta_x, window_height);
if (mainwind_delta_y)
draw(mainwind_delta_x, window_height + mainwind_delta_y,
window_width, window_height);
}
}
clear();
draw(0, 0, window_width, window_height);
change_scrollbar();
} else if (nav_rect_zoom_active) {
int delta_x, delta_y;
......@@ -2290,39 +2262,9 @@ void FlowCtx::scroll(int delta_x, int delta_y)
move_widgets(delta_x, delta_y);
if (window_width <= ABS(delta_x) || window_height <= ABS(delta_y)) {
// Entirely new area
clear();
draw(0, 0, window_width, window_height);
} else {
fdraw->copy_area(this, delta_x, delta_y);
if (!unobscured || widget_cnt)
draw(0, 0, window_width, window_height);
else {
if (delta_x >= 0 && delta_y >= 0) {
if (delta_x)
draw(0, 0, delta_x, window_height);
if (delta_y)
draw(delta_x, 0, window_width, delta_y);
} else if (delta_x <= 0 && delta_y <= 0) {
if (delta_x)
draw(window_width + delta_x, 0, window_width, window_height);
if (delta_y)
draw(0, window_height + delta_y, window_width + delta_x,
window_height);
} else if (delta_x <= 0 && delta_y >= 0) {
if (delta_x)
draw(window_width + delta_x, 0, window_width, window_height);
if (delta_y)
draw(0, 0, window_width + delta_x, delta_y);
} else {
if (delta_x)
draw(0, 0, delta_x, window_height);
if (delta_y)
draw(delta_x, window_height + delta_y, window_width, window_height);
}
}
}
clear();
draw(0, 0, window_width, window_height);
nav_clear();
nav_draw(0, 0, nav_window_width, nav_window_height);
}
......
......@@ -311,10 +311,6 @@ int FlowDraw::get_text_extent(FlowCtx* ctx, const char* text, int len,
return 1;
}
void FlowDraw::copy_area(FlowCtx* ctx, int x, int y)
{
}
int FlowDraw::create_input(FlowCtx* ctx, int x, int y, char* text, int len,
int idx, int width, int height, void* node, int number, void** data)
{
......
......@@ -143,7 +143,6 @@ public:
virtual void set_nav_cursor(FlowCtx* ctx, draw_eCursor cursor);
virtual int get_text_extent(FlowCtx* ctx, const char* text, int len,
flow_eDrawType gc_type, int idx, int* width, int* height, double size);
virtual void copy_area(FlowCtx* ctx, int x, int y);
virtual int create_input(FlowCtx* ctx, int x, int y, char* text, int len,
int idx, int width, int height, void* node, int number, void** data);
virtual int close_input(FlowCtx* ctx, void* data);
......
......@@ -2145,103 +2145,6 @@ int GlowDrawGtk::get_text_extent(const char* text, int len,
return 1;
}
void GlowDrawGtk::copy_area(GlowWind* wind, int x, int y)
{
DrawWindGtk* w = (DrawWindGtk*)wind->window;
GdkGC* gc;
if (ctx->nodraw)
return;
int window_width, window_height;
if (&ctx->mw == wind) {
window_width = ctx->mw.window_width;
window_height = ctx->mw.window_height;
} else {
window_width = ctx->navw.window_width;
window_height = ctx->navw.window_height;
}
gc = get_gc(this, glow_eDrawType_Line, 3);
if (x >= 0 && y >= 0) {
gdk_draw_drawable(w->window, gc, w->window, 0, 0, x, y, window_width - x,
window_height - y);
if (!w->double_buffer_on) {
if (x)
gdk_window_clear_area(w->window, 0, 0, x, window_height);
if (y)
gdk_window_clear_area(w->window, x, 0, window_width, y);
} else {
gdk_draw_drawable(w->buffer, gc, w->buffer, 0, 0, x, y, window_width - x,
window_height - y);
if (x)
gdk_draw_rectangle(w->buffer, get_gc(this, glow_eDrawType_LineErase, 0),
1, 0, 0, x, window_height);
if (y)
gdk_draw_rectangle(w->buffer, get_gc(this, glow_eDrawType_LineErase, 0),
1, x, 0, window_width, y);
}
} else if (x <= 0 && y <= 0) {
gdk_draw_drawable(w->window, gc, w->window, -x, -y, 0, 0, window_width + x,
window_height + y);
if (!w->double_buffer_on) {
if (x)
gdk_window_clear_area(
w->window, window_width + x, 0, window_width, window_height);
if (y)
gdk_window_clear_area(
w->window, 0, window_height + y, window_width + x, window_height);
} else {
gdk_draw_drawable(w->buffer, gc, w->buffer, -x, -y, 0, 0,
window_width + x, window_height + y);
if (x)
gdk_draw_rectangle(w->buffer, get_gc(this, glow_eDrawType_LineErase, 0),
1, window_width + x, 0, -x, window_height);
if (y)
gdk_draw_rectangle(w->buffer, get_gc(this, glow_eDrawType_LineErase, 0),
1, 0, window_height + y, window_width + x, -y);
}
} else if (x <= 0 && y >= 0) {
gdk_draw_drawable(w->window, gc, w->window, -x, 0, 0, y, window_width + x,
window_height - y);
if (!w->double_buffer_on) {
if (x)
gdk_window_clear_area(
w->window, window_width + x, 0, window_width, window_height);
if (y)
gdk_window_clear_area(w->window, 0, 0, window_width + x, y);
} else {
gdk_draw_drawable(w->buffer, gc, w->buffer, -x, 0, 0, y, window_width + x,
window_height - y);
if (x)
gdk_draw_rectangle(w->buffer, get_gc(this, glow_eDrawType_LineErase, 0),
1, window_width + x, 0, -x, window_height);
if (y)
gdk_draw_rectangle(w->buffer, get_gc(this, glow_eDrawType_LineErase, 0),
1, 0, 0, window_width + x, y);
}
} else // x > 0 && y < 0
{
gdk_draw_drawable(w->window, gc, w->window, 0, -y, x, 0, window_width - x,
window_height + y);
if (!w->double_buffer_on) {
if (x)
gdk_window_clear_area(w->window, 0, 0, x, window_height);
if (y)
gdk_window_clear_area(
w->window, x, window_height + y, window_width, window_height);
} else {
gdk_draw_drawable(w->buffer, gc, w->buffer, 0, -y, x, 0, window_width - x,
window_height + y);
if (x)
gdk_draw_rectangle(w->buffer, get_gc(this, glow_eDrawType_LineErase, 0),
1, 0, 0, x, window_height);
if (y)
gdk_draw_rectangle(w->buffer, get_gc(this, glow_eDrawType_LineErase, 0),
1, x, window_height + y, window_width - x, -y);
}
}
}
void GlowDrawGtk::set_inputfocus(GlowWind* wind)
{
DrawWindGtk* w = (DrawWindGtk*)wind->window;
......
......@@ -163,7 +163,6 @@ public:
virtual int get_text_extent(const char* text, int len, glow_eDrawType gc_type,
int idx, glow_eFont font_idx, int* width, int* height, int* descent,
double size, int rot);
virtual void copy_area(GlowWind* w, int x, int y);
virtual void set_inputfocus(GlowWind* w);
virtual void set_background(GlowWind* w, glow_eDrawType drawtype,
glow_tPixmap pixmap, glow_tImImage image, int pixmap_width,
......
......@@ -1610,63 +1610,6 @@ int GlowDrawQt::get_text_extent(const char* text, int len,
return 1;
}
void GlowDrawQt::copy_area(GlowWind* wind, int x, int y)
{
DrawWindQt* w = (DrawWindQt*)wind->window;
if (ctx->nodraw) {
return;
}
int window_width, window_height;
if (&ctx->mw == wind) {
window_width = ctx->mw.window_width;
window_height = ctx->mw.window_height;
} else {
window_width = ctx->navw.window_width;
window_height = ctx->navw.window_height;
}
unique_ptr<QPainter> painterBuffer
= get_painter(w->buffer, this, glow_eDrawType_Line, 3);
if (x >= 0 && y >= 0) {
painterBuffer->drawImage(
x, y, *(w->buffer), 0, 0, window_width - x, window_height - y);
if (x) {
painterBuffer->eraseRect(0, 0, x, window_height);
}
if (y) {
painterBuffer->eraseRect(x, 0, window_width, y);
}
} else if (x <= 0 && y <= 0) {
painterBuffer->drawImage(
0, 0, *(w->buffer), -x, -y, window_width + x, window_height + y);
if (x) {
painterBuffer->eraseRect(window_width + x, 0, -x, window_height);
}
if (y) {
painterBuffer->eraseRect(0, window_height + y, window_width + x, -y);
}
} else if (x <= 0 && y >= 0) {
painterBuffer->drawImage(
0, y, *(w->buffer), -x, 0, window_width + x, window_height - y);
if (x) {
painterBuffer->eraseRect(window_width + x, 0, -x, window_height);
}
if (y) {
painterBuffer->eraseRect(0, 0, window_width + x, y);
}
} else { // x > 0 && y < 0
painterBuffer->drawImage(
x, 0, *(w->buffer), 0, -y, window_width - x, window_height + y);
if (x) {
painterBuffer->eraseRect(0, 0, x, window_height);
}
if (y) {
painterBuffer->eraseRect(x, window_height + y, window_width - x, -y);
}
}
}
void GlowDrawQt::set_inputfocus(GlowWind* wind)
{
DrawWindQt* w = (DrawWindQt*)wind->window;
......
......@@ -167,7 +167,6 @@ public:
virtual int get_text_extent(const char* text, int len,
glow_eDrawType painter_type, int idx, glow_eFont font_idx, int* width,
int* height, int* descent, double size, int rot);
virtual void copy_area(GlowWind* w, int x, int y);
virtual void set_inputfocus(GlowWind* w);
virtual void set_background(GlowWind* w, glow_eDrawType drawtype,
glow_tPixmap pixmap, glow_tImImage image, int pixmap_width,
......
......@@ -1507,38 +1507,9 @@ int GlowCtx::event_handler_nav(glow_eEvent event, int x, int y)
((GrowCtx*)this)->polyline_last_end_y += mainwind_delta_y;
}
gdraw->copy_area(&mw, mainwind_delta_x, mainwind_delta_y);
// clear();
if (!unobscured)
draw(&mw, 0, 0, mw.window_width, mw.window_height);
else {
if (mainwind_delta_x >= 0 && mainwind_delta_y >= 0) {
if (mainwind_delta_x)
draw(&mw, 0, 0, mainwind_delta_x, mw.window_height);
if (mainwind_delta_y)
draw(&mw, mainwind_delta_x, 0, mw.window_width, mainwind_delta_y);
} else if (mainwind_delta_x <= 0 && mainwind_delta_y <= 0) {
if (mainwind_delta_x)
draw(&mw, mw.window_width + mainwind_delta_x, 0, mw.window_width,
mw.window_height);
if (mainwind_delta_y)
draw(&mw, 0, mw.window_height + mainwind_delta_y,
mw.window_width + mainwind_delta_x, mw.window_height);
} else if (mainwind_delta_x <= 0 && mainwind_delta_y >= 0) {
if (mainwind_delta_x)
draw(&mw, mw.window_width + mainwind_delta_x, 0, mw.window_width,
mw.window_height);
if (mainwind_delta_y)
draw(&mw, 0, 0, mw.window_width + mainwind_delta_x,
mainwind_delta_y);
} else {
if (mainwind_delta_x)
draw(&mw, 0, 0, mainwind_delta_x, mw.window_height);
if (mainwind_delta_y)
draw(&mw, mainwind_delta_x, mw.window_height + mainwind_delta_y,
mw.window_width, mw.window_height);
}
}
clear(&mw);
draw(&mw, 0, 0, mw.window_width, mw.window_height);
change_scrollbar();
} else if (nav_rect_zoom_active) {
int delta_x, delta_y;
......@@ -2083,42 +2054,9 @@ void GlowCtx::scroll(int delta_x, int delta_y)
move_widgets(delta_x, delta_y);
if (mw.window_width <= ABS(delta_x) || mw.window_height <= ABS(delta_y)) {
// Entirely new area
clear(&mw);
draw(&mw, 0, 0, mw.window_width, mw.window_height);
} else {
gdraw->copy_area(&mw, delta_x, delta_y);
if (!unobscured || widget_cnt)
draw(&mw, 0, 0, mw.window_width, mw.window_height);
else {
if (delta_x >= 0 && delta_y >= 0) {
if (delta_x)
draw(&mw, 0, 0, delta_x, mw.window_height);
if (delta_y)
draw(&mw, delta_x, 0, mw.window_width, delta_y);
} else if (delta_x <= 0 && delta_y <= 0) {
if (delta_x)
draw(&mw, mw.window_width + delta_x, 0, mw.window_width,
mw.window_height);
if (delta_y)
draw(&mw, 0, mw.window_height + delta_y, mw.window_width + delta_x,
mw.window_height);
} else if (delta_x <= 0 && delta_y >= 0) {
if (delta_x)
draw(&mw, mw.window_width + delta_x, 0, mw.window_width,
mw.window_height);
if (delta_y)
draw(&mw, 0, 0, mw.window_width + delta_x, delta_y);
} else {
if (delta_x)
draw(&mw, 0, 0, delta_x, mw.window_height);
if (delta_y)
draw(&mw, delta_x, mw.window_height + delta_y, mw.window_width,
mw.window_height);
}
}
}
clear(&mw);
draw(&mw, 0, 0, mw.window_width, mw.window_height);
clear(&navw);
draw(&navw, 0, 0, navw.window_width, navw.window_height);
if (ctx_type == glow_eCtxType_Grow) {
......
......@@ -225,38 +225,9 @@ int CurveCtx::event_handler_nav(glow_eEvent event, int x, int y)
((GrowCtx*)this)->polyline_last_end_y += mainwind_delta_y;
}
gdraw->copy_area(&mw, mainwind_delta_x, mainwind_delta_y);
// clear();
if (!unobscured)
draw(&mw, 0, 0, mw.window_width, mw.window_height);
else {
if (mainwind_delta_x >= 0 && mainwind_delta_y >= 0) {
if (mainwind_delta_x)
draw(&mw, 0, 0, mainwind_delta_x, mw.window_height);
if (mainwind_delta_y)
draw(&mw, mainwind_delta_x, 0, mw.window_width, mainwind_delta_y);
} else if (mainwind_delta_x <= 0 && mainwind_delta_y <= 0) {
if (mainwind_delta_x)
draw(&mw, mw.window_width + mainwind_delta_x, 0, mw.window_width,
mw.window_height);
if (mainwind_delta_y)
draw(&mw, 0, mw.window_height + mainwind_delta_y,
mw.window_width + mainwind_delta_x, mw.window_height);
} else if (mainwind_delta_x <= 0 && mainwind_delta_y >= 0) {
if (mainwind_delta_x)
draw(&mw, mw.window_width + mainwind_delta_x, 0, mw.window_width,
mw.window_height);
if (mainwind_delta_y)
draw(&mw, 0, 0, mw.window_width + mainwind_delta_x,
mainwind_delta_y);
} else {
if (mainwind_delta_x)
draw(&mw, 0, 0, mainwind_delta_x, mw.window_height);
if (mainwind_delta_y)
draw(&mw, mainwind_delta_x, mw.window_height + mainwind_delta_y,
mw.window_width, mw.window_height);
}
}
clear(&mw);
draw(&mw, 0, 0, mw.window_width, mw.window_height);
change_scrollbar();
} else if (nav_rect_zoom_active) {
int delta_x, delta_y;
......
......@@ -226,10 +226,6 @@ int GlowDraw::get_text_extent(const char* text, int len, glow_eDrawType gc_type,
return 1;
}
void GlowDraw::copy_area(GlowWind* w, int x, int y)
{
}
void GlowDraw::set_inputfocus(GlowWind* w)
{
}
......
......@@ -115,7 +115,6 @@ public:
virtual int get_text_extent(const char* text, int len, glow_eDrawType gc_type,
int idx, glow_eFont font_idx, int* width, int* height, int* descent,
double size, int rot);
virtual void copy_area(GlowWind* w, int x, int y);
virtual void set_inputfocus(GlowWind* w);
virtual void set_background(GlowWind* w, glow_eDrawType drawtype,
glow_tPixmap pixmap, glow_tImImage image, int pixmap_width,
......
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