mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
99cdcc9e3c
CoglPixelFormat is not a good way of describing the internal format of a texture because it's too specific given that we don't actually have exact knowledge of the internal format used by the driver. This makes cogl_texture_get_format private and in the future we'll provide a better way of querying the channels and their precision. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit ffde82981f22bd0185a7f33e1e6e1479f4c295b8) Note: Since we can't break API compatibility on the 1.x branch this adds a cogl/deprecated/cogl-texture-deprecated.c file with a cogl_texture_get_format() wrapper around the private api. This also moves the cogl_texture_get_rowstride() and cogl_texture_ref/unref() functions that were previously deprecated into cogl-texture-deprecated.c
80 lines
2.0 KiB
C
80 lines
2.0 KiB
C
/*
|
|
* Cogl
|
|
*
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
*
|
|
* Copyright (C) 2014 Intel Corporation.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library 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
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*
|
|
*
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include "cogl-types.h"
|
|
#include "cogl-texture.h"
|
|
#include "cogl-texture-private.h"
|
|
#include "cogl-object-private.h"
|
|
#include "deprecated/cogl-texture-deprecated.h"
|
|
|
|
CoglPixelFormat
|
|
cogl_texture_get_format (CoglTexture *texture)
|
|
{
|
|
return _cogl_texture_get_format (texture);
|
|
}
|
|
|
|
unsigned int
|
|
cogl_texture_get_rowstride (CoglTexture *texture)
|
|
{
|
|
CoglPixelFormat format = cogl_texture_get_format (texture);
|
|
/* FIXME: This function should go away. It previously just returned
|
|
the rowstride that was used to upload the data as far as I can
|
|
tell. This is not helpful */
|
|
|
|
/* Just guess at a suitable rowstride */
|
|
return (_cogl_pixel_format_get_bytes_per_pixel (format)
|
|
* cogl_texture_get_width (texture));
|
|
}
|
|
|
|
void *
|
|
cogl_texture_ref (void *object)
|
|
{
|
|
if (!cogl_is_texture (object))
|
|
return NULL;
|
|
|
|
_COGL_OBJECT_DEBUG_REF (CoglTexture, object);
|
|
|
|
cogl_object_ref (object);
|
|
|
|
return object;
|
|
}
|
|
|
|
void
|
|
cogl_texture_unref (void *object)
|
|
{
|
|
if (!cogl_is_texture (object))
|
|
{
|
|
g_warning (G_STRINGIFY (cogl_texture_unref)
|
|
": Ignoring unref of CoglObject "
|
|
"due to type mismatch");
|
|
return;
|
|
}
|
|
|
|
_COGL_OBJECT_DEBUG_UNREF (CoglTexture, object);
|
|
|
|
cogl_object_unref (object);
|
|
}
|