]> www.fi.muni.cz Git - evince.git/blobdiff - libdocument/ev-document-misc.c
[libdocument] Use EvPage instead of EvRenderContext in get_selected_text()
[evince.git] / libdocument / ev-document-misc.c
index 4d8bc28153fa36085a5dd2ca97b9e12883861034..605cbb0a87c0074a67a7c03762db37af0ddd0e41 100644 (file)
  * NULL, then it will fill the return pixbuf with the contents of
  * source_pixbuf.
  */
  * 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;
 {
        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);
        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)
 
        /* copy the source pixbuf */
        if (source_pixbuf)
@@ -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
 ev_document_misc_get_page_border_size (gint       page_width,
                                       gint       page_height,
 void
 ev_document_misc_get_page_border_size (gint       page_width,
                                       gint       page_height,