[evince/wip/gpoo/gtk4-rebase-port: 50/72] ev-view: push the clip region when snapshot the widget




commit 592af2da1d39574aa0ca012496bea72ad4e6d794
Author: Qiu Wenbo <qiuwenbo kylinos com cn>
Date:   Wed Aug 18 17:25:31 2021 +0800

    ev-view: push the clip region when snapshot the widget
    
    Signed-off-by: Qiu Wenbo <qiuwenbo kylinos com cn>

 libview/ev-view.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index d554d4260..7446d2892 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -4891,9 +4891,7 @@ static void ev_view_snapshot(GtkWidget *widget, GtkSnapshot *snapshot)
        height = gtk_widget_get_height(widget);
 
        gtk_snapshot_render_background (snapshot, gtk_widget_get_style_context (widget),
-                              0, 0,
-                              gtk_widget_get_allocated_width (widget),
-                              gtk_widget_get_allocated_height (widget));
+                              0, 0, width, height);
 
        clip_rect.x = 0;
        clip_rect.y = 0;
@@ -4903,6 +4901,8 @@ static void ev_view_snapshot(GtkWidget *widget, GtkSnapshot *snapshot)
        if (view->document == NULL)
                return;
 
+       gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_INIT (0, 0, width, height));
+
        compute_border (view, &border);
        for (i = view->start_page; i >= 0 && i <= view->end_page; i++) {
                GdkRectangle page_area;
@@ -4934,6 +4934,8 @@ static void ev_view_snapshot(GtkWidget *widget, GtkSnapshot *snapshot)
 #endif
        }
 
+       gtk_snapshot_pop (snapshot);
+
 }
 
 static void


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