[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#31288: 27.0.50; [PATCH] Make cairo build somewhat usable
From: |
Ari Roponen |
Subject: |
bug#31288: 27.0.50; [PATCH] Make cairo build somewhat usable |
Date: |
Fri, 27 Apr 2018 17:35:58 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>
> Please allow me a couple of minor comments on the changes:
>
>> @@ -1236,7 +1231,8 @@ x_update_end (struct frame *f)
>> {
>> cairo_t *cr = 0;
>> block_input();
>> -#if defined (USE_GTK) && defined (HAVE_GTK3)
>> + /* FIXME */
>> +#if 0 && defined (USE_GTK) && defined (HAVE_GTK3)
>> if (FRAME_GTK_WIDGET (f))
>> {
>> GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
>
> This hunk doesn't look right. If the code in question causes some
> trouble to a Cairo build, please ifdef it out only when USE_CAIRO is
> defined, not unconditionally. And if that still needs a FIXME
> comment, please add some description of what needs to be fixed and
> why.
>
That hunk is inside #ifdef USE_CAIRO, like almost the whole body of
x_update_end.
>> + cairo_surface_destroy (s);
>> + } else {
>> + SET_FRAME_GARBAGED (f);
>
> Please use GNU style of braces.
>
Done. New patch attached.
>From dd7b085d569be5f1eb4412e28ac73f3f304eeb0f Mon Sep 17 00:00:00 2001
From: Ari Roponen <ari.roponen@gmail.com>
Date: Fri, 27 Apr 2018 15:13:12 +0300
Subject: [PATCH 1/2] Fix cairo problems
* src/xterm.c (x_begin_cr_clip): Create image surface.
(x_update_end) [USE_CAIRO]: Disable GTK3-specific code for now.
(x_scroll_run) [USE_CAIRO]: Implement scrolling.
---
src/xterm.c | 43 ++++++++++++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 13 deletions(-)
diff --git a/src/xterm.c b/src/xterm.c
index 6ab4a03002..2a1c7e9edc 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -360,17 +360,12 @@ x_begin_cr_clip (struct frame *f, GC gc)
if (! FRAME_CR_SURFACE (f))
{
- cairo_surface_t *surface;
- surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f),
- FRAME_X_DRAWABLE (f),
- FRAME_DISPLAY_INFO (f)->visual,
- FRAME_PIXEL_WIDTH (f),
- FRAME_PIXEL_HEIGHT (f));
- cr = cairo_create (surface);
- cairo_surface_destroy (surface);
- }
- else
- cr = cairo_create (FRAME_CR_SURFACE (f));
+ FRAME_CR_SURFACE (f) =
+ cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ FRAME_PIXEL_WIDTH (f),
+ FRAME_PIXEL_HEIGHT (f));
+ }
+ cr = cairo_create (FRAME_CR_SURFACE (f));
FRAME_CR_CONTEXT (f) = cr;
}
cairo_save (cr);
@@ -1236,7 +1231,8 @@ x_update_end (struct frame *f)
{
cairo_t *cr = 0;
block_input();
-#if defined (USE_GTK) && defined (HAVE_GTK3)
+ /* FIXME */
+#if 0 && defined (USE_GTK) && defined (HAVE_GTK3)
if (FRAME_GTK_WIDGET (f))
{
GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
@@ -4271,7 +4267,28 @@ x_scroll_run (struct window *w, struct run *run)
x_clear_cursor (w);
#ifdef USE_CAIRO
- SET_FRAME_GARBAGED (f);
+ if (FRAME_CR_CONTEXT (f))
+ {
+ cairo_surface_t *s = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ width, height);
+ cairo_t *cr = cairo_create (s);
+ cairo_set_source_surface (cr, cairo_get_target (FRAME_CR_CONTEXT (f)),
+ -x, -from_y);
+ cairo_paint (cr);
+ cairo_destroy (cr);
+
+ cr = FRAME_CR_CONTEXT (f);
+ cairo_save (cr);
+ cairo_set_source_surface (cr, s, 0, to_y);
+ cairo_rectangle (cr, x, to_y, width, height);
+ cairo_fill (cr);
+ cairo_restore (cr);
+ cairo_surface_destroy (s);
+ }
+ else
+ {
+ SET_FRAME_GARBAGED (f);
+ }
#else
XCopyArea (FRAME_X_DISPLAY (f),
FRAME_X_DRAWABLE (f), FRAME_X_DRAWABLE (f),
--
2.17.0