[librsvg: 3/6] image_surface_new_from_href(): Don't get the mime_type from the pixbuf loader



commit d8173c30a34dcb21dcd57d5acfcac16ad807fcdc
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Nov 23 17:53:57 2018 -0600

    image_surface_new_from_href(): Don't get the mime_type from the pixbuf loader
    
    This is kind of iffy, since the loader may support multiple MIME-types
    but we only use the first one it reports.
    
    We'll move to sniffing the data on our own.

 rsvg_internals/src/handle.rs | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
---
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index 0f4e3895..c6b91429 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -143,21 +143,7 @@ pub fn image_surface_new_from_href(
     let surface = SharedImageSurface::from_pixbuf(&pixbuf)?.into_image_surface()?;
 
     if keep_image_data(handle) {
-        let mime_type = data.content_type.or_else(|| {
-            // Try to get the content type from the loader
-
-            loader.get_format().and_then(|format| {
-                let content_types = format.get_mime_types();
-
-                if content_types.len() != 0 {
-                    Some(content_types[0].clone())
-                } else {
-                    None
-                }
-            })
-        });
-
-        if let Some(mime_type) = mime_type {
+        if let Some(mime_type) = data.content_type {
             extern "C" {
                 fn cairo_surface_set_mime_data(
                     surface: *mut cairo_sys::cairo_surface_t,


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