[gtk/wip/chergert/glproto] switch to x, x2 areas for texture libraries
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto] switch to x, x2 areas for texture libraries
- Date: Fri, 29 Jan 2021 07:52:53 +0000 (UTC)
commit 13305e11ec2560e328a8a721a722db037c4c52d9
Author: Christian Hergert <chergert redhat com>
Date: Thu Jan 28 23:52:46 2021 -0800
switch to x,x2 areas for texture libraries
gsk/next/gskglglyphlibrary.c | 4 ++--
gsk/next/gskgliconlibrary.c | 4 ++--
gsk/next/gskglrenderjob.c | 13 +++++--------
gsk/next/gskgltexturelibrary.c | 24 ++++++++++++------------
gsk/next/gskgltexturelibraryprivate.h | 7 ++++++-
5 files changed, 27 insertions(+), 25 deletions(-)
---
diff --git a/gsk/next/gskglglyphlibrary.c b/gsk/next/gskglglyphlibrary.c
index 9187692567..0a4dcf8747 100644
--- a/gsk/next/gskglglyphlibrary.c
+++ b/gsk/next/gskglglyphlibrary.c
@@ -249,8 +249,8 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
if G_LIKELY (atlas != NULL)
{
- x = atlas->width * value->entry.area.origin.x;
- y = atlas->width * value->entry.area.origin.y;
+ x = atlas->width * value->entry.area.x;
+ y = atlas->width * value->entry.area.y;
}
else
{
diff --git a/gsk/next/gskgliconlibrary.c b/gsk/next/gskgliconlibrary.c
index 940cb76493..62e193002b 100644
--- a/gsk/next/gskgliconlibrary.c
+++ b/gsk/next/gskgliconlibrary.c
@@ -108,8 +108,8 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
if G_LIKELY (atlas != NULL)
{
- packed_x = atlas->width * icon_data->entry.area.origin.x;
- packed_y = atlas->width * icon_data->entry.area.origin.y;
+ packed_x = atlas->width * icon_data->entry.area.x;
+ packed_y = atlas->width * icon_data->entry.area.y;
}
else
{
diff --git a/gsk/next/gskglrenderjob.c b/gsk/next/gskglrenderjob.c
index 60c4021ef3..d5e69ec38a 100644
--- a/gsk/next/gskglrenderjob.c
+++ b/gsk/next/gskglrenderjob.c
@@ -2663,10 +2663,10 @@ gsk_gl_render_job_visit_text_node (GskGLRenderJob *job,
last_texture = texture_id;
}
- tx = glyph->entry.area.origin.x;
- ty = glyph->entry.area.origin.y;
- tx2 = tx + glyph->entry.area.size.width;
- ty2 = ty + glyph->entry.area.size.height;
+ tx = glyph->entry.area.x;
+ ty = glyph->entry.area.y;
+ tx2 = glyph->entry.area.x2;
+ ty2 = glyph->entry.area.y2;
glyph_x = floor (x + cx + 0.125) + glyph->ink_rect.x;
glyph_y = floor (y + cy + 0.125) + glyph->ink_rect.y;
@@ -3119,10 +3119,7 @@ gsk_gl_render_job_upload_texture (GskGLRenderJob *job,
gsk_gl_icon_library_lookup_or_add (job->driver->icons, texture, &icon_data);
offscreen->texture_id = GSK_GL_TEXTURE_ATLAS_ENTRY_TEXTURE (icon_data);
- offscreen->area.x = icon_data->entry.area.origin.x;
- offscreen->area.y = icon_data->entry.area.origin.y;
- offscreen->area.x2 = icon_data->entry.area.origin.x + icon_data->entry.area.size.width;
- offscreen->area.y2 = icon_data->entry.area.origin.y + icon_data->entry.area.size.height;
+ memcpy (&offscreen->area, &icon_data->entry.area, sizeof offscreen->area);
}
else
{
diff --git a/gsk/next/gskgltexturelibrary.c b/gsk/next/gskgltexturelibrary.c
index 484759c857..cf57f837cb 100644
--- a/gsk/next/gskgltexturelibrary.c
+++ b/gsk/next/gskgltexturelibrary.c
@@ -256,10 +256,10 @@ gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
{
entry->is_atlased = FALSE;
entry->texture = NULL;
- entry->area.origin.x = 0.0f;
- entry->area.origin.y = 0.0f;
- entry->area.size.width = 0.0f;
- entry->area.size.height = 0.0f;
+ entry->area.x = 0.0f;
+ entry->area.y = 0.0f;
+ entry->area.x2 = 0.0f;
+ entry->area.y2 = 0.0f;
}
else if (width <= self->max_entry_size && height <= self->max_entry_size)
{
@@ -275,10 +275,10 @@ gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
entry->atlas = atlas;
entry->is_atlased = TRUE;
- entry->area.origin.x = (float)(packed_x + 1) / atlas->width;
- entry->area.origin.y = (float)(packed_y + 1) / atlas->height;
- entry->area.size.width = (float)width / atlas->width;
- entry->area.size.height = (float)height / atlas->height;
+ entry->area.x = (float)(packed_x + 1) / atlas->width;
+ entry->area.y = (float)(packed_y + 1) / atlas->height;
+ entry->area.x2 = entry->area.x + (float)width / atlas->width;
+ entry->area.y2 = entry->area.y + (float)height / atlas->height;
}
else
{
@@ -286,10 +286,10 @@ gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
entry->texture = texture;
entry->is_atlased = FALSE;
- entry->area.origin.x = 0.0f;
- entry->area.origin.y = 0.0f;
- entry->area.size.width = 1.0f;
- entry->area.size.height = 1.0f;
+ entry->area.x = 0.0f;
+ entry->area.y = 0.0f;
+ entry->area.x2 = 1.0f;
+ entry->area.y2 = 1.0f;
}
g_hash_table_insert (self->hash_table, key, entry);
diff --git a/gsk/next/gskgltexturelibraryprivate.h b/gsk/next/gskgltexturelibraryprivate.h
index 261dbe2e87..6b415a1da3 100644
--- a/gsk/next/gskgltexturelibraryprivate.h
+++ b/gsk/next/gskgltexturelibraryprivate.h
@@ -64,7 +64,12 @@ typedef struct _GskGLTextureAtlasEntry
};
/* The area within the atlas translated to 0..1 bounds */
- graphene_rect_t area;
+ struct {
+ float x;
+ float y;
+ float x2;
+ float y2;
+ } area;
/* Number of pixels in the entry, used to calculate usage
* of an atlas while processing.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]