[mutter] cogl: Remove API implicitly using framebuffer stack



commit 3819291cb77aaa12a8d26cfa81390c744997b48d
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Fri Nov 22 16:44:17 2019 +0100

    cogl: Remove API implicitly using framebuffer stack
    
    E.g. cogl_frustum(), cogl_push_matrix(), etc.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/935

 cogl/cogl/cogl.c                                   | 198 -------------
 cogl/cogl/cogl1-context.h                          | 323 ---------------------
 cogl/cogl/deprecated/cogl-framebuffer-deprecated.h |  34 ---
 3 files changed, 555 deletions(-)
---
diff --git a/cogl/cogl/cogl.c b/cogl/cogl/cogl.c
index da4d1d247..30e67fb3d 100644
--- a/cogl/cogl/cogl.c
+++ b/cogl/cogl/cogl.c
@@ -75,14 +75,6 @@ _cogl_check_extension (const char *name, char * const *ext)
   return FALSE;
 }
 
-/* XXX: it's expected that we'll deprecated this with
- * cogl_framebuffer_clear at some point. */
-void
-cogl_clear (const CoglColor *color, unsigned long buffers)
-{
-  cogl_framebuffer_clear (cogl_get_draw_framebuffer (), buffers, color);
-}
-
 /* XXX: This API has been deprecated */
 void
 cogl_set_depth_test_enabled (gboolean setting)
@@ -154,34 +146,6 @@ cogl_set_source_color (const CoglColor *color)
   cogl_set_source (pipeline);
 }
 
