[evince] libview: Return NULL instead of empty regions from the pixbuf cache



commit bf18b5450a1791e33d0d82442cd493211e194785
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Wed Jul 3 18:59:16 2013 +0200

    libview: Return NULL instead of empty regions from the pixbuf cache
    
    This way we just need to check the pointer returned.

 libview/ev-pixbuf-cache.c |    6 ++++--
 libview/ev-view.c         |    3 +--
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/libview/ev-pixbuf-cache.c b/libview/ev-pixbuf-cache.c
index e4a8034..8127440 100644
--- a/libview/ev-pixbuf-cache.c
+++ b/libview/ev-pixbuf-cache.c
@@ -1085,7 +1085,8 @@ ev_pixbuf_cache_get_selection_region (EvPixbufCache *pixbuf_cache,
         * assumption that it'll be updated later and we can scale it as need
         * be */
        if (job_info->job && EV_JOB_RENDER (job_info->job)->include_selection)
-               return job_info->selection_region;
+               return job_info->selection_region && !cairo_region_is_empty(job_info->selection_region) ?
+                        job_info->selection_region : NULL;
 
        /* Now, lets see if we need to resize the region.  If we do, we clear the
         * old one. */
@@ -1114,7 +1115,8 @@ ev_pixbuf_cache_get_selection_region (EvPixbufCache *pixbuf_cache,
                g_object_unref (rc);
                ev_document_doc_mutex_unlock ();
        }
-       return job_info->selection_region;
+       return job_info->selection_region && !cairo_region_is_empty(job_info->selection_region) ?
+                job_info->selection_region : NULL;
 }
 
 static void
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 5c341b1..e488359 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -7326,9 +7326,8 @@ merge_selection_region (EvView *view,
                        tmp_region = ev_pixbuf_cache_get_selection_region (view->pixbuf_cache,
                                                                           cur_page,
                                                                           view->scale);
-                       if (tmp_region && !cairo_region_is_empty (tmp_region)) {
+                       if (tmp_region)
                                new_sel->covered_region = cairo_region_reference (tmp_region);
-                       }
                }
 
                /* Now we figure out what needs redrawing */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]