1/* gskgliconlibraryprivate.h
2 *
3 * Copyright 2020 Christian Hergert <chergert@redhat.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * SPDX-License-Identifier: LGPL-2.1-or-later
19 */
20
21#ifndef __GSK_GL_ICON_LIBRARY_PRIVATE_H__
22#define __GSK_GL_ICON_LIBRARY_PRIVATE_H__
23
24#include <pango/pango.h>
25
26#include "gskgltexturelibraryprivate.h"
27
28G_BEGIN_DECLS
29
30#define GSK_TYPE_GL_ICON_LIBRARY (gsk_gl_icon_library_get_type())
31
32typedef struct _GskGLIconData
33{
34 GskGLTextureAtlasEntry entry;
35 GdkTexture *source_texture;
36} GskGLIconData;
37
38G_DECLARE_FINAL_TYPE (GskGLIconLibrary, gsk_gl_icon_library, GSK, GL_ICON_LIBRARY, GskGLTextureLibrary)
39
40GskGLIconLibrary *gsk_gl_icon_library_new (GskGLDriver *driver);
41void gsk_gl_icon_library_add (GskGLIconLibrary *self,
42 GdkTexture *key,
43 const GskGLIconData **out_value);
44
45static inline void
46gsk_gl_icon_library_lookup_or_add (GskGLIconLibrary *self,
47 GdkTexture *key,
48 const GskGLIconData **out_value)
49{
50 GskGLTextureAtlasEntry *entry;
51
52 if G_LIKELY (gsk_gl_texture_library_lookup ((GskGLTextureLibrary *)self, key, &entry))
53 *out_value = (GskGLIconData *)entry;
54 else
55 gsk_gl_icon_library_add (self, key, out_value);
56}
57
58G_END_DECLS
59
60#endif /* __GSK_GL_ICON_LIBRARY_PRIVATE_H__ */
61

source code of gtk/gsk/gl/gskgliconlibraryprivate.h