-void
-cogl_set_viewport (int x,
-                   int y,
-                   int width,
-                   int height)
-{
-  CoglFramebuffer *framebuffer;
-
-  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
-  framebuffer = cogl_get_draw_framebuffer ();
-
-  cogl_framebuffer_set_viewport (framebuffer,
-                                 x,
-                                 y,
-                                 width,
-                                 height);
-}
-
-/* XXX: This should be deprecated, and we should expose a way to also
- * specify an x and y viewport offset */
-void
-cogl_viewport (unsigned int width,
-              unsigned int height)
-{
-  cogl_set_viewport (0, 0, width, height);
-}
-
 gboolean
 cogl_has_feature (CoglContext *ctx, CoglFeatureID feature)
 {
@@ -214,44 +178,6 @@ cogl_foreach_feature (CoglContext *ctx,
       callback (i, user_data);
 }
 
-/* XXX: This function should either be replaced with one returning
- * integers, or removed/deprecated and make the
- * _cogl_framebuffer_get_viewport* functions public.
- */
-void
-cogl_get_viewport (float viewport[4])
-{
-  CoglFramebuffer *framebuffer;
-
-  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
-  framebuffer = cogl_get_draw_framebuffer ();
-  cogl_framebuffer_get_viewport4fv (framebuffer, viewport);
-}
-
-void
-cogl_get_bitmasks (int *red,
-                   int *green,
-                   int *blue,
-                   int *alpha)
-{
-  CoglFramebuffer *framebuffer;
-
-  framebuffer = cogl_get_draw_framebuffer ();
-
-  if (red)
-    *red = cogl_framebuffer_get_red_bits (framebuffer);
-
-  if (green)
-    *green = cogl_framebuffer_get_green_bits (framebuffer);
-
-  if (blue)
-    *blue = cogl_framebuffer_get_blue_bits (framebuffer);
-
-  if (alpha)
-    *alpha = cogl_framebuffer_get_alpha_bits (framebuffer);
-}
-
 void
 cogl_flush (void)
 {
@@ -263,130 +189,6 @@ cogl_flush (void)
     _cogl_framebuffer_flush_journal (l->data);
 }
 
-void
-cogl_read_pixels (int x,
-                  int y,
-                  int width,
-                  int height,
-                  CoglReadPixelsFlags source,
-                  CoglPixelFormat format,
-                  uint8_t *pixels)
-{
-  int bpp;
-  CoglBitmap *bitmap;
-
-  g_return_if_fail (format != COGL_PIXEL_FORMAT_ANY);
-  g_return_if_fail (cogl_pixel_format_get_n_planes (format) == 1);
-
-  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
-  bpp = cogl_pixel_format_get_bytes_per_pixel (format, 0);
-  bitmap = cogl_bitmap_new_for_data (ctx,
-                                     width, height,
-                                     format,
-                                     bpp * width, /* rowstride */
-                                     pixels);
-  cogl_framebuffer_read_pixels_into_bitmap (_cogl_get_read_framebuffer (),
-                                            x, y,
-                                            source,
-                                            bitmap);
-  cogl_object_unref (bitmap);
-}
-
-void
-cogl_push_matrix (void)
-{
-  cogl_framebuffer_push_matrix (cogl_get_draw_framebuffer ());
-}
-
-void
-cogl_pop_matrix (void)
-{
-  cogl_framebuffer_pop_matrix (cogl_get_draw_framebuffer ());
-}
-
-void
-cogl_scale (float x, float y, float z)
-{
-  cogl_framebuffer_scale (cogl_get_draw_framebuffer (), x, y, z);
-}
-
-void
-cogl_translate (float x, float y, float z)
-{
-  cogl_framebuffer_translate (cogl_get_draw_framebuffer (), x, y, z);
-}
-
-void
-cogl_rotate (float angle, float x, float y, float z)
-{
-  cogl_framebuffer_rotate (cogl_get_draw_framebuffer (), angle, x, y, z);
-}
-
-void
-cogl_transform (const CoglMatrix *matrix)
-{
-  cogl_framebuffer_transform (cogl_get_draw_framebuffer (), matrix);
-}
-
-void
-cogl_perspective (float fov_y,
-                 float aspect,
-                 float z_near,
-                 float z_far)
-{
-  cogl_framebuffer_perspective (cogl_get_draw_framebuffer (),
-                                fov_y, aspect, z_near, z_far);
-}
-
-void
-cogl_frustum (float        left,
-             float        right,
-             float        bottom,
-             float        top,
-             float        z_near,
-             float        z_far)
-{
-  cogl_framebuffer_frustum (cogl_get_draw_framebuffer (),
-                            left, right, bottom, top, z_near, z_far);
-}
-
-void
-cogl_ortho (float left,
-           float right,
-           float bottom,
-           float top,
-           float near,
-           float far)
-{
-  cogl_framebuffer_orthographic (cogl_get_draw_framebuffer (),
-                                 left, top, right, bottom, near, far);
-}
-
-void
-cogl_get_modelview_matrix (CoglMatrix *matrix)
-{
-  cogl_framebuffer_get_modelview_matrix (cogl_get_draw_framebuffer (), matrix);
-}
-
-void
-cogl_set_modelview_matrix (CoglMatrix *matrix)
-{
-  cogl_framebuffer_set_modelview_matrix (cogl_get_draw_framebuffer (), matrix);
-}
-
-void
-cogl_get_projection_matrix (CoglMatrix *matrix)
-{
-  cogl_framebuffer_get_projection_matrix (cogl_get_draw_framebuffer (), matrix);
-}
-
-void
-cogl_set_projection_matrix (CoglMatrix *matrix)
-{
-  cogl_framebuffer_set_projection_matrix (cogl_get_draw_framebuffer (), matrix);
-}
-
 uint32_t
 _cogl_driver_error_quark (void)
 {
diff --git a/cogl/cogl/cogl1-context.h b/cogl/cogl/cogl1-context.h
index fc660b1d9..32c03c084 100644
--- a/cogl/cogl/cogl1-context.h
+++ b/cogl/cogl/cogl1-context.h
@@ -79,313 +79,6 @@ cogl_get_option_group (void);
 GCallback
 cogl_get_proc_address (const char *name);
 
-/**
- * cogl_get_bitmasks:
- * @red: (out): Return location for the number of red bits or %NULL
- * @green: (out): Return location for the number of green bits or %NULL
- * @blue: (out): Return location for the number of blue bits or %NULL
- * @alpha: (out): Return location for the number of alpha bits or %NULL
- *
- * Gets the number of bitplanes used for each of the color components
- * in the color buffer. Pass %NULL for any of the arguments if the
- * value is not required.
- *
- * Deprecated: 1.8: Use cogl_framebuffer_get_red/green/blue/alpha_bits()
- *                  instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_get_red_OR_green_OR_blue_OR_alpha_bits)
-void
-cogl_get_bitmasks (int *red,
-                   int *green,
-                   int *blue,
-                   int *alpha);
-
-/**
- * cogl_perspective:
- * @fovy: Vertical field of view angle in degrees.
- * @aspect: The (width over height) aspect ratio for display
- * @z_near: The distance to the near clipping plane (Must be positive)
- * @z_far: The distance to the far clipping plane (Must be positive)
- *
- * Replaces the current projection matrix with a perspective matrix
- * based on the provided values.
- *
- * <note>You should be careful not to have to great a @z_far / @z_near
- * ratio since that will reduce the effectiveness of depth testing
- * since there wont be enough precision to identify the depth of
- * objects near to each other.</note>
- *
- * Deprecated: 1.10: Use cogl_framebuffer_perspective() instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_perspective)
-void
-cogl_perspective (float fovy,
-                  float aspect,
-                  float z_near,
-                  float z_far);
-
-/**
- * cogl_frustum:
- * @left: X position of the left clipping plane where it
- *   intersects the near clipping plane
- * @right: X position of the right clipping plane where it
- *   intersects the near clipping plane
- * @bottom: Y position of the bottom clipping plane where it
- *   intersects the near clipping plane
- * @top: Y position of the top clipping plane where it intersects
- *   the near clipping plane
- * @z_near: The distance to the near clipping plane (Must be positive)
- * @z_far: The distance to the far clipping plane (Must be positive)
- *
- * Replaces the current projection matrix with a perspective matrix
- * for a given viewing frustum defined by 4 side clip planes that
- * all cross through the origin and 2 near and far clip planes.
- *
- * Since: 0.8.2
- * Deprecated: 1.10: Use cogl_framebuffer_frustum() instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_frustum)
-void
-cogl_frustum (float left,
-              float right,
-              float bottom,
-              float top,
-              float z_near,
-              float z_far);
-
-/**
- * cogl_ortho:
- * @left: The coordinate for the left clipping plane
- * @right: The coordinate for the right clipping plane
- * @bottom: The coordinate for the bottom clipping plane
- * @top: The coordinate for the top clipping plane
- * @near: The <emphasis>distance</emphasis> to the near clipping
- *   plane (negative if the plane is behind the viewer)
- * @far: The <emphasis>distance</emphasis> for the far clipping
- *   plane (negative if the plane is behind the viewer)
- *
- * Replaces the current projection matrix with an orthographic projection
- * matrix. See <xref linkend="cogl-ortho-matrix"/> to see how the matrix is
- * calculated.
- *
- * <figure id="cogl-ortho-matrix">
- *   <title></title>
- *   <graphic fileref="cogl_ortho.png" format="PNG"/>
- * </figure>
- *
- * <note>This function copies the arguments from OpenGL's glOrtho() even
- * though they are unnecessarily confusing due to the z near and z far
- * arguments actually being a "distance" from the origin, where
- * negative values are behind the viewer, instead of coordinates for
- * the z clipping planes which would have been consistent with the
- * left, right bottom and top arguments.</note>
- *
- * Since: 1.0
- * Deprecated: 1.10: Use cogl_framebuffer_orthographic() instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_orthographic)
-void
-cogl_ortho (float left,
-            float right,
-            float bottom,
-            float top,
-            float near,
-            float far);
-
-/**
- * cogl_viewport:
- * @width: Width of the viewport
- * @height: Height of the viewport
- *
- * Replace the current viewport with the given values.
- *
- * Since: 0.8.2
- * Deprecated: 1.8: Use cogl_framebuffer_set_viewport instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_set_viewport)
-void
-cogl_viewport (unsigned int width,
-              unsigned int height);
-
-/**
- * cogl_set_viewport:
- * @x: X offset of the viewport
- * @y: Y offset of the viewport
- * @width: Width of the viewport
- * @height: Height of the viewport
- *
- * Replaces the current viewport with the given values.
- *
- * Since: 1.2
- * Deprecated: 1.8: Use cogl_framebuffer_set_viewport() instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_set_viewport)
-void
-cogl_set_viewport (int x,
-                   int y,
-                   int width,
-                   int height);
-
-/**
- * cogl_push_matrix:
- *
- * Stores the current model-view matrix on the matrix stack. The matrix
- * can later be restored with cogl_pop_matrix().
- *
- * Deprecated: 1.10: Use cogl_framebuffer_push_matrix() instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_push_matrix)
-void
-cogl_push_matrix (void);
-
-/**
- * cogl_pop_matrix:
- *
- * Restores the current model-view matrix from the matrix stack.
- *
- * Deprecated: 1.10: Use cogl_framebuffer_pop_matrix() instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_push_matrix)
-void
-cogl_pop_matrix (void);
-
-/**
- * cogl_scale:
- * @x: Amount to scale along the x-axis
- * @y: Amount to scale along the y-axis
- * @z: Amount to scale along the z-axis
- *
- * Multiplies the current model-view matrix by one that scales the x,
- * y and z axes by the given values.
- *
- * Deprecated: 1.10: Use cogl_framebuffer_pop_matrix() instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_scale)
-void
-cogl_scale (float x,
-            float y,
-            float z);
-
-/**
- * cogl_translate:
- * @x: Distance to translate along the x-axis
- * @y: Distance to translate along the y-axis
- * @z: Distance to translate along the z-axis
- *
- * Multiplies the current model-view matrix by one that translates the
- * model along all three axes according to the given values.
- *
- * Deprecated: 1.10: Use cogl_framebuffer_translate() instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_translate)
-void
-cogl_translate (float x,
-                float y,
-                float z);
-
-/**
- * cogl_rotate:
- * @angle: Angle in degrees to rotate.
- * @x: X-component of vertex to rotate around.
- * @y: Y-component of vertex to rotate around.
- * @z: Z-component of vertex to rotate around.
- *
- * Multiplies the current model-view matrix by one that rotates the
- * model around the vertex specified by @x, @y and @z. The rotation
- * follows the right-hand thumb rule so for example rotating by 10
- * degrees about the vertex (0, 0, 1) causes a small counter-clockwise
- * rotation.
- *
- * Deprecated: 1.10: Use cogl_framebuffer_rotate() instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_rotate)
-void
-cogl_rotate (float angle,
-             float x,
-             float y,
-             float z);
-
-/**
- * cogl_transform:
- * @matrix: the matrix to multiply with the current model-view
- *
- * Multiplies the current model-view matrix by the given matrix.
- *
- * Since: 1.4
- * Deprecated: 1.10: Use cogl_framebuffer_transform() instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_transform)
-void
-cogl_transform (const CoglMatrix *matrix);
-
-/**
- * cogl_get_modelview_matrix:
- * @matrix: (out): return location for the model-view matrix
- *
- * Stores the current model-view matrix in @matrix.
- *
- * Deprecated: 1.10: Use cogl_framebuffer_get_modelview_matrix()
- *                   instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_get_modelview_matrix)
-void
-cogl_get_modelview_matrix (CoglMatrix *matrix);
-
-/**
- * cogl_set_modelview_matrix:
- * @matrix: the new model-view matrix
- *
- * Loads @matrix as the new model-view matrix.
- *
- * Deprecated: 1.10: Use cogl_framebuffer_set_modelview_matrix()
- *                   instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_set_modelview_matrix)
-void
-cogl_set_modelview_matrix (CoglMatrix *matrix);
-
-/**
- * cogl_get_projection_matrix:
- * @matrix: (out): return location for the projection matrix
- *
- * Stores the current projection matrix in @matrix.
- *
- * Deprecated: 1.10: Use cogl_framebuffer_get_projection_matrix()
- *                   instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_get_projection_matrix)
-void
-cogl_get_projection_matrix (CoglMatrix *matrix);
-
-/**
- * cogl_set_projection_matrix:
- * @matrix: the new projection matrix
- *
- * Loads matrix as the new projection matrix.
- *
- * Deprecated: 1.10: Use cogl_framebuffer_set_projection_matrix()
- *                   instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_set_projection_matrix)
-void
-cogl_set_projection_matrix (CoglMatrix *matrix);
-
-/**
- * cogl_get_viewport:
- * @v: (out) (array fixed-size=4): pointer to a 4 element array
- *   of #float<!-- -->s to receive the viewport dimensions.
- *
- * Stores the current viewport in @v. @v[0] and @v[1] get the x and y
- * position of the viewport and @v[2] and @v[3] get the width and
- * height.
- *
- * Deprecated: 1.10: Use cogl_framebuffer_get_viewport4fv()
- *                   instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_get_viewport4fv)
-void
-cogl_get_viewport (float v[4]);
-
 /**
  * cogl_set_depth_test_enabled:
  * @setting: %TRUE to enable depth testing or %FALSE to disable.
@@ -445,22 +138,6 @@ COGL_DEPRECATED_FOR (cogl_pipeline_get_cull_face_mode)
 gboolean
 cogl_get_backface_culling_enabled (void);
 
-/**
- * cogl_clear:
- * @color: Background color to clear to
- * @buffers: A mask of #CoglBufferBit<!-- -->'s identifying which auxiliary
- *   buffers to clear
- *
- * Clears all the auxiliary buffers identified in the @buffers mask, and if
- * that includes the color buffer then the specified @color is used.
- *
- * Deprecated: 1.16: Use cogl_framebuffer_clear() api instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_clear)
-void
-cogl_clear (const CoglColor *color,
-            unsigned long buffers);
-
 /**
  * cogl_set_source:
  * @material: A #CoglMaterial
diff --git a/cogl/cogl/deprecated/cogl-framebuffer-deprecated.h 
b/cogl/cogl/deprecated/cogl-framebuffer-deprecated.h
index e0f6a4236..200dcee03 100644
--- a/cogl/cogl/deprecated/cogl-framebuffer-deprecated.h
+++ b/cogl/cogl/deprecated/cogl-framebuffer-deprecated.h
@@ -153,40 +153,6 @@ COGL_DEPRECATED
 void
 cogl_pop_framebuffer (void);
 
-/**
- * cogl_read_pixels:
- * @x: The window x position to start reading from
- * @y: The window y position to start reading from
- * @width: The width of the rectangle you want to read
- * @height: The height of the rectangle you want to read
- * @source: Identifies which auxillary buffer you want to read
- *          (only COGL_READ_PIXELS_COLOR_BUFFER supported currently)
- * @format: The pixel format you want the result in
- *          (only COGL_PIXEL_FORMAT_RGBA_8888 supported currently)
- * @pixels: The location to write the pixel data.
- *
- * This reads a rectangle of pixels from the current framebuffer where
- * position (0, 0) is the top left. The pixel at (x, y) is the first
- * read, and the data is returned with a rowstride of (width * 4).
- *
- * Currently Cogl assumes that the framebuffer is in a premultiplied
- * format so if @format is non-premultiplied it will convert it. To
- * read the pixel values without any conversion you should either
- * specify a format that doesn't use an alpha channel or use one of
- * the formats ending in PRE.
- *
- * Deprecated: 1.16: Use cogl_framebuffer_read_pixels() instead
- */
-COGL_DEPRECATED_FOR (cogl_framebuffer_read_pixels)
-void
-cogl_read_pixels (int x,
-                  int y,
-                  int width,
-                  int height,
-                  CoglReadPixelsFlags source,
-                  CoglPixelFormat format,
-                  uint8_t *pixels);
-
 G_END_DECLS
 
 #endif /* __COGL_FRAMEBUFFER_DEPRECATED_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]