summaryrefslogtreecommitdiff
path: root/cogl/tests
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2019-11-13 22:21:58 +0100
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2019-12-03 19:02:14 +0000
commit49c8d423171d10b4a4b5560af8df7667d9275001 (patch)
tree0d96316601491a5a8dc48328a323776f6117dffa /cogl/tests
parent5c986060f0afe1a59fb4b402966ed214371f45f6 (diff)
downloadmutter-49c8d423171d10b4a4b5560af8df7667d9275001.tar.gz
clutter: Introduce paint contexts
When painting, actors rely on semi global state tracked by the state to get various things needed for painting, such as the current draw framebuffer. Having state hidden in such ways can be very deceiving as it's hard to follow changes spread out, and adding more and more state that should be tracked during a paint gets annoying as they will not change in isolation but one by one in their own places. To do this better, introduce a paint context that is passed along in paint calls that contains the necessary state needed during painting. The paint context implements a framebuffer stack just as Cogl works, which is currently needed for offscreen rendering used by clutter. The same context is passed around for paint nodes, contents and effects as well. In this commit, the context is only introduced, but not used. It aims to replace the Cogl framebuffer stack, and will allow actors to know what view it is currently painted on. https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
Diffstat (limited to 'cogl/tests')
-rw-r--r--cogl/tests/conform/test-materials.c4
-rw-r--r--cogl/tests/conform/test-multitexture.c4
-rw-r--r--cogl/tests/conform/test-readpixels.c4
-rw-r--r--cogl/tests/conform/test-texture-mipmaps.c4
-rw-r--r--cogl/tests/conform/test-texture-pixmap-x11.c4
-rw-r--r--cogl/tests/conform/test-vertex-buffer-contiguous.c4
-rw-r--r--cogl/tests/conform/test-vertex-buffer-interleved.c4
-rw-r--r--cogl/tests/conform/test-viewport.c4
8 files changed, 24 insertions, 8 deletions
diff --git a/cogl/tests/conform/test-materials.c b/cogl/tests/conform/test-materials.c
index b6d66ebf9..ef38cd613 100644
--- a/cogl/tests/conform/test-materials.c
+++ b/cogl/tests/conform/test-materials.c
@@ -191,7 +191,9 @@ test_invalid_texture_layers_with_constant_colors (TestState *state,
}
static void
-on_paint (ClutterActor *actor, TestState *state)
+on_paint (ClutterActor *actor,
+ ClutterPaintContext *paint_context,
+ TestState *state)
{
test_invalid_texture_layers (state,
0, 0 /* position */
diff --git a/cogl/tests/conform/test-multitexture.c b/cogl/tests/conform/test-multitexture.c
index d87a88d2c..5a7a4eca2 100644
--- a/cogl/tests/conform/test-multitexture.c
+++ b/cogl/tests/conform/test-multitexture.c
@@ -99,7 +99,9 @@ make_texture (guchar ref)
}
static void
-on_paint (ClutterActor *actor, TestState *state)
+on_paint (ClutterActor *actor,
+ ClutterPaintContext *paint_context,
+ TestState *state)
{
CoglHandle tex0, tex1;
CoglHandle material;
diff --git a/cogl/tests/conform/test-readpixels.c b/cogl/tests/conform/test-readpixels.c
index 42951dad5..4e861afc4 100644
--- a/cogl/tests/conform/test-readpixels.c
+++ b/cogl/tests/conform/test-readpixels.c
@@ -15,7 +15,9 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
static void
-on_paint (ClutterActor *actor, void *state)
+on_paint (ClutterActor *actor,
+ ClutterPaintContext *paint_context,
+ void *state)
{
float saved_viewport[4];
CoglMatrix saved_projection;
diff --git a/cogl/tests/conform/test-texture-mipmaps.c b/cogl/tests/conform/test-texture-mipmaps.c
index d4edbb1bd..8db876315 100644
--- a/cogl/tests/conform/test-texture-mipmaps.c
+++ b/cogl/tests/conform/test-texture-mipmaps.c
@@ -45,7 +45,9 @@ make_texture (void)
}
static void
-on_paint (ClutterActor *actor, TestState *state)
+on_paint (ClutterActor *actor,
+ ClutterPaintContext *paint_context,
+ TestState *state)
{
CoglHandle tex;
CoglHandle material;
diff --git a/cogl/tests/conform/test-texture-pixmap-x11.c b/cogl/tests/conform/test-texture-pixmap-x11.c
index 4424a60db..d2b9d7ae5 100644
--- a/cogl/tests/conform/test-texture-pixmap-x11.c
+++ b/cogl/tests/conform/test-texture-pixmap-x11.c
@@ -140,7 +140,9 @@ check_paint (TestState *state, int x, int y, int scale)
#define FRAME_COUNT_UPDATED 8
static void
-on_paint (ClutterActor *actor, TestState *state)
+on_paint (ClutterActor *actor,
+ ClutterPaintContext *paint_context,
+ TestState *state)
{
CoglHandle material;
diff --git a/cogl/tests/conform/test-vertex-buffer-contiguous.c b/cogl/tests/conform/test-vertex-buffer-contiguous.c
index 2bc89fa1c..f74e3ac7a 100644
--- a/cogl/tests/conform/test-vertex-buffer-contiguous.c
+++ b/cogl/tests/conform/test-vertex-buffer-contiguous.c
@@ -96,7 +96,9 @@ validate_result (TestState *state)
}
static void
-on_paint (ClutterActor *actor, TestState *state)
+on_paint (ClutterActor *actor,
+ ClutterPaintContext *paint_context,
+ TestState *state)
{
/* Draw a faded blue triangle */
cogl_vertex_buffer_enable (state->buffer, "gl_Color::blue");
diff --git a/cogl/tests/conform/test-vertex-buffer-interleved.c b/cogl/tests/conform/test-vertex-buffer-interleved.c
index c1696e97a..057adc94a 100644
--- a/cogl/tests/conform/test-vertex-buffer-interleved.c
+++ b/cogl/tests/conform/test-vertex-buffer-interleved.c
@@ -63,7 +63,9 @@ validate_result (TestState *state)
}
static void
-on_paint (ClutterActor *actor, TestState *state)
+on_paint (ClutterActor *actor,
+ ClutterPaintContext *paint_context,
+ TestState *state)
{
/* Draw a faded blue triangle */
cogl_vertex_buffer_draw (state->buffer,
diff --git a/cogl/tests/conform/test-viewport.c b/cogl/tests/conform/test-viewport.c
index 9d9af0e02..1b2582954 100644
--- a/cogl/tests/conform/test-viewport.c
+++ b/cogl/tests/conform/test-viewport.c
@@ -66,7 +66,9 @@ assert_rectangle_color_and_black_border (int x,
static void
-on_paint (ClutterActor *actor, void *state)
+on_paint (ClutterActor *actor,
+ ClutterPaintContext *paint_context,
+ void *state)
{
float saved_viewport[4];
CoglMatrix saved_projection;