[evince] [libdocument] Add specific method to get a loading thumbnail
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] [libdocument] Add specific method to get a loading thumbnail
- Date: Tue, 4 May 2010 09:33:08 +0000 (UTC)
commit d02aafbc4423ead5b00e452452643e076c4fa2e8
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Tue May 4 11:29:47 2010 +0200
[libdocument] Add specific method to get a loading thumbnail
It allows getting a loading thumbnail with inverted colors. See
bug #616111.
libdocument/ev-document-misc.c | 31 +++++++++++++++++++++++++------
libdocument/ev-document-misc.h | 3 +++
2 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c
index 4d8bc28..605cbb0 100644
--- a/libdocument/ev-document-misc.c
+++ b/libdocument/ev-document-misc.c
@@ -32,10 +32,11 @@
* NULL, then it will fill the return pixbuf with the contents of
* source_pixbuf.
*/
-GdkPixbuf *
-ev_document_misc_get_thumbnail_frame (int width,
- int height,
- GdkPixbuf *source_pixbuf)
+static GdkPixbuf *
+create_thumbnail_frame (int width,
+ int height,
+ GdkPixbuf *source_pixbuf,
+ gboolean fill_bg)
{
GdkPixbuf *retval;
guchar *data;
@@ -67,8 +68,10 @@ ev_document_misc_get_thumbnail_frame (int width,
rowstride = gdk_pixbuf_get_rowstride (retval);
gdk_pixbuf_fill (retval, 0x000000ff);
- for (i = 1; i < height_r + 1; i++)
- memset (data + (rowstride * i) + 4, 0xffffffff, width_r * 4);
+ if (fill_bg) {
+ for (i = 1; i < height_r + 1; i++)
+ memset (data + (rowstride * i) + 4, 0xffffffff, width_r * 4);
+ }
/* copy the source pixbuf */
if (source_pixbuf)
@@ -91,6 +94,22 @@ ev_document_misc_get_thumbnail_frame (int width,
return retval;
}
+GdkPixbuf *
+ev_document_misc_get_thumbnail_frame (int width,
+ int height,
+ GdkPixbuf *source_pixbuf)
+{
+ return create_thumbnail_frame (width, height, source_pixbuf, TRUE);
+}
+
+GdkPixbuf *
+ev_document_misc_get_loading_thumbnail (int width,
+ int height,
+ gboolean inverted_colors)
+{
+ return create_thumbnail_frame (width, height, NULL, !inverted_colors);
+}
+
void
ev_document_misc_get_page_border_size (gint page_width,
gint page_height,
diff --git a/libdocument/ev-document-misc.h b/libdocument/ev-document-misc.h
index 2503aa7..b09c194 100644
--- a/libdocument/ev-document-misc.h
+++ b/libdocument/ev-document-misc.h
@@ -36,6 +36,9 @@ G_BEGIN_DECLS
GdkPixbuf *ev_document_misc_get_thumbnail_frame (int width,
int height,
GdkPixbuf *source_pixbuf);
+GdkPixbuf *ev_document_misc_get_loading_thumbnail (int width,
+ int height,
+ gboolean inverted_colors);
void ev_document_misc_get_page_border_size (gint page_width,
gint page_height,
GtkBorder *border);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]