Skip to content

Commit

Permalink
main,callbacks: rename temp_buffer to aux_backbuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
bk138 committed Mar 2, 2024
1 parent d370033 commit 4ef95c5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ void on_monitors_changed ( GdkScreen *screen,
cairo_surface_destroy(data->backbuffer);
data->backbuffer = new_shape;

// recreate temp_buffer
cairo_surface_destroy(data->temp_buffer);
data->temp_buffer = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, data->width, data->height);
// recreate auxiliary backbuffer
cairo_surface_destroy(data->aux_backbuffer);
data->aux_backbuffer = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, data->width, data->height);

/*
these depend on the shape surface
Expand Down Expand Up @@ -283,7 +283,7 @@ gboolean on_buttonpress (GtkWidget *win,
// store original state to have dynamic update of line and rect
if (type == GROMIT_LINE || type == GROMIT_RECT)
{
copy_surface(data->temp_buffer, data->backbuffer);
copy_surface(data->aux_backbuffer, data->backbuffer);
}

devdata->lastx = ev->x;
Expand Down Expand Up @@ -392,7 +392,7 @@ gboolean on_motion (GtkWidget *win,
if(devdata->motion_time > 0)
{
if (type == GROMIT_LINE || type == GROMIT_RECT) {
copy_surface(data->backbuffer, data->temp_buffer);
copy_surface(data->backbuffer, data->aux_backbuffer);
GdkRectangle rect = {0, 0, data->width, data->height};
gdk_window_invalidate_rect(gtk_widget_get_window(data->win), &rect, 0);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ void setup_main_app (GromitData *data, int argc, char ** argv)
}

// original state for LINE and RECT tool
cairo_surface_destroy(data->temp_buffer);
data->temp_buffer = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, data->width, data->height);
cairo_surface_destroy(data->aux_backbuffer);
data->aux_backbuffer = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, data->width, data->height);

/* EVENTS */
gtk_widget_add_events (data->win, GROMIT_WINDOW_EVENTS);
Expand Down
3 changes: 2 additions & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ typedef struct
GHashTable *tool_config;

cairo_surface_t *backbuffer;
/* Auxiliary backbuffer for tools like LINE or RECT */
cairo_surface_t *aux_backbuffer;

GHashTable *devdatatable;

Expand All @@ -146,7 +148,6 @@ typedef struct
cairo_surface_t *undobuffer[GROMIT_MAX_UNDO];
gint undo_head, undo_depth, redo_depth;

cairo_surface_t *temp_buffer;

gboolean show_intro_on_startup;

Expand Down

0 comments on commit 4ef95c5

Please sign in to comment.