diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/displaywindow.c | 23 | ||||
-rw-r--r-- | src/render.c | 6 |
2 files changed, 24 insertions, 5 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c index cb985b64..1c60add6 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -116,6 +116,8 @@ static gboolean displaywindow_expose(GtkWidget *da, GdkEventExpose *event, { cairo_t *cr; int i; + cairo_matrix_t basic_m; + cairo_matrix_t m; cr = gdk_cairo_create(da->window); @@ -125,6 +127,14 @@ static gboolean displaywindow_expose(GtkWidget *da, GdkEventExpose *event, cairo_set_source_rgb(cr, 0.5, 0.5, 0.5); cairo_fill(cr); + /* Set up basic coordinate system + * - origin in the centre, y upwards. */ + cairo_identity_matrix(cr); + cairo_translate(cr, dw->width/2.0, dw->height/2.0); + cairo_matrix_init(&m, 1.0, 0.0, 0.0, -1.0, 0.0, 0.0); + cairo_transform(cr, &m); + cairo_get_matrix(cr, &basic_m); + if ( dw->pixbufs != NULL ) { int i; @@ -136,10 +146,13 @@ static gboolean displaywindow_expose(GtkWidget *da, GdkEventExpose *event, int h = gdk_pixbuf_get_height(dw->pixbufs[i]); cairo_matrix_t m; - cairo_identity_matrix(cr); - cairo_translate(cr, dw->width/2.0, dw->height/2.0); + /* Start with the basic coordinate system */ + cairo_set_matrix(cr, &basic_m); + + /* Move to the right location */ cairo_translate(cr, p.cx/dw->binning, p.cy/dw->binning); + /* Twiddle directions according to matrix */ cairo_matrix_init(&m, p.fsx, p.fsy, p.ssx, p.ssy, 0.0, 0.0); cairo_transform(cr, &m); @@ -153,6 +166,12 @@ static gboolean displaywindow_expose(GtkWidget *da, GdkEventExpose *event, } + cairo_identity_matrix(cr); + cairo_translate(cr, dw->width/2.0, dw->height/2.0); + cairo_arc(cr, 0.0, 0.0, 5.0/dw->binning, 0.0, 2.0*M_PI); + cairo_set_source_rgb(cr, 1.0, 0.0, 0.0); + cairo_fill(cr); + if ( (dw->show_col_scale) && (dw->col_scale != NULL) ) { cairo_identity_matrix(cr); cairo_translate(cr, dw->width, 0.0); diff --git a/src/render.c b/src/render.c index 96fab6d2..eeeda871 100644 --- a/src/render.c +++ b/src/render.c @@ -348,9 +348,9 @@ static GdkPixbuf *render_panel(struct image *image, /* Stuff inside square brackets makes this pixel go to * the expected location in the pixbuf (which measures * from the top-left corner */ - data[3*( x+w*(h-1-y) )+0] = 255*r; - data[3*( x+w*(h-1-y) )+1] = 255*g; - data[3*( x+w*(h-1-y) )+2] = 255*b; + data[3*( x+w*y )+0] = 255*r; + data[3*( x+w*y )+1] = 255*g; + data[3*( x+w*y )+2] = 255*b; } } |