[mutter] cogl: Remove unused CoglTextureRectangle
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl: Remove unused CoglTextureRectangle
- Date: Thu, 18 Apr 2019 19:06:35 +0000 (UTC)
commit c881b4970d5eaa272674ac0036edc65a3cb6b4b1
Author: Adam Jackson <ajax redhat com>
Date: Fri Mar 8 12:16:44 2019 -0500
cogl: Remove unused CoglTextureRectangle
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
cogl/cogl/cogl-context-private.h | 2 -
cogl/cogl/cogl-context.c | 27 -
cogl/cogl/cogl-framebuffer.h | 39 +-
cogl/cogl/cogl-meta-texture.c | 85 +---
cogl/cogl/cogl-offscreen.h | 8 +-
cogl/cogl/cogl-pipeline-layer-state.c | 18 -
cogl/cogl/cogl-pipeline.c | 12 +-
cogl/cogl/cogl-primitive-texture.h | 9 +-
cogl/cogl/cogl-primitive.h | 4 +-
cogl/cogl/cogl-primitives.c | 4 -
cogl/cogl/cogl-sub-texture.c | 63 +--
cogl/cogl/cogl-texture-rectangle-private.h | 66 ---
cogl/cogl/cogl-texture-rectangle.c | 776 -----------------------------
cogl/cogl/cogl-texture-rectangle.h | 216 --------
cogl/cogl/cogl-texture.c | 1 -
cogl/cogl/cogl-texture.h | 2 -
cogl/cogl/cogl.h | 1 -
cogl/cogl/deprecated/cogl-auto-texture.c | 1 -
cogl/cogl/driver/gl/cogl-pipeline-opengl.c | 10 +-
cogl/cogl/driver/gl/cogl-util-gl.c | 5 -
cogl/cogl/meson.build | 3 -
cogl/cogl/winsys/cogl-texture-pixmap-x11.c | 78 +--
cogl/cogl/winsys/cogl-winsys-glx.c | 1 -
23 files changed, 58 insertions(+), 1373 deletions(-)
---
diff --git a/cogl/cogl/cogl-context-private.h b/cogl/cogl/cogl-context-private.h
index bc92d07c3..59de2329b 100644
--- a/cogl/cogl/cogl-context-private.h
+++ b/cogl/cogl/cogl-context-private.h
@@ -50,7 +50,6 @@
#include "cogl-texture-driver.h"
#include "cogl-pipeline-cache.h"
#include "cogl-texture-2d.h"
-#include "cogl-texture-rectangle.h"
#include "cogl-sampler-cache-private.h"
#include "cogl-gpu-info-private.h"
#include "cogl-gl-header.h"
@@ -165,7 +164,6 @@ struct _CoglContext
/* Textures */
CoglTexture2D *default_gl_texture_2d_tex;
- CoglTextureRectangle *default_gl_texture_rect_tex;
/* Central list of all framebuffers so all journals can be flushed
* at any time. */
diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c
index 9a575d88e..3f9bd11d5 100644
--- a/cogl/cogl/cogl-context.c
+++ b/cogl/cogl/cogl-context.c
@@ -40,7 +40,6 @@
#include "cogl-journal-private.h"
#include "cogl-texture-private.h"
#include "cogl-texture-2d-private.h"
-#include "cogl-texture-rectangle-private.h"
#include "cogl-pipeline-private.h"
#include "cogl-framebuffer-private.h"
#include "cogl-onscreen-private.h"
@@ -128,10 +127,8 @@ cogl_context_new (CoglDisplay *display,
{
CoglContext *context;
uint8_t white_pixel[] = { 0xff, 0xff, 0xff, 0xff };
- CoglBitmap *white_pixel_bitmap;
const CoglWinsysVtable *winsys;
int i;
- CoglError *internal_error = NULL;
_cogl_init ();
@@ -279,7 +276,6 @@ cogl_context_new (CoglDisplay *display,
context->legacy_state_set = 0;
context->default_gl_texture_2d_tex = NULL;
- context->default_gl_texture_rect_tex = NULL;
context->framebuffers = NULL;
context->current_draw_buffer = NULL;
@@ -407,27 +403,6 @@ cogl_context_new (CoglDisplay *display,
white_pixel,
NULL); /* abort on error */
- /* TODO: add cogl_texture_rectangle_new_from_data() */
- white_pixel_bitmap =
- cogl_bitmap_new_for_data (context,
- 1, 1, /* width/height */
- COGL_PIXEL_FORMAT_RGBA_8888_PRE,
- 4, /* rowstride */
- white_pixel);
-
- internal_error = NULL;
- context->default_gl_texture_rect_tex =
- cogl_texture_rectangle_new_from_bitmap (white_pixel_bitmap);
-
- /* XXX: we need to allocate the texture now because the white_pixel
- * data is on the stack */
- cogl_texture_allocate (COGL_TEXTURE (context->default_gl_texture_rect_tex),
- &internal_error);
- if (internal_error)
- cogl_error_free (internal_error);
-
- cogl_object_unref (white_pixel_bitmap);
-
cogl_push_source (context->opaque_color_pipeline);
context->atlases = NULL;
@@ -466,8 +441,6 @@ _cogl_context_free (CoglContext *context)
if (context->default_gl_texture_2d_tex)
cogl_object_unref (context->default_gl_texture_2d_tex);
- if (context->default_gl_texture_rect_tex)
- cogl_object_unref (context->default_gl_texture_rect_tex);
if (context->opaque_color_pipeline)
cogl_object_unref (context->opaque_color_pipeline);
diff --git a/cogl/cogl/cogl-framebuffer.h b/cogl/cogl/cogl-framebuffer.h
index 97273a71b..867971bcf 100644
--- a/cogl/cogl/cogl-framebuffer.h
+++ b/cogl/cogl/cogl-framebuffer.h
@@ -1129,8 +1129,8 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
* This drawing api doesn't support high-level meta texture types such
* as #CoglTexture2DSliced so it is the user's responsibility to
* ensure that only low-level textures that can be directly sampled by
- * a GPU such as #CoglTexture2D or #CoglTextureRectangle are associated with
- * layers of the given @pipeline.
+ * a GPU such as #CoglTexture2D are associated with layers of the given
+ * @pipeline.
*
* <note>This api doesn't support any of the legacy global state options such
* as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or
@@ -1171,8 +1171,8 @@ cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
* This drawing api doesn't support high-level meta texture types such
* as #CoglTexture2DSliced so it is the user's responsibility to
* ensure that only low-level textures that can be directly sampled by
- * a GPU such as #CoglTexture2D or #CoglTextureRectangle are associated with
- * layers of the given @pipeline.
+ * a GPU such as #CoglTexture2D are associated with layers of the given
+ * @pipeline.
*
* Stability: unstable
* Since: 1.10
@@ -1214,8 +1214,8 @@ cogl_framebuffer_vdraw_attributes (CoglFramebuffer *framebuffer,
* This drawing api doesn't support high-level meta texture types such
* as #CoglTexture2DSliced so it is the user's responsibility to
* ensure that only low-level textures that can be directly sampled by
- * a GPU such as #CoglTexture2D or #CoglTextureRectangle are associated with
- * layers of the given @pipeline.
+ * a GPU such as #CoglTexture2D are associated with layers of the given
+ * @pipeline.
*
* <note>This api doesn't support any of the legacy global state options such
* as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or
@@ -1280,8 +1280,8 @@ cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
* This drawing api doesn't support high-level meta texture types such
* as #CoglTexture2DSliced so it is the user's responsibility to
* ensure that only low-level textures that can be directly sampled by
- * a GPU such as #CoglTexture2D or #CoglTextureRectangle are associated with
- * layers of the given @pipeline.
+ * a GPU such as #CoglTexture2D are associated with layers of the given
+ * @pipeline.
*
* <note>This api doesn't support any of the legacy global state
* options such as cogl_set_depth_test_enabled(),
@@ -1348,8 +1348,8 @@ cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer,
* This drawing api doesn't support high-level meta texture types such
* as #CoglTexture2DSliced so it is the user's responsibility to
* ensure that only low-level textures that can be directly sampled by
- * a GPU such as #CoglTexture2D or #CoglTextureRectangle are associated with
- * layers of the given @pipeline.
+ * a GPU such as #CoglTexture2D are associated with layers of the given
+ * @pipeline.
*
* <note>This api doesn't support any of the legacy global state
* options such as cogl_set_depth_test_enabled(),
@@ -1443,11 +1443,6 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
* bottom right. To map an entire texture across the rectangle pass
* in @s_1=0, @t_1=0, @s_2=1, @t_2=1.
*
- * <note>Even if you have associated a #CoglTextureRectangle texture
- * with one of your @pipeline layers which normally implies working
- * with non-normalized texture coordinates this api should still be
- * passed normalized texture coordinates.</note>
- *
* Since: 1.10
* Stability: unstable
*/
@@ -1500,9 +1495,7 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer,
* <note>This api can not currently handle multiple high-level meta
* texture layers. The first layer may be a high level meta texture
* such as #CoglTexture2DSliced but all other layers much be low
- * level textures such as #CoglTexture2D and additionally they
- * should be textures that can be sampled using normalized coordinates
- * (so not #CoglTextureRectangle textures).</note>
+ * level textures such as #CoglTexture2D.
*
* The top left texture coordinate for layer 0 of any pipeline will be
* (tex_coords[0], tex_coords[1]) and the bottom right coordinate will
@@ -1516,11 +1509,6 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer,
* in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1,
* tex_coords[3]=1.
*
- * <note>Even if you have associated a #CoglTextureRectangle texture
- * which normally implies working with non-normalized texture
- * coordinates this api should still be passed normalized texture
- * coordinates.</note>
- *
* The first pair of coordinates are for the first layer (with the
* smallest layer index) and if you supply less texture coordinates
* than there are layers in the current source material then default
@@ -1624,11 +1612,6 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer,
* in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1,
* tex_coords[3]=1.
*
- * <note>Even if you have associated a #CoglTextureRectangle texture
- * which normally implies working with non-normalized texture
- * coordinates this api should still be passed normalized texture
- * coordinates.</note>
- *
* Since: 1.10
* Stability: unstable
*/
diff --git a/cogl/cogl/cogl-meta-texture.c b/cogl/cogl/cogl-meta-texture.c
index 3e195f3af..adee5ce04 100644
--- a/cogl/cogl/cogl-meta-texture.c
+++ b/cogl/cogl/cogl-meta-texture.c
@@ -36,7 +36,7 @@
#include "cogl-matrix.h"
#include "cogl-spans.h"
#include "cogl-meta-texture.h"
-#include "cogl-texture-rectangle-private.h"
+#include "cogl-texture-private.h"
#include <string.h>
#include <math.h>
@@ -316,16 +316,9 @@ foreach_clamped_region (CoglMetaTexture *meta_texture,
if (wrap_s == COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE)
{
- float max_s_coord;
+ float max_s_coord = 1.0;
float half_texel_width;
- /* Consider that rectangle textures have non-normalized
- * coordinates... */
- if (cogl_is_texture_rectangle (meta_texture))
- max_s_coord = width;
- else
- max_s_coord = 1.0;
-
half_texel_width = max_s_coord / (width * 2);
/* Handle any left clamped region */
@@ -375,16 +368,9 @@ foreach_clamped_region (CoglMetaTexture *meta_texture,
if (wrap_t == COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE)
{
float height = cogl_texture_get_height (COGL_TEXTURE (meta_texture));
- float max_t_coord;
+ float max_t_coord = 1.0;
float half_texel_height;
- /* Consider that rectangle textures have non-normalized
- * coordinates... */
- if (cogl_is_texture_rectangle (meta_texture))
- max_t_coord = height;
- else
- max_t_coord = 1.0;
-
half_texel_height = max_t_coord / (height * 2);
/* Handle any top clamped region */
@@ -466,33 +452,6 @@ normalize_meta_coords_cb (CoglTexture *slice_texture,
data->user_data);
}
-typedef struct _UnNormalizeData
-{
- CoglMetaTextureCallback callback;
- void *user_data;
- float width;
- float height;
-} UnNormalizeData;
-
-static void
-un_normalize_slice_coords_cb (CoglTexture *slice_texture,
- const float *slice_coords,
- const float *meta_coords,
- void *user_data)
-{
- UnNormalizeData *data = user_data;
- float un_normalized_slice_coords[4] = {
- slice_coords[0] * data->width,
- slice_coords[1] * data->height,
- slice_coords[2] * data->width,
- slice_coords[3] * data->height
- };
-
- data->callback (slice_texture,
- un_normalized_slice_coords, meta_coords,
- data->user_data);
-}
-
void
cogl_meta_texture_foreach_in_region (CoglMetaTexture *meta_texture,
float tx_1,
@@ -539,19 +498,16 @@ cogl_meta_texture_foreach_in_region (CoglMetaTexture *meta_texture,
* coordinates beyond this point and only re-normalize just before
* calling the user's callback... */
- if (!cogl_is_texture_rectangle (COGL_TEXTURE (meta_texture)))
- {
- normalize_data.callback = callback;
- normalize_data.user_data = user_data;
- normalize_data.s_normalize_factor = 1.0f / width;
- normalize_data.t_normalize_factor = 1.0f / height;
- callback = normalize_meta_coords_cb;
- user_data = &normalize_data;
- tx_1 *= width;
- ty_1 *= height;
- tx_2 *= width;
- ty_2 *= height;
- }
+ normalize_data.callback = callback;
+ normalize_data.user_data = user_data;
+ normalize_data.s_normalize_factor = 1.0f / width;
+ normalize_data.t_normalize_factor = 1.0f / height;
+ callback = normalize_meta_coords_cb;
+ user_data = &normalize_data;
+ tx_1 *= width;
+ ty_1 *= height;
+ tx_2 *= width;
+ ty_2 *= height;
/* XXX: at some point this wont be routed through the CoglTexture
* vtable, instead there will be a separate CoglMetaTexture
@@ -609,21 +565,6 @@ cogl_meta_texture_foreach_in_region (CoglMetaTexture *meta_texture,
CoglSpan x_span = { 0, width, 0 };
CoglSpan y_span = { 0, height, 0 };
float meta_region_coords[4] = { tx_1, ty_1, tx_2, ty_2 };
- UnNormalizeData un_normalize_data;
-
- /* If we are dealing with a CoglTextureRectangle then we need a shim
- * callback that un_normalizes the slice coordinates we get from
- * _cogl_texture_spans_foreach_in_region before passing them to
- * the user's callback. */
- if (cogl_is_texture_rectangle (meta_texture))
- {
- un_normalize_data.callback = callback;
- un_normalize_data.user_data = user_data;
- un_normalize_data.width = width;
- un_normalize_data.height = height;
- callback = un_normalize_slice_coords_cb;
- user_data = &un_normalize_data;
- }
_cogl_texture_spans_foreach_in_region (&x_span, 1,
&y_span, 1,
diff --git a/cogl/cogl/cogl-offscreen.h b/cogl/cogl/cogl-offscreen.h
index 5782de594..dd2fae58f 100644
--- a/cogl/cogl/cogl-offscreen.h
+++ b/cogl/cogl/cogl-offscreen.h
@@ -75,8 +75,8 @@ GType cogl_offscreen_get_gtype (void);
* destroy the offscreen buffer before you can use the @texture again.
*
* <note>This api only works with low-level #CoglTexture types such as
- * #CoglTexture2D and #CoglTextureRectangle, and not with meta-texture
- * types such as #CoglTexture2DSliced.</note>
+ * #CoglTexture2D and not with meta-texture types such as
+ * #CoglTexture2DSliced.</note>
*
* The storage for the framebuffer is actually allocated lazily
* so this function will never return %NULL to indicate a runtime
@@ -110,8 +110,8 @@ cogl_offscreen_new_with_texture (CoglTexture *texture);
* you can use the @texture again.
*
* <note>This only works with low-level #CoglTexture types such as
- * #CoglTexture2D and #CoglTextureRectangle, and not with meta-texture
- * types such as #CoglTexture2DSliced.</note>
+ * #CoglTexture2D and not with meta-texture types such as
+ * #CoglTexture2DSliced.</note>
*
* Return value: (transfer full): a newly instantiated #CoglOffscreen
* framebuffer or %NULL if it wasn't possible to create the
diff --git a/cogl/cogl/cogl-pipeline-layer-state.c b/cogl/cogl/cogl-pipeline-layer-state.c
index 3d10925c4..eeca3953c 100644
--- a/cogl/cogl/cogl-pipeline-layer-state.c
+++ b/cogl/cogl/cogl-pipeline-layer-state.c
@@ -335,24 +335,6 @@ cogl_pipeline_set_layer_null_texture (CoglPipeline *pipeline,
int layer_index,
CoglTextureType texture_type)
{
- CoglContext *ctx = _cogl_context_get_default ();
-
- /* Disallow setting texture types that aren't supported */
- switch (texture_type)
- {
- case COGL_TEXTURE_TYPE_2D:
- break;
-
- case COGL_TEXTURE_TYPE_RECTANGLE:
- if (ctx->default_gl_texture_rect_tex == NULL)
- {
- g_warning ("The default rectangle texture was set on a pipeline but "
- "rectangle textures are not supported");
- texture_type = COGL_TEXTURE_TYPE_2D;
- }
- break;
- }
-
_cogl_pipeline_set_layer_texture_type (pipeline, layer_index, texture_type);
_cogl_pipeline_set_layer_texture_data (pipeline, layer_index, NULL);
}
diff --git a/cogl/cogl/cogl-pipeline.c b/cogl/cogl/cogl-pipeline.c
index cdcf5a657..4112daa2e 100644
--- a/cogl/cogl/cogl-pipeline.c
+++ b/cogl/cogl/cogl-pipeline.c
@@ -1904,7 +1904,6 @@ fallback_layer_cb (CoglPipelineLayer *layer, void *user_data)
{
CoglPipelineFallbackState *state = user_data;
CoglPipeline *pipeline = state->pipeline;
- CoglTextureType texture_type = _cogl_pipeline_layer_get_texture_type (layer);
CoglTexture *texture = NULL;
COGL_STATIC_COUNTER (layer_fallback_counter,
"layer fallback counter",
@@ -1919,16 +1918,7 @@ fallback_layer_cb (CoglPipelineLayer *layer, void *user_data)
COGL_COUNTER_INC (_cogl_uprof_context, layer_fallback_counter);
- switch (texture_type)
- {
- case COGL_TEXTURE_TYPE_2D:
- texture = COGL_TEXTURE (ctx->default_gl_texture_2d_tex);
- break;
-
- case COGL_TEXTURE_TYPE_RECTANGLE:
- texture = COGL_TEXTURE (ctx->default_gl_texture_rect_tex);
- break;
- }
+ texture = COGL_TEXTURE (ctx->default_gl_texture_2d_tex);
if (texture == NULL)
{
diff --git a/cogl/cogl/cogl-primitive-texture.h b/cogl/cogl/cogl-primitive-texture.h
index 837347509..14b994bce 100644
--- a/cogl/cogl/cogl-primitive-texture.h
+++ b/cogl/cogl/cogl-primitive-texture.h
@@ -45,11 +45,10 @@ G_BEGIN_DECLS
* #CoglTexture2D.
*
* A #CoglPrimitiveTexture is a texture that is directly represented
- * by a single texture on the GPU. For example these could be a
- * #CoglTexture2D or #CoglTextureRectangle. This is opposed to high level
- * meta textures which may be composed of multiple primitive textures or a
- * sub-region of another texture such as #CoglAtlasTexture and
- * #CoglTexture2DSliced.
+ * by a single texture on the GPU. For example this could be a
+ * #CoglTexture2D. This is opposed to high level meta textures which
+ * may be composed of multiple primitive textures or a sub-region of
+ * another texture such as #CoglAtlasTexture and #CoglTexture2DSliced.
*
* A texture that implements this interface can be directly used with
* the low level cogl_primitive_draw() API. Other types of textures
diff --git a/cogl/cogl/cogl-primitive.h b/cogl/cogl/cogl-primitive.h
index b6867bbbe..b2ddb0db3 100644
--- a/cogl/cogl/cogl-primitive.h
+++ b/cogl/cogl/cogl-primitive.h
@@ -926,8 +926,8 @@ cogl_primitive_foreach_attribute (CoglPrimitive *primitive,
* This drawing api doesn't support high-level meta texture types such
* as #CoglTexture2DSliced so it is the user's responsibility to
* ensure that only low-level textures that can be directly sampled by
- * a GPU such as #CoglTexture2D or #CoglTextureRectangle are associated
- * with layers of the given @pipeline.
+ * a GPU such as #CoglTexture2D are associated with layers of the given
+ * @pipeline.
*
* Stability: unstable
* Since: 1.16
diff --git a/cogl/cogl/cogl-primitives.c b/cogl/cogl/cogl-primitives.c
index 811dfd8f7..8726f87fe 100644
--- a/cogl/cogl/cogl-primitives.c
+++ b/cogl/cogl/cogl-primitives.c
@@ -187,8 +187,6 @@ validate_first_layer_cb (CoglPipeline *pipeline,
* texture coordinates require repeating,
* - CoglTexture2DAtlas: if the users given texture coordinates require
* repeating,
- * - CoglTextureRectangle: if the users given texture coordinates require
- * repeating,
* - CoglTexturePixmap: if the users given texture coordinates require
* repeating
*/
@@ -430,8 +428,6 @@ validate_tex_coords_cb (CoglPipeline *pipeline,
* - CoglTexture{1D,2D}: always.
* - CoglTexture2DAtlas: assuming the users given texture coordinates don't
* require repeating.
- * - CoglTextureRectangle: assuming the users given texture coordinates don't
- * require repeating.
* - CoglTexturePixmap: assuming the users given texture coordinates don't
* require repeating.
*/
diff --git a/cogl/cogl/cogl-sub-texture.c b/cogl/cogl/cogl-sub-texture.c
index 00a962f91..1ab2dc90f 100644
--- a/cogl/cogl/cogl-sub-texture.c
+++ b/cogl/cogl/cogl-sub-texture.c
@@ -40,7 +40,6 @@
#include "cogl-context-private.h"
#include "cogl-object.h"
#include "cogl-texture-driver.h"
-#include "cogl-texture-rectangle-private.h"
#include "cogl-texture-2d.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-texture-gl-private.h"
@@ -60,30 +59,13 @@ _cogl_sub_texture_unmap_quad (CoglSubTexture *sub_tex,
float *coords)
{
CoglTexture *tex = COGL_TEXTURE (sub_tex);
+ float width = cogl_texture_get_width (sub_tex->full_texture);
+ float height = cogl_texture_get_height (sub_tex->full_texture);
- /* NB: coords[] come in as non-normalized if sub_tex->full_texture
- * is a CoglTextureRectangle otherwhise they are normalized. The
- * coordinates we write out though must always be normalized.
- *
- * NB: sub_tex->sub_x/y/width/height are in non-normalized
- * coordinates.
- */
- if (cogl_is_texture_rectangle (sub_tex->full_texture))
- {
- coords[0] = (coords[0] - sub_tex->sub_x) / tex->width;
- coords[1] = (coords[1] - sub_tex->sub_y) / tex->height;
- coords[2] = (coords[2] - sub_tex->sub_x) / tex->width;
- coords[3] = (coords[3] - sub_tex->sub_y) / tex->height;
- }
- else
- {
- float width = cogl_texture_get_width (sub_tex->full_texture);
- float height = cogl_texture_get_height (sub_tex->full_texture);
- coords[0] = (coords[0] * width - sub_tex->sub_x) / tex->width;
- coords[1] = (coords[1] * height - sub_tex->sub_y) / tex->height;
- coords[2] = (coords[2] * width - sub_tex->sub_x) / tex->width;
- coords[3] = (coords[3] * height - sub_tex->sub_y) / tex->height;
- }
+ coords[0] = (coords[0] * width - sub_tex->sub_x) / tex->width;
+ coords[1] = (coords[1] * height - sub_tex->sub_y) / tex->height;
+ coords[2] = (coords[2] * width - sub_tex->sub_x) / tex->width;
+ coords[3] = (coords[3] * height - sub_tex->sub_y) / tex->height;
}
static void
@@ -91,31 +73,13 @@ _cogl_sub_texture_map_quad (CoglSubTexture *sub_tex,
float *coords)
{
CoglTexture *tex = COGL_TEXTURE (sub_tex);
+ float width = cogl_texture_get_width (sub_tex->full_texture);
+ float height = cogl_texture_get_height (sub_tex->full_texture);
- /* NB: coords[] always come in as normalized coordinates but may go
- * out as non-normalized if sub_tex->full_texture is a
- * CoglTextureRectangle.
- *
- * NB: sub_tex->sub_x/y/width/height are in non-normalized
- * coordinates.
- */
-
- if (cogl_is_texture_rectangle (sub_tex->full_texture))
- {
- coords[0] = coords[0] * tex->width + sub_tex->sub_x;
- coords[1] = coords[1] * tex->height + sub_tex->sub_y;
- coords[2] = coords[2] * tex->width + sub_tex->sub_x;
- coords[3] = coords[3] * tex->height + sub_tex->sub_y;
- }
- else
- {
- float width = cogl_texture_get_width (sub_tex->full_texture);
- float height = cogl_texture_get_height (sub_tex->full_texture);
- coords[0] = (coords[0] * tex->width + sub_tex->sub_x) / width;
- coords[1] = (coords[1] * tex->height + sub_tex->sub_y) / height;
- coords[2] = (coords[2] * tex->width + sub_tex->sub_x) / width;
- coords[3] = (coords[3] * tex->height + sub_tex->sub_y) / height;
- }
+ coords[0] = (coords[0] * tex->width + sub_tex->sub_x) / width;
+ coords[1] = (coords[1] * tex->height + sub_tex->sub_y) / height;
+ coords[2] = (coords[2] * tex->width + sub_tex->sub_x) / width;
+ coords[3] = (coords[3] * tex->height + sub_tex->sub_y) / height;
}
typedef struct _CoglSubTextureForeachData
@@ -165,8 +129,7 @@ _cogl_sub_texture_foreach_sub_texture_in_region (
_cogl_sub_texture_map_quad (sub_tex, mapped_coords);
/* TODO: Add something like cogl_is_low_level_texture() */
- if (cogl_is_texture_2d (full_texture) ||
- cogl_is_texture_rectangle (full_texture))
+ if (cogl_is_texture_2d (full_texture))
{
callback (sub_tex->full_texture,
mapped_coords,
diff --git a/cogl/cogl/cogl-texture.c b/cogl/cogl/cogl-texture.c
index dd4c37e9a..bdbeb0d89 100644
--- a/cogl/cogl/cogl-texture.c
+++ b/cogl/cogl/cogl-texture.c
@@ -47,7 +47,6 @@
#include "cogl-texture-2d-sliced-private.h"
#include "cogl-texture-2d-private.h"
#include "cogl-texture-2d-gl.h"
-#include "cogl-texture-rectangle-private.h"
#include "cogl-sub-texture-private.h"
#include "cogl-atlas-texture-private.h"
#include "cogl-pipeline.h"
diff --git a/cogl/cogl/cogl-texture.h b/cogl/cogl/cogl-texture.h
index 0c428b5ee..dfdcb73af 100644
--- a/cogl/cogl/cogl-texture.h
+++ b/cogl/cogl/cogl-texture.h
@@ -110,7 +110,6 @@ typedef enum
/**
* CoglTextureType:
* @COGL_TEXTURE_TYPE_2D: A #CoglTexture2D
- * @COGL_TEXTURE_TYPE_RECTANGLE: A #CoglTextureRectangle
*
* Constants representing the underlying hardware texture type of a
* #CoglTexture.
@@ -121,7 +120,6 @@ typedef enum
typedef enum
{
COGL_TEXTURE_TYPE_2D,
- COGL_TEXTURE_TYPE_RECTANGLE
} CoglTextureType;
uint32_t cogl_texture_error_quark (void);
diff --git a/cogl/cogl/cogl.h b/cogl/cogl/cogl.h
index 8663d251e..34a2408dc 100644
--- a/cogl/cogl/cogl.h
+++ b/cogl/cogl/cogl.h
@@ -105,7 +105,6 @@
#include <cogl/cogl-quaternion.h>
#include <cogl/cogl-texture-2d.h>
#include <cogl/cogl-texture-2d-gl.h>
-#include <cogl/cogl-texture-rectangle.h>
#include <cogl/cogl-texture-2d-sliced.h>
#include <cogl/cogl-sub-texture.h>
#include <cogl/cogl-atlas-texture.h>
diff --git a/cogl/cogl/deprecated/cogl-auto-texture.c b/cogl/cogl/deprecated/cogl-auto-texture.c
index 9465c76d1..ea5fedcc2 100644
--- a/cogl/cogl/deprecated/cogl-auto-texture.c
+++ b/cogl/cogl/deprecated/cogl-auto-texture.c
@@ -48,7 +48,6 @@
#include "cogl-bitmap-private.h"
#include "cogl-atlas-texture-private.h"
#include "cogl-error-private.h"
-#include "cogl-texture-rectangle.h"
#include "cogl-sub-texture.h"
#include "cogl-texture-2d-gl.h"
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c
index 481962354..ece8ada0d 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c
@@ -764,15 +764,7 @@ flush_layers_common_gl_state_cb (CoglPipelineLayer *layer, void *user_data)
GLenum gl_target;
if (texture == NULL)
- switch (_cogl_pipeline_layer_get_texture_type (layer))
- {
- case COGL_TEXTURE_TYPE_2D:
- texture = COGL_TEXTURE (ctx->default_gl_texture_2d_tex);
- break;
- case COGL_TEXTURE_TYPE_RECTANGLE:
- texture = COGL_TEXTURE (ctx->default_gl_texture_rect_tex);
- break;
- }
+ texture = COGL_TEXTURE (ctx->default_gl_texture_2d_tex);
cogl_texture_get_gl_texture (texture,
&gl_texture,
diff --git a/cogl/cogl/driver/gl/cogl-util-gl.c b/cogl/cogl/driver/gl/cogl-util-gl.c
index 022516c79..36c63150c 100644
--- a/cogl/cogl/driver/gl/cogl-util-gl.c
+++ b/cogl/cogl/driver/gl/cogl-util-gl.c
@@ -148,11 +148,6 @@ _cogl_gl_util_get_texture_target_string (CoglTextureType texture_type,
tex_coord_swizzle = "st";
break;
- case COGL_TEXTURE_TYPE_RECTANGLE:
- target_string = "2DRect";
- tex_coord_swizzle = "st";
- break;
-
default:
target_string = "Unknown";
tex_coord_swizzle = NULL;
diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build
index 2e8e5af31..38ac9a10c 100644
--- a/cogl/cogl/meson.build
+++ b/cogl/cogl/meson.build
@@ -120,7 +120,6 @@ cogl_nonintrospected_headers = [
'cogl-matrix-stack.h',
'cogl-poll.h',
'cogl-texture-2d-gl.h',
- 'cogl-texture-rectangle.h',
'cogl-sub-texture.h',
'cogl-atlas-texture.h',
'cogl-meta-texture.h',
@@ -311,8 +310,6 @@ cogl_sources = [
'cogl-texture.c',
'cogl-texture-2d.c',
'cogl-texture-2d-sliced.c',
- 'cogl-texture-rectangle-private.h',
- 'cogl-texture-rectangle.c',
'cogl-rectangle-map.h',
'cogl-rectangle-map.c',
'cogl-atlas.h',
diff --git a/cogl/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/cogl/winsys/cogl-texture-pixmap-x11.c
index 1cb599e48..881a4ff8e 100644
--- a/cogl/cogl/winsys/cogl-texture-pixmap-x11.c
+++ b/cogl/cogl/winsys/cogl-texture-pixmap-x11.c
@@ -44,7 +44,6 @@
#include "cogl-texture-driver.h"
#include "cogl-texture-2d-private.h"
#include "cogl-texture-2d-sliced.h"
-#include "cogl-texture-rectangle-private.h"
#include "cogl-context-private.h"
#include "cogl-display-private.h"
#include "cogl-renderer-private.h"
@@ -871,33 +870,6 @@ _cogl_texture_pixmap_x11_get_data (CoglTexture *tex,
return cogl_texture_get_data (child_tex, format, rowstride, data);
}
-typedef struct _NormalizeCoordsWrapperData
-{
- int width;
- int height;
- CoglMetaTextureCallback callback;
- void *user_data;
-} NormalizeCoordsWrapperData;
-
-static void
-normalize_coords_wrapper_cb (CoglTexture *child_texture,
- const float *child_texture_coords,
- const float *meta_coords,
- void *user_data)
-{
- NormalizeCoordsWrapperData *data = user_data;
- float normalized_coords[4];
-
- normalized_coords[0] = meta_coords[0] / data->width;
- normalized_coords[1] = meta_coords[1] / data->height;
- normalized_coords[2] = meta_coords[2] / data->width;
- normalized_coords[3] = meta_coords[3] / data->height;
-
- data->callback (child_texture,
- child_texture_coords, normalized_coords,
- data->user_data);
-}
-
static void
_cogl_texture_pixmap_x11_foreach_sub_texture_in_region
(CoglTexture *tex,
@@ -912,47 +884,15 @@ _cogl_texture_pixmap_x11_foreach_sub_texture_in_region
CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
/* Forward on to the child texture */
-
- /* tfp textures may be implemented in terms of a
- * CoglTextureRectangle texture which uses un-normalized texture
- * coordinates but we want to consistently deal with normalized
- * texture coordinates with CoglTexturePixmapX11... */
- if (cogl_is_texture_rectangle (child_tex))
- {
- NormalizeCoordsWrapperData data;
- int width = tex->width;
- int height = tex->height;
-
- virtual_tx_1 *= width;
- virtual_ty_1 *= height;
- virtual_tx_2 *= width;
- virtual_ty_2 *= height;
-
- data.width = width;
- data.height = height;
- data.callback = callback;
- data.user_data = user_data;
-
- cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (child_tex),
- virtual_tx_1,
- virtual_ty_1,
- virtual_tx_2,
- virtual_ty_2,
- COGL_PIPELINE_WRAP_MODE_REPEAT,
- COGL_PIPELINE_WRAP_MODE_REPEAT,
- normalize_coords_wrapper_cb,
- &data);
- }
- else
- cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (child_tex),
- virtual_tx_1,
- virtual_ty_1,
- virtual_tx_2,
- virtual_ty_2,
- COGL_PIPELINE_WRAP_MODE_REPEAT,
- COGL_PIPELINE_WRAP_MODE_REPEAT,
- callback,
- user_data);
+ cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (child_tex),
+ virtual_tx_1,
+ virtual_ty_1,
+ virtual_tx_2,
+ virtual_ty_2,
+ COGL_PIPELINE_WRAP_MODE_REPEAT,
+ COGL_PIPELINE_WRAP_MODE_REPEAT,
+ callback,
+ user_data);
}
static int
diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c
index 3e595338f..4b9e05826 100644
--- a/cogl/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/cogl/winsys/cogl-winsys-glx.c
@@ -44,7 +44,6 @@
#include "cogl-glx-display-private.h"
#include "cogl-private.h"
#include "cogl-texture-2d-private.h"
-#include "cogl-texture-rectangle-private.h"
#include "cogl-frame-info-private.h"
#include "cogl-framebuffer-private.h"
#include "cogl-onscreen-private.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]