[mutter/wip/nieldsg/cogl-pixel-format-include-dr: 127/128] cogl: Split CoglTextureComponents into its own header



commit cd171c405782fea9f8647dcce2271f5eb33e85dd
Author: Niels De Graef <niels degraef barco com>
Date:   Mon Jun 24 08:57:24 2019 +0200

    cogl: Split CoglTextureComponents into its own header
    
    CoglTextureComponents is an enum that mostly makes sense in
    `cogl_texture_set_components()`, but it's as prevalent as
    `CoglPixelFormat` due to its intimate relation with it. For example: as
    of now, there is no way to distinguish between ARGB and XRGB; this needs
    an extra using CoglTextureComponents to enforce (not) using the alpha
    channel.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/594

 cogl/cogl/cogl-pixel-format.h       |  1 +
 cogl/cogl/cogl-texture-components.h | 80 +++++++++++++++++++++++++++++++++++++
 cogl/cogl/cogl-texture.h            | 23 -----------
 cogl/cogl/meson.build               |  1 +
 4 files changed, 82 insertions(+), 23 deletions(-)
---
diff --git a/cogl/cogl/cogl-pixel-format.h b/cogl/cogl/cogl-pixel-format.h
index c2659fee0..d5e3b3876 100644
--- a/cogl/cogl/cogl-pixel-format.h
+++ b/cogl/cogl/cogl-pixel-format.h
@@ -39,6 +39,7 @@
 #include <stddef.h>
 
 #include <cogl/cogl-defines.h>
+#include <cogl/cogl-texture-components.h>
 
 #include <glib.h>
 #include <glib-object.h>
diff --git a/cogl/cogl/cogl-texture-components.h b/cogl/cogl/cogl-texture-components.h
new file mode 100644
index 000000000..1c459177e
--- /dev/null
+++ b/cogl/cogl/cogl-texture-components.h
@@ -0,0 +1,80 @@
+/*
+ * Cogl
+ *
+ * A Low Level GPU Graphics and Utilities API
+ *
+ * Copyright (C) 2007,2008,2009,2010 Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ *
+ */
+
+#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
+#error "Only <cogl/cogl.h> can be included directly."
+#endif
+
+#ifndef __COGL_TEXTURE_COMPONENTS_H__
+#define __COGL_TEXTURE_COMPONENTS_H__
+
+#include <cogl/cogl-types.h>
+#include <cogl/cogl-macros.h>
+#include <cogl/cogl-defines.h>
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION:cogl-texture-components
+ * @short_description: Functions for creating and manipulating textures
+ *
+ * CoglTextureComponents can be used to specify what components of a
+ * #CoglTexture can be used for sampling later. This affects how data is
+ * uploaded to the GPU.
+ */
+
+/**
+ * CoglTextureComponents:
+ * @COGL_TEXTURE_COMPONENTS_A: Only the alpha component
+ * @COGL_TEXTURE_COMPONENTS_RG: Red and green components. Note that
+ *   this can only be used if the %COGL_FEATURE_ID_TEXTURE_RG feature
+ *   is advertised.
+ * @COGL_TEXTURE_COMPONENTS_RGB: Red, green and blue components
+ * @COGL_TEXTURE_COMPONENTS_RGBA: Red, green, blue and alpha components
+ * @COGL_TEXTURE_COMPONENTS_DEPTH: Only a depth component
+ *
+ * See cogl_texture_set_components().
+ *
+ * Since: 1.18
+ */
+typedef enum _CoglTextureComponents
+{
+  COGL_TEXTURE_COMPONENTS_A = 1,
+  COGL_TEXTURE_COMPONENTS_RG,
+  COGL_TEXTURE_COMPONENTS_RGB,
+  COGL_TEXTURE_COMPONENTS_RGBA,
+  COGL_TEXTURE_COMPONENTS_DEPTH
+} CoglTextureComponents;
+
+G_END_DECLS
+
+#endif /* __COGL_TEXTURE_COMPONENTS_H__ */
diff --git a/cogl/cogl/cogl-texture.h b/cogl/cogl/cogl-texture.h
index 924912d02..b99627ea8 100644
--- a/cogl/cogl/cogl-texture.h
+++ b/cogl/cogl/cogl-texture.h
@@ -122,29 +122,6 @@ uint32_t cogl_texture_error_quark (void);
 gboolean
 cogl_is_texture (void *object);
 
-/**
- * CoglTextureComponents:
- * @COGL_TEXTURE_COMPONENTS_A: Only the alpha component
- * @COGL_TEXTURE_COMPONENTS_RG: Red and green components. Note that
- *   this can only be used if the %COGL_FEATURE_ID_TEXTURE_RG feature
- *   is advertised.
- * @COGL_TEXTURE_COMPONENTS_RGB: Red, green and blue components
- * @COGL_TEXTURE_COMPONENTS_RGBA: Red, green, blue and alpha components
- * @COGL_TEXTURE_COMPONENTS_DEPTH: Only a depth component
- *
- * See cogl_texture_set_components().
- *
- * Since: 1.18
- */
-typedef enum _CoglTextureComponents
-{
-  COGL_TEXTURE_COMPONENTS_A = 1,
-  COGL_TEXTURE_COMPONENTS_RG,
-  COGL_TEXTURE_COMPONENTS_RGB,
-  COGL_TEXTURE_COMPONENTS_RGBA,
-  COGL_TEXTURE_COMPONENTS_DEPTH
-} CoglTextureComponents;
-
 /**
  * cogl_texture_set_components:
  * @texture: a #CoglTexture pointer.
diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build
index dab2674c4..74ef2f251 100644
--- a/cogl/cogl/meson.build
+++ b/cogl/cogl/meson.build
@@ -93,6 +93,7 @@ cogl_headers = [
   'cogl-texture.h',
   'cogl-texture-2d.h',
   'cogl-texture-2d-sliced.h',
+  'cogl-texture-components.h',
   'cogl-types.h',
   'cogl.h',
 ]


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