[gtk+: 93/97] gl renderer: Don't crash if the first op is an opacity one
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+: 93/97] gl renderer: Don't crash if the first op is an opacity one
- Date: Thu, 21 Dec 2017 18:16:02 +0000 (UTC)
commit f044b0154901a0f4b5d066ea30c22c34b805127f
Author: Timm Bäder <mail baedert org>
Date: Tue Dec 19 16:00:43 2017 +0100
gl renderer: Don't crash if the first op is an opacity one
gsk/gl/gskglrenderops.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index 7b9a6a2..9e2f719 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -236,11 +236,20 @@ ops_set_opacity (RenderOpBuilder *builder,
if (builder->current_opacity == opacity)
return opacity;
- last_op = &g_array_index (builder->render_ops, RenderOp, builder->render_ops->len - 1);
-
- if (last_op->op == OP_CHANGE_OPACITY)
+ if (builder->render_ops->len > 0)
{
- last_op->opacity = opacity;
+ last_op = &g_array_index (builder->render_ops, RenderOp, builder->render_ops->len - 1);
+
+ if (last_op->op == OP_CHANGE_OPACITY)
+ {
+ last_op->opacity = opacity;
+ }
+ else
+ {
+ op.op = OP_CHANGE_OPACITY;
+ op.opacity = opacity;
+ g_array_append_val (builder->render_ops, op);
+ }
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]