diff options
author | Laurent Napias <[email protected]> | 2019-06-29 10:43:23 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-07-01 17:07:40 +0200 |
commit | aa24676651f8bd3e8b434f72d5aac98e84c0867d (patch) | |
tree | 37693766ecb4733c6061dcc2ddc26954fab5ca01 /backend/tiff/tiff-document.c | |
parent | 6741c5db1e5c48c01b25bb7900dc40d48552925d (diff) | |
download | atril-aa24676651f8bd3e8b434f72d5aac98e84c0867d.tar.bz2 atril-aa24676651f8bd3e8b434f72d5aac98e84c0867d.tar.xz |
Remove trailing whitespaces
Diffstat (limited to 'backend/tiff/tiff-document.c')
-rw-r--r-- | backend/tiff/tiff-document.c | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/backend/tiff/tiff-document.c b/backend/tiff/tiff-document.c index 0aa31cb6..3d273fee 100644 --- a/backend/tiff/tiff-document.c +++ b/backend/tiff/tiff-document.c @@ -47,7 +47,7 @@ struct _TiffDocument TIFF *tiff; gint n_pages; TIFF2PSContext *ps_export_ctx; - + gchar *uri; }; @@ -89,22 +89,22 @@ tiff_document_load (EvDocument *document, TiffDocument *tiff_document = TIFF_DOCUMENT (document); gchar *filename; TIFF *tiff; - + filename = g_filename_from_uri (uri, NULL, error); if (!filename) return FALSE; - + push_handlers (); tiff = TIFFOpen (filename, "r"); if (tiff) { guint32 w, h; - + /* FIXME: unused data? why bother here */ TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h); } - + if (!tiff) { pop_handlers (); @@ -116,12 +116,12 @@ tiff_document_load (EvDocument *document, g_free (filename); return FALSE; } - + tiff_document->tiff = tiff; g_free (tiff_document->uri); g_free (filename); tiff_document->uri = g_strdup (uri); - + pop_handlers (); return TRUE; } @@ -130,24 +130,24 @@ static gboolean tiff_document_save (EvDocument *document, const char *uri, GError **error) -{ +{ TiffDocument *tiff_document = TIFF_DOCUMENT (document); - return ev_xfer_uri_simple (tiff_document->uri, uri, error); + return ev_xfer_uri_simple (tiff_document->uri, uri, error); } static int tiff_document_get_n_pages (EvDocument *document) { TiffDocument *tiff_document = TIFF_DOCUMENT (document); - + g_return_val_if_fail (TIFF_IS_DOCUMENT (document), 0); g_return_val_if_fail (tiff_document->tiff != NULL, 0); - + if (tiff_document->n_pages == -1) { push_handlers (); tiff_document->n_pages = 0; - + do { tiff_document->n_pages ++; } @@ -165,7 +165,7 @@ tiff_document_get_resolution (TiffDocument *tiff_document, { gfloat x = 72.0, y = 72.0; gushort unit; - + if (TIFFGetField (tiff_document->tiff, TIFFTAG_XRESOLUTION, &x) && TIFFGetField (tiff_document->tiff, TIFFTAG_YRESOLUTION, &y)) { if (TIFFGetFieldDefaulted (tiff_document->tiff, TIFFTAG_RESOLUTIONUNIT, &unit)) { @@ -189,24 +189,24 @@ tiff_document_get_page_size (EvDocument *document, guint32 w, h; gfloat x_res, y_res; TiffDocument *tiff_document = TIFF_DOCUMENT (document); - + g_return_if_fail (TIFF_IS_DOCUMENT (document)); g_return_if_fail (tiff_document->tiff != NULL); - + push_handlers (); if (TIFFSetDirectory (tiff_document->tiff, page->index) != 1) { pop_handlers (); return; } - + TIFFGetField (tiff_document->tiff, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField (tiff_document->tiff, TIFFTAG_IMAGELENGTH, &h); tiff_document_get_resolution (tiff_document, &x_res, &y_res); h = h * (x_res / y_res); - + *width = w; *height = h; - + pop_handlers (); } @@ -224,10 +224,10 @@ tiff_document_render (EvDocument *document, cairo_surface_t *surface; cairo_surface_t *rotated_surface; static const cairo_user_data_key_t key; - + g_return_val_if_fail (TIFF_IS_DOCUMENT (document), NULL); g_return_val_if_fail (tiff_document->tiff != NULL, NULL); - + push_handlers (); if (TIFFSetDirectory (tiff_document->tiff, rc->page->index) != 1) { pop_handlers (); @@ -252,9 +252,9 @@ tiff_document_render (EvDocument *document, } tiff_document_get_resolution (tiff_document, &x_res, &y_res); - + pop_handlers (); - + /* Sanity check the doc */ if (width <= 0 || height <= 0) { g_warning("Invalid width or height."); @@ -265,22 +265,22 @@ tiff_document_render (EvDocument *document, if (rowstride / 4 != width) { g_warning("Overflow while rendering document."); /* overflow, or cairo was changed in an unsupported way */ - return NULL; + return NULL; } - + bytes = height * rowstride; if (bytes / rowstride != height) { g_warning("Overflow while rendering document."); /* overflow */ return NULL; } - + pixels = g_try_malloc (bytes); if (!pixels) { g_warning("Failed to allocate memory for rendering."); return NULL; } - + surface = cairo_image_surface_create_for_data (pixels, CAIRO_FORMAT_RGB24, width, height, @@ -315,7 +315,7 @@ tiff_document_render (EvDocument *document, (height * rc->scale * (x_res / y_res)) + 0.5, rc->rotation); cairo_surface_destroy (surface); - + return rotated_surface; } @@ -331,7 +331,7 @@ tiff_document_render_pixbuf (EvDocument *document, GdkPixbuf *pixbuf; GdkPixbuf *scaled_pixbuf; GdkPixbuf *rotated_pixbuf; - + push_handlers (); if (TIFFSetDirectory (tiff_document->tiff, rc->page->index) != 1) { pop_handlers (); @@ -349,28 +349,28 @@ tiff_document_render_pixbuf (EvDocument *document, } tiff_document_get_resolution (tiff_document, &x_res, &y_res); - + pop_handlers (); - + /* Sanity check the doc */ if (width <= 0 || height <= 0) - return NULL; + return NULL; rowstride = width * 4; if (rowstride / 4 != width) /* overflow */ - return NULL; - + return NULL; + bytes = height * rowstride; if (bytes / rowstride != height) /* overflow */ - return NULL; - + return NULL; + pixels = g_try_malloc (bytes); if (!pixels) return NULL; - - pixbuf = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, TRUE, 8, + + pixbuf = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, TRUE, 8, width, height, rowstride, (GdkPixbufDestroyNotify) g_free, NULL); TIFFReadRGBAImageOriented (tiff_document->tiff, @@ -384,10 +384,10 @@ tiff_document_render_pixbuf (EvDocument *document, height * rc->scale * (x_res / y_res), GDK_INTERP_BILINEAR); g_object_unref (pixbuf); - + rotated_pixbuf = gdk_pixbuf_rotate_simple (scaled_pixbuf, 360 - rc->rotation); g_object_unref (scaled_pixbuf); - + return rotated_pixbuf; } @@ -437,26 +437,26 @@ tiff_document_class_init (TiffDocumentClass *klass) static GdkPixbuf * tiff_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, - EvRenderContext *rc, + EvRenderContext *rc, gboolean border) { GdkPixbuf *pixbuf; pixbuf = tiff_document_render_pixbuf (EV_DOCUMENT (document), rc); - + if (border) { GdkPixbuf *tmp_pixbuf = pixbuf; - + pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, tmp_pixbuf); g_object_unref (tmp_pixbuf); } - + return pixbuf; } static void tiff_document_thumbnails_get_dimensions (EvDocumentThumbnails *document, - EvRenderContext *rc, + EvRenderContext *rc, gint *width, gint *height) { |