[gtk/ebassi/issue-3864] gsk/gl: Build with G_DISABLE_ASSERT enabled
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/issue-3864] gsk/gl: Build with G_DISABLE_ASSERT enabled
- Date: Mon, 12 Apr 2021 11:28:14 +0000 (UTC)
commit 1968a18edb5faeee17d3c6b03bd300784503188b
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Apr 12 12:27:33 2021 +0100
gsk/gl: Build with G_DISABLE_ASSERT enabled
gsk/gl/gskgldriver.c | 10 ++++++----
gsk/gl/gskglrenderer.c | 5 +++++
gsk/gl/gskglrenderops.c | 22 ++++++++++++++++++++--
3 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c
index e1d019c029..3cf9bfebce 100644
--- a/gsk/gl/gskgldriver.c
+++ b/gsk/gl/gskgldriver.c
@@ -433,8 +433,6 @@ gsk_gl_driver_slice_texture (GskGLDriver *self,
guint *out_n_slices)
{
const int max_texture_size = gsk_gl_driver_get_max_texture_size (self) / 4; // XXX Too much?
- const int tex_width = texture->width;
- const int tex_height = texture->height;
const int cols = (texture->width / max_texture_size) + 1;
const int rows = (texture->height / max_texture_size) + 1;
int col, row;
@@ -442,8 +440,7 @@ gsk_gl_driver_slice_texture (GskGLDriver *self,
TextureSlice *slices;
Texture *tex;
- g_assert (tex_width > max_texture_size || tex_height > max_texture_size);
-
+ g_assert (texture->width > max_texture_size || texture->height > max_texture_size);
tex = gdk_texture_get_render_data (texture, self);
@@ -730,7 +727,12 @@ gsk_gl_driver_mark_texture_permanent (GskGLDriver *self,
{
Texture *t = gsk_gl_driver_get_texture (self, texture_id);
+#ifdef G_DISABLE_ASSERT
+ if (t == NULL)
+ return;
+#else
g_assert (t != NULL);
+#endif
t->permanent = TRUE;
}
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index c72cedaeb4..359d03c748 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -2002,7 +2002,12 @@ render_unblurred_inset_shadow_node (GskGLRenderer *self,
const float dy = gsk_inset_shadow_node_get_dy (node);
const float spread = gsk_inset_shadow_node_get_spread (node);
+#if G_DISABLE_ASSERT
+ if (blur_radius == 0)
+ return;
+#else
g_assert (blur_radius == 0);
+#endif
ops_set_program (builder, &self->programs->inset_shadow_program);
ops_set_inset_shadow (builder, transform_rect (self, builder, gsk_inset_shadow_node_get_outline (node)),
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index 36f7e37e35..04296b2f22 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -19,9 +19,9 @@ rounded_rect_equal (const GskRoundedRect *r1,
const GskRoundedRect *r2)
{
if (r1 == r2)
- return true;
+ return true;
- if (!r1)
+ if (r1 == NULL || r2 == NULL)
return false;
if (r1->bounds.origin.x != r2->bounds.origin.x ||
@@ -626,6 +626,9 @@ ops_draw (RenderOpBuilder *builder,
ProgramState *program_state = get_current_program_state (builder);
OpDraw *op;
+ if (program_state == NULL)
+ return NULL;
+
if (memcmp (&builder->current_projection, &program_state->projection, sizeof (graphene_matrix_t)) != 0)
{
OpMatrix *opm;
@@ -739,7 +742,12 @@ ops_set_inset_shadow (RenderOpBuilder *self,
ProgramState *current_program_state = get_current_program_state (self);
OpShadow *op;
+#ifdef G_DISABLE_ASSERT
+ if (current_program_state == NULL)
+ return;
+#else
g_assert (current_program_state);
+#endif
op = ops_begin (self, OP_CHANGE_INSET_SHADOW);
@@ -806,7 +814,12 @@ ops_set_unblurred_outset_shadow (RenderOpBuilder *self,
ProgramState *current_program_state = get_current_program_state (self);
OpShadow *op;
+#ifdef G_DISABLE_ASSERT
+ if (current_program_state == NULL)
+ return;
+#else
g_assert (current_program_state);
+#endif
op = ops_begin (self, OP_CHANGE_UNBLURRED_OUTSET_SHADOW);
@@ -869,7 +882,12 @@ ops_set_linear_gradient (RenderOpBuilder *self,
OpLinearGradient *op;
const guint real_n_color_stops = MIN (GL_MAX_GRADIENT_STOPS, n_color_stops);
+#ifdef G_DISABLE_ASSERT
+ if (current_program_state == NULL)
+ return;
+#else
g_assert (current_program_state);
+#endif
op = ops_begin (self, OP_CHANGE_LINEAR_GRADIENT);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]