mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
ngl: Reduce type checking overhead
No need to be very careful here, these are entirely internal types.
This commit is contained in:
parent
466d33ca69
commit
f88efb811b
@ -88,7 +88,7 @@ gsk_ngl_glyph_library_begin_frame (GskNglTextureLibrary *library,
|
||||
gint64 frame_id,
|
||||
GPtrArray *removed_atlases)
|
||||
{
|
||||
GskNglGlyphLibrary *self = GSK_NGL_GLYPH_LIBRARY (library);
|
||||
GskNglGlyphLibrary *self = (GskNglGlyphLibrary *)library;
|
||||
|
||||
memset (self->front, 0, sizeof self->front);
|
||||
}
|
||||
@ -117,8 +117,10 @@ gsk_ngl_glyph_library_class_init (GskNglGlyphLibraryClass *klass)
|
||||
static void
|
||||
gsk_ngl_glyph_library_init (GskNglGlyphLibrary *self)
|
||||
{
|
||||
GSK_NGL_TEXTURE_LIBRARY (self)->max_entry_size = MAX_GLYPH_SIZE;
|
||||
gsk_ngl_texture_library_set_funcs (GSK_NGL_TEXTURE_LIBRARY (self),
|
||||
GskNglTextureLibrary *tl = (GskNglTextureLibrary *)self;
|
||||
|
||||
tl->max_entry_size = MAX_GLYPH_SIZE;
|
||||
gsk_ngl_texture_library_set_funcs (tl,
|
||||
gsk_ngl_glyph_key_hash,
|
||||
gsk_ngl_glyph_key_equal,
|
||||
gsk_ngl_glyph_key_free,
|
||||
@ -200,6 +202,7 @@ gsk_ngl_glyph_library_upload_glyph (GskNglGlyphLibrary *self,
|
||||
int height,
|
||||
double device_scale)
|
||||
{
|
||||
GskNglTextureLibrary *tl = (GskNglTextureLibrary *)self;
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
cairo_scaled_font_t *scaled_font;
|
||||
cairo_surface_t *surface;
|
||||
@ -264,7 +267,7 @@ gsk_ngl_glyph_library_upload_glyph (GskNglGlyphLibrary *self,
|
||||
|
||||
gdk_gl_context_pop_debug_group (gdk_gl_context_get_current ());
|
||||
|
||||
GSK_NGL_TEXTURE_LIBRARY (self)->driver->command_queue->n_uploads++;
|
||||
tl->driver->command_queue->n_uploads++;
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
@ -279,6 +282,7 @@ gsk_ngl_glyph_library_add (GskNglGlyphLibrary *self,
|
||||
GskNglGlyphKey *key,
|
||||
const GskNglGlyphValue **out_value)
|
||||
{
|
||||
GskNglTextureLibrary *tl = (GskNglTextureLibrary *)self;
|
||||
PangoRectangle ink_rect;
|
||||
GskNglGlyphValue *value;
|
||||
int width;
|
||||
@ -301,7 +305,7 @@ gsk_ngl_glyph_library_add (GskNglGlyphLibrary *self,
|
||||
width = (int) ceil (ink_rect.width * key->scale / 1024.0);
|
||||
height = (int) ceil (ink_rect.height * key->scale / 1024.0);
|
||||
|
||||
value = gsk_ngl_texture_library_pack (GSK_NGL_TEXTURE_LIBRARY (self),
|
||||
value = gsk_ngl_texture_library_pack (tl,
|
||||
key,
|
||||
sizeof *value,
|
||||
width,
|
||||
|
@ -63,8 +63,10 @@ gsk_ngl_icon_library_class_init (GskNglIconLibraryClass *klass)
|
||||
static void
|
||||
gsk_ngl_icon_library_init (GskNglIconLibrary *self)
|
||||
{
|
||||
GSK_NGL_TEXTURE_LIBRARY (self)->max_entry_size = 128;
|
||||
gsk_ngl_texture_library_set_funcs (GSK_NGL_TEXTURE_LIBRARY (self),
|
||||
GskNglTextureLibrary *tl = (GskNglTextureLibrary *)self;
|
||||
|
||||
tl->max_entry_size = 128;
|
||||
gsk_ngl_texture_library_set_funcs (tl,
|
||||
NULL, NULL, NULL,
|
||||
gsk_ngl_icon_data_free);
|
||||
}
|
||||
@ -74,6 +76,7 @@ gsk_ngl_icon_library_add (GskNglIconLibrary *self,
|
||||
GdkTexture *key,
|
||||
const GskNglIconData **out_value)
|
||||
{
|
||||
GskNglTextureLibrary *tl = (GskNglTextureLibrary *)self;
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
cairo_surface_t *surface;
|
||||
GskNglIconData *icon_data;
|
||||
@ -95,7 +98,7 @@ gsk_ngl_icon_library_add (GskNglIconLibrary *self,
|
||||
width = key->width;
|
||||
height = key->height;
|
||||
|
||||
icon_data = gsk_ngl_texture_library_pack (GSK_NGL_TEXTURE_LIBRARY (self),
|
||||
icon_data = gsk_ngl_texture_library_pack (tl,
|
||||
key,
|
||||
sizeof (GskNglIconData),
|
||||
width, height, 1,
|
||||
@ -202,7 +205,7 @@ gsk_ngl_icon_library_add (GskNglIconLibrary *self,
|
||||
cairo_surface_destroy (surface);
|
||||
g_free (free_data);
|
||||
|
||||
GSK_NGL_TEXTURE_LIBRARY (self)->driver->command_queue->n_uploads++;
|
||||
tl->driver->command_queue->n_uploads++;
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
|
@ -3332,7 +3332,7 @@ gsk_ngl_render_job_upload_texture (GskNglRenderJob *job,
|
||||
GdkTexture *texture,
|
||||
GskNglRenderOffscreen *offscreen)
|
||||
{
|
||||
if (gsk_ngl_texture_library_can_cache (GSK_NGL_TEXTURE_LIBRARY (job->driver->icons),
|
||||
if (gsk_ngl_texture_library_can_cache ((GskNglTextureLibrary *)job->driver->icons,
|
||||
texture->width,
|
||||
texture->height) &&
|
||||
!GDK_IS_GL_TEXTURE (texture))
|
||||
|
Loading…
Reference in New Issue
Block a user