Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
fdf0bd56
Commit
fdf0bd56
authored
Apr 18, 2011
by
Moritz Lipp
Browse files
Save surface temporary in page_t
parent
8bcb79ea
Changes
3
Hide whitespace changes
Inline
Side-by-side
document.c
View file @
fdf0bd56
...
...
@@ -386,6 +386,7 @@ zathura_page_get(zathura_document_t* document, unsigned int page_id)
page
->
rendered
=
false
;
page
->
event_box
=
gtk_event_box_new
();
page
->
drawing_area
=
gtk_drawing_area_new
();
page
->
surface
=
NULL
;
g_signal_connect
(
page
->
drawing_area
,
"expose-event"
,
G_CALLBACK
(
page_expose_event
),
page
);
gtk_container_add
(
GTK_CONTAINER
(
page
->
event_box
),
page
->
drawing_area
);
...
...
document.h
View file @
fdf0bd56
...
...
@@ -150,6 +150,7 @@ struct zathura_page_s
GtkWidget
*
event_box
;
/**> Widget wrapper for mouse events */
GtkWidget
*
drawing_area
;
/**> Drawing area */
GStaticMutex
lock
;
/**> Lock */
cairo_surface_t
*
surface
;
/** Cairo surface */
};
/**
...
...
render.c
View file @
fdf0bd56
...
...
@@ -176,10 +176,7 @@ render(zathura_t* zathura, zathura_page_t* page)
}
/* draw to gtk widget */
cairo_t
*
cairo
=
gdk_cairo_create
(
page
->
drawing_area
->
window
);
cairo_set_source_surface
(
cairo
,
surface
,
0
,
0
);
cairo_paint
(
cairo
);
cairo_destroy
(
cairo
);
page
->
surface
=
surface
;
zathura_image_buffer_free
(
image_buffer
);
g_static_mutex_unlock
(
&
(
page
->
lock
));
...
...
@@ -209,22 +206,30 @@ gboolean
page_expose_event
(
GtkWidget
*
widget
,
GdkEventExpose
*
event
,
gpointer
data
)
{
zathura_page_t
*
page
=
data
;
if
(
page
==
NULL
)
{
return
FALSE
;
}
g_static_mutex_lock
(
&
(
page
->
lock
));
cairo_t
*
cairo
=
gdk_cairo_create
(
page
->
drawing_area
->
window
);
if
(
cairo
==
NULL
)
{
girara_error
(
"Could not
c
re
ate blank page
"
);
girara_error
(
"Could not re
treive cairo object
"
);
g_static_mutex_unlock
(
&
(
page
->
lock
));
return
false
;
return
FALSE
;
}
cairo_set_source_rgb
(
cairo
,
0
,
0
,
0
);
cairo_rectangle
(
cairo
,
0
,
0
,
page
->
width
,
page
->
height
);
cairo_fill
(
cairo
);
cairo_destroy
(
cairo
);
if
(
page
->
surface
==
NULL
)
{
cairo_set_source_surface
(
cairo
,
page
->
surface
,
0
,
0
);
cairo_paint
(
cairo
);
cairo_destroy
(
cairo
);
cairo_surface_destroy
(
page
->
surface
);
page
->
surface
=
NULL
;
}
g_static_mutex_unlock
(
&
(
page
->
lock
));
return
true
;
return
TRUE
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment