[gnome-photos/wip/rishi/misc-fixes: 7/11] base-item: Save everything other than PNGs as JPEGs



commit 4afaa85fa6056c67892c9164089a5a6ab8646692
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Jan 2 16:56:42 2016 +0100

    base-item: Save everything other than PNGs as JPEGs
    
    This is a reasonable strategy to start with. It let's us avoid writing
    size guessing code for every possible image format out there. Apart
    from RAW images, PNGs and JPEGs are the most common formats out there,
    and JPEG is a good option for exporting RAWs.
    
    We can add support for more formats as we go along.

 src/photos-base-item.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 4fed453..2c4e8eb 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -1,7 +1,7 @@
 /*
  * Photos - access, organize and share your photos on GNOME
  * Copyright © 2014, 2015 Pranav Kant
- * Copyright © 2012, 2013, 2014, 2015 Red Hat, Inc.
+ * Copyright © 2012, 2013, 2014, 2015, 2016 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -2175,7 +2175,7 @@ photos_base_item_save_async (PhotosBaseItem *self,
   GeglBuffer *buffer;
   GeglNode *graph;
   PhotosBaseItemSaveData *data;
-  gchar *type = NULL;
+  const gchar *type;
 
   g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
   priv = self->priv;
@@ -2188,8 +2188,10 @@ photos_base_item_save_async (PhotosBaseItem *self,
   g_return_if_fail (priv->processor != NULL);
   g_return_if_fail (!gegl_processor_work (priv->processor, NULL));
 
-  type = photos_utils_get_pixbuf_type_from_mime_type (priv->mime_type);
-  g_return_if_fail (type != NULL);
+  if (g_strcmp0 (priv->mime_type, "image/png") == 0)
+    type = "png";
+  else
+    type = "jpeg";
 
   data = photos_base_item_save_data_new (dir, type);
 
@@ -2205,7 +2207,6 @@ photos_base_item_save_async (PhotosBaseItem *self,
                                   photos_base_item_save_buffer_zoom,
                                   g_object_ref (task));
 
-  g_free (type);
   g_object_unref (buffer);
   g_object_unref (task);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]