Commit 8e74db9c authored by Christoffer Ackelman's avatar Christoffer Ackelman

GTK: Minor optimization of subwindow drawing.

parent 7df9937e
......@@ -1216,12 +1216,14 @@ int GlowDrawGtk::begin(DrawWind *w) {
return 0;
}
void GlowDrawGtk::end() {
int width, height;
gdk_drawable_get_size(w->buffer, &width, &height);
void GlowDrawGtk::end(bool flush) {
if (flush) {
int width, height;
gdk_drawable_get_size(w->buffer, &width, &height);
gdk_draw_drawable(w->window, get_gc(this, glow_eDrawType_Line, 0), w->buffer,
0, 0, 0, 0, width, height);
gdk_draw_drawable(w->window, get_gc(this, glow_eDrawType_Line, 0), w->buffer,
0, 0, 0, 0, width, height);
}
this->w = NULL;
}
......
......@@ -114,7 +114,7 @@ public:
void clear();
int begin(DrawWind* wind);
void end();
void end(bool flush = true);
void get_window_size(DrawWind* w, int* width, int* height);
void set_window_size(DrawWind* w, int width, int height);
......
......@@ -877,7 +877,7 @@ int GlowDrawQt::begin(DrawWind *w) {
return 0;
}
void GlowDrawQt::end() {
void GlowDrawQt::end(bool flush) {
this->w = NULL;
}
......
......@@ -110,7 +110,7 @@ public:
void clear();
int begin(DrawWind *w);
void end();
void end(bool flush = true);
void get_window_size(DrawWind* w, int* width, int* height);
void set_window_size(DrawWind* w, int width, int height);
......
......@@ -81,7 +81,7 @@ public:
virtual void set_window_size(DrawWind* w, int width, int height) = 0;
virtual int begin(DrawWind* wind) = 0;
virtual void end() = 0;
virtual void end(bool flush = true) = 0;
virtual void rect(int x, int y, int width, int height, glow_eDrawType gc_type,
int fill, int idx, int highlight = 0) = 0;
......
......@@ -168,11 +168,10 @@ void GrowCtx::set_mode(grow_eMode grow_mode)
int GrowCtx::subw_event_handler(glow_eEvent event, int x, int y, int w, int h)
{
int i;
double fx, fy;
int sts;
fx = double(x + mw->offset_x) / mw->zoom_factor_x;
fy = double(y + mw->offset_y) / mw->zoom_factor_y;
double fx = double(x + mw->offset_x) / mw->zoom_factor_x;
double fy = double(y + mw->offset_y) / mw->zoom_factor_y;
if (has_subwindows == -1) {
// Initialize
......@@ -258,14 +257,10 @@ int GrowCtx::event_handler(glow_eEvent event, int x, int y, int w, int h)
{
int sts = 0;
int i;
GlowCtx* ctx;
int node_move_event = 0;
double fx, fy;
ctx = this;
fx = double(x + ctx->mw->offset_x) / ctx->mw->zoom_factor_x;
fy = double(y + ctx->mw->offset_y) / ctx->mw->zoom_factor_y;
double fx = double(x + mw->offset_x) / mw->zoom_factor_x;
double fy = double(y + mw->offset_y) / mw->zoom_factor_y;
callback_object_type = glow_eObjectType_NoObject;
callback_object = 0;
......@@ -1555,13 +1550,13 @@ int GrowCtx::event_handler(glow_eEvent event, int x, int y, int w, int h)
} else if (select_rect_active && edit_mode != grow_eMode_Scale) {
glow_eSelectPolicy policy;
if (ctx->select_policy == glow_eSelectPolicy_Both) {
if (select_policy == glow_eSelectPolicy_Both) {
if (x < select_rect_start_x)
policy = glow_eSelectPolicy_Partial;
else
policy = glow_eSelectPolicy_Surround;
} else
policy = ctx->select_policy;
policy = select_policy;
select_rect_active = 0;
select_rect_last_x = x;
......@@ -1745,12 +1740,11 @@ int GrowCtx::event_handler(glow_eEvent event, int x, int y, int w, int h)
cursor_present = 0;
if (node_movement_active || con_create_active || select_rect_active
|| node_movement_paste_active) {
if (x < 0 || x > ctx->mw->window_width || y < 0 || y > mw->window_height) {
if (x < 0 || x > mw->window_width || y < 0 || y > mw->window_height) {
/* Start auto scrolling */
auto_scrolling(this);
}
} else if (x < 0 || x > ctx->mw->window_width || y < 0
|| y > mw->window_height)
} else if (x < 0 || x > mw->window_width || y < 0 || y > mw->window_height)
a.set_hot(0);
tiptext->remove();
break;
......
......@@ -323,7 +323,11 @@ void GrowWindow::draw(DrawWind* w, GlowTransform* t, int highlight, int hot,
ctx->gdraw->rect(
ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, fill_drawtype, 1, 0);
ctx->gdraw->end(false);
ctx->gdraw->begin(window_ctx->mw);
window_ctx->draw(window_ctx->mw, ll_x, ll_y, ur_x, ur_y);
ctx->gdraw->end(false);
ctx->gdraw->begin(w);
ctx->gdraw->pop_customcolors();
}
......
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