View | Details | Raw Unified | Return to bug 150534
Collapse All | Expand All

(-)xzgv-0.9.1.orig/src/backend.c (+24 lines)
Lines 31-36 Link Here
31
#include <string.h>
31
#include <string.h>
32
#include <time.h>
32
#include <time.h>
33
#include <gtk/gtk.h>
33
#include <gtk/gtk.h>
34
#include <libexif/exif-data.h>
34
35
35
#include "backend.h"
36
#include "backend.h"
36
37
Lines 234-239 public_info_update(im); Link Here
234
return(im);
235
return(im);
235
}
236
}
236
237
238
int backend_get_orientation_from_file(char *filename)
239
{
240
GdkPixbufFormat *imform;
241
gchar *format;
242
ExifData *ed;
243
ExifEntry *entry;
244
ExifByteOrder bo;
245
ExifShort orient;
246
static const ExifShort xzgv_orient[]={0,0,1,3,2,7,4,6,5};
247
248
if((imform=gdk_pixbuf_get_file_info(filename,NULL,NULL))==NULL) return 0;
249
if((format=gdk_pixbuf_format_get_name(imform))==NULL) return 0;
250
if(!strcmp(format, "jpeg") || !strcmp(format, "tiff"))
251
  {
252
  if((ed=exif_data_new_from_file(filename))==NULL) return 0;
253
  if((entry=exif_data_get_entry(ed,EXIF_TAG_ORIENTATION))==NULL) return 0;
254
  if((orient=exif_get_short(entry->data,exif_data_get_byte_order(ed)))>sizeof(xzgv_orient)-1) return 0;
255
  orient=xzgv_orient[orient];
256
  return (int)orient;
257
  }
258
return 0;
259
}
260
237
261
238
/* render image at (x,y) in window (at actual size).
262
/* render image at (x,y) in window (at actual size).
239
 * This is a fairly high-level one, but most backends will probably
263
 * This is a fairly high-level one, but most backends will probably
(-)xzgv-0.9.1.orig/src/backend.h (+1 lines)
Lines 30-35 extern xzgv_image *backend_create_image_ Link Here
30
extern xzgv_image *backend_create_image_from_data_destructively(
30
extern xzgv_image *backend_create_image_from_data_destructively(
31
  unsigned char *rgb,int w,int h);
31
  unsigned char *rgb,int w,int h);
32
extern xzgv_image *backend_create_image_from_file(char *filename);
32
extern xzgv_image *backend_create_image_from_file(char *filename);
33
extern int backend_get_orientation_from_file(char *filename);
33
extern void backend_render_image_into_window(xzgv_image *image,GdkWindow *win,
34
extern void backend_render_image_into_window(xzgv_image *image,GdkWindow *win,
34
                                             int x,int y);
35
                                             int x,int y);
35
extern int backend_render_pixmap_for_image(xzgv_image *image,int x,int y);
36
extern int backend_render_pixmap_for_image(xzgv_image *image,int x,int y);
(-)xzgv-0.9.1.orig/src/main.c (+2 lines)
Lines 359-364 int origw,origh; Link Here
359
jpeg_exif_orient=0;
359
jpeg_exif_orient=0;
360
360
361
ret=backend_create_image_from_file(file);	/* use backend's loader */
361
ret=backend_create_image_from_file(file);	/* use backend's loader */
362
if((ret != NULL) && use_exif_orient) jpeg_exif_orient=backend_get_orientation_from_file(file);
363
362
origw=0; origh=0;
364
origw=0; origh=0;
363
if(ret)
365
if(ret)
364
  {
366
  {
(-)xzgv-0.9.1.orig/src/Makefile (-2 / +4 lines)
Lines 9-16 Link Here
9
# This gets definitions for CC, CFLAGS, BINDIR etc.
9
# This gets definitions for CC, CFLAGS, BINDIR etc.
10
include ../config.mk
10
include ../config.mk
11
11
12
CFLAGS+=`pkg-config --cflags gtk+-2.0` `pkg-config --cflags gdk-pixbuf-2.0`
12
CFLAGS+=`pkg-config --cflags gtk+-2.0` `pkg-config --cflags gdk-pixbuf-2.0` `pkg-config --cflags libexif`
13
LDFLAGS+=`pkg-config --libs gtk+-2.0` `pkg-config --libs gdk-pixbuf-2.0`
13
14
LDFLAGS+=`pkg-config --libs gtk+-2.0` `pkg-config --libs gdk-pixbuf-2.0` `pkg-config --libs libexif`
15
14
16
15
all: xzgv
17
all: xzgv
16
18

Return to bug 150534