[recipes] Drop no longer needed rotation code
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Drop no longer needed rotation code
- Date: Sun, 19 Feb 2017 01:11:45 +0000 (UTC)
commit 21dfc064d5cd2fdbf4d4a61373d952d553334238
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 18 19:12:10 2017 -0500
Drop no longer needed rotation code
Since we now always rotate images in the file system, we
no longer need to write out a rotated image to the cache
for the css.
src/gr-recipe-tile.c | 3 +--
src/gr-utils.c | 47 -----------------------------------------------
src/gr-utils.h | 3 ---
3 files changed, 1 insertions(+), 52 deletions(-)
---
diff --git a/src/gr-recipe-tile.c b/src/gr-recipe-tile.c
index 46da62d..02ed712 100644
--- a/src/gr-recipe-tile.c
+++ b/src/gr-recipe-tile.c
@@ -75,11 +75,10 @@ add_recipe_css (GrRecipe *recipe,
ri = &g_array_index (images, GrRotatedImage, index);
- path = ensure_rotated_image (ri->path, ri->angle);
g_string_append_printf (css, "image.recipe.small.%s,\nbox.recipe.%s {\n", id, id);
g_string_append_printf (css, " background: url('%s');\n"
" background-size: cover;\n"
- " background-position: center;\n", path);
+ " background-position: center;\n", ri->path);
g_string_append (css, "}\n\n");
}
}
diff --git a/src/gr-utils.c b/src/gr-utils.c
index 739d040..83ecc19 100644
--- a/src/gr-utils.c
+++ b/src/gr-utils.c
@@ -484,53 +484,6 @@ portals_available (void)
return owner != NULL;
}
-char *
-ensure_rotated_image (const char *path,
- int angle)
-{
- g_autofree char *rotated = NULL;
- g_autofree char *basename = NULL;
- g_autofree char *subdir = NULL;
- g_autofree char *dir = NULL;
-
- if (angle == 0)
- return g_strdup (path);
-
- basename = g_path_get_basename (path);
- subdir = g_strdup_printf ("images%d", angle);
-
- dir = g_build_filename (g_get_user_cache_dir (), PACKAGE_NAME, subdir, NULL);
- g_mkdir_with_parents (dir, S_IRWXU | S_IRWXG | S_IRWXO);
-
- rotated = g_build_filename (dir, basename, NULL);
- if (!g_file_test (rotated, G_FILE_TEST_EXISTS)) {
- g_autoptr(GdkPixbuf) original = NULL;
- g_autoptr(GdkPixbuf) pb = NULL;
- g_autoptr(GError) error = NULL;
- const char *format;
-
- original = gdk_pixbuf_new_from_file (path, &error);
- if (original == NULL) {
- g_message ("Failed to load image from %s: %s", path, error->message);
- return NULL;
- }
-
- pb = gdk_pixbuf_rotate_simple (original, angle);
-
- if (g_str_has_suffix (path, ".jpg"))
- format = "jpeg";
- else
- format = "png";
-
- if (!gdk_pixbuf_save (pb, rotated, format, &error, NULL)) {
- g_message ("Failed to save rotated image to %s: %s", rotated, error->message);
- return NULL;
- }
- }
-
- return g_strdup (rotated);
-}
-
void
all_headers (GtkListBoxRow *row,
GtkListBoxRow *before,
diff --git a/src/gr-utils.h b/src/gr-utils.h
index 5ff7ab3..d077726 100644
--- a/src/gr-utils.h
+++ b/src/gr-utils.h
@@ -34,9 +34,6 @@ GdkPixbuf *load_pixbuf_fill_size (const char *path,
int width,
int height);
-char *ensure_rotated_image (const char *path,
- int angle);
-
const char *get_pkg_data_dir (void);
const char *get_user_data_dir (void);
const char *get_old_user_data_dir (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]