Optimize redraw on key release.
This commit is contained in:
		@ -98,6 +98,7 @@ eek_gtk_keyboard_real_draw (GtkWidget *self,
 | 
			
		||||
{
 | 
			
		||||
    EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
 | 
			
		||||
    GtkAllocation allocation;
 | 
			
		||||
    EekColor background;
 | 
			
		||||
 | 
			
		||||
    gtk_widget_get_allocation (self, &allocation);
 | 
			
		||||
 | 
			
		||||
@ -128,6 +129,22 @@ eek_gtk_keyboard_real_draw (GtkWidget *self,
 | 
			
		||||
        eek_color_free (color);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* blank background */
 | 
			
		||||
    eek_renderer_get_background_color (priv->renderer,
 | 
			
		||||
                                       EEK_ELEMENT(priv->keyboard),
 | 
			
		||||
                                       &background);
 | 
			
		||||
    cairo_set_source_rgba (cr,
 | 
			
		||||
                           background.red,
 | 
			
		||||
                           background.green,
 | 
			
		||||
                           background.blue,
 | 
			
		||||
                           background.alpha);
 | 
			
		||||
    cairo_rectangle (cr,
 | 
			
		||||
                     0.0,
 | 
			
		||||
                     0.0,
 | 
			
		||||
                     allocation.width,
 | 
			
		||||
                     allocation.height);
 | 
			
		||||
    cairo_fill (cr);
 | 
			
		||||
 | 
			
		||||
    eek_renderer_render_keyboard (priv->renderer, cr);
 | 
			
		||||
 | 
			
		||||
    /* redraw dragged key */
 | 
			
		||||
@ -423,6 +440,7 @@ on_key_released (EekKeyboard *keyboard,
 | 
			
		||||
                     large_bounds.height);
 | 
			
		||||
    cairo_clip (cr);
 | 
			
		||||
    eek_renderer_render_keyboard (priv->renderer, cr);
 | 
			
		||||
    cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
 | 
			
		||||
    cairo_destroy (cr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -635,7 +635,6 @@ eek_renderer_real_render_keyboard (EekRenderer *self,
 | 
			
		||||
                                   cairo_t     *cr)
 | 
			
		||||
{
 | 
			
		||||
    EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(self);
 | 
			
		||||
    EekColor background;
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (priv->keyboard);
 | 
			
		||||
    g_return_if_fail (priv->allocation_width > 0.0);
 | 
			
		||||
@ -644,23 +643,6 @@ eek_renderer_real_render_keyboard (EekRenderer *self,
 | 
			
		||||
    if (!priv->keyboard_surface)
 | 
			
		||||
        priv->keyboard_surface = create_keyboard_surface (self);
 | 
			
		||||
 | 
			
		||||
    /* blank background */
 | 
			
		||||
    eek_renderer_get_background_color (self,
 | 
			
		||||
                                       EEK_ELEMENT(priv->keyboard),
 | 
			
		||||
                                       &background);
 | 
			
		||||
    cairo_set_source_rgba (cr,
 | 
			
		||||
                           background.red,
 | 
			
		||||
                           background.green,
 | 
			
		||||
                           background.blue,
 | 
			
		||||
                           background.alpha);
 | 
			
		||||
 | 
			
		||||
    cairo_rectangle (cr,
 | 
			
		||||
                     0.0,
 | 
			
		||||
                     0.0,
 | 
			
		||||
                     priv->allocation_width,
 | 
			
		||||
                     priv->allocation_height);
 | 
			
		||||
    cairo_fill (cr);
 | 
			
		||||
 | 
			
		||||
    cairo_set_source_surface (cr, priv->keyboard_surface, 0.0, 0.0);
 | 
			
		||||
    cairo_paint (cr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user