Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/libview/ev-pixbuf-cache.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2009-11-29 14:57:08 (GMT)
committer Carlos Garcia Campos <carlosgc@gnome.org>2009-11-29 14:57:08 (GMT)
commit139f0ec4a2f5fe022b9a7d5848b5998615f81834 (patch)
treef817669014f438cf3d03f560d239d14dcf17a47f /libview/ev-pixbuf-cache.c
parentf89486b20069a9e9de2ff8bc08df1fcd49bb6355 (diff)
[libview] Invert colors of pages after rendering when inverted colors option is enabled
See bgo#321823.
Diffstat (limited to 'libview/ev-pixbuf-cache.c')
-rw-r--r--libview/ev-pixbuf-cache.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/libview/ev-pixbuf-cache.c b/libview/ev-pixbuf-cache.c
index df06705..d0f8644 100644
--- a/libview/ev-pixbuf-cache.c
+++ b/libview/ev-pixbuf-cache.c
@@ -45,6 +45,7 @@ struct _EvPixbufCache
EvDocument *document;
int start_page;
int end_page;
+ gboolean inverted_colors;
/* preload_cache_size is the number of pages prior to the current
* visible area that we cache. It's normally 1, but could be 2 in the
@@ -468,6 +469,9 @@ copy_job_page_and_selection_to_job_info (EvJobRender *job_render,
cairo_surface_destroy (job_info->surface);
}
job_info->surface = cairo_surface_reference (job_render->surface);
+ if (pixbuf_cache->inverted_colors) {
+ ev_document_misc_invert_surface (job_info->surface);
+ }
job_info->points_set = FALSE;
if (job_render->flags & EV_RENDER_INCLUDE_SELECTION) {
@@ -759,6 +763,38 @@ ev_pixbuf_cache_set_page_range (EvPixbufCache *pixbuf_cache,
ev_pixbuf_cache_add_jobs_if_needed (pixbuf_cache, rotation, scale);
}
+void
+ev_pixbuf_cache_set_inverted_colors (EvPixbufCache *pixbuf_cache,
+ gboolean inverted_colors)
+{
+ gint i;
+
+ if (pixbuf_cache->inverted_colors == inverted_colors)
+ return;
+
+ pixbuf_cache->inverted_colors = inverted_colors;
+
+ for (i = 0; i < pixbuf_cache->preload_cache_size; i++) {
+ CacheJobInfo *job_info;
+
+ job_info = pixbuf_cache->prev_job + i;
+ if (job_info->surface)
+ ev_document_misc_invert_surface (job_info->surface);
+
+ job_info = pixbuf_cache->next_job + i;
+ if (job_info->surface)
+ ev_document_misc_invert_surface (job_info->surface);
+ }
+
+ for (i = 0; i < PAGE_CACHE_LEN (pixbuf_cache); i++) {
+ CacheJobInfo *job_info;
+
+ job_info = pixbuf_cache->job_list + i;
+ if (job_info->surface)
+ ev_document_misc_invert_surface (job_info->surface);
+ }
+}
+
cairo_surface_t *
ev_pixbuf_cache_get_surface (EvPixbufCache *pixbuf_cache,
gint page)