Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f3ccb3a5f4 |
@@ -20,7 +20,7 @@ mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
float b = 1.0/distance (pos, p2);
|
||||
float sum = r + g + b;
|
||||
|
||||
float alpha = 1.0 - pow (1.0/(sum), 40.0)*pow (10.0, 40.0*0.7);
|
||||
float alpha = 1.0 - pow (1.0/(sum), 40)*pow (10.0, 40*0.7);
|
||||
|
||||
fragColor = vec4 (r*0.5, g*0.5, b*0.5, 1.0) * alpha;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ float ccell2(vec2 p, float r) {
|
||||
float df(vec2 p, float scale, inout vec2 nn) {
|
||||
p /= scale;
|
||||
nn = hextile(p);
|
||||
nn = floor(nn + 0.5);
|
||||
nn = round(nn);
|
||||
float r = hash(nn);
|
||||
|
||||
float d;;
|
||||
|
||||
@@ -179,7 +179,7 @@ float ccell2(vec2 p, float r) {
|
||||
float df(vec2 p, float scale, inout vec2 nn) {
|
||||
p /= scale;
|
||||
nn = hextile(p);
|
||||
nn = floor(nn + 0.5);
|
||||
nn = round(nn);
|
||||
float r = hash(nn);
|
||||
|
||||
float d;;
|
||||
|
||||
+22
-20
@@ -53,30 +53,31 @@
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="width-request">220</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<object class="GtkScrolledWindow">
|
||||
<style>
|
||||
<class name="sidebar"/>
|
||||
</style>
|
||||
<property name="width-request">120</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="min-content-width">150</property>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="key-capture-widget">window</property>
|
||||
<object class="GtkBox">
|
||||
<property name="width-request">220</property>
|
||||
<property name="orientation">vertical</property>
|
||||
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="search-entry">
|
||||
<accessibility>
|
||||
<relation name="controls">listview</relation>
|
||||
</accessibility>
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="key-capture-widget">window</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="search-entry">
|
||||
<accessibility>
|
||||
<relation name="controls">listview</relation>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<style>
|
||||
<class name="sidebar"/>
|
||||
</style>
|
||||
<property name="width-request">120</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="min-content-width">150</property>
|
||||
<property name="vexpand">1</property>
|
||||
|
||||
<child>
|
||||
<object class="GtkListView" id="listview">
|
||||
<style>
|
||||
@@ -93,6 +94,7 @@
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -31,7 +31,7 @@ void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec
|
||||
float propagation_length = time * wave_speed;
|
||||
|
||||
float t = (propagation_length - distance_from_center) / wave_length;
|
||||
float offset_magnitude = 0.0;
|
||||
float offset_magnitude = 0;
|
||||
if (t > 0.0)
|
||||
offset_magnitude = decay(wave_height * sin(t * 2.0 * PI), t);
|
||||
|
||||
|
||||
@@ -98,22 +98,19 @@ gsk_render_node_write_to_file
|
||||
GskScalingFilter
|
||||
gsk_render_node_get_bounds
|
||||
|
||||
<SUBSECTION>
|
||||
<SUBSECTION Nodes>
|
||||
gsk_color_node_new
|
||||
gsk_color_node_get_color
|
||||
gsk_texture_node_new
|
||||
gsk_texture_node_get_texture
|
||||
<SUBSECTION>
|
||||
GskColorStop
|
||||
gsk_linear_gradient_node_new
|
||||
gsk_repeating_linear_gradient_node_new
|
||||
gsk_linear_gradient_node_get_start
|
||||
gsk_linear_gradient_node_get_end
|
||||
gsk_linear_gradient_node_get_n_color_stops
|
||||
gsk_linear_gradient_node_get_color_stops
|
||||
<SUBSECTION>
|
||||
gsk_repeating_linear_gradient_node_new
|
||||
gsk_radial_gradient_node_new
|
||||
gsk_repeating_radial_gradient_node_new
|
||||
gsk_radial_gradient_node_get_n_color_stops
|
||||
gsk_radial_gradient_node_get_color_stops
|
||||
gsk_radial_gradient_node_get_start
|
||||
@@ -121,18 +118,16 @@ gsk_radial_gradient_node_get_end
|
||||
gsk_radial_gradient_node_get_hradius
|
||||
gsk_radial_gradient_node_get_vradius
|
||||
gsk_radial_gradient_node_get_center
|
||||
<SUBSECTION>
|
||||
gsk_repeating_radial_gradient_node_new
|
||||
gsk_conic_gradient_node_new
|
||||
gsk_conic_gradient_node_get_n_color_stops
|
||||
gsk_conic_gradient_node_get_color_stops
|
||||
gsk_conic_gradient_node_get_center
|
||||
gsk_conic_gradient_node_get_rotation
|
||||
<SUBSECTION>
|
||||
gsk_border_node_new
|
||||
gsk_border_node_get_outline
|
||||
gsk_border_node_get_widths
|
||||
gsk_border_node_get_colors
|
||||
<SUBSECTION>
|
||||
gsk_inset_shadow_node_new
|
||||
gsk_inset_shadow_node_get_outline
|
||||
gsk_inset_shadow_node_get_color
|
||||
@@ -140,7 +135,6 @@ gsk_inset_shadow_node_get_dx
|
||||
gsk_inset_shadow_node_get_dy
|
||||
gsk_inset_shadow_node_get_spread
|
||||
gsk_inset_shadow_node_get_blur_radius
|
||||
<SUBSECTION>
|
||||
gsk_outset_shadow_node_new
|
||||
gsk_outset_shadow_node_get_outline
|
||||
gsk_outset_shadow_node_get_color
|
||||
@@ -148,57 +142,45 @@ gsk_outset_shadow_node_get_dx
|
||||
gsk_outset_shadow_node_get_dy
|
||||
gsk_outset_shadow_node_get_spread
|
||||
gsk_outset_shadow_node_get_blur_radius
|
||||
<SUBSECTION>
|
||||
gsk_cairo_node_new
|
||||
gsk_cairo_node_get_draw_context
|
||||
gsk_cairo_node_get_surface
|
||||
<SUBSECTION>
|
||||
gsk_container_node_new
|
||||
gsk_container_node_get_n_children
|
||||
gsk_container_node_get_child
|
||||
<SUBSECTION>
|
||||
gsk_transform_node_new
|
||||
gsk_transform_node_get_child
|
||||
gsk_transform_node_get_transform
|
||||
<SUBSECTION>
|
||||
gsk_opacity_node_new
|
||||
gsk_opacity_node_get_child
|
||||
gsk_opacity_node_get_opacity
|
||||
<SUBSECTION>
|
||||
gsk_color_matrix_node_new
|
||||
gsk_color_matrix_node_get_child
|
||||
gsk_color_matrix_node_get_color_matrix
|
||||
gsk_color_matrix_node_get_color_offset
|
||||
<SUBSECTION>
|
||||
gsk_repeat_node_new
|
||||
gsk_repeat_node_get_child
|
||||
gsk_repeat_node_get_child_bounds
|
||||
<SUBSECTION>
|
||||
gsk_clip_node_new
|
||||
gsk_clip_node_get_child
|
||||
gsk_clip_node_get_clip
|
||||
<SUBSECTION>
|
||||
gsk_rounded_clip_node_new
|
||||
gsk_rounded_clip_node_get_child
|
||||
gsk_rounded_clip_node_get_clip
|
||||
<SUBSECTION>
|
||||
GskShadow
|
||||
gsk_shadow_node_new
|
||||
gsk_shadow_node_get_shadow
|
||||
gsk_shadow_node_get_n_shadows
|
||||
gsk_shadow_node_get_child
|
||||
<SUBSECTION>
|
||||
GskBlendMode
|
||||
gsk_blend_node_new
|
||||
gsk_blend_node_get_bottom_child
|
||||
gsk_blend_node_get_top_child
|
||||
gsk_blend_node_get_blend_mode
|
||||
<SUBSECTION>
|
||||
gsk_cross_fade_node_new
|
||||
gsk_cross_fade_node_get_start_child
|
||||
gsk_cross_fade_node_get_end_child
|
||||
gsk_cross_fade_node_get_progress
|
||||
<SUBSECTION>
|
||||
gsk_text_node_new
|
||||
gsk_text_node_get_font
|
||||
gsk_text_node_get_glyphs
|
||||
@@ -206,15 +188,12 @@ gsk_text_node_get_color
|
||||
gsk_text_node_has_color_glyphs
|
||||
gsk_text_node_get_num_glyphs
|
||||
gsk_text_node_get_offset
|
||||
<SUBSECTION>
|
||||
gsk_blur_node_new
|
||||
gsk_blur_node_get_child
|
||||
gsk_blur_node_get_radius
|
||||
<SUBSECTION>
|
||||
gsk_debug_node_new
|
||||
gsk_debug_node_get_child
|
||||
gsk_debug_node_get_message
|
||||
<SUBSECTION>
|
||||
gsk_gl_shader_node_new
|
||||
gsk_gl_shader_node_get_n_children
|
||||
gsk_gl_shader_node_get_child
|
||||
|
||||
@@ -1062,7 +1062,7 @@ to start a drag manually, call gdk_drag_begin().
|
||||
The ::drag-data-get signal has been replaced by the #GtkDragSource::prepare
|
||||
signal, which returns a #GdkContentProvider for the drag operation.
|
||||
|
||||
The destination-side Drag-and-Drop API in GTK 4 have also been changed
|
||||
The destination-side Drag-and-Drop apis in GTK 4 have also been changed
|
||||
to use an event controller, #GtkDropTarget. Instead of calling
|
||||
gtk_drag_dest_set() and connecting to #GtkWidget signals, you create
|
||||
a #GtkDropTarget object, attach it to the widget with
|
||||
|
||||
+4
-7
@@ -182,7 +182,6 @@ G_GNUC_UNUSED static inline void
|
||||
gdk_array(splice) (GdkArray *self,
|
||||
gsize pos,
|
||||
gsize removed,
|
||||
gboolean stolen,
|
||||
_T_ *additions,
|
||||
gsize added)
|
||||
{
|
||||
@@ -193,9 +192,8 @@ gdk_array(splice) (GdkArray *self,
|
||||
g_assert (pos + removed <= size);
|
||||
remaining = size - pos - removed;
|
||||
|
||||
if (!stolen)
|
||||
gdk_array(free_elements) (gdk_array(index) (self, pos),
|
||||
gdk_array(index) (self, pos + removed));
|
||||
gdk_array(free_elements) (gdk_array(index) (self, pos),
|
||||
gdk_array(index) (self, pos + removed));
|
||||
|
||||
gdk_array(reserve) (self, size - removed + added);
|
||||
|
||||
@@ -227,9 +225,9 @@ gdk_array(set_size) (GdkArray *self,
|
||||
{
|
||||
gsize old_size = gdk_array(get_size) (self);
|
||||
if (new_size > old_size)
|
||||
gdk_array(splice) (self, old_size, 0, FALSE, NULL, new_size - old_size);
|
||||
gdk_array(splice) (self, old_size, 0, NULL, new_size - old_size);
|
||||
else
|
||||
gdk_array(splice) (self, new_size, old_size - new_size, FALSE, NULL, 0);
|
||||
gdk_array(splice) (self, new_size, old_size - new_size, NULL, 0);
|
||||
}
|
||||
|
||||
G_GNUC_UNUSED static void
|
||||
@@ -243,7 +241,6 @@ gdk_array(append) (GdkArray *self,
|
||||
gdk_array(splice) (self,
|
||||
gdk_array(get_size) (self),
|
||||
0,
|
||||
FALSE,
|
||||
#ifdef GDK_ARRAY_BY_VALUE
|
||||
value,
|
||||
#else
|
||||
|
||||
@@ -1138,22 +1138,6 @@ gdk_event_get_axes (GdkEvent *event,
|
||||
return GDK_EVENT_GET_CLASS (event)->get_axes (event, axes, n_axes);
|
||||
}
|
||||
|
||||
double *
|
||||
gdk_event_dup_axes (GdkEvent *event)
|
||||
{
|
||||
double *axes;
|
||||
guint n_axes;
|
||||
|
||||
if (gdk_event_get_axes (event, &axes, &n_axes))
|
||||
{
|
||||
double *axes_copy = g_memdup (axes, n_axes * sizeof (double));
|
||||
|
||||
return axes_copy;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_get_event_type:
|
||||
* @event: a #GdkEvent
|
||||
|
||||
@@ -603,8 +603,6 @@ void _gdk_event_queue_handle_motion_compression (GdkDisplay *display);
|
||||
void gdk_event_queue_handle_scroll_compression (GdkDisplay *display);
|
||||
void _gdk_event_queue_flush (GdkDisplay *display);
|
||||
|
||||
double * gdk_event_dup_axes (GdkEvent *event);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+138
-6
@@ -95,7 +95,139 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GdkVulkanContext, gdk_vulkan_context, GDK_TYPE
|
||||
const char *
|
||||
gdk_vulkan_strerror (VkResult result)
|
||||
{
|
||||
return "Unknown Vulkan error.";
|
||||
/* If your compiler brought you here with a warning about missing
|
||||
* enumeration values, you're running a newer Vulkan version than
|
||||
* the GTK developers (or you are a GTK developer) and have
|
||||
* encountered a newly added Vulkan error message.
|
||||
* You want to add it to this enum now.
|
||||
*
|
||||
* Because the Vulkan people don't make adding this too easy, here's
|
||||
* the process to manage it:
|
||||
* 1. go to
|
||||
* https://github.com/KhronosGroup/Vulkan-Headers/blob/master/include/vulkan/vulkan_core.h
|
||||
* 2. Find the line where this enum value was added.
|
||||
* 3. Click the commit that added this line.
|
||||
* 4. The commit you're looking at now should also change
|
||||
* VK_HEADER_VERSION, find that number.
|
||||
* 5. Use that number in the #ifdef when adding the enum value to
|
||||
* this enum.
|
||||
* 6. For the error message, look at the specification (the one
|
||||
* that includes all extensions) at
|
||||
* https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkResult
|
||||
* 7. If this value has not been added to the specification yet,
|
||||
* search for the error message in the text of specification.
|
||||
* Often it will have a description that can be used as an error
|
||||
* message.
|
||||
* 8. If that didn't lead to one (or you are lazy), just use the
|
||||
* literal string of the enum value as the error message. A
|
||||
* GTK developer will add the correct one once it's added to the
|
||||
* specification.
|
||||
*/
|
||||
switch (result)
|
||||
{
|
||||
case VK_SUCCESS:
|
||||
return "Command successfully completed.";
|
||||
case VK_NOT_READY:
|
||||
return "A fence or query has not yet completed.";
|
||||
case VK_TIMEOUT:
|
||||
return "A wait operation has not completed in the specified time.";
|
||||
case VK_EVENT_SET:
|
||||
return "An event is signaled.";
|
||||
case VK_EVENT_RESET:
|
||||
return "An event is unsignaled.";
|
||||
case VK_INCOMPLETE:
|
||||
return "A return array was too small for the result.";
|
||||
case VK_SUBOPTIMAL_KHR:
|
||||
return "A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully.";
|
||||
case VK_ERROR_OUT_OF_HOST_MEMORY:
|
||||
return "A host memory allocation has failed.";
|
||||
case VK_ERROR_OUT_OF_DEVICE_MEMORY:
|
||||
return "A device memory allocation has failed.";
|
||||
case VK_ERROR_INITIALIZATION_FAILED:
|
||||
return "Initialization of an object could not be completed for implementation-specific reasons.";
|
||||
case VK_ERROR_DEVICE_LOST:
|
||||
return "The logical or physical device has been lost.";
|
||||
case VK_ERROR_MEMORY_MAP_FAILED:
|
||||
return "Mapping of a memory object has failed.";
|
||||
case VK_ERROR_LAYER_NOT_PRESENT:
|
||||
return "A requested layer is not present or could not be loaded.";
|
||||
case VK_ERROR_EXTENSION_NOT_PRESENT:
|
||||
return "A requested extension is not supported.";
|
||||
case VK_ERROR_FEATURE_NOT_PRESENT:
|
||||
return "A requested feature is not supported.";
|
||||
case VK_ERROR_INCOMPATIBLE_DRIVER:
|
||||
return "The requested version of Vulkan is not supported by the driver or is otherwise incompatible for implementation-specific reasons.";
|
||||
case VK_ERROR_TOO_MANY_OBJECTS:
|
||||
return "Too many objects of the type have already been created.";
|
||||
case VK_ERROR_FORMAT_NOT_SUPPORTED:
|
||||
return "A requested format is not supported on this device.";
|
||||
#if VK_HEADER_VERSION >= 24
|
||||
case VK_ERROR_FRAGMENTED_POOL:
|
||||
return "A requested pool allocation has failed due to fragmentation of the pool’s memory.";
|
||||
#endif
|
||||
case VK_ERROR_SURFACE_LOST_KHR:
|
||||
return "A surface is no longer available.";
|
||||
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
|
||||
return "The requested window is already in use by Vulkan or another API in a manner which prevents it from being used again.";
|
||||
case VK_ERROR_OUT_OF_DATE_KHR:
|
||||
return "A surface has changed in such a way that it is no longer compatible with the swapchain.";
|
||||
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
|
||||
return "The display used by a swapchain does not use the same presentable image layout, or is incompatible in a way that prevents sharing an image.";
|
||||
case VK_ERROR_VALIDATION_FAILED_EXT:
|
||||
return "The application caused the validation layer to fail.";
|
||||
case VK_ERROR_INVALID_SHADER_NV:
|
||||
return "One or more shaders failed to compile or link.";
|
||||
#if VK_HEADER_VERSION >= 39
|
||||
case VK_ERROR_OUT_OF_POOL_MEMORY_KHR:
|
||||
return "A pool memory allocation has failed.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 54
|
||||
case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR:
|
||||
return "An external handle is not a valid handle of the specified type.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 64
|
||||
case VK_ERROR_NOT_PERMITTED_EXT:
|
||||
return "The caller does not have sufficient privileges.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 72
|
||||
case VK_ERROR_FRAGMENTATION_EXT:
|
||||
return "A descriptor pool creation has failed due to fragmentation";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 89
|
||||
case VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT:
|
||||
return "Invalid DRM format modifier plane layout";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 97
|
||||
case VK_ERROR_INVALID_DEVICE_ADDRESS_EXT:
|
||||
return "Invalid device address";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 105
|
||||
case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT:
|
||||
return "An operation on a swapchain created with VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT failed as it did not have exclusive full-screen access.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 131
|
||||
case VK_ERROR_UNKNOWN:
|
||||
return "An unknown error has occurred; either the application has provided invalid input, or an implementation failure has occurred.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 135
|
||||
case VK_THREAD_IDLE_KHR:
|
||||
return "A deferred operation is not complete but there is currently no work for this thread to do at the time of this call.";
|
||||
case VK_THREAD_DONE_KHR:
|
||||
return "A deferred operation is not complete but there is no work remaining to assign to additional threads.";
|
||||
case VK_OPERATION_DEFERRED_KHR:
|
||||
return "A deferred operation was requested and at least some of the work was deferred.";
|
||||
case VK_OPERATION_NOT_DEFERRED_KHR:
|
||||
return "A deferred operation was requested and no operations were deferred.";
|
||||
case VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT:
|
||||
return "A requested pipeline creation would have required compilation, but the application requested compilation to not be performed.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION < 140
|
||||
case VK_RESULT_RANGE_SIZE:
|
||||
#endif
|
||||
case VK_RESULT_MAX_ENUM:
|
||||
default:
|
||||
return "Unknown Vulkan error.";
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -170,7 +302,7 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not query surface capabilities: %d", res);
|
||||
"Could not query surface capabilities: %s", gdk_vulkan_strerror (res));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -267,7 +399,7 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
else
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not create swapchain for this surface: %d", res);
|
||||
"Could not create swapchain for this surface: %s", gdk_vulkan_strerror (res));
|
||||
priv->swapchain = VK_NULL_HANDLE;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -443,7 +575,7 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not create surface for this surface: %d", res);
|
||||
"Could not create surface for this surface: %s", gdk_vulkan_strerror (res));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -454,7 +586,7 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not check if queue family supports this surface: %d", res);
|
||||
"Could not check if queue family supports this surface: %s", gdk_vulkan_strerror (res));
|
||||
}
|
||||
else if (!supported)
|
||||
{
|
||||
@@ -982,7 +1114,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_UNSUPPORTED,
|
||||
"Could not create a Vulkan instance: %d", res);
|
||||
"Could not create a Vulkan instance: %s", gdk_vulkan_strerror (res));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
+11
-17
@@ -1824,7 +1824,6 @@ blur_texture (GskGLRenderer *self,
|
||||
float blur_radius_x,
|
||||
float blur_radius_y)
|
||||
{
|
||||
const GskRoundedRect new_clip = GSK_ROUNDED_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height);
|
||||
int pass1_texture_id, pass1_render_target;
|
||||
int pass2_texture_id, pass2_render_target;
|
||||
int prev_render_target;
|
||||
@@ -1851,16 +1850,17 @@ blur_texture (GskGLRenderer *self,
|
||||
GL_NEAREST, GL_NEAREST,
|
||||
&pass2_texture_id, &pass2_render_target);
|
||||
|
||||
init_projection_matrix (&item_proj, &new_clip.bounds);
|
||||
init_projection_matrix (&item_proj,
|
||||
&GRAPHENE_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height));
|
||||
|
||||
ops_set_program (builder, &self->programs->blur_program);
|
||||
prev_projection = ops_set_projection (builder, &item_proj);
|
||||
ops_set_modelview (builder, NULL);
|
||||
prev_viewport = ops_set_viewport (builder, &new_clip.bounds);
|
||||
ops_push_clip (builder, &new_clip);
|
||||
prev_viewport = ops_set_viewport (builder, &GRAPHENE_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height));
|
||||
ops_push_clip (builder, &GSK_ROUNDED_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height));
|
||||
|
||||
prev_render_target = ops_set_render_target (builder, pass1_render_target);
|
||||
ops_begin (builder, OP_CLEAR);
|
||||
ops_set_program (builder, &self->programs->blur_program);
|
||||
|
||||
op = ops_begin (builder, OP_CHANGE_BLUR);
|
||||
op->size.width = texture_to_blur_width;
|
||||
@@ -1871,7 +1871,7 @@ blur_texture (GskGLRenderer *self,
|
||||
ops_set_texture (builder, region->texture_id);
|
||||
|
||||
load_vertex_data_with_region (ops_draw (builder, NULL),
|
||||
&new_clip.bounds,
|
||||
&GRAPHENE_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height),
|
||||
builder, region,
|
||||
FALSE);
|
||||
#if 0
|
||||
@@ -1893,7 +1893,7 @@ blur_texture (GskGLRenderer *self,
|
||||
ops_set_render_target (builder, pass2_render_target);
|
||||
ops_begin (builder, OP_CLEAR);
|
||||
load_vertex_data_with_region (ops_draw (builder, NULL), /* render pass 2 */
|
||||
&new_clip.bounds,
|
||||
&GRAPHENE_RECT_INIT (0, 0, texture_to_blur_width, texture_to_blur_height),
|
||||
builder, region,
|
||||
FALSE);
|
||||
|
||||
@@ -2940,15 +2940,10 @@ static inline void
|
||||
apply_color_matrix_op (const Program *program,
|
||||
const OpColorMatrix *op)
|
||||
{
|
||||
OP_PRINT (" -> Color matrix. Send matrix: %d. Send offset: %d.",
|
||||
op->matrix.send, op->offset.send);
|
||||
|
||||
if (op->matrix.send)
|
||||
{
|
||||
float mat[16];
|
||||
graphene_matrix_to_float (op->matrix.value, mat);
|
||||
glUniformMatrix4fv (program->color_matrix.color_matrix_location, 1, GL_FALSE, mat);
|
||||
}
|
||||
float mat[16];
|
||||
OP_PRINT (" -> Color Matrix");
|
||||
graphene_matrix_to_float (op->matrix, mat);
|
||||
glUniformMatrix4fv (program->color_matrix.color_matrix_location, 1, GL_FALSE, mat);
|
||||
|
||||
if (op->offset.send)
|
||||
{
|
||||
@@ -3204,7 +3199,6 @@ static inline void
|
||||
apply_repeat_op (const Program *program,
|
||||
const OpRepeat *op)
|
||||
{
|
||||
OP_PRINT (" -> Repeat");
|
||||
glUniform4fv (program->repeat.child_bounds_location, 1, op->child_bounds);
|
||||
glUniform4fv (program->repeat.texture_rect_location, 1, op->texture_rect);
|
||||
}
|
||||
|
||||
+157
-75
@@ -14,28 +14,27 @@ rect_equal (const graphene_rect_t *a,
|
||||
return memcmp (a, b, sizeof (graphene_rect_t)) == 0;
|
||||
}
|
||||
|
||||
static inline bool G_GNUC_PURE
|
||||
static inline gboolean G_GNUC_PURE
|
||||
rounded_rect_equal (const GskRoundedRect *r1,
|
||||
const GskRoundedRect *r2)
|
||||
{
|
||||
if (r1 == r2)
|
||||
return true;
|
||||
int i;
|
||||
|
||||
if (!r1)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
if (r1->bounds.origin.x != r2->bounds.origin.x ||
|
||||
r1->bounds.origin.y != r2->bounds.origin.y ||
|
||||
r1->bounds.size.width != r2->bounds.size.width ||
|
||||
r1->bounds.size.height != r2->bounds.size.height)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
for (int i = 0; i < 4; i ++)
|
||||
for (i = 0; i < 4; i ++)
|
||||
if (r1->corner[i].width != r2->corner[i].width ||
|
||||
r1->corner[i].height != r2->corner[i].height)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static inline gboolean G_GNUC_PURE
|
||||
@@ -209,9 +208,10 @@ ops_free (RenderOpBuilder *builder)
|
||||
|
||||
void
|
||||
ops_set_program (RenderOpBuilder *builder,
|
||||
Program *program)
|
||||
Program *program)
|
||||
{
|
||||
OpProgram *op;
|
||||
ProgramState *program_state = NULL;
|
||||
|
||||
if (builder->current_program == program)
|
||||
return;
|
||||
@@ -220,6 +220,86 @@ ops_set_program (RenderOpBuilder *builder,
|
||||
op->program = program;
|
||||
|
||||
builder->current_program = program;
|
||||
|
||||
program_state = &program->state;
|
||||
|
||||
if (memcmp (&builder->current_projection, &program_state->projection, sizeof (graphene_matrix_t)) != 0)
|
||||
{
|
||||
OpMatrix *opm;
|
||||
|
||||
opm = ops_begin (builder, OP_CHANGE_PROJECTION);
|
||||
opm->matrix = builder->current_projection;
|
||||
program_state->projection = builder->current_projection;
|
||||
}
|
||||
|
||||
if (program_state->modelview == NULL ||
|
||||
!gsk_transform_equal (builder->current_modelview, program_state->modelview))
|
||||
{
|
||||
OpMatrix *opm;
|
||||
|
||||
opm = ops_begin (builder, OP_CHANGE_MODELVIEW);
|
||||
gsk_transform_to_matrix (builder->current_modelview, &opm->matrix);
|
||||
gsk_transform_unref (program_state->modelview);
|
||||
program_state->modelview = gsk_transform_ref (builder->current_modelview);
|
||||
}
|
||||
|
||||
if (!rect_equal (&builder->current_viewport, &program_state->viewport))
|
||||
{
|
||||
OpViewport *opv;
|
||||
|
||||
opv = ops_begin (builder, OP_CHANGE_VIEWPORT);
|
||||
opv->viewport = builder->current_viewport;
|
||||
program_state->viewport = builder->current_viewport;
|
||||
}
|
||||
|
||||
if (!rounded_rect_equal (builder->current_clip, &program_state->clip))
|
||||
{
|
||||
OpClip *opc;
|
||||
|
||||
opc = ops_begin (builder, OP_CHANGE_CLIP);
|
||||
opc->clip = *builder->current_clip;
|
||||
opc->send_corners = !rounded_rect_corners_equal (builder->current_clip, &program_state->clip);
|
||||
program_state->clip = *builder->current_clip;
|
||||
}
|
||||
|
||||
if (program_state->opacity != builder->current_opacity)
|
||||
{
|
||||
OpOpacity *opo;
|
||||
|
||||
opo = ops_begin (builder, OP_CHANGE_OPACITY);
|
||||
opo->opacity = builder->current_opacity;
|
||||
program_state->opacity = builder->current_opacity;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ops_set_clip (RenderOpBuilder *builder,
|
||||
const GskRoundedRect *clip)
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
OpClip *op;
|
||||
|
||||
if (current_program_state &&
|
||||
rounded_rect_equal (¤t_program_state->clip, clip))
|
||||
return;
|
||||
|
||||
if (!(op = op_buffer_peek_tail_checked (&builder->render_ops, OP_CHANGE_CLIP)))
|
||||
{
|
||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_CLIP);
|
||||
op->send_corners = !current_program_state ||
|
||||
!rounded_rect_corners_equal (¤t_program_state->clip, clip);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the op before sent the corners, this one needs, too */
|
||||
op->send_corners |= !current_program_state ||
|
||||
!rounded_rect_corners_equal (¤t_program_state->clip, clip);
|
||||
}
|
||||
|
||||
op->clip = *clip;
|
||||
|
||||
if (current_program_state)
|
||||
current_program_state->clip = *clip;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -238,6 +318,7 @@ ops_push_clip (RenderOpBuilder *self,
|
||||
g_array_append_val (self->clip_stack, entry);
|
||||
self->current_clip = &g_array_index (self->clip_stack, ClipStackEntry, self->clip_stack->len - 1).rect;
|
||||
self->clip_is_rectilinear = entry.is_rectilinear;
|
||||
ops_set_clip (self, clip);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -255,6 +336,7 @@ ops_pop_clip (RenderOpBuilder *self)
|
||||
{
|
||||
self->current_clip = &head->rect;
|
||||
self->clip_is_rectilinear = head->is_rectilinear;
|
||||
ops_set_clip (self, &head->rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -270,6 +352,32 @@ ops_has_clip (RenderOpBuilder *self)
|
||||
self->clip_stack->len > 1;
|
||||
}
|
||||
|
||||
static void
|
||||
ops_set_modelview_internal (RenderOpBuilder *builder,
|
||||
GskTransform *transform)
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
OpMatrix *op;
|
||||
|
||||
#if 0
|
||||
XXX This is not possible if we want pop() to work.
|
||||
if (builder->current_program &&
|
||||
gsk_transform_equal (builder->current_program_state->modelview, transform))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (!(op = op_buffer_peek_tail_checked (&builder->render_ops, OP_CHANGE_MODELVIEW)))
|
||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_MODELVIEW);
|
||||
|
||||
gsk_transform_to_matrix (transform, &op->matrix);
|
||||
|
||||
if (builder->current_program != NULL)
|
||||
{
|
||||
gsk_transform_unref (current_program_state->modelview);
|
||||
current_program_state->modelview = gsk_transform_ref (transform);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ops_set_modelview:
|
||||
* @builder
|
||||
@@ -302,6 +410,7 @@ ops_set_modelview (RenderOpBuilder *builder,
|
||||
builder->current_modelview = entry->transform;
|
||||
builder->scale_x = entry->metadata.scale_x;
|
||||
builder->scale_y = entry->metadata.scale_y;
|
||||
ops_set_modelview_internal (builder, entry->transform);
|
||||
}
|
||||
|
||||
/* This sets the given modelview to the one we get when multiplying
|
||||
@@ -347,6 +456,7 @@ ops_push_modelview (RenderOpBuilder *builder,
|
||||
builder->scale_x = entry->metadata.scale_x;
|
||||
builder->scale_y = entry->metadata.scale_y;
|
||||
builder->current_modelview = entry->transform;
|
||||
ops_set_modelview_internal (builder, entry->transform);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -370,6 +480,7 @@ ops_pop_modelview (RenderOpBuilder *builder)
|
||||
builder->scale_x = head->metadata.scale_x;
|
||||
builder->scale_y = head->metadata.scale_y;
|
||||
builder->current_modelview = head->transform;
|
||||
ops_set_modelview_internal (builder, head->transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -381,7 +492,17 @@ graphene_matrix_t
|
||||
ops_set_projection (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *projection)
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
graphene_matrix_t prev_mv;
|
||||
OpMatrix *op;
|
||||
|
||||
if (!(op = op_buffer_peek_tail_checked (&builder->render_ops, OP_CHANGE_PROJECTION)))
|
||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_PROJECTION);
|
||||
|
||||
op->matrix = *projection;
|
||||
|
||||
if (builder->current_program != NULL)
|
||||
current_program_state->projection = *projection;
|
||||
|
||||
prev_mv = builder->current_projection;
|
||||
builder->current_projection = *projection;
|
||||
@@ -397,8 +518,9 @@ ops_set_viewport (RenderOpBuilder *builder,
|
||||
OpViewport *op;
|
||||
graphene_rect_t prev_viewport;
|
||||
|
||||
if (rect_equal (&builder->current_viewport, viewport))
|
||||
return *viewport;
|
||||
if (current_program_state != NULL &&
|
||||
rect_equal (¤t_program_state->viewport, viewport))
|
||||
return current_program_state->viewport;
|
||||
|
||||
op = ops_begin (builder, OP_CHANGE_VIEWPORT);
|
||||
op->viewport = *viewport;
|
||||
@@ -464,14 +586,24 @@ float
|
||||
ops_set_opacity (RenderOpBuilder *builder,
|
||||
float opacity)
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
OpOpacity *op;
|
||||
float prev_opacity;
|
||||
|
||||
if (builder->current_opacity == opacity)
|
||||
return opacity;
|
||||
|
||||
if (!(op = op_buffer_peek_tail_checked (&builder->render_ops, OP_CHANGE_OPACITY)))
|
||||
op = op_buffer_add (&builder->render_ops, OP_CHANGE_OPACITY);
|
||||
|
||||
op->opacity = opacity;
|
||||
|
||||
prev_opacity = builder->current_opacity;
|
||||
builder->current_opacity = opacity;
|
||||
|
||||
if (builder->current_program != NULL)
|
||||
current_program_state->opacity = opacity;
|
||||
|
||||
return prev_opacity;
|
||||
}
|
||||
|
||||
@@ -534,30 +666,30 @@ ops_set_color_matrix (RenderOpBuilder *builder,
|
||||
const graphene_vec4_t *offset)
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
const bool offset_equal = graphene_vec4_equal (offset, ¤t_program_state->color_matrix.offset);
|
||||
const bool matrix_equal = graphene_matrix_equal_fast (matrix,
|
||||
¤t_program_state->color_matrix.matrix);
|
||||
OpColorMatrix *op;
|
||||
bool offset_equal;
|
||||
|
||||
if (offset_equal && matrix_equal)
|
||||
offset_equal = memcmp (offset,
|
||||
¤t_program_state->color_matrix.offset,
|
||||
sizeof (graphene_vec4_t)) == 0;
|
||||
|
||||
if (memcmp (matrix,
|
||||
¤t_program_state->color_matrix.matrix,
|
||||
sizeof (graphene_matrix_t)) == 0 &&
|
||||
offset_equal)
|
||||
return;
|
||||
|
||||
op = ops_begin (builder, OP_CHANGE_COLOR_MATRIX);
|
||||
current_program_state->color_matrix.matrix = *matrix;
|
||||
|
||||
if (!matrix_equal)
|
||||
{
|
||||
current_program_state->color_matrix.matrix = *matrix;
|
||||
op->matrix.value = matrix;
|
||||
op->matrix.send = TRUE;
|
||||
}
|
||||
else
|
||||
op->matrix.send = FALSE;
|
||||
op = ops_begin (builder, OP_CHANGE_COLOR_MATRIX);
|
||||
op->matrix = matrix;
|
||||
|
||||
if (!offset_equal)
|
||||
{
|
||||
current_program_state->color_matrix.offset = *offset;
|
||||
op->offset.value = offset;
|
||||
op->offset.send = TRUE;
|
||||
|
||||
current_program_state->color_matrix.offset = *offset;
|
||||
}
|
||||
else
|
||||
op->offset.send = FALSE;
|
||||
@@ -623,58 +755,8 @@ GskQuadVertex *
|
||||
ops_draw (RenderOpBuilder *builder,
|
||||
const GskQuadVertex vertex_data[GL_N_VERTICES])
|
||||
{
|
||||
ProgramState *program_state = get_current_program_state (builder);
|
||||
OpDraw *op;
|
||||
|
||||
if (memcmp (&builder->current_projection, &program_state->projection, sizeof (graphene_matrix_t)) != 0)
|
||||
{
|
||||
OpMatrix *opm;
|
||||
|
||||
opm = ops_begin (builder, OP_CHANGE_PROJECTION);
|
||||
opm->matrix = builder->current_projection;
|
||||
program_state->projection = builder->current_projection;
|
||||
}
|
||||
|
||||
if (program_state->modelview == NULL ||
|
||||
!gsk_transform_equal (builder->current_modelview, program_state->modelview))
|
||||
{
|
||||
OpMatrix *opm;
|
||||
|
||||
opm = ops_begin (builder, OP_CHANGE_MODELVIEW);
|
||||
gsk_transform_to_matrix (builder->current_modelview, &opm->matrix);
|
||||
gsk_transform_unref (program_state->modelview);
|
||||
program_state->modelview = gsk_transform_ref (builder->current_modelview);
|
||||
}
|
||||
|
||||
if (!rect_equal (&builder->current_viewport, &program_state->viewport))
|
||||
{
|
||||
OpViewport *opv;
|
||||
|
||||
opv = ops_begin (builder, OP_CHANGE_VIEWPORT);
|
||||
opv->viewport = builder->current_viewport;
|
||||
program_state->viewport = builder->current_viewport;
|
||||
}
|
||||
|
||||
if (!rounded_rect_equal (builder->current_clip, &program_state->clip))
|
||||
{
|
||||
OpClip *opc;
|
||||
|
||||
opc = ops_begin (builder, OP_CHANGE_CLIP);
|
||||
opc->clip = *builder->current_clip;
|
||||
opc->send_corners = !rounded_rect_corners_equal (builder->current_clip, &program_state->clip);
|
||||
program_state->clip = *builder->current_clip;
|
||||
}
|
||||
|
||||
if (program_state->opacity != builder->current_opacity)
|
||||
{
|
||||
OpOpacity *opo;
|
||||
|
||||
opo = ops_begin (builder, OP_CHANGE_OPACITY);
|
||||
opo->opacity = builder->current_opacity;
|
||||
program_state->opacity = builder->current_opacity;
|
||||
}
|
||||
|
||||
/* TODO: Did the additions above break the following optimization? */
|
||||
if ((op = op_buffer_peek_tail_checked (&builder->render_ops, OP_DRAW)))
|
||||
{
|
||||
op->vao_size += GL_N_VERTICES;
|
||||
|
||||
+1
-2
@@ -53,7 +53,6 @@ typedef struct { GskRoundedRect value; guint send: 1; guint send_corners: 1; } R
|
||||
typedef struct { const GdkRGBA *value; guint send: 1; } RGBAUniformValue;
|
||||
typedef struct { const graphene_vec4_t *value; guint send: 1; } Vec4UniformValue;
|
||||
typedef struct { const GskColorStop *value; guint send: 1; } ColorStopUniformValue;
|
||||
typedef struct { const graphene_matrix_t *value; guint send: 1; } MatrixUniformValue;
|
||||
|
||||
/* OpNode are allocated within OpBuffer.pos, but we keep
|
||||
* a secondary index into the locations of that buffer
|
||||
@@ -168,7 +167,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MatrixUniformValue matrix;
|
||||
const graphene_matrix_t *matrix;
|
||||
Vec4UniformValue offset;
|
||||
} OpColorMatrix;
|
||||
|
||||
|
||||
+5
-22
@@ -1263,22 +1263,15 @@ gsk_border_node_diff (GskRenderNode *node1,
|
||||
gdk_rgba_equal (&self1->border_color[0], &self2->border_color[0]))
|
||||
return;
|
||||
|
||||
/* Different uniformity -> diff impossible */
|
||||
if (self1->uniform ^ self2->uniform)
|
||||
{
|
||||
gsk_render_node_diff_impossible (node1, node2, region);
|
||||
return;
|
||||
}
|
||||
|
||||
if (self1->border_width[0] == self2->border_width[0] &&
|
||||
self1->border_width[1] == self2->border_width[1] &&
|
||||
self1->border_width[2] == self2->border_width[2] &&
|
||||
self1->border_width[3] == self2->border_width[3] &&
|
||||
if (gsk_rounded_rect_equal (&self1->outline, &self2->outline) &&
|
||||
gdk_rgba_equal (&self1->border_color[0], &self2->border_color[0]) &&
|
||||
gdk_rgba_equal (&self1->border_color[1], &self2->border_color[1]) &&
|
||||
gdk_rgba_equal (&self1->border_color[2], &self2->border_color[2]) &&
|
||||
gdk_rgba_equal (&self1->border_color[3], &self2->border_color[3]) &&
|
||||
gsk_rounded_rect_equal (&self1->outline, &self2->outline))
|
||||
self1->border_width[0] == self2->border_width[0] &&
|
||||
self1->border_width[1] == self2->border_width[1] &&
|
||||
self1->border_width[2] == self2->border_width[2] &&
|
||||
self1->border_width[3] == self2->border_width[3])
|
||||
return;
|
||||
|
||||
gsk_render_node_diff_impossible (node1, node2, region);
|
||||
@@ -2762,16 +2755,6 @@ gsk_transform_node_draw (GskRenderNode *node,
|
||||
ctm.xx, ctm.yx,
|
||||
ctm.xy, ctm.yy,
|
||||
ctm.x0, ctm.y0));
|
||||
if (xx * yy == xy * yx)
|
||||
{
|
||||
/* broken matrix here. This can happen during transitions
|
||||
* (like when flipping an axis at the point where scale == 0)
|
||||
* and just means that nothing should be drawn.
|
||||
* But Cairo thows lots of ugly errors instead of silently
|
||||
* going on. So We silently go on.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
cairo_transform (cr, &ctm);
|
||||
|
||||
gsk_render_node_draw (self->child, cr);
|
||||
|
||||
+61
-89
@@ -688,16 +688,10 @@ create_ascii_glyphs (PangoFont *font)
|
||||
glyph_string = pango_glyph_string_new ();
|
||||
for (i = MIN_ASCII_GLYPH; i < MAX_ASCII_GLYPH; i++)
|
||||
{
|
||||
const char text[2] = { i, 0 };
|
||||
|
||||
pango_shape_with_flags (text,
|
||||
1,
|
||||
text,
|
||||
1,
|
||||
¬_a_hack,
|
||||
glyph_string,
|
||||
PANGO_SHAPE_ROUND_POSITIONS);
|
||||
|
||||
pango_shape ((char[2]) { i, 0 },
|
||||
1,
|
||||
¬_a_hack,
|
||||
glyph_string);
|
||||
if (glyph_string->num_glyphs != 1)
|
||||
{
|
||||
pango_glyph_string_free (glyph_string);
|
||||
@@ -2310,84 +2304,6 @@ base64_encode_with_linebreaks (const guchar *data,
|
||||
return out;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_text_node_serialize_glyphs (GskRenderNode *node,
|
||||
GString *p)
|
||||
{
|
||||
const guint n_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
const PangoGlyphInfo *glyphs = gsk_text_node_get_glyphs (node, NULL);
|
||||
PangoFont *font = gsk_text_node_get_font (node);
|
||||
GString *str;
|
||||
guint i, j;
|
||||
PangoGlyphString *ascii;
|
||||
|
||||
ascii = create_ascii_glyphs (font);
|
||||
str = g_string_new ("");
|
||||
|
||||
for (i = 0; i < n_glyphs; i++)
|
||||
{
|
||||
if (ascii)
|
||||
{
|
||||
for (j = 0; j < ascii->num_glyphs; j++)
|
||||
{
|
||||
if (glyphs[i].glyph == ascii->glyphs[j].glyph &&
|
||||
glyphs[i].geometry.width == ascii->glyphs[j].geometry.width &&
|
||||
glyphs[i].geometry.x_offset == 0 &&
|
||||
glyphs[i].geometry.y_offset == 0 &&
|
||||
glyphs[i].attr.is_cluster_start)
|
||||
{
|
||||
g_string_append_c (str, j + MIN_ASCII_GLYPH);
|
||||
break;
|
||||
}
|
||||
else if (glyphs[i].glyph == ascii->glyphs[j].glyph)
|
||||
{
|
||||
if (glyphs[i].geometry.width != ascii->glyphs[j].geometry.width)
|
||||
g_print ("not ascii because of width (%d != %d)\n",
|
||||
glyphs[i].geometry.width,
|
||||
ascii->glyphs[j].geometry.width);
|
||||
if (glyphs[i].geometry.x_offset != 0 ||
|
||||
glyphs[i].geometry.y_offset != 0)
|
||||
g_print ("not ascii because of offset\n");
|
||||
if (!glyphs[i].attr.is_cluster_start)
|
||||
g_print ("not ascii because of cluster\n");
|
||||
}
|
||||
}
|
||||
if (j != ascii->num_glyphs)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (str->len)
|
||||
{
|
||||
g_string_append_printf (p, "\"%s\", ", str->str);
|
||||
g_string_set_size (str, 0);
|
||||
}
|
||||
|
||||
g_string_append_printf (p, "%u %g",
|
||||
glyphs[i].glyph,
|
||||
(double) glyphs[i].geometry.width / PANGO_SCALE);
|
||||
if (!glyphs[i].attr.is_cluster_start ||
|
||||
glyphs[i].geometry.x_offset != 0 ||
|
||||
glyphs[i].geometry.y_offset != 0)
|
||||
{
|
||||
g_string_append_printf (p, " %g %g",
|
||||
(double) glyphs[i].geometry.x_offset / PANGO_SCALE,
|
||||
(double) glyphs[i].geometry.y_offset / PANGO_SCALE);
|
||||
if (!glyphs[i].attr.is_cluster_start)
|
||||
g_string_append (p, " same-cluster");
|
||||
}
|
||||
|
||||
if (i + 1 < n_glyphs)
|
||||
g_string_append (p, ", ");
|
||||
}
|
||||
|
||||
if (str->len)
|
||||
g_string_append_printf (p, "\"%s\"", str->str);
|
||||
|
||||
g_string_free (str, TRUE);
|
||||
if (ascii)
|
||||
pango_glyph_string_free (ascii);
|
||||
}
|
||||
|
||||
static void
|
||||
render_node_print (Printer *p,
|
||||
GskRenderNode *node)
|
||||
@@ -2715,11 +2631,16 @@ render_node_print (Printer *p,
|
||||
|
||||
case GSK_TEXT_NODE:
|
||||
{
|
||||
const guint n_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
const PangoGlyphInfo *glyphs = gsk_text_node_get_glyphs (node, NULL);
|
||||
const graphene_point_t *offset = gsk_text_node_get_offset (node);
|
||||
const GdkRGBA *color = gsk_text_node_get_color (node);
|
||||
PangoFont *font = gsk_text_node_get_font (node);
|
||||
PangoFontDescription *desc;
|
||||
char *font_name;
|
||||
GString *str;
|
||||
guint i, j;
|
||||
PangoGlyphString *ascii = create_ascii_glyphs (font);
|
||||
|
||||
start_node (p, "text");
|
||||
|
||||
@@ -2729,14 +2650,61 @@ render_node_print (Printer *p,
|
||||
_indent (p);
|
||||
desc = pango_font_describe (font);
|
||||
font_name = pango_font_description_to_string (desc);
|
||||
if (ascii == NULL)
|
||||
g_print ("\"%s\" has no ascii table\n", font_name);
|
||||
g_string_append_printf (p->str, "font: \"%s\";\n", font_name);
|
||||
g_free (font_name);
|
||||
pango_font_description_free (desc);
|
||||
|
||||
_indent (p);
|
||||
str = g_string_new (NULL);
|
||||
g_string_append (p->str, "glyphs: ");
|
||||
for (i = 0; i < n_glyphs; i++)
|
||||
{
|
||||
if (ascii)
|
||||
{
|
||||
for (j = 0; j < ascii->num_glyphs; j++)
|
||||
{
|
||||
if (glyphs[i].glyph == ascii->glyphs[j].glyph &&
|
||||
glyphs[i].geometry.width == ascii->glyphs[j].geometry.width &&
|
||||
glyphs[i].geometry.x_offset == 0 &&
|
||||
glyphs[i].geometry.y_offset == 0 &&
|
||||
glyphs[i].attr.is_cluster_start)
|
||||
{
|
||||
g_string_append_c (str, j + MIN_ASCII_GLYPH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j != ascii->num_glyphs)
|
||||
continue;
|
||||
}
|
||||
|
||||
gsk_text_node_serialize_glyphs (node, p->str);
|
||||
if (str->len)
|
||||
{
|
||||
g_string_append_printf (p->str, "\"%s\", ", str->str);
|
||||
g_string_set_size (str, 0);
|
||||
}
|
||||
|
||||
g_string_append_printf (p->str, "%u %g",
|
||||
glyphs[i].glyph,
|
||||
(double) glyphs[i].geometry.width / PANGO_SCALE);
|
||||
if (!glyphs[i].attr.is_cluster_start ||
|
||||
glyphs[i].geometry.x_offset != 0 ||
|
||||
glyphs[i].geometry.y_offset != 0)
|
||||
{
|
||||
g_string_append_printf (p->str, "%g %g",
|
||||
(double) glyphs[i].geometry.x_offset / PANGO_SCALE,
|
||||
(double) glyphs[i].geometry.y_offset / PANGO_SCALE);
|
||||
if (!glyphs[i].attr.is_cluster_start)
|
||||
g_string_append (p->str, " same-cluster");
|
||||
}
|
||||
|
||||
if (i + 1 < n_glyphs)
|
||||
g_string_append (p->str, ", ");
|
||||
}
|
||||
|
||||
if (str->len)
|
||||
g_string_append_printf (p->str, "\"%s\"", str->str);
|
||||
|
||||
g_string_append_c (p->str, ';');
|
||||
g_string_append_c (p->str, '\n');
|
||||
@@ -2745,6 +2713,10 @@ render_node_print (Printer *p,
|
||||
append_point_param (p, "offset", offset);
|
||||
|
||||
end_node (p);
|
||||
|
||||
g_string_free (str, TRUE);
|
||||
if (ascii)
|
||||
pango_glyph_string_free (ascii);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -96,9 +96,6 @@ void gsk_render_node_diff_impossible (GskRenderNode
|
||||
|
||||
bool gsk_border_node_get_uniform (GskRenderNode *self);
|
||||
|
||||
void gsk_text_node_serialize_glyphs (GskRenderNode *self,
|
||||
GString *str);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSK_RENDER_NODE_PRIVATE_H__ */
|
||||
|
||||
+5
-7
@@ -127,10 +127,8 @@ gsk_transform_alloc (const GskTransformClass *transform_class,
|
||||
|
||||
self->transform_class = transform_class;
|
||||
self->category = next ? MIN (category, next->category) : category;
|
||||
if (gsk_transform_is_identity (next))
|
||||
gsk_transform_unref (next);
|
||||
else
|
||||
self->next = next;
|
||||
self->next = gsk_transform_is_identity (next) ? NULL : gsk_transform_ref (next);
|
||||
g_clear_pointer (&next, gsk_transform_unref);
|
||||
|
||||
return self;
|
||||
}
|
||||
@@ -219,7 +217,7 @@ gsk_identity_transform_equal (GskTransform *first_transform,
|
||||
static const GskTransformClass GSK_IDENTITY_TRANSFORM_CLASS =
|
||||
{
|
||||
sizeof (GskTransform),
|
||||
"GskIdentityTransform",
|
||||
"GskIdentityMatrix",
|
||||
gsk_identity_transform_finalize,
|
||||
gsk_identity_transform_to_matrix,
|
||||
gsk_identity_transform_apply_2d,
|
||||
@@ -1709,8 +1707,8 @@ gsk_transform_invert (GskTransform *self)
|
||||
|
||||
/**
|
||||
* gsk_transform_equal:
|
||||
* @first: (nullable): the first transform
|
||||
* @second: (nullable): the second transform
|
||||
* @first: the first transform
|
||||
* @second: the second transform
|
||||
*
|
||||
* Checks two transforms for equality.
|
||||
*
|
||||
|
||||
@@ -15,8 +15,8 @@ void main() {
|
||||
gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0);
|
||||
|
||||
// The -90 is because conics point to the top by default
|
||||
rotation = mod (u_rotation - 90.0, 360.0);
|
||||
if (rotation < 0.0)
|
||||
rotation = mod (u_rotation - 90, 360.0);
|
||||
if (rotation < 0)
|
||||
rotation += 360.0;
|
||||
rotation = PI / 180.0 * rotation;
|
||||
|
||||
@@ -55,7 +55,7 @@ void main() {
|
||||
angle -= rotation;
|
||||
// fract() does the modulo here, so now we have progress
|
||||
// into the current conic
|
||||
float offset = fract (angle / 2.0 / PI + 2.0);
|
||||
float offset = fract (angle / 2 / PI + 2);
|
||||
|
||||
vec4 color = color_stops[0];
|
||||
for (int i = 1; i < u_num_color_stops; i ++) {
|
||||
|
||||
+11
-22
@@ -66,11 +66,11 @@ get_color (GskPangoRenderer *crenderer,
|
||||
rgba->red = color->red / 65535.;
|
||||
rgba->green = color->green / 65535.;
|
||||
rgba->blue = color->blue / 65535.;
|
||||
rgba->alpha = a ? a / 65535. : crenderer->fg_color->alpha;
|
||||
rgba->alpha = a ? a / 65535. : crenderer->fg_color.alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
*rgba = *crenderer->fg_color;
|
||||
*rgba = crenderer->fg_color;
|
||||
if (a)
|
||||
rgba->alpha = a / 65535.;
|
||||
}
|
||||
@@ -138,19 +138,11 @@ gsk_pango_renderer_draw_trapezoid (PangoRenderer *renderer,
|
||||
double x22)
|
||||
{
|
||||
GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
|
||||
PangoLayout *layout;
|
||||
PangoRectangle ink_rect;
|
||||
cairo_t *cr;
|
||||
double x, y;
|
||||
|
||||
layout = pango_renderer_get_layout (renderer);
|
||||
if (!layout)
|
||||
return;
|
||||
cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds);
|
||||
|
||||
pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
|
||||
cr = gtk_snapshot_append_cairo (crenderer->snapshot,
|
||||
&GRAPHENE_RECT_INIT (ink_rect.x, ink_rect.y,
|
||||
ink_rect.width, ink_rect.height));
|
||||
set_color (crenderer, part, cr);
|
||||
|
||||
x = y = 0;
|
||||
@@ -242,6 +234,7 @@ gsk_pango_renderer_draw_shape (PangoRenderer *renderer,
|
||||
int y)
|
||||
{
|
||||
GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
|
||||
cairo_t *cr;
|
||||
PangoLayout *layout;
|
||||
PangoCairoShapeRendererFunc shape_renderer;
|
||||
gpointer shape_renderer_data;
|
||||
@@ -270,25 +263,17 @@ gsk_pango_renderer_draw_shape (PangoRenderer *renderer,
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
cairo_t *cr;
|
||||
PangoRectangle ink_rect;
|
||||
cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds);
|
||||
|
||||
layout = pango_renderer_get_layout (renderer);
|
||||
if (!layout)
|
||||
return;
|
||||
|
||||
pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
|
||||
cr = gtk_snapshot_append_cairo (crenderer->snapshot,
|
||||
&GRAPHENE_RECT_INIT (ink_rect.x, ink_rect.y,
|
||||
ink_rect.width, ink_rect.height));
|
||||
shape_renderer = pango_cairo_context_get_shape_renderer (pango_layout_get_context (layout),
|
||||
&shape_renderer_data);
|
||||
|
||||
if (!shape_renderer)
|
||||
{
|
||||
cairo_destroy (cr);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
set_color (crenderer, PANGO_RENDER_PART_FOREGROUND, cr);
|
||||
|
||||
@@ -495,6 +480,7 @@ gtk_snapshot_append_layout (GtkSnapshot *snapshot,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
GskPangoRenderer *crenderer;
|
||||
PangoRectangle ink_rect;
|
||||
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
g_return_if_fail (PANGO_IS_LAYOUT (layout));
|
||||
@@ -502,7 +488,10 @@ gtk_snapshot_append_layout (GtkSnapshot *snapshot,
|
||||
crenderer = gsk_pango_renderer_acquire ();
|
||||
|
||||
crenderer->snapshot = snapshot;
|
||||
crenderer->fg_color = color;
|
||||
crenderer->fg_color = *color;
|
||||
|
||||
pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
|
||||
graphene_rect_init (&crenderer->bounds, ink_rect.x, ink_rect.y, ink_rect.width, ink_rect.height);
|
||||
|
||||
pango_renderer_draw_layout (PANGO_RENDERER (crenderer), layout, 0, 0);
|
||||
|
||||
|
||||
+3
-2
@@ -49,7 +49,7 @@ typedef gboolean (*GskPangoShapeHandler) (PangoAttrShape *attr,
|
||||
/*
|
||||
* This is a PangoRenderer implementation that translates all the draw calls to
|
||||
* gsk render nodes, using the GtkSnapshot helper class. Glyphs are translated
|
||||
* to text nodes, other draw calls may fall back to cairo nodes.
|
||||
* to text nodes, all other draw calls fall back to cairo nodes.
|
||||
*/
|
||||
|
||||
struct _GskPangoRenderer
|
||||
@@ -58,7 +58,8 @@ struct _GskPangoRenderer
|
||||
|
||||
GtkWidget *widget;
|
||||
GtkSnapshot *snapshot;
|
||||
const GdkRGBA *fg_color;
|
||||
GdkRGBA fg_color;
|
||||
graphene_rect_t bounds;
|
||||
|
||||
/* Error underline color for this widget */
|
||||
GdkRGBA *error_color;
|
||||
|
||||
@@ -52,6 +52,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCellRendererText, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCellRendererToggle, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCellView, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCheckButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkClipboard, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorButton, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorChooser, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorChooserDialog, g_object_unref)
|
||||
|
||||
@@ -100,7 +100,7 @@ gtk_accels_remove (GtkAccels *accels,
|
||||
|
||||
position = gtk_accels_find (accels, action_and_target);
|
||||
if (position < gtk_accels_get_size (accels))
|
||||
gtk_accels_splice (accels, position, 1, FALSE, NULL, 0);
|
||||
gtk_accels_splice (accels, position, 1, NULL, 0);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
|
||||
+3
-3
@@ -317,8 +317,8 @@ gtk_box_buildable_iface_init (GtkBuildableIface *iface)
|
||||
|
||||
/**
|
||||
* gtk_box_new:
|
||||
* @orientation: the box’s orientation
|
||||
* @spacing: the number of pixels to place by default between children
|
||||
* @orientation: the box’s orientation.
|
||||
* @spacing: the number of pixels to place by default between children.
|
||||
*
|
||||
* Creates a new #GtkBox.
|
||||
*
|
||||
@@ -479,7 +479,7 @@ gtk_box_get_baseline_position (GtkBox *box)
|
||||
* gtk_box_insert_child_after:
|
||||
* @box: a #GtkBox
|
||||
* @child: the #GtkWidget to insert
|
||||
* @sibling: (nullable): the sibling after which to insert @child
|
||||
* @sibling: (nullable): the sibling to move @child after, or %NULL
|
||||
*
|
||||
* Inserts @child in the position after @sibling in the list
|
||||
* of @box children. If @sibling is %NULL, insert @child at
|
||||
|
||||
@@ -58,15 +58,8 @@
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* |[<!-- language="plain" -->
|
||||
* colorbutton
|
||||
* ╰── button.color
|
||||
* ╰── [content]
|
||||
*]|
|
||||
*
|
||||
* GtkColorButton has a single CSS node with name colorbutton which
|
||||
* contains a button node. To differentiate it from a plain #GtkButton,
|
||||
* it gets the .color style class.
|
||||
* GtkColorButton has a single CSS node with name button. To differentiate
|
||||
* it from a plain #GtkButton, it gets the .color style class.
|
||||
*/
|
||||
|
||||
typedef struct _GtkColorButtonClass GtkColorButtonClass;
|
||||
|
||||
@@ -167,7 +167,7 @@ gtk_css_selector_matches_insert_sorted (GtkCssSelectorMatches *matches,
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_css_selector_matches_splice (matches, i, 0, FALSE, (gpointer[1]) { data }, 1);
|
||||
gtk_css_selector_matches_splice (matches, i, 0, (gpointer[1]) { data }, 1);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
|
||||
+3
-51
@@ -55,63 +55,15 @@
|
||||
* source must be added to a widget as an event controller, using
|
||||
* gtk_widget_add_controller().
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* static void
|
||||
* my_widget_init (MyWidget *self)
|
||||
* {
|
||||
* GtkDragSource *drag_source = gtk_drag_source_new ();
|
||||
*
|
||||
* g_signal_connect (drag_source, "prepare", G_CALLBACK (on_drag_prepare), self);
|
||||
* g_signal_connect (drag_source, "drag-begin", G_CALLBACK (on_drag_begin), self);
|
||||
*
|
||||
* gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (drag_source));
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* Setting up the content provider and icon ahead of time only
|
||||
* makes sense when the data does not change. More commonly, you
|
||||
* will want to set them up just in time. To do so, #GtkDragSource
|
||||
* has #GtkDragSource::prepare and #GtkDragSource::drag-begin signals.
|
||||
*
|
||||
* The ::prepare signal is emitted before a drag is started, and
|
||||
* can be used to set the content provider and actions that the
|
||||
* drag should be started with.
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* static GdkContentProvider *
|
||||
* on_drag_prepare (GtkDragSource *source,
|
||||
* double x,
|
||||
* double y,
|
||||
* MyWidget *self)
|
||||
* {
|
||||
* // This widget supports two types of content: GFile objects
|
||||
* // and GdkPixbuf objects; GTK will handle the serialization
|
||||
* // of these types automatically
|
||||
* GFile *file = my_widget_get_file (self);
|
||||
* GdkPixbuf *pixbuf = my_widget_get_pixbuf (self);
|
||||
*
|
||||
* return gdk_content_provider_new_union ((GdkContentProvider *[2]) {
|
||||
* gdk_content_provider_new_typed (G_TYPE_FILE, file),
|
||||
* gdk_content_provider_new_typed (GDK_TYPE_PIXBUF, pixbuf),
|
||||
* }, 2);
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* The ::drag-begin signal is emitted after the #GdkDrag object has
|
||||
* been created, and can be used to set up the drag icon.
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* static void
|
||||
* on_drag_begin (GtkDragSource *source,
|
||||
* GtkDrag *drag,
|
||||
* MyWidget *self)
|
||||
* {
|
||||
* // Set the widget as the drag icon
|
||||
* GdkPaintable *paintable = gtk_widget_paintable_new (GTK_WIDGET (self));
|
||||
* gtk_drag_source_set_icon (source, paintable, 0, 0);
|
||||
* g_object_unref (paintable);
|
||||
* }
|
||||
* ]|
|
||||
* drag should be started with. The ::drag-begin signal is emitted
|
||||
* after the #GdkDrag object has been created, and can be used
|
||||
* to set up the drag icon.
|
||||
*
|
||||
* During the DND operation, GtkDragSource emits signals that
|
||||
* can be used to obtain updates about the status of the operation,
|
||||
|
||||
+1
-40
@@ -47,46 +47,7 @@
|
||||
* The most basic way to use a #GtkDropTarget to receive drops on a
|
||||
* widget is to create it via gtk_drop_target_new() passing in the
|
||||
* #GType of the data you want to receive and connect to the
|
||||
* GtkDropTarget::drop signal to receive the data:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* static gboolean
|
||||
* on_drop (GtkDropTarget *target,
|
||||
* const GValue *value,
|
||||
* double x,
|
||||
* double y,
|
||||
* gpointer data)
|
||||
* {
|
||||
* MyWidget *self = data;
|
||||
*
|
||||
* // Call the appropriate setter depending on the type of data
|
||||
* // that we received
|
||||
* if (G_VALUE_HOLDS (value, G_TYPE_FILE))
|
||||
* my_widget_set_file (self, g_value_get_object (value));
|
||||
* else if (G_VALUE_HOLDS (value, GDK_TYPE_PIXBUF))
|
||||
* my_widget_set_pixbuf (self, g_value_get_object (value));
|
||||
* else
|
||||
* return FALSE;
|
||||
*
|
||||
* return TRUE;
|
||||
* }
|
||||
*
|
||||
* static void
|
||||
* my_widget_init (MyWidget *self)
|
||||
* {
|
||||
* GtkDropTarget *target =
|
||||
* gtk_drop_target_new (G_TYPE_INVALID, GDK_ACTION_COPY);
|
||||
*
|
||||
* // This widget accepts two types of drop types: GFile objects
|
||||
* // and GdkPixbuf objects
|
||||
* gtk_drop_target_set_gtypes (target, (GTypes [2]) {
|
||||
* G_TYPE_FILE,
|
||||
* GDK_TYPE_PIXBUF,
|
||||
* }, 2);
|
||||
*
|
||||
* gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (target));
|
||||
* }
|
||||
* ]|
|
||||
* GtkDropTarget::drop signal to receive the data.
|
||||
*
|
||||
* #GtkDropTarget supports more options, such as:
|
||||
*
|
||||
|
||||
+1
-8
@@ -59,14 +59,7 @@
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* |[<!-- language="plain" -->
|
||||
* fontbutton
|
||||
* ╰── button.font
|
||||
* ╰── [content]
|
||||
*]|
|
||||
*
|
||||
* GtkFontButton has a single CSS node with name fontbutton which
|
||||
* contains a button node with the .font style class.
|
||||
* GtkFontButton has a single CSS node with name fontbutton.
|
||||
*/
|
||||
|
||||
typedef struct _GtkFontButtonClass GtkFontButtonClass;
|
||||
|
||||
+3
-10
@@ -35,7 +35,6 @@
|
||||
#include "gtkintl.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtknative.h"
|
||||
|
||||
G_DEFINE_TYPE (GtkGestureStylus, gtk_gesture_stylus, GTK_TYPE_GESTURE_SINGLE)
|
||||
|
||||
@@ -320,8 +319,6 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
|
||||
GArray *backlog_array;
|
||||
GdkTimeCoord *history = NULL;
|
||||
guint n_coords = 0, i;
|
||||
double surf_x, surf_y;
|
||||
GtkNative *native;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_GESTURE_STYLUS (gesture), FALSE);
|
||||
g_return_val_if_fail (backlog != NULL && n_elems != NULL, FALSE);
|
||||
@@ -334,9 +331,6 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
|
||||
if (!history)
|
||||
return FALSE;
|
||||
|
||||
native = gtk_widget_get_native (gtk_get_event_widget (event));
|
||||
gtk_native_get_surface_transform (native, &surf_x, &surf_y);
|
||||
|
||||
backlog_array = g_array_new (FALSE, FALSE, sizeof (GdkTimeCoord));
|
||||
for (i = 0; i < n_coords; i++)
|
||||
{
|
||||
@@ -345,11 +339,10 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
|
||||
|
||||
g_array_append_val (backlog_array, *time_coord);
|
||||
time_coord = &g_array_index (backlog_array, GdkTimeCoord, backlog_array->len - 1);
|
||||
|
||||
if (gtk_widget_compute_point (GTK_WIDGET (native),
|
||||
if (gtk_widget_compute_point (gtk_get_event_widget (event),
|
||||
gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)),
|
||||
&GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X] - surf_x,
|
||||
time_coord->axes[GDK_AXIS_Y] - surf_y),
|
||||
&GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X],
|
||||
time_coord->axes[GDK_AXIS_Y]),
|
||||
&p))
|
||||
{
|
||||
time_coord->axes[GDK_AXIS_X] = p.x;
|
||||
|
||||
+8
-5
@@ -3850,7 +3850,7 @@ gtk_icon_paintable_ensure_texture (GtkIconPaintable *self)
|
||||
|
||||
icon_ensure_texture__locked (self, FALSE);
|
||||
|
||||
texture = self->texture;
|
||||
texture = g_object_ref (self->texture);
|
||||
|
||||
g_mutex_unlock (&self->texture_lock);
|
||||
|
||||
@@ -3867,10 +3867,10 @@ init_color_matrix (graphene_matrix_t *color_matrix,
|
||||
const GdkRGBA *warning_color,
|
||||
const GdkRGBA *error_color)
|
||||
{
|
||||
const GdkRGBA fg_default = { 0.7450980392156863, 0.7450980392156863, 0.7450980392156863, 1.0};
|
||||
const GdkRGBA success_default = { 0.3046921492332342,0.6015716792553597, 0.023437857633325704, 1.0};
|
||||
const GdkRGBA warning_default = {0.9570458533607996, 0.47266346227206835, 0.2421911955443656, 1.0 };
|
||||
const GdkRGBA error_default = { 0.796887159533074, 0 ,0, 1.0 };
|
||||
GdkRGBA fg_default = { 0.7450980392156863, 0.7450980392156863, 0.7450980392156863, 1.0};
|
||||
GdkRGBA success_default = { 0.3046921492332342,0.6015716792553597, 0.023437857633325704, 1.0};
|
||||
GdkRGBA warning_default = {0.9570458533607996, 0.47266346227206835, 0.2421911955443656, 1.0 };
|
||||
GdkRGBA error_default = { 0.796887159533074, 0 ,0, 1.0 };
|
||||
const GdkRGBA *fg = foreground_color ? foreground_color : &fg_default;
|
||||
const GdkRGBA *sc = success_color ? success_color : &success_default;
|
||||
const GdkRGBA *wc = warning_color ? warning_color : &warning_default;
|
||||
@@ -3971,8 +3971,11 @@ gtk_icon_paintable_snapshot_with_colors (GtkIconPaintable *icon,
|
||||
|
||||
if (symbolic)
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
|
||||
static GdkPaintableFlags
|
||||
icon_paintable_get_flags (GdkPaintable *paintable)
|
||||
{
|
||||
|
||||
+108
-82
@@ -3199,11 +3199,12 @@ get_layout_location (GtkLabel *self,
|
||||
int *yp)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (self);
|
||||
int layout_width, layout_height, x, y;
|
||||
int req_width, x, y;
|
||||
int req_height;
|
||||
float xalign, yalign;
|
||||
PangoRectangle logical;
|
||||
int baseline, layout_baseline, baseline_offset;
|
||||
int widget_width, widget_height;
|
||||
int label_width, label_height;
|
||||
|
||||
xalign = self->xalign;
|
||||
yalign = self->yalign;
|
||||
@@ -3211,17 +3212,19 @@ get_layout_location (GtkLabel *self,
|
||||
if (_gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
|
||||
xalign = 1.0 - xalign;
|
||||
|
||||
pango_layout_get_pixel_extents (self->layout, NULL, &logical);
|
||||
pango_layout_get_extents (self->layout, NULL, &logical);
|
||||
|
||||
layout_width = logical.width;
|
||||
layout_height = logical.height;
|
||||
pango_extents_to_pixels (&logical, NULL);
|
||||
|
||||
widget_width = gtk_widget_get_width (widget);
|
||||
widget_height = gtk_widget_get_height (widget);
|
||||
req_width = logical.width;
|
||||
req_height = logical.height;
|
||||
|
||||
label_width = gtk_widget_get_width (widget);
|
||||
label_height = gtk_widget_get_height (widget);
|
||||
|
||||
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||
|
||||
x = floor ((xalign * (widget_width - layout_width)) - logical.x);
|
||||
x = floor ((xalign * (label_width - req_width)) - logical.x);
|
||||
|
||||
baseline_offset = 0;
|
||||
if (baseline != -1)
|
||||
@@ -3231,7 +3234,23 @@ get_layout_location (GtkLabel *self,
|
||||
yalign = 0.0; /* Can't support yalign while baseline aligning */
|
||||
}
|
||||
|
||||
y = floor ((widget_height - layout_height) * yalign) + baseline_offset;
|
||||
/* bgo#315462 - For single-line labels, *do* align the requisition with
|
||||
* respect to the allocation, even if we are under-allocated. For multi-line
|
||||
* labels, always show the top of the text when they are under-allocated. The
|
||||
* rationale is this:
|
||||
*
|
||||
* - Single-line labels appear in GtkButtons, and it is very easy to get them
|
||||
* to be smaller than their requisition. The button may clip the label, but
|
||||
* the label will still be able to show most of itself and the focus
|
||||
* rectangle. Also, it is fairly easy to read a single line of clipped text.
|
||||
*
|
||||
* - Multi-line labels should not be clipped to showing "something in the
|
||||
* middle". You want to read the first line, at least, to get some context.
|
||||
*/
|
||||
if (pango_layout_get_line_count (self->layout) == 1)
|
||||
y = floor ((label_height - req_height) * yalign) + baseline_offset;
|
||||
else
|
||||
y = floor (MAX ((label_height - req_height) * yalign, 0)) + baseline_offset;
|
||||
|
||||
if (xp)
|
||||
*xp = x;
|
||||
@@ -3421,84 +3440,42 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
GtkLabelSelectionInfo *info;
|
||||
GtkStyleContext *context;
|
||||
int lx, ly;
|
||||
int width, height;
|
||||
int width, height, x;
|
||||
|
||||
if (!self->text || (*self->text == '\0'))
|
||||
return;
|
||||
info = self->select_info;
|
||||
|
||||
gtk_label_ensure_layout (self);
|
||||
|
||||
context = _gtk_widget_get_style_context (widget);
|
||||
get_layout_location (self, &lx, &ly);
|
||||
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
|
||||
info = self->select_info;
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
width = gtk_widget_get_width (widget);
|
||||
height = gtk_widget_get_height (widget);
|
||||
x = 0;
|
||||
|
||||
if (info->selection_anchor != info->selection_end)
|
||||
if (self->text && (*self->text != '\0'))
|
||||
{
|
||||
int range[2];
|
||||
cairo_region_t *range_clip;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
int i;
|
||||
get_layout_location (self, &lx, &ly);
|
||||
|
||||
range[0] = MIN (info->selection_anchor, info->selection_end);
|
||||
range[1] = MAX (info->selection_anchor, info->selection_end);
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
|
||||
gtk_style_context_save_to_node (context, info->selection_node);
|
||||
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
for (i = 0; i < cairo_region_num_rectangles (range_clip); i++)
|
||||
if (info && (info->selection_anchor != info->selection_end))
|
||||
{
|
||||
cairo_region_get_rectangle (range_clip, i, &clip_rect);
|
||||
int range[2];
|
||||
cairo_region_t *range_clip;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
int i;
|
||||
|
||||
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect));
|
||||
gtk_snapshot_render_background (snapshot, context, 0, 0, width, height);
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
range[0] = info->selection_anchor;
|
||||
range[1] = info->selection_end;
|
||||
|
||||
cairo_region_destroy (range_clip);
|
||||
if (range[0] > range[1])
|
||||
{
|
||||
int tmp = range[0];
|
||||
range[0] = range[1];
|
||||
range[1] = tmp;
|
||||
}
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkLabelLink *focus_link;
|
||||
GtkLabelLink *active_link;
|
||||
int range[2];
|
||||
cairo_region_t *range_clip;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
int i;
|
||||
GdkRectangle rect;
|
||||
|
||||
if (info->selectable &&
|
||||
gtk_widget_has_focus (widget) &&
|
||||
gtk_widget_is_drawable (widget))
|
||||
{
|
||||
PangoDirection cursor_direction;
|
||||
|
||||
cursor_direction = get_cursor_direction (self);
|
||||
gtk_snapshot_render_insertion_cursor (snapshot, context,
|
||||
lx, ly,
|
||||
self->layout, self->select_info->selection_end,
|
||||
cursor_direction);
|
||||
}
|
||||
|
||||
focus_link = gtk_label_get_focus_link (self, NULL);
|
||||
active_link = info->active_link;
|
||||
|
||||
if (active_link)
|
||||
{
|
||||
range[0] = active_link->start;
|
||||
range[1] = active_link->end;
|
||||
|
||||
gtk_style_context_save_to_node (context, active_link->cssnode);
|
||||
gtk_style_context_save_to_node (context, info->selection_node);
|
||||
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
for (i = 0; i < cairo_region_num_rectangles (range_clip); i++)
|
||||
@@ -3506,7 +3483,7 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
cairo_region_get_rectangle (range_clip, i, &clip_rect);
|
||||
|
||||
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect));
|
||||
gtk_snapshot_render_background (snapshot, context, 0, 0, width, height);
|
||||
gtk_snapshot_render_background (snapshot, context, x, 0, width, height);
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
@@ -3515,22 +3492,71 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
if (focus_link && gtk_widget_has_visible_focus (widget))
|
||||
else if (info)
|
||||
{
|
||||
range[0] = focus_link->start;
|
||||
range[1] = focus_link->end;
|
||||
GtkLabelLink *focus_link;
|
||||
GtkLabelLink *active_link;
|
||||
int range[2];
|
||||
cairo_region_t *range_clip;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
int i;
|
||||
GdkRectangle rect;
|
||||
|
||||
gtk_style_context_save_to_node (context, focus_link->cssnode);
|
||||
if (info->selectable &&
|
||||
gtk_widget_has_focus (widget) &&
|
||||
gtk_widget_is_drawable (widget))
|
||||
{
|
||||
PangoDirection cursor_direction;
|
||||
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
cairo_region_get_extents (range_clip, &rect);
|
||||
cursor_direction = get_cursor_direction (self);
|
||||
gtk_snapshot_render_insertion_cursor (snapshot, context,
|
||||
lx, ly,
|
||||
self->layout, self->select_info->selection_end,
|
||||
cursor_direction);
|
||||
}
|
||||
|
||||
gtk_snapshot_render_focus (snapshot, context, rect.x, rect.y, rect.width, rect.height);
|
||||
focus_link = gtk_label_get_focus_link (self, NULL);
|
||||
active_link = info->active_link;
|
||||
|
||||
cairo_region_destroy (range_clip);
|
||||
if (active_link)
|
||||
{
|
||||
range[0] = active_link->start;
|
||||
range[1] = active_link->end;
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
gtk_style_context_save_to_node (context, active_link->cssnode);
|
||||
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
for (i = 0; i < cairo_region_num_rectangles (range_clip); i++)
|
||||
{
|
||||
cairo_region_get_rectangle (range_clip, i, &clip_rect);
|
||||
|
||||
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect));
|
||||
gtk_snapshot_render_background (snapshot, context, x, 0, width, height);
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
cairo_region_destroy (range_clip);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
if (focus_link && gtk_widget_has_visible_focus (widget))
|
||||
{
|
||||
range[0] = focus_link->start;
|
||||
range[1] = focus_link->end;
|
||||
|
||||
gtk_style_context_save_to_node (context, focus_link->cssnode);
|
||||
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
cairo_region_get_extents (range_clip, &rect);
|
||||
|
||||
gtk_snapshot_render_focus (snapshot, context, rect.x, rect.y, rect.width, rect.height);
|
||||
|
||||
cairo_region_destroy (range_clip);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -587,12 +587,11 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
||||
int min, nat, row_height;
|
||||
int x, y;
|
||||
GtkOrientation orientation, opposite_orientation;
|
||||
GtkScrollablePolicy scroll_policy, opposite_scroll_policy;
|
||||
GtkScrollablePolicy scroll_policy;
|
||||
|
||||
orientation = gtk_list_base_get_orientation (GTK_LIST_BASE (self));
|
||||
opposite_orientation = OPPOSITE_ORIENTATION (orientation);
|
||||
scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), orientation);
|
||||
opposite_scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), opposite_orientation);
|
||||
|
||||
/* step 0: exit early if list is empty */
|
||||
if (gtk_list_item_manager_get_root (self->item_manager) == NULL)
|
||||
@@ -603,7 +602,7 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
||||
-1,
|
||||
&min, &nat, NULL, NULL);
|
||||
self->list_width = orientation == GTK_ORIENTATION_VERTICAL ? width : height;
|
||||
if (opposite_scroll_policy == GTK_SCROLL_MINIMUM)
|
||||
if (scroll_policy == GTK_SCROLL_MINIMUM)
|
||||
self->list_width = MAX (min, self->list_width);
|
||||
else
|
||||
self->list_width = MAX (nat, self->list_width);
|
||||
|
||||
+16
-3
@@ -936,6 +936,8 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
GdkEventType type;
|
||||
double x, y;
|
||||
double dx, dy;
|
||||
double *axes = NULL;
|
||||
guint n_axes = 0;
|
||||
|
||||
type = gdk_event_get_event_type (event);
|
||||
|
||||
@@ -958,6 +960,16 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
break;
|
||||
}
|
||||
|
||||
if (gdk_event_get_axes (event, &axes, &n_axes))
|
||||
{
|
||||
double *axes_copy = g_memdup (axes, n_axes * sizeof (double));
|
||||
|
||||
/* The newly created event takes ownership of the axes, so
|
||||
* we need a copy
|
||||
*/
|
||||
axes = axes_copy;
|
||||
}
|
||||
|
||||
switch ((guint) type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS:
|
||||
@@ -970,7 +982,7 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
gdk_event_get_modifier_state (event),
|
||||
gdk_button_event_get_button (event),
|
||||
x, y,
|
||||
gdk_event_dup_axes (event));
|
||||
g_steal_pointer (&axes));
|
||||
case GDK_MOTION_NOTIFY:
|
||||
return gdk_motion_event_new (new_surface,
|
||||
gdk_event_get_device (event),
|
||||
@@ -978,7 +990,7 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
x, y,
|
||||
gdk_event_dup_axes (event));
|
||||
g_steal_pointer (&axes));
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
@@ -990,7 +1002,7 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
x, y,
|
||||
gdk_event_dup_axes (event),
|
||||
g_steal_pointer (&axes),
|
||||
gdk_touch_event_get_emulating_pointer (event));
|
||||
case GDK_TOUCHPAD_SWIPE:
|
||||
gdk_touchpad_event_get_deltas (event, &dx, &dy);
|
||||
@@ -1018,6 +1030,7 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
break;
|
||||
}
|
||||
|
||||
g_assert (!axes);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
+2
-8
@@ -104,14 +104,8 @@
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* |[<!-- language="plain" -->
|
||||
* menubutton
|
||||
* ╰── button.toggle
|
||||
* ╰── [content]
|
||||
*]|
|
||||
*
|
||||
* GtkMenuButton has a single CSS node with name menubutton
|
||||
* which contains a toggle button node.
|
||||
* GtkMenuButton has a single CSS node with name button. To differentiate
|
||||
* it from a plain #GtkButton, it gets the .popup style class.
|
||||
*
|
||||
* # Accessibility
|
||||
*
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
* and #GtkModelButton:icon properties.
|
||||
*
|
||||
* The appearance of model buttons can be influenced with the
|
||||
* #GtkModelButton:iconic property.
|
||||
* #GtkModelButton:centered and #GtkModelButton:iconic properties.
|
||||
*
|
||||
* Model buttons have built-in support for submenus in #GtkPopoverMenu.
|
||||
* To make a GtkModelButton that opens a submenu when activated, set
|
||||
@@ -177,6 +177,7 @@ struct _GtkModelButton
|
||||
GtkEventController *controller;
|
||||
|
||||
guint active : 1;
|
||||
guint centered : 1;
|
||||
guint iconic : 1;
|
||||
guint keep_open : 1;
|
||||
};
|
||||
@@ -489,7 +490,7 @@ update_node_name (GtkModelButton *self)
|
||||
{
|
||||
case GTK_BUTTON_ROLE_TITLE:
|
||||
start_name = "arrow";
|
||||
end_name = "";
|
||||
end_name = NULL;
|
||||
break;
|
||||
case GTK_BUTTON_ROLE_NORMAL:
|
||||
start_name = NULL;
|
||||
@@ -759,6 +760,8 @@ gtk_model_button_set_iconic (GtkModelButton *self,
|
||||
gtk_widget_add_css_class (widget, "flat");
|
||||
}
|
||||
|
||||
self->centered = iconic;
|
||||
|
||||
if (!iconic)
|
||||
{
|
||||
if (self->start_indicator)
|
||||
|
||||
@@ -206,7 +206,7 @@ gtk_multi_filter_remove (GtkMultiFilter *self,
|
||||
|
||||
filter = gtk_filters_get (&self->filters, position);
|
||||
g_signal_handlers_disconnect_by_func (filter, gtk_multi_filter_changed_cb, self);
|
||||
gtk_filters_splice (&self->filters, position, 1, FALSE, NULL, 0);
|
||||
gtk_filters_splice (&self->filters, position, 1, NULL, 0);
|
||||
|
||||
gtk_filter_changed (GTK_FILTER (self),
|
||||
GTK_MULTI_FILTER_GET_CLASS (self)->removal_change);
|
||||
|
||||
@@ -432,7 +432,7 @@ gtk_multi_sorter_remove (GtkMultiSorter *self,
|
||||
|
||||
sorter = gtk_sorters_get (&self->sorters, position);
|
||||
g_signal_handlers_disconnect_by_func (sorter, gtk_multi_sorter_changed_cb, self);
|
||||
gtk_sorters_splice (&self->sorters, position, 1, FALSE, NULL, 0);
|
||||
gtk_sorters_splice (&self->sorters, position, 1, NULL, 0);
|
||||
|
||||
gtk_sorter_changed_with_keys (GTK_SORTER (self),
|
||||
GTK_SORTER_CHANGE_LESS_STRICT,
|
||||
|
||||
+1
-1
@@ -516,7 +516,7 @@ gtk_picture_new_for_filename (const char *filename)
|
||||
* gtk_picture_new_for_resource:
|
||||
* @resource_path: (nullable): resource path to play back
|
||||
*
|
||||
* Creates a new #GtkPicture displaying the resource at @resource_path.
|
||||
* Creates a new #GtkPicture displaying the file @filename.
|
||||
*
|
||||
* This is a utility function that calls gtk_picture_new_for_file().
|
||||
* See that function for details.
|
||||
|
||||
@@ -743,12 +743,8 @@ gtk_css_style_snapshot_outline (GtkCssBoxes *boxes,
|
||||
if (gdk_rgba_is_clear (color))
|
||||
return;
|
||||
|
||||
border_width[0] = _gtk_css_number_value_get (outline->outline_width, 100);
|
||||
|
||||
if (G_APPROX_VALUE (border_width[0], 0, FLT_EPSILON))
|
||||
return;
|
||||
|
||||
border_style[1] = border_style[2] = border_style[3] = border_style[0];
|
||||
border_width[0] = _gtk_css_number_value_get (outline->outline_width, 100);
|
||||
border_width[3] = border_width[2] = border_width[1] = border_width[0];
|
||||
colors[0] = colors[1] = colors[2] = colors[3] = *color;
|
||||
|
||||
|
||||
@@ -26,6 +26,139 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* _gtk_rounded_box_init_rect:
|
||||
* @box: box to initialize
|
||||
* @x: x coordinate of box
|
||||
* @y: y coordinate of box
|
||||
* @width: width of box
|
||||
* @height: height of box
|
||||
*
|
||||
* Initializes the given @box to represent the given rectangle.
|
||||
* The
|
||||
**/
|
||||
void
|
||||
_gtk_rounded_box_init_rect (GskRoundedRect *box,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
memset (box, 0, sizeof (GskRoundedRect));
|
||||
|
||||
box->bounds.origin.x = x;
|
||||
box->bounds.origin.y = y;
|
||||
box->bounds.size.width = width;
|
||||
box->bounds.size.height = height;
|
||||
}
|
||||
|
||||
/* clamp border radius, following CSS specs */
|
||||
static void
|
||||
gtk_rounded_box_clamp_border_radius (GskRoundedRect *box)
|
||||
{
|
||||
double factor = 1.0;
|
||||
double corners;
|
||||
|
||||
corners = box->corner[GSK_CORNER_TOP_LEFT].width + box->corner[GSK_CORNER_TOP_RIGHT].width;
|
||||
if (corners != 0)
|
||||
factor = MIN (factor, box->bounds.size.width / corners);
|
||||
|
||||
corners = box->corner[GSK_CORNER_TOP_RIGHT].height + box->corner[GSK_CORNER_BOTTOM_RIGHT].height;
|
||||
if (corners != 0)
|
||||
factor = MIN (factor, box->bounds.size.height / corners);
|
||||
|
||||
corners = box->corner[GSK_CORNER_BOTTOM_RIGHT].width + box->corner[GSK_CORNER_BOTTOM_LEFT].width;
|
||||
if (corners != 0)
|
||||
factor = MIN (factor, box->bounds.size.width / corners);
|
||||
|
||||
corners = box->corner[GSK_CORNER_TOP_LEFT].height + box->corner[GSK_CORNER_BOTTOM_LEFT].height;
|
||||
if (corners != 0)
|
||||
factor = MIN (factor, box->bounds.size.height / corners);
|
||||
|
||||
box->corner[GSK_CORNER_TOP_LEFT].width *= factor;
|
||||
box->corner[GSK_CORNER_TOP_LEFT].height *= factor;
|
||||
box->corner[GSK_CORNER_TOP_RIGHT].width *= factor;
|
||||
box->corner[GSK_CORNER_TOP_RIGHT].height *= factor;
|
||||
box->corner[GSK_CORNER_BOTTOM_RIGHT].width *= factor;
|
||||
box->corner[GSK_CORNER_BOTTOM_RIGHT].height *= factor;
|
||||
box->corner[GSK_CORNER_BOTTOM_LEFT].width *= factor;
|
||||
box->corner[GSK_CORNER_BOTTOM_LEFT].height *= factor;
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_rounded_box_apply_border_radius (GskRoundedRect *box,
|
||||
const GtkCssValue * const corner[4])
|
||||
{
|
||||
box->corner[GSK_CORNER_TOP_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_LEFT],
|
||||
box->bounds.size.width);
|
||||
box->corner[GSK_CORNER_TOP_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_LEFT],
|
||||
box->bounds.size.height);
|
||||
|
||||
box->corner[GSK_CORNER_TOP_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_RIGHT],
|
||||
box->bounds.size.width);
|
||||
box->corner[GSK_CORNER_TOP_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_RIGHT],
|
||||
box->bounds.size.height);
|
||||
|
||||
box->corner[GSK_CORNER_BOTTOM_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_BOTTOM_RIGHT],
|
||||
box->bounds.size.width);
|
||||
box->corner[GSK_CORNER_BOTTOM_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_BOTTOM_RIGHT],
|
||||
box->bounds.size.height);
|
||||
|
||||
box->corner[GSK_CORNER_BOTTOM_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_BOTTOM_LEFT],
|
||||
box->bounds.size.width);
|
||||
box->corner[GSK_CORNER_BOTTOM_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_BOTTOM_LEFT],
|
||||
box->bounds.size.height);
|
||||
|
||||
gtk_rounded_box_clamp_border_radius (box);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_rounded_boxes_init_for_style (GskRoundedRect *border_box,
|
||||
GskRoundedRect *padding_box,
|
||||
GskRoundedRect *content_box,
|
||||
GtkCssStyle *style,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
const GtkCssValue *corner[4];
|
||||
GskRoundedRect box;
|
||||
|
||||
gsk_rounded_rect_init_from_rect (&box, &GRAPHENE_RECT_INIT (x, y, width, height), 0);
|
||||
|
||||
corner[GSK_CORNER_TOP_LEFT] = style->border->border_top_left_radius;
|
||||
corner[GSK_CORNER_TOP_RIGHT] = style->border->border_top_right_radius;
|
||||
corner[GSK_CORNER_BOTTOM_LEFT] = style->border->border_bottom_left_radius;
|
||||
corner[GSK_CORNER_BOTTOM_RIGHT] = style->border->border_bottom_right_radius;
|
||||
|
||||
_gtk_rounded_box_apply_border_radius (&box, corner);
|
||||
|
||||
if (border_box)
|
||||
gsk_rounded_rect_init_copy (border_box, &box);
|
||||
|
||||
if (padding_box || content_box)
|
||||
{
|
||||
gsk_rounded_rect_shrink (&box,
|
||||
_gtk_css_number_value_get (style->border->border_top_width, 100),
|
||||
_gtk_css_number_value_get (style->border->border_right_width, 100),
|
||||
_gtk_css_number_value_get (style->border->border_bottom_width, 100),
|
||||
_gtk_css_number_value_get (style->border->border_left_width, 100));
|
||||
if (padding_box)
|
||||
gsk_rounded_rect_init_copy (padding_box, &box);
|
||||
|
||||
if (content_box)
|
||||
{
|
||||
gsk_rounded_rect_shrink (&box,
|
||||
_gtk_css_number_value_get (style->size->padding_top, 100),
|
||||
_gtk_css_number_value_get (style->size->padding_right, 100),
|
||||
_gtk_css_number_value_get (style->size->padding_bottom, 100),
|
||||
_gtk_css_number_value_get (style->size->padding_left, 100));
|
||||
gsk_rounded_rect_init_copy (content_box, &box);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
double angle1;
|
||||
double angle2;
|
||||
@@ -458,3 +591,12 @@ _gtk_rounded_box_path_left (const GskRoundedRect *outer,
|
||||
cairo_close_path (cr);
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_rounded_box_clip_path (const GskRoundedRect *box,
|
||||
cairo_t *cr)
|
||||
{
|
||||
cairo_rectangle (cr,
|
||||
box->bounds.origin.x, box->bounds.origin.y,
|
||||
box->bounds.size.width, box->bounds.size.height);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,20 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_rounded_box_init_rect (GskRoundedRect *box,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
void gtk_rounded_boxes_init_for_style (GskRoundedRect *border_box,
|
||||
GskRoundedRect *padding_box,
|
||||
GskRoundedRect *content_box,
|
||||
GtkCssStyle *style,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
|
||||
double _gtk_rounded_box_guess_length (const GskRoundedRect *box,
|
||||
GtkCssSide side);
|
||||
|
||||
@@ -46,6 +60,8 @@ void _gtk_rounded_box_path_bottom (const GskRounde
|
||||
void _gtk_rounded_box_path_left (const GskRoundedRect *outer,
|
||||
const GskRoundedRect *inner,
|
||||
cairo_t *cr);
|
||||
void _gtk_rounded_box_clip_path (const GskRoundedRect *box,
|
||||
cairo_t *cr);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+2
-2
@@ -1386,7 +1386,7 @@ gtk_snapshot_pop_one (GtkSnapshot *snapshot)
|
||||
|
||||
/* Remove all the state's nodes from the list of nodes */
|
||||
g_assert (state->start_node_index + state->n_nodes == gtk_snapshot_nodes_get_size (&snapshot->nodes));
|
||||
gtk_snapshot_nodes_splice (&snapshot->nodes, state->start_node_index, state->n_nodes, FALSE, NULL, 0);
|
||||
gtk_snapshot_nodes_splice (&snapshot->nodes, state->start_node_index, state->n_nodes, NULL, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1400,7 +1400,7 @@ gtk_snapshot_pop_one (GtkSnapshot *snapshot)
|
||||
g_assert (previous_state->start_node_index + previous_state->n_nodes == gtk_snapshot_nodes_get_size (&snapshot->nodes));
|
||||
}
|
||||
|
||||
gtk_snapshot_states_splice (&snapshot->state_stack, state_index, 1, FALSE, NULL, 0);
|
||||
gtk_snapshot_states_splice (&snapshot->state_stack, state_index, 1, NULL, 0);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
+1
-1
@@ -471,7 +471,7 @@ gtk_string_list_splice (GtkStringList *self,
|
||||
else
|
||||
n_additions = 0;
|
||||
|
||||
objects_splice (&self->items, position, n_removals, FALSE, NULL, n_additions);
|
||||
objects_splice (&self->items, position, n_removals, NULL, n_additions);
|
||||
|
||||
for (i = 0; i < n_additions; i++)
|
||||
{
|
||||
|
||||
+15
-2
@@ -3906,6 +3906,7 @@ gtk_text_layout_after_buffer_delete_range (GtkTextBuffer *textbuffer,
|
||||
|
||||
static void
|
||||
render_para (GskPangoRenderer *crenderer,
|
||||
int offset_y,
|
||||
GtkTextLineDisplay *line_display,
|
||||
int selection_start_index,
|
||||
int selection_end_index,
|
||||
@@ -3935,6 +3936,13 @@ render_para (GskPangoRenderer *crenderer,
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
if (offset_y)
|
||||
{
|
||||
gtk_snapshot_save (crenderer->snapshot);
|
||||
gtk_snapshot_translate (crenderer->snapshot,
|
||||
&GRAPHENE_POINT_INIT (0, offset_y));
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
PangoLayoutLine *line = pango_layout_iter_get_line_readonly (iter);
|
||||
@@ -4106,6 +4114,9 @@ render_para (GskPangoRenderer *crenderer,
|
||||
}
|
||||
while (pango_layout_iter_next_line (iter));
|
||||
|
||||
if (offset_y)
|
||||
gtk_snapshot_restore (crenderer->snapshot);
|
||||
|
||||
pango_layout_iter_free (iter);
|
||||
}
|
||||
|
||||
@@ -4164,7 +4175,9 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
||||
|
||||
crenderer->widget = widget;
|
||||
crenderer->snapshot = snapshot;
|
||||
crenderer->fg_color = &color;
|
||||
crenderer->fg_color = color;
|
||||
|
||||
graphene_rect_init (&crenderer->bounds, 0, 0, clip->width, clip->height);
|
||||
|
||||
gtk_text_layout_wrap_loop_start (layout);
|
||||
|
||||
@@ -4235,7 +4248,7 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
||||
if (line_display->node == NULL)
|
||||
{
|
||||
gtk_snapshot_push_collect (snapshot);
|
||||
render_para (crenderer, line_display,
|
||||
render_para (crenderer, 0, line_display,
|
||||
selection_start_index, selection_end_index,
|
||||
cursor_alpha);
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ typedef struct _GtkAdjustment GtkAdjustment;
|
||||
typedef struct _GtkBitset GtkBitset;
|
||||
typedef struct _GtkBuilder GtkBuilder;
|
||||
typedef struct _GtkBuilderScope GtkBuilderScope;
|
||||
typedef struct _GtkClipboard GtkClipboard;
|
||||
typedef struct _GtkCssStyleChange GtkCssStyleChange;
|
||||
typedef struct _GtkEventController GtkEventController;
|
||||
typedef struct _GtkGesture GtkGesture;
|
||||
|
||||
@@ -545,11 +545,6 @@ gtk_video_notify_cb (GtkMediaStream *stream,
|
||||
gtk_video_update_error (self);
|
||||
if (g_str_equal (pspec->name, "playing"))
|
||||
gtk_video_update_playing (self);
|
||||
if (g_str_equal (pspec->name, "prepared"))
|
||||
{
|
||||
if (self->autoplay && gtk_media_stream_is_prepared (stream))
|
||||
gtk_media_stream_play (stream);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6480,8 +6480,6 @@ gtk_window_destroy (GtkWindow *window)
|
||||
|
||||
g_list_store_remove (toplevel_list, i);
|
||||
|
||||
gtk_window_release_application (window);
|
||||
|
||||
gtk_widget_unrealize (GTK_WIDGET (window));
|
||||
|
||||
g_object_unref (window);
|
||||
|
||||
@@ -65,9 +65,9 @@ static void
|
||||
recurse_child_widgets (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
gboolean needs_clip;
|
||||
int width = gtk_widget_get_width (widget);
|
||||
int height = gtk_widget_get_height (widget);
|
||||
gboolean needs_clip;
|
||||
GtkCssStyle *style;
|
||||
GtkWidget *child;
|
||||
GtkBorder boxes[4];
|
||||
@@ -107,23 +107,15 @@ recurse_child_widgets (GtkWidget *widget,
|
||||
const GdkRGBA *color = &colors[i];
|
||||
const GtkBorder *box = &boxes[i];
|
||||
|
||||
if (gdk_rgba_is_clear (color))
|
||||
goto next;
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT ( 0, - box->top, width, box->top));
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (width, 0, box->right, height));
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (0, height, width, box->bottom));
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (- box->left, 0, box->left, height));
|
||||
|
||||
if (box->top > 0)
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT ( 0, - box->top, width, box->top));
|
||||
if (box->right > 0)
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (width, 0, box->right, height));
|
||||
if (box->bottom > 0)
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (0, height, width, box->bottom));
|
||||
if (box->left > 0)
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (- box->left, 0, box->left, height));
|
||||
|
||||
next:
|
||||
/* Grow box + offset */
|
||||
width += box->left + box->right;
|
||||
height += box->top + box->bottom;
|
||||
|
||||
@@ -774,10 +774,13 @@ populate_render_node_properties (GtkListStore *store,
|
||||
case GSK_TEXT_NODE:
|
||||
{
|
||||
const PangoFont *font = gsk_text_node_get_font (node);
|
||||
const PangoGlyphInfo *glyphs = gsk_text_node_get_glyphs (node, NULL);
|
||||
const GdkRGBA *color = gsk_text_node_get_color (node);
|
||||
guint num_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
const graphene_point_t *offset = gsk_text_node_get_offset (node);
|
||||
PangoFontDescription *desc;
|
||||
GString *s;
|
||||
int i;
|
||||
|
||||
desc = pango_font_describe ((PangoFont *)font);
|
||||
tmp = pango_font_description_to_string (desc);
|
||||
@@ -785,8 +788,9 @@ populate_render_node_properties (GtkListStore *store,
|
||||
g_free (tmp);
|
||||
pango_font_description_free (desc);
|
||||
|
||||
s = g_string_sized_new (0);
|
||||
gsk_text_node_serialize_glyphs (node, s);
|
||||
s = g_string_sized_new (6 * num_glyphs);
|
||||
for (i = 0; i < num_glyphs; i++)
|
||||
g_string_append_printf (s, "%x ", glyphs[i].glyph);
|
||||
add_text_row (store, "Glyphs", s->str);
|
||||
g_string_free (s, TRUE);
|
||||
|
||||
|
||||
@@ -6310,6 +6310,186 @@ void ra_shift_tail(roaring_array_t *ra, int32_t count, int32_t distance);
|
||||
|
||||
#endif
|
||||
/* end file include/roaring/roaring_array.h */
|
||||
/* begin file include/roaring/misc/configreport.h */
|
||||
/*
|
||||
* configreport.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_MISC_CONFIGREPORT_H_
|
||||
#define INCLUDE_MISC_CONFIGREPORT_H_
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifdef IS_X64
|
||||
// useful for basic info (0)
|
||||
static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
|
||||
unsigned int *ecx, unsigned int *edx) {
|
||||
#ifdef ROARING_INLINE_ASM
|
||||
__asm volatile("cpuid"
|
||||
: "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
|
||||
: "0"(*eax), "2"(*ecx));
|
||||
#endif /* not sure what to do when inline assembly is unavailable*/
|
||||
}
|
||||
|
||||
// CPUID instruction takes no parameters as CPUID implicitly uses the EAX
|
||||
// register.
|
||||
// The EAX register should be loaded with a value specifying what information to
|
||||
// return
|
||||
static inline void cpuinfo(int code, int *eax, int *ebx, int *ecx, int *edx) {
|
||||
#ifdef ROARING_INLINE_ASM
|
||||
__asm__ volatile("cpuid;" // call cpuid instruction
|
||||
: "=a"(*eax), "=b"(*ebx), "=c"(*ecx),
|
||||
"=d"(*edx) // output equal to "movl %%eax %1"
|
||||
: "a"(code) // input equal to "movl %1, %%eax"
|
||||
//:"%eax","%ebx","%ecx","%edx"// clobbered register
|
||||
);
|
||||
#endif /* not sure what to do when inline assembly is unavailable*/
|
||||
}
|
||||
|
||||
static inline int computecacheline(void) {
|
||||
int eax = 0, ebx = 0, ecx = 0, edx = 0;
|
||||
cpuinfo((int)0x80000006, &eax, &ebx, &ecx, &edx);
|
||||
return ecx & 0xFF;
|
||||
}
|
||||
|
||||
// this is quite imperfect, but can be handy
|
||||
static inline const char *guessprocessor(void) {
|
||||
unsigned eax = 1, ebx = 0, ecx = 0, edx = 0;
|
||||
native_cpuid(&eax, &ebx, &ecx, &edx);
|
||||
const char *codename;
|
||||
switch (eax >> 4) {
|
||||
case 0x506E:
|
||||
codename = "Skylake";
|
||||
break;
|
||||
case 0x406C:
|
||||
codename = "CherryTrail";
|
||||
break;
|
||||
case 0x306D:
|
||||
codename = "Broadwell";
|
||||
break;
|
||||
case 0x306C:
|
||||
codename = "Haswell";
|
||||
break;
|
||||
case 0x306A:
|
||||
codename = "IvyBridge";
|
||||
break;
|
||||
case 0x206A:
|
||||
case 0x206D:
|
||||
codename = "SandyBridge";
|
||||
break;
|
||||
case 0x2065:
|
||||
case 0x206C:
|
||||
case 0x206F:
|
||||
codename = "Westmere";
|
||||
break;
|
||||
case 0x106E:
|
||||
case 0x106A:
|
||||
case 0x206E:
|
||||
codename = "Nehalem";
|
||||
break;
|
||||
case 0x1067:
|
||||
case 0x106D:
|
||||
codename = "Penryn";
|
||||
break;
|
||||
case 0x006F:
|
||||
case 0x1066:
|
||||
codename = "Merom";
|
||||
break;
|
||||
case 0x0066:
|
||||
codename = "Presler";
|
||||
break;
|
||||
case 0x0063:
|
||||
case 0x0064:
|
||||
codename = "Prescott";
|
||||
break;
|
||||
case 0x006D:
|
||||
codename = "Dothan";
|
||||
break;
|
||||
case 0x0366:
|
||||
codename = "Cedarview";
|
||||
break;
|
||||
case 0x0266:
|
||||
codename = "Lincroft";
|
||||
break;
|
||||
case 0x016C:
|
||||
codename = "Pineview";
|
||||
break;
|
||||
default:
|
||||
codename = "UNKNOWN";
|
||||
break;
|
||||
}
|
||||
return codename;
|
||||
}
|
||||
|
||||
static inline void tellmeall(void) {
|
||||
printf("Intel processor: %s\t", guessprocessor());
|
||||
|
||||
#ifdef __VERSION__
|
||||
printf(" compiler version: %s\t", __VERSION__);
|
||||
#endif
|
||||
printf("\tBuild option USEAVX ");
|
||||
#ifdef USEAVX
|
||||
printf("enabled\n");
|
||||
#else
|
||||
printf("disabled\n");
|
||||
#endif
|
||||
#ifndef __AVX2__
|
||||
printf("AVX2 is NOT available.\n");
|
||||
#endif
|
||||
|
||||
if ((sizeof(int) != 4) || (sizeof(long) != 8)) {
|
||||
printf("number of bytes: int = %lu long = %lu \n",
|
||||
(long unsigned int)sizeof(size_t),
|
||||
(long unsigned int)sizeof(int));
|
||||
}
|
||||
#if defined(__LITTLE_ENDIAN__) && __LITTLE_ENDIAN__
|
||||
// This is what we expect!
|
||||
// printf("you have little endian machine");
|
||||
#endif
|
||||
#if defined(__BIG_ENDIAN__) && __BIG_ENDIAN__
|
||||
printf("you have a big endian machine");
|
||||
#endif
|
||||
#if __CHAR_BIT__
|
||||
if (__CHAR_BIT__ != 8) printf("on your machine, chars don't have 8bits???");
|
||||
#endif
|
||||
if (computecacheline() != 64)
|
||||
printf("cache line: %d bytes\n", computecacheline());
|
||||
}
|
||||
#else
|
||||
|
||||
static inline void tellmeall(void) {
|
||||
printf("Non-X64 processor\n");
|
||||
#ifdef __arm__
|
||||
printf("ARM processor detected\n");
|
||||
#endif
|
||||
#ifdef __VERSION__
|
||||
printf(" compiler version: %s\t", __VERSION__);
|
||||
#endif
|
||||
if ((sizeof(int) != 4) || (sizeof(long) != 8)) {
|
||||
printf("number of bytes: int = %lu long = %lu \n",
|
||||
(long unsigned int)sizeof(size_t),
|
||||
(long unsigned int)sizeof(int));
|
||||
}
|
||||
#if __LITTLE_ENDIAN__
|
||||
// This is what we expect!
|
||||
// printf("you have little endian machine");
|
||||
#endif
|
||||
#if __BIG_ENDIAN__
|
||||
printf("you have a big endian machine");
|
||||
#endif
|
||||
#if __CHAR_BIT__
|
||||
if (__CHAR_BIT__ != 8) printf("on your machine, chars don't have 8bits???");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* INCLUDE_MISC_CONFIGREPORT_H_ */
|
||||
/* end file include/roaring/misc/configreport.h */
|
||||
/* begin file include/roaring/roaring.h */
|
||||
/*
|
||||
An implementation of Roaring Bitmaps in C.
|
||||
|
||||
+20
-21
@@ -251,8 +251,9 @@ static GdkPixbuf *
|
||||
load_symbolic_svg (const char *escaped_file_data,
|
||||
int width,
|
||||
int height,
|
||||
const char *icon_width_str,
|
||||
const char *icon_height_str,
|
||||
double scale,
|
||||
int icon_width,
|
||||
int icon_height,
|
||||
const char *fg_string,
|
||||
const char *success_color_string,
|
||||
const char *warning_color_string,
|
||||
@@ -262,13 +263,22 @@ load_symbolic_svg (const char *escaped_file_data,
|
||||
GInputStream *stream;
|
||||
GdkPixbuf *pixbuf;
|
||||
char *data;
|
||||
char *svg_width, *svg_height;
|
||||
|
||||
if (width == 0)
|
||||
width = icon_width * scale;
|
||||
if (height == 0)
|
||||
height = icon_height * scale;
|
||||
|
||||
svg_width = g_strdup_printf ("%d", icon_width);
|
||||
svg_height = g_strdup_printf ("%d", icon_height);
|
||||
|
||||
data = g_strconcat ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
|
||||
"<svg version=\"1.1\"\n"
|
||||
" xmlns=\"http://www.w3.org/2000/svg\"\n"
|
||||
" xmlns:xi=\"http://www.w3.org/2001/XInclude\"\n"
|
||||
" width=\"", icon_width_str, "\"\n"
|
||||
" height=\"", icon_height_str, "\">\n"
|
||||
" width=\"", svg_width, "\"\n"
|
||||
" height=\"", svg_height, "\">\n"
|
||||
" <style type=\"text/css\">\n"
|
||||
" rect,circle,path {\n"
|
||||
" fill: ", fg_string," !important;\n"
|
||||
@@ -286,6 +296,8 @@ load_symbolic_svg (const char *escaped_file_data,
|
||||
" <xi:include href=\"data:text/xml;base64,", escaped_file_data, "\"/>\n"
|
||||
"</svg>",
|
||||
NULL);
|
||||
g_free (svg_width);
|
||||
g_free (svg_height);
|
||||
|
||||
stream = g_memory_input_stream_new_from_data (data, -1, g_free);
|
||||
pixbuf = gdk_pixbuf_new_from_stream_at_scale (stream, width, height, TRUE, NULL, error);
|
||||
@@ -434,8 +446,6 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
||||
{
|
||||
const char *r_string = "rgb(255,0,0)";
|
||||
const char *g_string = "rgb(0,255,0)";
|
||||
char *icon_width_str;
|
||||
char *icon_height_str;
|
||||
GdkPixbuf *loaded;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
int plane;
|
||||
@@ -458,13 +468,6 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
||||
}
|
||||
|
||||
escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
|
||||
icon_width_str = g_strdup_printf ("%d", icon_width);
|
||||
icon_height_str = g_strdup_printf ("%d", icon_height);
|
||||
|
||||
if (width == 0)
|
||||
width = icon_width * scale;
|
||||
if (height == 0)
|
||||
height = icon_height * scale;
|
||||
|
||||
for (plane = 0; plane < 3; plane++)
|
||||
{
|
||||
@@ -480,16 +483,16 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
||||
* channels, with the color of the fg being implicitly
|
||||
* the "rest", as all color fractions should add up to 1.
|
||||
*/
|
||||
loaded = load_symbolic_svg (escaped_file_data, width, height,
|
||||
icon_width_str,
|
||||
icon_height_str,
|
||||
loaded = load_symbolic_svg (escaped_file_data, width, height, scale,
|
||||
icon_width,
|
||||
icon_height,
|
||||
g_string,
|
||||
plane == 0 ? r_string : g_string,
|
||||
plane == 1 ? r_string : g_string,
|
||||
plane == 2 ? r_string : g_string,
|
||||
error);
|
||||
if (loaded == NULL)
|
||||
goto out;
|
||||
return NULL;
|
||||
|
||||
if (pixbuf == NULL)
|
||||
{
|
||||
@@ -509,10 +512,6 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
||||
|
||||
g_free (escaped_file_data);
|
||||
|
||||
out:
|
||||
g_free (icon_width_str);
|
||||
g_free (icon_height_str);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
|
||||
@@ -507,8 +507,8 @@ set_attribute_value (Element *element,
|
||||
}
|
||||
|
||||
len = g_strv_length (element->attribute_names);
|
||||
element->attribute_names = g_realloc_n (element->attribute_names, len + 2, sizeof (char *));
|
||||
element->attribute_values = g_realloc_n (element->attribute_values, len + 2, sizeof (char *));
|
||||
element->attribute_names = g_realloc (element->attribute_names, len + 2);
|
||||
element->attribute_values = g_realloc (element->attribute_values, len + 2);
|
||||
element->attribute_names[len] = g_strdup (name);
|
||||
element->attribute_values[len] = g_strdup (value);
|
||||
element->attribute_names[len + 1] = NULL;
|
||||
|
||||
+1
-1
@@ -723,7 +723,7 @@ if cairogobj_pkg_found
|
||||
endif
|
||||
|
||||
if vulkan_pkg_found
|
||||
gdk_packages += ' vulkan'
|
||||
gdk_packages += 'vulkan'
|
||||
endif
|
||||
|
||||
pkgconf.set('GDK_PACKAGES', gdk_packages)
|
||||
|
||||
@@ -25,14 +25,11 @@
|
||||
|
||||
#include <gst/player/gstplayer-video-renderer.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
struct _GtkGstPaintable
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GdkPaintable *image;
|
||||
double pixel_aspect_ratio;
|
||||
};
|
||||
|
||||
struct _GtkGstPaintableClass
|
||||
@@ -69,8 +66,7 @@ gtk_gst_paintable_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
GtkGstPaintable *self = GTK_GST_PAINTABLE (paintable);
|
||||
|
||||
if (self->image)
|
||||
return round (self->pixel_aspect_ratio *
|
||||
gdk_paintable_get_intrinsic_width (self->image));
|
||||
return gdk_paintable_get_intrinsic_width (self->image);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -92,8 +88,7 @@ gtk_gst_paintable_paintable_get_intrinsic_aspect_ratio (GdkPaintable *paintable)
|
||||
GtkGstPaintable *self = GTK_GST_PAINTABLE (paintable);
|
||||
|
||||
if (self->image)
|
||||
return self->pixel_aspect_ratio *
|
||||
gdk_paintable_get_intrinsic_aspect_ratio (self->image);
|
||||
return gdk_paintable_get_intrinsic_aspect_ratio (self->image);
|
||||
|
||||
return 0.0;
|
||||
};
|
||||
@@ -162,8 +157,7 @@ gtk_gst_paintable_new (void)
|
||||
|
||||
static void
|
||||
gtk_gst_paintable_set_paintable (GtkGstPaintable *self,
|
||||
GdkPaintable *paintable,
|
||||
double pixel_aspect_ratio)
|
||||
GdkPaintable *paintable)
|
||||
{
|
||||
gboolean size_changed;
|
||||
|
||||
@@ -171,8 +165,7 @@ gtk_gst_paintable_set_paintable (GtkGstPaintable *self,
|
||||
return;
|
||||
|
||||
if (self->image == NULL ||
|
||||
self->pixel_aspect_ratio * gdk_paintable_get_intrinsic_width (self->image) !=
|
||||
pixel_aspect_ratio * gdk_paintable_get_intrinsic_width (paintable) ||
|
||||
gdk_paintable_get_intrinsic_width (self->image) != gdk_paintable_get_intrinsic_width (paintable) ||
|
||||
gdk_paintable_get_intrinsic_height (self->image) != gdk_paintable_get_intrinsic_height (paintable) ||
|
||||
gdk_paintable_get_intrinsic_aspect_ratio (self->image) != gdk_paintable_get_intrinsic_aspect_ratio (paintable))
|
||||
size_changed = TRUE;
|
||||
@@ -180,7 +173,6 @@ gtk_gst_paintable_set_paintable (GtkGstPaintable *self,
|
||||
size_changed = FALSE;
|
||||
|
||||
g_set_object (&self->image, paintable);
|
||||
self->pixel_aspect_ratio = pixel_aspect_ratio;
|
||||
|
||||
if (size_changed)
|
||||
gdk_paintable_invalidate_size (GDK_PAINTABLE (self));
|
||||
@@ -193,7 +185,6 @@ typedef struct _SetTextureInvocation SetTextureInvocation;
|
||||
struct _SetTextureInvocation {
|
||||
GtkGstPaintable *paintable;
|
||||
GdkTexture *texture;
|
||||
double pixel_aspect_ratio;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -211,23 +202,20 @@ gtk_gst_paintable_set_texture_invoke (gpointer data)
|
||||
SetTextureInvocation *invoke = data;
|
||||
|
||||
gtk_gst_paintable_set_paintable (invoke->paintable,
|
||||
GDK_PAINTABLE (invoke->texture),
|
||||
invoke->pixel_aspect_ratio);
|
||||
GDK_PAINTABLE (invoke->texture));
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_gst_paintable_queue_set_texture (GtkGstPaintable *self,
|
||||
GdkTexture *texture,
|
||||
double pixel_aspect_ratio)
|
||||
GdkTexture *texture)
|
||||
{
|
||||
SetTextureInvocation *invoke;
|
||||
|
||||
invoke = g_slice_new0 (SetTextureInvocation);
|
||||
invoke->paintable = g_object_ref (self);
|
||||
invoke->texture = g_object_ref (texture);
|
||||
invoke->pixel_aspect_ratio = pixel_aspect_ratio;
|
||||
|
||||
g_main_context_invoke_full (NULL,
|
||||
G_PRIORITY_DEFAULT,
|
||||
|
||||
@@ -31,8 +31,7 @@ G_DECLARE_FINAL_TYPE (GtkGstPaintable, gtk_gst_paintable, GTK, GST_PAINTABLE, GO
|
||||
GdkPaintable * gtk_gst_paintable_new (void);
|
||||
|
||||
void gtk_gst_paintable_queue_set_texture (GtkGstPaintable *self,
|
||||
GdkTexture *texture,
|
||||
double pixel_aspect_ratio);
|
||||
GdkTexture *texture);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -111,17 +111,9 @@ gtk_gst_memory_format_from_video (GstVideoFormat format)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
video_frame_free (GstVideoFrame *frame)
|
||||
{
|
||||
gst_video_frame_unmap (frame);
|
||||
g_free (frame);
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
gtk_gst_sink_texture_from_buffer (GtkGstSink *self,
|
||||
GstBuffer *buffer,
|
||||
double *pixel_aspect_ratio)
|
||||
GstBuffer *buffer)
|
||||
{
|
||||
GstVideoFrame frame;
|
||||
GdkTexture *texture;
|
||||
@@ -132,16 +124,15 @@ gtk_gst_sink_texture_from_buffer (GtkGstSink *self,
|
||||
|
||||
bytes = g_bytes_new_with_free_func (frame.data[0],
|
||||
frame.info.width * frame.info.stride[0],
|
||||
(GDestroyNotify) video_frame_free,
|
||||
g_memdup (&frame, sizeof (frame)));
|
||||
(GDestroyNotify) gst_buffer_unref,
|
||||
gst_buffer_ref (buffer));
|
||||
texture = gdk_memory_texture_new (frame.info.width,
|
||||
frame.info.height,
|
||||
gtk_gst_memory_format_from_video (GST_VIDEO_FRAME_FORMAT (&frame)),
|
||||
bytes,
|
||||
frame.info.stride[0]);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
*pixel_aspect_ratio = ((double) frame.info.par_n) / ((double) frame.info.par_d);
|
||||
gst_video_frame_unmap (&frame);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -151,7 +142,6 @@ gtk_gst_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
||||
{
|
||||
GtkGstSink *self;
|
||||
GdkTexture *texture;
|
||||
double pixel_aspect_ratio;
|
||||
|
||||
GST_TRACE ("rendering buffer:%p", buf);
|
||||
|
||||
@@ -159,10 +149,10 @@ gtk_gst_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
||||
texture = gtk_gst_sink_texture_from_buffer (self, buf, &pixel_aspect_ratio);
|
||||
texture = gtk_gst_sink_texture_from_buffer (self, buf);
|
||||
if (texture)
|
||||
{
|
||||
gtk_gst_paintable_queue_set_texture (self->paintable, texture, pixel_aspect_ratio);
|
||||
gtk_gst_paintable_queue_set_texture (self->paintable, texture);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ if gstplayer_dep.found()
|
||||
'gtkgstsink.c',
|
||||
],
|
||||
c_args: extra_c_args,
|
||||
dependencies: [ libm, libgtk_dep, gstplayer_dep ],
|
||||
dependencies: [ libgtk_dep, gstplayer_dep ],
|
||||
install_dir: media_install_dir,
|
||||
install: true,
|
||||
)
|
||||
|
||||
@@ -76,4 +76,5 @@ shared_module('printbackend-file',
|
||||
install: true,
|
||||
)
|
||||
|
||||
# Store the print backends in the config.h
|
||||
cdata.set_quoted('GTK_PRINT_BACKENDS', ','.join(print_backends))
|
||||
|
||||
+1297
-1315
File diff suppressed because it is too large
Load Diff
+3074
-4785
File diff suppressed because it is too large
Load Diff
@@ -77,7 +77,7 @@ gdk_array(test_splice) (void)
|
||||
for (j = 0; j < add; j++)
|
||||
sum += ++additions[j];
|
||||
|
||||
gdk_array(splice) (&v, pos, remove, FALSE, additions, add);
|
||||
gdk_array(splice) (&v, pos, remove, additions, add);
|
||||
{
|
||||
gsize total = 0;
|
||||
for (j = 0; j < gdk_array(get_size) (&v); j++)
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
transform {
|
||||
/* break the transform on purpose, because
|
||||
this is valid in GSK and should result
|
||||
in nothing being drawn. */
|
||||
transform: scale(0);
|
||||
child: color {
|
||||
color: red;
|
||||
bounds: 0 0 100 100;
|
||||
}
|
||||
}
|
||||
|
||||
/* make sure the rendering has a size */
|
||||
color {
|
||||
color: transparent;
|
||||
bounds: 0 0 1 1;
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 86 B |
@@ -48,7 +48,6 @@ compare_render_tests = [
|
||||
'empty-shadow',
|
||||
'empty-texture',
|
||||
'empty-transform',
|
||||
'invalid-transform',
|
||||
'opacity_clip',
|
||||
'outset_shadow_offset_both',
|
||||
'outset_shadow_offset_x',
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
text {
|
||||
color: rgb(50,50,50);
|
||||
font: "Cantarell 11";
|
||||
glyphs: "N", 430 5, 406 8, 417 7, 772 4, 783 5, 783 5, 793 6 0 0 same-cluster;
|
||||
offset: 0 32.0186;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
text {
|
||||
color: rgb(50,50,50);
|
||||
font: "Cantarell 11";
|
||||
glyphs: "N", 430 5, 406 8, 417 7, 772 4, 783 5, 783 5, 793 6 0 0 same-cluster;
|
||||
offset: 0 32.0186;
|
||||
}
|
||||
Reference in New Issue
Block a user