[gtk/font-rendering-demo-3] Small fixes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/font-rendering-demo-3] Small fixes
- Date: Sat, 28 Jul 2018 14:50:01 +0000 (UTC)
commit 8740690ecbab691bee29a98b907fe87c43a4ddc2
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 28 10:47:20 2018 -0400
Small fixes
Avoid a crash, and fix the title capitalization.
demos/gtk-demo/fontrendering.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/demos/gtk-demo/fontrendering.c b/demos/gtk-demo/fontrendering.c
index e54f2cb163..de7dc31c84 100644
--- a/demos/gtk-demo/fontrendering.c
+++ b/demos/gtk-demo/fontrendering.c
@@ -1,4 +1,4 @@
-/* Pango/Font rendering
+/* Pango/Font Rendering
*
* Demonstrates variations in font rendering.
*/
@@ -82,7 +82,9 @@ update_image (void)
pango_extents_to_pixels (&logical, NULL);
- surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, logical.width, logical.height);
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ MAX(1,logical.width),
+ MAX(1,logical.height));
cr = cairo_create (surface);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
@@ -109,7 +111,9 @@ update_image (void)
iter = pango_layout_get_iter (layout);
run = pango_layout_iter_get_run (iter);
- surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, logical.width * 3 / 2, 4*logical.height);
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ MAX(1, logical.width) * 3 / 2,
+ MAX(1, logical.height) * 4);
cr = cairo_create (surface);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]