[mutter] cogl: Remove deprecated primitives functions
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl: Remove deprecated primitives functions
- Date: Tue, 3 Dec 2019 19:16:05 +0000 (UTC)
commit ae4ae61a5f74385ade642c2696726f04023ea79a
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri Nov 22 15:55:26 2019 +0100
cogl: Remove deprecated primitives functions
Such as cogl_rectangle() and cogl_polygon().
https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
cogl/cogl/cogl-clip-stack.c | 1 -
cogl/cogl/cogl-context-private.h | 1 -
cogl/cogl/cogl-primitives.c | 370 ---------------------
cogl/cogl/cogl-primitives.h | 196 -----------
cogl/cogl/cogl-texture.c | 1 -
cogl/cogl/cogl.h | 1 -
cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c | 1 -
.../cogl/driver/gl/gles/cogl-texture-driver-gles.c | 1 -
cogl/cogl/meson.build | 2 -
9 files changed, 574 deletions(-)
---
diff --git a/cogl/cogl/cogl-clip-stack.c b/cogl/cogl/cogl-clip-stack.c
index 96eb105a0..aa3172e2e 100644
--- a/cogl/cogl/cogl-clip-stack.c
+++ b/cogl/cogl/cogl-clip-stack.c
@@ -36,7 +36,6 @@
#include <glib.h>
#include "cogl-clip-stack.h"
-#include "cogl-primitives.h"
#include "cogl-context-private.h"
#include "cogl-framebuffer-private.h"
#include "cogl-journal-private.h"
diff --git a/cogl/cogl/cogl-context-private.h b/cogl/cogl/cogl-context-private.h
index 112b0b211..4b7567c37 100644
--- a/cogl/cogl/cogl-context-private.h
+++ b/cogl/cogl/cogl-context-private.h
@@ -39,7 +39,6 @@
#endif
#include "cogl-display-private.h"
-#include "cogl-primitives.h"
#include "cogl-clip-stack.h"
#include "cogl-matrix-stack.h"
#include "cogl-pipeline-private.h"
diff --git a/cogl/cogl/cogl-primitives.c b/cogl/cogl/cogl-primitives.c
index 5b0aa2eec..9636d60c5 100644
--- a/cogl/cogl/cogl-primitives.c
+++ b/cogl/cogl/cogl-primitives.c
@@ -720,136 +720,6 @@ _cogl_framebuffer_draw_multitextured_rectangles (
cogl_object_unref (pipeline);
}
-static void
-_cogl_rectangles_with_multitexture_coords (
- CoglMultiTexturedRect *rects,
- int n_rects)
-{
- _cogl_framebuffer_draw_multitextured_rectangles (cogl_get_draw_framebuffer (),
- cogl_get_source (),
- rects,
- n_rects,
- FALSE);
-}
-
-void
-cogl_rectangles (const float *verts,
- unsigned int n_rects)
-{
- CoglMultiTexturedRect *rects;
- int i;
-
- /* XXX: All the cogl_rectangle* APIs normalize their input into an array of
- * CoglMultiTexturedRect rectangles and pass these on to our work horse;
- * _cogl_rectangles_with_multitexture_coords.
- */
-
- rects = g_alloca (n_rects * sizeof (CoglMultiTexturedRect));
-
- for (i = 0; i < n_rects; i++)
- {
- rects[i].position = &verts[i * 4];
- rects[i].tex_coords = NULL;
- rects[i].tex_coords_len = 0;
- }
-
- _cogl_rectangles_with_multitexture_coords (rects, n_rects);
-}
-
-void
-cogl_rectangles_with_texture_coords (const float *verts,
- unsigned int n_rects)
-{
- CoglMultiTexturedRect *rects;
- int i;
-
- /* XXX: All the cogl_rectangle* APIs normalize their input into an array of
- * CoglMultiTexturedRect rectangles and pass these on to our work horse;
- * _cogl_rectangles_with_multitexture_coords.
- */
-
- rects = g_alloca (n_rects * sizeof (CoglMultiTexturedRect));
-
- for (i = 0; i < n_rects; i++)
- {
- rects[i].position = &verts[i * 8];
- rects[i].tex_coords = &verts[i * 8 + 4];
- rects[i].tex_coords_len = 4;
- }
-
- _cogl_rectangles_with_multitexture_coords (rects, n_rects);
-}
-
-void
-cogl_rectangle_with_texture_coords (float x_1,
- float y_1,
- float x_2,
- float y_2,
- float tx_1,
- float ty_1,
- float tx_2,
- float ty_2)
-{
- const float position[4] = {x_1, y_1, x_2, y_2};
- const float tex_coords[4] = {tx_1, ty_1, tx_2, ty_2};
- CoglMultiTexturedRect rect;
-
- /* XXX: All the cogl_rectangle* APIs normalize their input into an array of
- * CoglMultiTexturedRect rectangles and pass these on to our work horse;
- * _cogl_rectangles_with_multitexture_coords.
- */
-
- rect.position = position;
- rect.tex_coords = tex_coords;
- rect.tex_coords_len = 4;
-
- _cogl_rectangles_with_multitexture_coords (&rect, 1);
-}
-
-void
-cogl_rectangle_with_multitexture_coords (float x_1,
- float y_1,
- float x_2,
- float y_2,
- const float *user_tex_coords,
- int user_tex_coords_len)
-{
- const float position[4] = {x_1, y_1, x_2, y_2};
- CoglMultiTexturedRect rect;
-
- /* XXX: All the cogl_rectangle* APIs normalize their input into an array of
- * CoglMultiTexturedRect rectangles and pass these on to our work horse;
- * _cogl_rectangles_with_multitexture_coords.
- */
-
- rect.position = position;
- rect.tex_coords = user_tex_coords;
- rect.tex_coords_len = user_tex_coords_len;
-
- _cogl_rectangles_with_multitexture_coords (&rect, 1);
-}
-
-void
-cogl_rectangle (float x_1,
- float y_1,
- float x_2,
- float y_2)
-{
- const float position[4] = {x_1, y_1, x_2, y_2};
- CoglMultiTexturedRect rect;
-
- /* XXX: All the cogl_rectangle* APIs normalize their input into an array of
- * CoglMultiTexturedRect rectangles and pass these on to our work horse;
- * _cogl_rectangles_with_multitexture_coords.
- */
-
- rect.position = position;
- rect.tex_coords = NULL;
- rect.tex_coords_len = 0;
-
- _cogl_rectangles_with_multitexture_coords (&rect, 1);
-}
-
void
_cogl_rectangle_immediate (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
@@ -898,243 +768,3 @@ _cogl_rectangle_immediate (CoglFramebuffer *framebuffer,
cogl_object_unref (attributes[0]);
cogl_object_unref (attribute_buffer);
}
-
-typedef struct _AppendTexCoordsState
-{
- const CoglTextureVertex *vertices_in;
- int vertex;
- int layer;
- float *vertices_out;
-} AppendTexCoordsState;
-
-static gboolean
-append_tex_coord_attributes_cb (CoglPipeline *pipeline,
- int layer_index,
- void *user_data)
-{
- AppendTexCoordsState *state = user_data;
- CoglTexture *texture;
- float tx, ty;
- float *t;
-
- tx = state->vertices_in[state->vertex].tx;
- ty = state->vertices_in[state->vertex].ty;
-
- /* NULL textures will be handled in
- * _cogl_pipeline_flush_layers_gl_state but there is no need to worry
- * about scaling texture coordinates in this case */
- texture = cogl_pipeline_get_layer_texture (pipeline, layer_index);
- if (texture != NULL)
- _cogl_texture_transform_coords_to_gl (texture, &tx, &ty);
-
- /* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
- t = state->vertices_out + 3 + 2 * state->layer;
- t[0] = tx;
- t[1] = ty;
-
- state->layer++;
-
- return TRUE;
-}
-
-typedef struct _ValidateState
-{
- CoglPipeline *original_pipeline;
- CoglPipeline *pipeline;
-} ValidateState;
-
-static gboolean
-_cogl_polygon_validate_layer_cb (CoglPipeline *pipeline,
- int layer_index,
- void *user_data)
-{
- ValidateState *state = user_data;
-
- /* By default COGL_PIPELINE_WRAP_MODE_AUTOMATIC becomes
- * GL_CLAMP_TO_EDGE but we want the polygon API to use GL_REPEAT to
- * maintain compatibility with previous releases
- */
-
- if (cogl_pipeline_get_layer_wrap_mode_s (pipeline, layer_index) ==
- COGL_PIPELINE_WRAP_MODE_AUTOMATIC)
- {
- if (state->original_pipeline == state->pipeline)
- state->pipeline = cogl_pipeline_copy (pipeline);
-
- cogl_pipeline_set_layer_wrap_mode_s (state->pipeline, layer_index,
- COGL_PIPELINE_WRAP_MODE_REPEAT);
- }
-
- if (cogl_pipeline_get_layer_wrap_mode_t (pipeline, layer_index) ==
- COGL_PIPELINE_WRAP_MODE_AUTOMATIC)
- {
- if (state->original_pipeline == state->pipeline)
- state->pipeline = cogl_pipeline_copy (pipeline);
-
- cogl_pipeline_set_layer_wrap_mode_t (state->pipeline, layer_index,
- COGL_PIPELINE_WRAP_MODE_REPEAT);
- }
-
- return TRUE;
-}
-
-void
-cogl_polygon (const CoglTextureVertex *vertices,
- unsigned int n_vertices,
- gboolean use_color)
-{
- CoglPipeline *pipeline;
- ValidateState validate_state;
- int n_layers;
- int n_attributes;
- CoglAttribute **attributes;
- int i;
- unsigned int stride;
- size_t stride_bytes;
- CoglAttributeBuffer *attribute_buffer;
- float *v;
-
- _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
- pipeline = cogl_get_source ();
-
- validate_state.original_pipeline = pipeline;
- validate_state.pipeline = pipeline;
- cogl_pipeline_foreach_layer (pipeline,
- _cogl_polygon_validate_layer_cb,
- &validate_state);
- pipeline = validate_state.pipeline;
-
- n_layers = cogl_pipeline_get_n_layers (pipeline);
-
- n_attributes = 1 + n_layers + (use_color ? 1 : 0);
- attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
-
- /* Our data is arranged like:
- * [X, Y, Z, TX0, TY0, TX1, TY1..., R, G, B, A,...] */
- stride = 3 + (2 * n_layers) + (use_color ? 1 : 0);
- stride_bytes = stride * sizeof (float);
-
- /* Make sure there is enough space in the global vertex array. This
- * is used so we can render the polygon with a single call to OpenGL
- * but still support any number of vertices */
- g_array_set_size (ctx->polygon_vertices, n_vertices * stride);
-
- attribute_buffer =
- cogl_attribute_buffer_new (ctx, n_vertices * stride_bytes, NULL);
-
- attributes[0] = cogl_attribute_new (attribute_buffer,
- "cogl_position_in",
- stride_bytes,
- 0,
- 3,
- COGL_ATTRIBUTE_TYPE_FLOAT);
-
- for (i = 0; i < n_layers; i++)
- {
- static const char *names[] = {
- "cogl_tex_coord0_in",
- "cogl_tex_coord1_in",
- "cogl_tex_coord2_in",
- "cogl_tex_coord3_in",
- "cogl_tex_coord4_in",
- "cogl_tex_coord5_in",
- "cogl_tex_coord6_in",
- "cogl_tex_coord7_in"
- };
- char *allocated_name = NULL;
- const char *name;
-
- if (i < 8)
- name = names[i];
- else
- name = allocated_name = g_strdup_printf ("cogl_tex_coord%d_in", i);
-
- attributes[i + 1] = cogl_attribute_new (attribute_buffer,
- name,
- stride_bytes,
- /* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
- 12 + 8 * i,
- 2,
- COGL_ATTRIBUTE_TYPE_FLOAT);
-
- g_free (allocated_name);
- }
-
- if (use_color)
- {
- attributes[n_attributes - 1] =
- cogl_attribute_new (attribute_buffer,
- "cogl_color_in",
- stride_bytes,
- /* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
- 12 + 8 * n_layers,
- 4,
- COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
- }
-
- /* Convert the vertices into an array of float vertex attributes */
- v = (float *)ctx->polygon_vertices->data;
- for (i = 0; i < n_vertices; i++)
- {
- AppendTexCoordsState append_tex_coords_state;
- uint8_t *c;
-
- /* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
- v[0] = vertices[i].x;
- v[1] = vertices[i].y;
- v[2] = vertices[i].z;
-
- append_tex_coords_state.vertices_in = vertices;
- append_tex_coords_state.vertex = i;
- append_tex_coords_state.layer = 0;
- append_tex_coords_state.vertices_out = v;
- cogl_pipeline_foreach_layer (pipeline,
- append_tex_coord_attributes_cb,
- &append_tex_coords_state);
-
- if (use_color)
- {
- /* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
- c = (uint8_t *) (v + 3 + 2 * n_layers);
- c[0] = cogl_color_get_red_byte (&vertices[i].color);
- c[1] = cogl_color_get_green_byte (&vertices[i].color);
- c[2] = cogl_color_get_blue_byte (&vertices[i].color);
- c[3] = cogl_color_get_alpha_byte (&vertices[i].color);
- }
-
- v += stride;
- }
-
- v = (float *)ctx->polygon_vertices->data;
- cogl_buffer_set_data (COGL_BUFFER (attribute_buffer),
- 0,
- v,
- ctx->polygon_vertices->len * sizeof (float));
-
- /* XXX: although this may seem redundant, we need to do this since
- * cogl_polygon() can be used with legacy state and its the source stack
- * which track whether legacy state is enabled.
- *
- * (We only have a CoglDrawFlag to disable legacy state not one
- * to enable it) */
- cogl_push_source (pipeline);
-
- _cogl_framebuffer_draw_attributes (cogl_get_draw_framebuffer (),
- pipeline,
- COGL_VERTICES_MODE_TRIANGLE_FAN,
- 0, n_vertices,
- attributes,
- n_attributes,
- 0 /* no draw flags */);
-
- cogl_pop_source ();
-
- if (pipeline != validate_state.original_pipeline)
- cogl_object_unref (pipeline);
-
- cogl_object_unref (attribute_buffer);
-
- for (i = 0; i < n_attributes; i++)
- cogl_object_unref (attributes[i]);
-}
diff --git a/cogl/cogl/cogl-texture.c b/cogl/cogl/cogl-texture.c
index f9b7e63e9..587088c97 100644
--- a/cogl/cogl/cogl-texture.c
+++ b/cogl/cogl/cogl-texture.c
@@ -52,7 +52,6 @@
#include "cogl-context-private.h"
#include "cogl-object-private.h"
#include "cogl-object-private.h"
-#include "cogl-primitives.h"
#include "cogl-framebuffer-private.h"
#include "cogl1-context.h"
#include "cogl-sub-texture.h"
diff --git a/cogl/cogl/cogl.h b/cogl/cogl/cogl.h
index 29601cc58..732726a2a 100644
--- a/cogl/cogl/cogl.h
+++ b/cogl/cogl/cogl.h
@@ -65,7 +65,6 @@
#include <cogl/cogl-matrix-stack.h>
#include <cogl/cogl-offscreen.h>
#include <cogl/cogl-pixel-format.h>
-#include <cogl/cogl-primitives.h>
#include <cogl/cogl-texture.h>
#include <cogl/cogl-types.h>
#include <cogl/cogl-version.h>
diff --git a/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c
index 47d1a9799..5b33a0a25 100644
--- a/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c
+++ b/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c
@@ -43,7 +43,6 @@
#include "cogl-pipeline.h"
#include "cogl-context-private.h"
#include "cogl-object-private.h"
-#include "cogl-primitives.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "driver/gl/cogl-util-gl-private.h"
#include "driver/gl/cogl-texture-gl-private.h"
diff --git a/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c
b/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c
index b7b354467..01653bc87 100644
--- a/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c
+++ b/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c
@@ -43,7 +43,6 @@
#include "cogl-pipeline.h"
#include "cogl-context-private.h"
#include "cogl-object-private.h"
-#include "cogl-primitives.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "driver/gl/cogl-util-gl-private.h"
#include "driver/gl/cogl-texture-gl-private.h"
diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build
index f9d5c5ef4..008b3bfb6 100644
--- a/cogl/cogl/meson.build
+++ b/cogl/cogl/meson.build
@@ -88,7 +88,6 @@ cogl_headers = [
'cogl-pipeline-state.h',
'cogl-pipeline-layer-state.h',
'cogl-pixel-format.h',
- 'cogl-primitives.h',
'cogl-texture.h',
'cogl-texture-2d.h',
'cogl-texture-2d-sliced.h',
@@ -237,7 +236,6 @@ cogl_sources = [
'cogl-bitmap-conversion.c',
'cogl-bitmap-packing.h',
'cogl-primitives-private.h',
- 'cogl-primitives.h',
'cogl-primitives.c',
'cogl-bitmap-pixbuf.c',
'cogl-clip-stack.h',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]