summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkoan <jkoan@gmx.de>2022-08-03 17:09:25 +0200
committerjkoan <jkoan@users.noreply.github.com>2022-10-24 06:17:26 +0200
commit5c417f683488570aa12da6d1cbdf983570e1ddb4 (patch)
tree09355e837eb0cc515f5e255db55eac764db3009c
parent3af1e3509f77ad998785b1b27d75f85d067a657b (diff)
downloadnavit-5c417f683488570aa12da6d1cbdf983570e1ddb4.tar.gz
removed:graphics:Remove feature to read image from zip (See #1194)
-rw-r--r--navit/graphics.c56
-rw-r--r--navit/graphics.h11
-rw-r--r--navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c22
3 files changed, 20 insertions, 69 deletions
diff --git a/navit/graphics.c b/navit/graphics.c
index 08de16a1e..4e7b58368 100644
--- a/navit/graphics.c
+++ b/navit/graphics.c
@@ -776,7 +776,7 @@ struct graphics_image * graphics_image_new_scaled(struct graphics *gra, char *pa
}
static void image_new_helper(struct graphics *gra, struct graphics_image *this_, char *path, char *name, int width,
- int height, int rotate, int zip) {
+ int height, int rotate) {
int i=0;
int stdsizes[]= {8,12,16,22,24,32,36,48,64,72,96,128,192,256};
const int numstdsizes=sizeof(stdsizes)/sizeof(int);
@@ -865,42 +865,20 @@ static void image_new_helper(struct graphics *gra, struct graphics_image *this_,
this_->width=width;
this_->height=height;
dbg(lvl_debug,"Trying to load image '%s' for '%s' at %dx%d", new_name, path, width, height);
- if (zip) {
- unsigned char *start;
- int len;
- if (file_get_contents(new_name, &start, &len)) {
- struct graphics_image_buffer buffer= {"buffer:",graphics_image_type_unknown};
- buffer.start=start;
- buffer.len=len;
- this_->hot = graphics_dpi_scale_point(gra,&this_->hot);
- if(this_->width != IMAGE_W_H_UNSET)
- this_->width = graphics_dpi_scale(gra,this_->width);
- if(this_->height != IMAGE_W_H_UNSET)
- this_->height = graphics_dpi_scale(gra,this_->height);
- this_->priv=gra->meth.image_new(gra->priv, &this_->meth, (char *)&buffer, &this_->width, &this_->height, &this_->hot,
- rotate);
- this_->hot = graphics_dpi_unscale_point(gra,&this_->hot);
- if(this_->width != IMAGE_W_H_UNSET)
- this_->width = graphics_dpi_unscale(gra,this_->width);
- if(this_->height != IMAGE_W_H_UNSET)
- this_->height = graphics_dpi_unscale(gra,this_->height);
- g_free(start);
- }
- } else {
- if (strcmp(new_name,"buffer:")) {
- this_->hot = graphics_dpi_scale_point(gra,&this_->hot);
- if(this_->width != IMAGE_W_H_UNSET)
- this_->width = graphics_dpi_scale(gra,this_->width);
- if(this_->height != IMAGE_W_H_UNSET)
- this_->height = graphics_dpi_scale(gra,this_->height);
- this_->priv=gra->meth.image_new(gra->priv, &this_->meth, new_name, &this_->width, &this_->height, &this_->hot, rotate);
- this_->hot = graphics_dpi_unscale_point(gra,&this_->hot);
- if(this_->width != IMAGE_W_H_UNSET)
- this_->width = graphics_dpi_unscale(gra,this_->width);
- if(this_->height != IMAGE_W_H_UNSET)
- this_->height = graphics_dpi_unscale(gra,this_->height);
- }
- }
+
+
+ this_->hot = graphics_dpi_scale_point(gra,&this_->hot);
+ if(this_->width != IMAGE_W_H_UNSET)
+ this_->width = graphics_dpi_scale(gra,this_->width);
+ if(this_->height != IMAGE_W_H_UNSET)
+ this_->height = graphics_dpi_scale(gra,this_->height);
+ this_->priv=gra->meth.image_new(gra->priv, &this_->meth, new_name, &this_->width, &this_->height, &this_->hot, rotate);
+ this_->hot = graphics_dpi_unscale_point(gra,&this_->hot);
+ if(this_->width != IMAGE_W_H_UNSET)
+ this_->width = graphics_dpi_unscale(gra,this_->width);
+ if(this_->height != IMAGE_W_H_UNSET)
+ this_->height = graphics_dpi_unscale(gra,this_->height);
+
if (this_->priv) {
dbg(lvl_info,"Using image '%s' for '%s' at %dx%d", new_name, path, width, height);
g_free(new_name);
@@ -999,9 +977,7 @@ struct graphics_image * graphics_image_new_scaled_rotated(struct graphics *gra,
newheight=h;
name=g_strndup(pathi,s-pathi);
- image_new_helper(gra, this_, pathi, name, newwidth, newheight, rotate, 0);
- if (!this_->priv && strstr(pathi, ".zip/"))
- image_new_helper(gra, this_, pathi, name, newwidth, newheight, rotate, 1);
+ image_new_helper(gra, this_, pathi, name, newwidth, newheight, rotate);
g_free(name);
}
diff --git a/navit/graphics.h b/navit/graphics.h
index 270879df1..83fc1c8c2 100644
--- a/navit/graphics.h
+++ b/navit/graphics.h
@@ -54,17 +54,6 @@ struct graphics_font_methods;
struct graphics_gc_methods;
struct graphics_image_methods;
-enum graphics_image_type {
- graphics_image_type_unknown=0,
-};
-
-struct graphics_image_buffer {
- char magic[8]; /* buffer:\0 */
- enum graphics_image_type type;
- void *start;
- int len;
-};
-
struct graphics_keyboard_priv;
/**
diff --git a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
index e9d34dd82..896eebb1d 100644
--- a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
+++ b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
@@ -228,24 +228,10 @@ static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct gr
struct graphics_image_priv *ret;
const char *option;
- if (!strcmp(name,"buffer:")) {
- struct graphics_image_buffer *buffer=(struct graphics_image_buffer *)name;
- GdkPixbufLoader *loader=gdk_pixbuf_loader_new();
- if (!loader)
- return NULL;
- if (*w != IMAGE_W_H_UNSET || *h != IMAGE_W_H_UNSET)
- gdk_pixbuf_loader_set_size(loader, *w, *h);
- gdk_pixbuf_loader_write(loader, buffer->start, buffer->len, NULL);
- gdk_pixbuf_loader_close(loader, NULL);
- pixbuf=gdk_pixbuf_loader_get_pixbuf(loader);
- g_object_ref(pixbuf);
- g_object_unref(loader);
- } else {
- if (*w == IMAGE_W_H_UNSET && *h == IMAGE_W_H_UNSET)
- pixbuf=gdk_pixbuf_new_from_file(name, NULL);
- else
- pixbuf=gdk_pixbuf_new_from_file_at_size(name, *w, *h, NULL);
- }
+ if (*w == IMAGE_W_H_UNSET && *h == IMAGE_W_H_UNSET)
+ pixbuf=gdk_pixbuf_new_from_file(name, NULL);
+ else
+ pixbuf=gdk_pixbuf_new_from_file_at_size(name, *w, *h, NULL);
if (!pixbuf)
return NULL;