Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

See merge request GNOME/gtk!3328
This commit is contained in:
Matthias Clasen 2021-03-21 20:48:04 +00:00
commit 48f87c1eea
8 changed files with 73 additions and 21 deletions

View File

@ -149,10 +149,10 @@ render_glyph (GlyphCacheKey *key,
glyph_info.glyph = key->data.glyph;
glyph_info.geometry.width = value->draw_width * 1024;
if (glyph_info.glyph & PANGO_GLYPH_UNKNOWN_FLAG)
glyph_info.geometry.x_offset = 250 * key->data.xshift;
glyph_info.geometry.x_offset = 256 * key->data.xshift;
else
glyph_info.geometry.x_offset = 250 * key->data.xshift - value->draw_x * 1024;
glyph_info.geometry.y_offset = 250 * key->data.yshift - value->draw_y * 1024;
glyph_info.geometry.x_offset = 256 * key->data.xshift - value->draw_x * 1024;
glyph_info.geometry.y_offset = 256 * key->data.yshift - value->draw_y * 1024;
glyph_string.num_glyphs = 1;
glyph_string.glyphs = &glyph_info;

View File

@ -424,8 +424,6 @@ gsk_ngl_command_queue_init (GskNglCommandQueue *self)
gsk_ngl_command_binds_init (&self->batch_binds, 1024);
gsk_ngl_command_uniforms_init (&self->batch_uniforms, 2048);
self->debug_groups = g_string_chunk_new (4096);
gsk_ngl_buffer_init (&self->vertices, GL_ARRAY_BUFFER, sizeof (GskNglDrawVertex));
}
@ -1215,8 +1213,6 @@ gsk_ngl_command_queue_end_frame (GskNglCommandQueue *self)
}
}
g_string_chunk_clear (self->debug_groups);
self->batches.len = 0;
self->batch_binds.len = 0;
self->batch_uniforms.len = 0;

View File

