1 | /* gskgltextureprivate.h |
2 | * |
3 | * Copyright 2020 Christian Hergert <chergert@redhat.com> |
4 | * |
5 | * This file is free software; you can redistribute it and/or modify it under |
6 | * the terms of the GNU Lesser General Public License as published by the Free |
7 | * Software Foundation; either version 2.1 of the License, or (at your option) |
8 | * any later version. |
9 | * |
10 | * This file is distributed in the hope that it will be useful, but WITHOUT |
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
13 | * License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public License along |
16 | * 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_TEXTURE_PRIVATE_H__ |
22 | #define _GSK_GL_TEXTURE_PRIVATE_H__ |
23 | |
24 | #include "gskgltypesprivate.h" |
25 | |
26 | G_BEGIN_DECLS |
27 | |
28 | struct _GskGLTextureSlice |
29 | { |
30 | cairo_rectangle_int_t rect; |
31 | guint texture_id; |
32 | }; |
33 | |
34 | struct _GskGLTextureNineSlice |
35 | { |
36 | cairo_rectangle_int_t rect; |
37 | struct { |
38 | float x; |
39 | float y; |
40 | float x2; |
41 | float y2; |
42 | } area; |
43 | }; |
44 | |
45 | struct _GskGLTexture |
46 | { |
47 | /* Used to insert into queue */ |
48 | GList link; |
49 | |
50 | /* Identifier of the frame that created it */ |
51 | gint64 last_used_in_frame; |
52 | |
53 | /* Backpointer to texture (can be cleared asynchronously) */ |
54 | GdkTexture *user; |
55 | |
56 | /* Only used by nine-slice textures */ |
57 | GskGLTextureNineSlice *nine_slice; |
58 | |
59 | /* Only used by sliced textures */ |
60 | GskGLTextureSlice *slices; |
61 | guint n_slices; |
62 | |
63 | /* The actual GL texture identifier in some shared context */ |
64 | guint texture_id; |
65 | |
66 | int width; |
67 | int height; |
68 | int min_filter; |
69 | int mag_filter; |
70 | int format; |
71 | |
72 | /* Set when used by an atlas so we don't drop the texture */ |
73 | guint permanent : 1; |
74 | }; |
75 | |
76 | GskGLTexture * gsk_gl_texture_new (guint texture_id, |
77 | int width, |
78 | int height, |
79 | int format, |
80 | int min_filter, |
81 | int mag_filter, |
82 | gint64 frame_id); |
83 | const GskGLTextureNineSlice * gsk_gl_texture_get_nine_slice (GskGLTexture *texture, |
84 | const GskRoundedRect *outline, |
85 | float , |
86 | float ); |
87 | void gsk_gl_texture_free (GskGLTexture *texture); |
88 | |
89 | G_END_DECLS |
90 | |
91 | #endif /* _GSK_GL_TEXTURE_PRIVATE_H__ */ |
92 | |