mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-10 06:02:10 -05:00
GTK: use cairo_paint() to copy from backing store to screen
I just found cairo_paint() while wandering the Cairo documentation. It just fills the entire clip region with data from the current source, which is precisely what draw_area() wants to do. This is simpler for us than requesting the bounding rectangle of the clipping region and then filling it, and as far as I can tell the clipping rectangle generally covers the whole window anyway.
This commit is contained in:
parent
01043ce4fc
commit
c93a225b97
@ -953,7 +953,6 @@ static gint draw_area(GtkWidget *widget, cairo_t *cr, gpointer data)
|
|||||||
* inst->surface to the window.
|
* inst->surface to the window.
|
||||||
*/
|
*/
|
||||||
if (inst->surface) {
|
if (inst->surface) {
|
||||||
GdkRectangle dirtyrect;
|
|
||||||
cairo_surface_t *target_surface;
|
cairo_surface_t *target_surface;
|
||||||
double orig_sx, orig_sy;
|
double orig_sx, orig_sy;
|
||||||
cairo_matrix_t m;
|
cairo_matrix_t m;
|
||||||
@ -982,12 +981,8 @@ static gint draw_area(GtkWidget *widget, cairo_t *cr, gpointer data)
|
|||||||
cairo_surface_set_device_scale(target_surface, 1.0, 1.0);
|
cairo_surface_set_device_scale(target_surface, 1.0, 1.0);
|
||||||
cairo_translate(cr, m.x0 * (orig_sx - 1.0), m.y0 * (orig_sy - 1.0));
|
cairo_translate(cr, m.x0 * (orig_sx - 1.0), m.y0 * (orig_sy - 1.0));
|
||||||
|
|
||||||
gdk_cairo_get_clip_rectangle(cr, &dirtyrect);
|
|
||||||
|
|
||||||
cairo_set_source_surface(cr, inst->surface, 0, 0);
|
cairo_set_source_surface(cr, inst->surface, 0, 0);
|
||||||
cairo_rectangle(cr, dirtyrect.x, dirtyrect.y,
|
cairo_paint(cr);
|
||||||
dirtyrect.width, dirtyrect.height);
|
|
||||||
cairo_fill(cr);
|
|
||||||
|
|
||||||
cairo_surface_set_device_scale(target_surface, orig_sx, orig_sy);
|
cairo_surface_set_device_scale(target_surface, orig_sx, orig_sy);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user