diff --git a/src/compositor/cogl-utils.c b/src/compositor/cogl-utils.c index 68db1118d..1d47d8895 100644 --- a/src/compositor/cogl-utils.c +++ b/src/compositor/cogl-utils.c @@ -77,13 +77,6 @@ meta_create_texture_pipeline (CoglTexture *src_texture) * Creates a texture of the given size with the specified components * for use as a frame buffer object. * - * If non-power-of-two textures are not supported on the system, then - * the texture will be created as a texture rectangle; in this case, - * hardware repeating isn't possible, and texture coordinates are also - * different, but Cogl hides these issues from the application, except from - * GLSL shaders. Since GLSL is never (or at least almost never) - * present on such a system, this is not typically an issue. - * * If %META_TEXTURE_ALLOW_SLICING is present in @flags, and the texture * is larger than the texture size limits of the system, then the texture * will be created as a sliced texture. This also will cause problems @@ -101,12 +94,7 @@ meta_create_texture (int width, CoglContext *ctx = clutter_backend_get_cogl_context (backend); CoglTexture *texture; - gboolean should_use_rectangle = FALSE; - - if (should_use_rectangle) - texture = COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, width, height)); - else - texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height)); + texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height)); cogl_texture_set_components (texture, components); if ((flags & META_TEXTURE_ALLOW_SLICING) != 0) diff --git a/src/compositor/meta-texture-rectangle.c b/src/compositor/meta-texture-rectangle.c deleted file mode 100644 index 6a01ed002..000000000 --- a/src/compositor/meta-texture-rectangle.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * texture rectangle - * - * A small utility function to help create a rectangle texture - * - * Authored By Neil Roberts - * - * Copyright (C) 2011, 2012 Intel Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#include "config.h" - -#include "clutter/clutter.h" -#include "compositor/meta-texture-rectangle.h" - -static void -texture_rectangle_check_cb (CoglTexture *sub_texture, - const float *sub_texture_coords, - const float *meta_coords, - void *user_data) -{ - gboolean *result = user_data; - - if (cogl_is_texture_rectangle (sub_texture)) - *result = TRUE; -} - -/* Determines if the given texture is using a rectangle texture as its - * primitive texture type. Eventually this function could be replaced - * with cogl_texture_get_type if Cogl makes that public. - * - * http://git.gnome.org/browse/cogl/commit/?h=8012eee31 - */ -gboolean -meta_texture_rectangle_check (CoglTexture *texture) -{ - gboolean result = FALSE; - - cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (texture), - 0.0f, 0.0f, /* tx_1 / ty_1 */ - 1.0f, 1.0f, /* tx_2 / ty_2 */ - COGL_PIPELINE_WRAP_MODE_REPEAT, - COGL_PIPELINE_WRAP_MODE_REPEAT, - texture_rectangle_check_cb, - &result); - - return result; -} diff --git a/src/compositor/meta-texture-rectangle.h b/src/compositor/meta-texture-rectangle.h deleted file mode 100644 index 8b6e04c23..000000000 --- a/src/compositor/meta-texture-rectangle.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * texture rectangle - * - * A small utility function to help create a rectangle texture - * - * Authored By Neil Roberts - * - * Copyright (C) 2011 Intel Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#ifndef __META_TEXTURE_RECTANGLE_H__ -#define __META_TEXTURE_RECTANGLE_H__ - -#include "cogl/cogl.h" - -G_BEGIN_DECLS - -gboolean -meta_texture_rectangle_check (CoglTexture *texture); - -G_END_DECLS - -#endif /* __META_TEXTURE_RECTANGLE_H__ */ diff --git a/src/compositor/meta-texture-tower.c b/src/compositor/meta-texture-tower.c index a41cdc89d..a95ee5ccf 100644 --- a/src/compositor/meta-texture-tower.c +++ b/src/compositor/meta-texture-tower.c @@ -25,7 +25,6 @@ #include #include -#include "compositor/meta-texture-rectangle.h" #include "compositor/meta-texture-tower.h" #ifndef M_LOG2E @@ -346,34 +345,15 @@ get_paint_level (int width, int height) return (int)(0.5 + lambda); } -static gboolean -is_power_of_two (int x) -{ - return (x & (x - 1)) == 0; -} - static void texture_tower_create_texture (MetaTextureTower *tower, int level, int width, int height) { - if ((!is_power_of_two (width) || !is_power_of_two (height)) && - meta_texture_rectangle_check (tower->textures[level - 1])) - { - ClutterBackend *backend = clutter_get_default_backend (); - CoglContext *context = clutter_backend_get_cogl_context (backend); - CoglTextureRectangle *texture_rectangle; - - texture_rectangle = cogl_texture_rectangle_new_with_size (context, width, height); - tower->textures[level] = COGL_TEXTURE (texture_rectangle); - } - else - { - tower->textures[level] = cogl_texture_new_with_size (width, height, - COGL_TEXTURE_NO_AUTO_MIPMAP, - TEXTURE_FORMAT); - } + tower->textures[level] = cogl_texture_new_with_size (width, height, + COGL_TEXTURE_NO_AUTO_MIPMAP, + TEXTURE_FORMAT); tower->invalid[level].x1 = 0; tower->invalid[level].y1 = 0; diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index f850cb222..837a4c3e9 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -31,7 +31,6 @@ #include "compositor/meta-cullable.h" #include "compositor/meta-surface-actor-x11.h" #include "compositor/meta-surface-actor.h" -#include "compositor/meta-texture-rectangle.h" #include "compositor/meta-window-actor-private.h" #include "compositor/region-utils.h" #include "meta/meta-enum-types.h" @@ -1507,6 +1506,7 @@ build_and_scan_frame_mask (MetaWindowActor *self, int stride; cairo_t *cr; cairo_surface_t *surface; + CoglError *error = NULL; stex = meta_surface_actor_get_texture (priv->surface); g_return_if_fail (stex); @@ -1559,31 +1559,14 @@ build_and_scan_frame_mask (MetaWindowActor *self, cairo_destroy (cr); cairo_surface_destroy (surface); - if (meta_texture_rectangle_check (paint_tex)) - { - mask_texture = COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, tex_width, tex_height)); - cogl_texture_set_components (mask_texture, COGL_TEXTURE_COMPONENTS_A); - cogl_texture_set_region (mask_texture, - 0, 0, /* src_x/y */ - 0, 0, /* dst_x/y */ - tex_width, tex_height, /* dst_width/height */ - tex_width, tex_height, /* width/height */ - COGL_PIXEL_FORMAT_A_8, - stride, mask_data); - } - else - { - CoglError *error = NULL; + mask_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, tex_width, tex_height, + COGL_PIXEL_FORMAT_A_8, + stride, mask_data, &error)); - mask_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, tex_width, tex_height, - COGL_PIXEL_FORMAT_A_8, - stride, mask_data, &error)); - - if (error) - { - g_warning ("Failed to allocate mask texture: %s", error->message); - cogl_error_free (error); - } + if (error) + { + g_warning ("Failed to allocate mask texture: %s", error->message); + cogl_error_free (error); } meta_shaped_texture_set_mask_texture (stex, mask_texture); diff --git a/src/meson.build b/src/meson.build index 9919b5cfb..8ed6cb0cf 100644 --- a/src/meson.build +++ b/src/meson.build @@ -291,8 +291,6 @@ mutter_sources = [ 'compositor/meta-surface-actor-x11.h', 'compositor/meta-sync-ring.c', 'compositor/meta-sync-ring.h', - 'compositor/meta-texture-rectangle.c', - 'compositor/meta-texture-rectangle.h', 'compositor/meta-texture-tower.c', 'compositor/meta-texture-tower.h', 'compositor/meta-window-actor.c',