@ -225,9 +225,6 @@ struct _GskNglCommandQueue
*/
GskNglCommandUniforms batch_uniforms;
/* String storage for debug groups */
GStringChunk *debug_groups;
/* Discovered max texture size when loading the command queue so that we
* can either scale down or slice textures to fit within this size. Assumed
* to be both height and width.

View File

@ -176,10 +176,10 @@ render_glyph (cairo_surface_t *surface,
glyph_info.glyph = key->glyph;
glyph_info.geometry.width = value->ink_rect.width * 1024;
if (glyph_info.glyph & PANGO_GLYPH_UNKNOWN_FLAG)
glyph_info.geometry.x_offset = 250 * key->xshift;
glyph_info.geometry.x_offset = 256 * key->xshift;
else
glyph_info.geometry.x_offset = 250 * key->xshift - value->ink_rect.x * 1024;
glyph_info.geometry.y_offset = 250 * key->yshift - value->ink_rect.y * 1024;
glyph_info.geometry.x_offset = 256 * key->xshift - value->ink_rect.x * 1024;
glyph_info.geometry.y_offset = 256 * key->yshift - value->ink_rect.y * 1024;
glyph_string.num_glyphs = 1;
glyph_string.glyphs = &glyph_info;

View File

@ -71,7 +71,7 @@ gboolean gsk_ngl_glyph_library_add (GskNglGlyphLibrary *self,
static inline int
gsk_ngl_glyph_key_phase (float value)
{
return floor (4 * (value + 0.125)) - 4 * floor (value + 0.125);
return floorf (4 * (value + 0.125)) - 4 * floorf (value + 0.125);
}
static inline void
@ -108,6 +108,8 @@ gsk_ngl_glyph_library_lookup_or_add (GskNglGlyphLibrary *self,
GskNglGlyphKey *k = g_slice_copy (sizeof *key, key);
g_object_ref (k->font);
gsk_ngl_glyph_library_add (self, k, out_value);
self->front[front_index].key = *key;
self->front[front_index].value = *out_value;
}
return GSK_NGL_TEXTURE_ATLAS_ENTRY_TEXTURE (*out_value) != 0;

View File

@ -396,9 +396,9 @@ gtk_calendar_class_init (GtkCalendarClass *class)
/**
* GtkCalendar:day:
*
* The selected day (as a number between 1 and 31.
* The selected day (as a number between 1 and 31).
*
* This can be set to 0 to unselect the currently selected day).
* This can be set to 0 to unselect the currently selected day.
* This property gets initially set to the current day.
*/
g_object_class_install_property (gobject_class,

View File

@ -844,6 +844,43 @@ describe_expression (GtkExpression *expression)
g_type_name (gtk_expression_get_value_type (expression)));
}
static void
toggle_unicode (GtkToggleButton *button,
GParamSpec *pspec,
GtkWidget *stack)
{
GtkWidget *entry;
GtkWidget *unicode;
entry = gtk_stack_get_child_by_name (GTK_STACK (stack), "entry");
unicode = gtk_stack_get_child_by_name (GTK_STACK (stack), "unicode");
if (gtk_toggle_button_get_active (button))
{
const char *text;
const char *p;
GString *s;
text = gtk_editable_get_text (GTK_EDITABLE (entry));
s = g_string_sized_new (6 * strlen (text));
for (p = text; *p; p = g_utf8_next_char (p))
{
gunichar ch = g_utf8_get_char (p);
if (s->len > 0)
g_string_append_c (s, ' ');
g_string_append_printf (s, "U+%04X", ch);
}
gtk_editable_set_text (GTK_EDITABLE (unicode), s->str);
g_string_free (s, TRUE);
gtk_stack_set_visible_child_name (GTK_STACK (stack), "unicode");
}
else
{
gtk_editable_set_text (GTK_EDITABLE (unicode), "");
gtk_stack_set_visible_child_name (GTK_STACK (stack), "entry");
}
}
static GtkWidget *
property_editor (GObject *object,
GParamSpec *spec,
@ -926,18 +963,38 @@ property_editor (GObject *object,
}
else if (type == G_TYPE_PARAM_STRING)
{
prop_edit = gtk_entry_new ();
GtkWidget *entry;
GtkWidget *button;
GtkWidget *stack;
GtkWidget *unicode;
entry = gtk_entry_new ();
g_object_connect_property (object, spec,
G_CALLBACK (string_changed),
prop_edit, G_OBJECT (prop_edit));
entry, G_OBJECT (entry));
if (GTK_IS_CSS_NODE (object))
connect_controller (G_OBJECT (prop_edit), "changed",
connect_controller (G_OBJECT (entry), "changed",
object, spec, G_CALLBACK (intern_string_modified));
else
connect_controller (G_OBJECT (prop_edit), "changed",
connect_controller (G_OBJECT (entry), "changed",
object, spec, G_CALLBACK (string_modified));
unicode = gtk_entry_new ();
gtk_editable_set_editable (GTK_EDITABLE (unicode), FALSE);
stack = gtk_stack_new ();
gtk_stack_add_named (GTK_STACK (stack), entry, "entry");
gtk_stack_add_named (GTK_STACK (stack), unicode, "unicode");
prop_edit = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_append (GTK_BOX (prop_edit), stack);
button = gtk_toggle_button_new_with_label ("Unicode");
gtk_box_append (GTK_BOX (prop_edit), button);
g_signal_connect (button, "notify::active", G_CALLBACK (toggle_unicode), stack);
}
else if (type == G_TYPE_PARAM_BOOLEAN)
{

View File

@ -66,7 +66,7 @@ if debug
gtk_debug_cflags += '-DG_ENABLE_CONSISTENCY_CHECKS'
endif
elif optimization in ['2', '3', 's']
gtk_debug_cflags += '-DG_DISABLE_CAST_CHECKS'
gtk_debug_cflags += '-DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT'
endif
add_project_arguments(gtk_debug_cflags, language: 'c')