Commit d02aafbc authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

[libdocument] Add specific method to get a loading thumbnail

It allows getting a loading thumbnail with inverted colors. See
bug #616111.
parent 5f13b35d
...@@ -32,10 +32,11 @@ ...@@ -32,10 +32,11 @@
* NULL, then it will fill the return pixbuf with the contents of * NULL, then it will fill the return pixbuf with the contents of
* source_pixbuf. * source_pixbuf.
*/ */
GdkPixbuf * static GdkPixbuf *
ev_document_misc_get_thumbnail_frame (int width, create_thumbnail_frame (int width,
int height, int height,
GdkPixbuf *source_pixbuf) GdkPixbuf *source_pixbuf,
gboolean fill_bg)
{ {
GdkPixbuf *retval; GdkPixbuf *retval;
guchar *data; guchar *data;
...@@ -67,8 +68,10 @@ ev_document_misc_get_thumbnail_frame (int width, ...@@ -67,8 +68,10 @@ ev_document_misc_get_thumbnail_frame (int width,
rowstride = gdk_pixbuf_get_rowstride (retval); rowstride = gdk_pixbuf_get_rowstride (retval);
gdk_pixbuf_fill (retval, 0x000000ff); gdk_pixbuf_fill (retval, 0x000000ff);
for (i = 1; i < height_r + 1; i++) if (fill_bg) {
memset (data + (rowstride * i) + 4, 0xffffffff, width_r * 4); for (i = 1; i < height_r + 1; i++)
memset (data + (rowstride * i) + 4, 0xffffffff, width_r * 4);
}
/* copy the source pixbuf */ /* copy the source pixbuf */
if (source_pixbuf) if (source_pixbuf)
...@@ -91,6 +94,22 @@ ev_document_misc_get_thumbnail_frame (int width, ...@@ -91,6 +94,22 @@ ev_document_misc_get_thumbnail_frame (int width,
return retval; 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 void
ev_document_misc_get_page_border_size (gint page_width, ev_document_misc_get_page_border_size (gint page_width,
gint page_height, gint page_height,
......
...@@ -36,6 +36,9 @@ G_BEGIN_DECLS ...@@ -36,6 +36,9 @@ G_BEGIN_DECLS
GdkPixbuf *ev_document_misc_get_thumbnail_frame (int width, GdkPixbuf *ev_document_misc_get_thumbnail_frame (int width,
int height, int height,
GdkPixbuf *source_pixbuf); 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, void ev_document_misc_get_page_border_size (gint page_width,
gint page_height, gint page_height,
GtkBorder *border); GtkBorder *border);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment