Commit 32e2ff9c authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

contact sheet: fixed painting of the scaled image

parent 9f8e5874
......@@ -880,7 +880,6 @@ static void
load_current_image (GthContactSheetCreator *self)
{
ItemData *item_data;
int requested_size;
if (self->priv->current_file == NULL) {
if (self->priv->sort_type->cmp_func != 0)
......@@ -898,16 +897,9 @@ load_current_image (GthContactSheetCreator *self)
FALSE,
((double) ++self->priv->n_loaded_files) / (self->priv->n_files + 1));
if (self->priv->squared_thumbnails)
/* the squared thumbnail requires the original size to avoid
* a thumbnail upscaling that degrades the image quality. */
requested_size = -1;
else
requested_size = MAX (self->priv->thumb_height, self->priv->thumb_width);
gth_image_loader_load (self->priv->image_loader,
item_data->file_data,
requested_size,
-1,
G_PRIORITY_DEFAULT,
gth_task_get_cancellable (GTH_TASK (self)),
image_loader_ready_cb,
......@@ -943,10 +935,19 @@ image_loader_ready_cb (GObject *source_object,
image_surface = gth_image_get_cairo_surface (image);
item_data = self->priv->current_file->data;
if (self->priv->squared_thumbnails)
if (self->priv->squared_thumbnails) {
item_data->thumbnail = _cairo_image_surface_scale_squared (image_surface, MIN (self->priv->thumb_height, self->priv->thumb_width), SCALE_FILTER_BEST, NULL);
else
item_data->thumbnail = cairo_surface_reference (image_surface);
}
else {
int width, height;
width = cairo_image_surface_get_width (image_surface);
height = cairo_image_surface_get_height (image_surface);
if (scale_keeping_ratio (&width, &height, self->priv->thumb_width, self->priv->thumb_height, FALSE))
item_data->thumbnail = _cairo_image_surface_scale (image_surface, width, height, SCALE_FILTER_BEST, NULL);
else
item_data->thumbnail = cairo_surface_reference (image_surface);
}
item_data->original_width = original_width;
item_data->original_height = original_height;
......
......@@ -875,23 +875,21 @@ _cairo_draw_slide (cairo_t *cr,
image_height);
cairo_fill (cr);
image_x -= 1;
image_y -= 1;
image_x2 = image_x + image_width + 2;
image_y2 = image_y + image_height + 2;
image_x2 = image_x + image_width + 1;
image_y2 = image_y + image_height + 1;
cairo_set_source_rgb (cr, dark_gray, dark_gray, dark_gray);
cairo_move_to (cr, image_x, image_y);
cairo_line_to (cr, image_x2 - 1, image_y);
cairo_line_to (cr, image_x2, image_y);
cairo_move_to (cr, image_x, image_y);
cairo_line_to (cr, image_x, image_y2 - 1);
cairo_line_to (cr, image_x, image_y2);
cairo_stroke (cr);
cairo_set_source_rgb (cr, mid_gray, mid_gray, mid_gray);
cairo_move_to (cr, image_x2 - 1, image_y - 1);
cairo_line_to (cr, image_x2 - 1, image_y2 - 1);
cairo_move_to (cr, image_x, image_y2 - 1);
cairo_line_to (cr, image_x2, image_y2 - 1);
cairo_move_to (cr, image_x2, image_y);
cairo_line_to (cr, image_x2, image_y2);
cairo_move_to (cr, image_x, image_y2);
cairo_line_to (cr, image_x2, image_y2);
cairo_stroke (cr);
}
}
......@@ -899,31 +897,31 @@ _cairo_draw_slide (cairo_t *cr,
/* outer border. */
cairo_set_source_rgb (cr, mid_gray, mid_gray, mid_gray);
cairo_move_to (cr, frame_x - 1, frame_y);
cairo_move_to (cr, frame_x, frame_y);
cairo_line_to (cr, frame_x2, frame_y);
cairo_move_to (cr, frame_x, frame_y - 1);
cairo_move_to (cr, frame_x, frame_y);
cairo_line_to (cr, frame_x, frame_y2);
cairo_stroke (cr);
cairo_set_source_rgb (cr, darker_gray, darker_gray, darker_gray);
cairo_move_to (cr, frame_x2, frame_y - 1);
cairo_move_to (cr, frame_x2, frame_y);
cairo_line_to (cr, frame_x2, frame_y2);
cairo_move_to (cr, frame_x - 1, frame_y2);
cairo_move_to (cr, frame_x, frame_y2);
cairo_line_to (cr, frame_x2, frame_y2);
cairo_stroke (cr);
cairo_set_source_rgb (cr, light_gray, light_gray, light_gray);
cairo_move_to (cr, frame_x, frame_y + 1);
cairo_line_to (cr, frame_x2 - 1, frame_y + 1);
cairo_move_to (cr, frame_x + 1, frame_y);
cairo_line_to (cr, frame_x + 1, frame_y2 - 1);
cairo_move_to (cr, frame_x, frame_y);
cairo_line_to (cr, frame_x2, frame_y);
cairo_move_to (cr, frame_x, frame_y);
cairo_line_to (cr, frame_x, frame_y2);
cairo_stroke (cr);
cairo_set_source_rgb (cr, dark_gray, dark_gray, dark_gray);
cairo_move_to (cr, frame_x2 - 1, frame_y);
cairo_line_to (cr, frame_x2 - 1, frame_y2 - 1);
cairo_move_to (cr, frame_x, frame_y2 - 1);
cairo_line_to (cr, frame_x2 - 1, frame_y2 - 1);
cairo_move_to (cr, frame_x2, frame_y);
cairo_line_to (cr, frame_x2, frame_y2);
cairo_move_to (cr, frame_x, frame_y2);
cairo_line_to (cr, frame_x2, frame_y2);
cairo_stroke (cr);
cairo_restore (cr);
......
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