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




commit 528a14cd783bda7ddcd15df79cf543dd6322d7b3
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 d9e8e0707..348aa3d2e 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -4929,9 +4929,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;
@@ -4941,6 +4939,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;
@@ -4972,6 +4972,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]