mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
Add constructors which take a CoglBitmap to all primitive textures
This adds public constructors which take a CoglBitmap to all primitive texture types. This constructor should be considered the canonical constructor for initializing the texture with data because it should be possible to wrap any type of data in a CoglBitmap. Having at least this single constructor avoids the need to have an explosion of constructors such as new_from_data, new_from_pixel_buffer and new_from_file etc. The already available internal bitmap constructor for CoglTexture2D has had its flags parameter removed under the assumption that flags do not make sense for primitive textures. The meta constructor cogl_texture_new_from_bitmap now just explicitly calls set_auto_mipmap after constructing the texture depending on the value of the COGL_TEXTURE_NO_AUTO_MIPMAP flag. Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
parent
e7f1582630
commit
6197e3abf3
@ -293,7 +293,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
|
|||||||
width * bpp,
|
width * bpp,
|
||||||
clear_data);
|
clear_data);
|
||||||
|
|
||||||
tex = _cogl_texture_2d_new_from_bitmap (clear_bmp, COGL_TEXTURE_NONE,
|
tex = cogl_texture_2d_new_from_bitmap (clear_bmp,
|
||||||
atlas->texture_format,
|
atlas->texture_format,
|
||||||
NULL);
|
NULL);
|
||||||
cogl_object_unref (clear_bmp);
|
cogl_object_unref (clear_bmp);
|
||||||
|
@ -397,23 +397,22 @@ cogl_context_new (CoglDisplay *display,
|
|||||||
|
|
||||||
/* Create default textures used for fall backs */
|
/* Create default textures used for fall backs */
|
||||||
context->default_gl_texture_2d_tex =
|
context->default_gl_texture_2d_tex =
|
||||||
_cogl_texture_2d_new_from_bitmap (default_texture_bitmap,
|
cogl_texture_2d_new_from_bitmap (default_texture_bitmap,
|
||||||
COGL_TEXTURE_NONE,
|
|
||||||
/* internal format */
|
/* internal format */
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
NULL);
|
NULL);
|
||||||
/* If 3D or rectangle textures aren't supported then these should
|
/* If 3D or rectangle textures aren't supported then these should
|
||||||
just silently return NULL */
|
just silently return NULL */
|
||||||
context->default_gl_texture_3d_tex =
|
context->default_gl_texture_3d_tex =
|
||||||
_cogl_texture_3d_new_from_bitmap (default_texture_bitmap,
|
cogl_texture_3d_new_from_bitmap (default_texture_bitmap,
|
||||||
1, /* height */
|
1, /* height */
|
||||||
1, /* depth */
|
1, /* depth */
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
NULL);
|
NULL);
|
||||||
context->default_gl_texture_rect_tex =
|
context->default_gl_texture_rect_tex =
|
||||||
_cogl_texture_rectangle_new_from_bitmap (default_texture_bitmap,
|
cogl_texture_rectangle_new_from_bitmap (default_texture_bitmap,
|
||||||
COGL_TEXTURE_NONE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE);
|
NULL);
|
||||||
|
|
||||||
cogl_object_unref (default_texture_bitmap);
|
cogl_object_unref (default_texture_bitmap);
|
||||||
|
|
||||||
|
@ -53,12 +53,6 @@ struct _CoglTexture2D
|
|||||||
CoglTexturePixel first_pixel;
|
CoglTexturePixel first_pixel;
|
||||||
};
|
};
|
||||||
|
|
||||||
CoglHandle
|
|
||||||
_cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
|
||||||
CoglTextureFlags flags,
|
|
||||||
CoglPixelFormat internal_format,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base)
|
#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base)
|
||||||
/* NB: The reason we require the width, height and format to be passed
|
/* NB: The reason we require the width, height and format to be passed
|
||||||
* even though they may seem redundant is because GLES 1/2 don't
|
* even though they may seem redundant is because GLES 1/2 don't
|
||||||
|
@ -221,9 +221,8 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
|
|||||||
return _cogl_texture_2d_handle_new (tex_2d);
|
return _cogl_texture_2d_handle_new (tex_2d);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglHandle
|
CoglTexture2D *
|
||||||
_cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
||||||
CoglTextureFlags flags,
|
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -301,9 +300,6 @@ _cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
|
|
||||||
cogl_object_unref (dst_bmp);
|
cogl_object_unref (dst_bmp);
|
||||||
|
|
||||||
_cogl_texture_2d_set_auto_mipmap (COGL_TEXTURE (tex_2d),
|
|
||||||
!(flags & COGL_TEXTURE_NO_AUTO_MIPMAP));
|
|
||||||
|
|
||||||
return _cogl_texture_2d_handle_new (tex_2d);
|
return _cogl_texture_2d_handle_new (tex_2d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +330,7 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
|
|||||||
rowstride,
|
rowstride,
|
||||||
(guint8 *) data);
|
(guint8 *) data);
|
||||||
|
|
||||||
tex =_cogl_texture_2d_new_from_bitmap (bmp, COGL_TEXTURE_NONE,
|
tex = cogl_texture_2d_new_from_bitmap (bmp,
|
||||||
internal_format,
|
internal_format,
|
||||||
error);
|
error);
|
||||||
|
|
||||||
|
@ -112,12 +112,12 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
|
|||||||
* @height: height of texture in pixels
|
* @height: height of texture in pixels
|
||||||
* @format: the #CoglPixelFormat the buffer is stored in in RAM
|
* @format: the #CoglPixelFormat the buffer is stored in in RAM
|
||||||
* @internal_format: the #CoglPixelFormat that will be used for storing
|
* @internal_format: the #CoglPixelFormat that will be used for storing
|
||||||
* the buffer on the GPU. If COGL_PIXEL_FORMAT_ANY is given then a
|
* the buffer on the GPU. If %COGL_PIXEL_FORMAT_ANY is given then a
|
||||||
* premultiplied format similar to the format of the source data will
|
* premultiplied format similar to the format of the source data will
|
||||||
* be used. The default blending equations of Cogl expect premultiplied
|
* be used. The default blending equations of Cogl expect premultiplied
|
||||||
* color data; the main use of passing a non-premultiplied format here
|
* color data; the main use of passing a non-premultiplied format here
|
||||||
* is if you have non-premultiplied source data and are going to adjust
|
* is if you have non-premultiplied source data and are going to adjust
|
||||||
* the blend mode (see cogl_material_set_blend()) or use the data for
|
* the blend mode (see cogl_pipeline_set_blend()) or use the data for
|
||||||
* something other than straight blending.
|
* something other than straight blending.
|
||||||
* @rowstride: the memory offset in bytes between the starts of
|
* @rowstride: the memory offset in bytes between the starts of
|
||||||
* scanlines in @data. A value of 0 will make Cogl automatically
|
* scanlines in @data. A value of 0 will make Cogl automatically
|
||||||
@ -152,6 +152,44 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
|
|||||||
const guint8 *data,
|
const guint8 *data,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_texture_2d_new_from_bitmap:
|
||||||
|
* @bitmap: A #CoglBitmap
|
||||||
|
* @internal_format: the #CoglPixelFormat that will be used for storing
|
||||||
|
* the buffer on the GPU. If %COGL_PIXEL_FORMAT_ANY is given then a
|
||||||
|
* premultiplied format similar to the format of the source data will
|
||||||
|
* be used. The default blending equations of Cogl expect premultiplied
|
||||||
|
* color data; the main use of passing a non-premultiplied format here
|
||||||
|
* is if you have non-premultiplied source data and are going to adjust
|
||||||
|
* the blend mode (see cogl_pipeline_set_blend()) or use the data for
|
||||||
|
* something other than straight blending.
|
||||||
|
* @error: A #GError for exceptions
|
||||||
|
*
|
||||||
|
* Creates a new #CoglTexture2D texture based on data residing in a
|
||||||
|
* bitmap. These are unlike sliced textures for example which may be
|
||||||
|
* comprised of multiple internal textures, or atlas textures where
|
||||||
|
* Cogl has to modify texture coordinates before they may be used by
|
||||||
|
* the GPU.
|
||||||
|
*
|
||||||
|
* <note>Many GPUs only support power of two sizes for #CoglTexture2D
|
||||||
|
* textures. You can check support for non power of two textures by
|
||||||
|
* checking for the %COGL_FEATURE_ID_TEXTURE_NPOT feature via
|
||||||
|
* cogl_has_feature().</note>
|
||||||
|
*
|
||||||
|
* Returns: A newly allocated #CoglTexture2D, or if the size is not
|
||||||
|
* supported (because it is too large or a non-power-of-two
|
||||||
|
* size that the hardware doesn't support) it will return
|
||||||
|
* %NULL and set @error.
|
||||||
|
*
|
||||||
|
* Since: 2.0
|
||||||
|
* Stability: unstable
|
||||||
|
*/
|
||||||
|
CoglTexture2D *
|
||||||
|
cogl_texture_2d_new_from_bitmap (CoglBitmap *bitmap,
|
||||||
|
CoglPixelFormat internal_format,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
|
||||||
#define cogl_texture_2d_new_from_foreign cogl_texture_2d_new_from_foreign_EXP
|
#define cogl_texture_2d_new_from_foreign cogl_texture_2d_new_from_foreign_EXP
|
||||||
/**
|
/**
|
||||||
* cogl_texture_2d_new_from_foreign:
|
* cogl_texture_2d_new_from_foreign:
|
||||||
|
@ -55,36 +55,4 @@ struct _CoglTexture3D
|
|||||||
CoglTexturePixel first_pixel;
|
CoglTexturePixel first_pixel;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* cogl_texture_3d_new_from_bitmap:
|
|
||||||
* @bmp_handle: A #CoglBitmap object.
|
|
||||||
* @height: height of the texture in pixels.
|
|
||||||
* @depth: depth of the texture in pixels.
|
|
||||||
* @internal_format: the #CoglPixelFormat that will be used for storing
|
|
||||||
* the buffer on the GPU. If COGL_PIXEL_FORMAT_ANY is given then a
|
|
||||||
* premultiplied format similar to the format of the source data will
|
|
||||||
* be used. The default blending equations of Cogl expect premultiplied
|
|
||||||
* color data; the main use of passing a non-premultiplied format here
|
|
||||||
* is if you have non-premultiplied source data and are going to adjust
|
|
||||||
* the blend mode (see cogl_pipeline_set_blend()) or use the data for
|
|
||||||
* something other than straight blending.
|
|
||||||
* @error: A GError return location.
|
|
||||||
*
|
|
||||||
* Creates a new 3D texture and initializes it with the images in
|
|
||||||
* @bmp_handle. The images are assumed to be packed together after one
|
|
||||||
* another in the increasing y axis. The height of individual image is
|
|
||||||
* given as @height and the number of images is given in @depth. The
|
|
||||||
* actual height of the bitmap can be larger than @height × @depth. In
|
|
||||||
* this case it assumes there is padding between the images.
|
|
||||||
*
|
|
||||||
* Return value: the newly created texture or %NULL if
|
|
||||||
* there was an error.
|
|
||||||
*/
|
|
||||||
CoglTexture3D *
|
|
||||||
_cogl_texture_3d_new_from_bitmap (CoglBitmap *bmp,
|
|
||||||
unsigned int height,
|
|
||||||
unsigned int depth,
|
|
||||||
CoglPixelFormat internal_format,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
#endif /* __COGL_TEXTURE_3D_PRIVATE_H */
|
#endif /* __COGL_TEXTURE_3D_PRIVATE_H */
|
||||||
|
@ -245,7 +245,7 @@ cogl_texture_3d_new_with_size (CoglContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglTexture3D *
|
CoglTexture3D *
|
||||||
_cogl_texture_3d_new_from_bitmap (CoglBitmap *bmp,
|
cogl_texture_3d_new_from_bitmap (CoglBitmap *bmp,
|
||||||
unsigned int height,
|
unsigned int height,
|
||||||
unsigned int depth,
|
unsigned int depth,
|
||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
@ -407,7 +407,7 @@ cogl_texture_3d_new_from_data (CoglContext *context,
|
|||||||
rowstride,
|
rowstride,
|
||||||
(guint8 *) data);
|
(guint8 *) data);
|
||||||
|
|
||||||
ret = _cogl_texture_3d_new_from_bitmap (bitmap,
|
ret = cogl_texture_3d_new_from_bitmap (bitmap,
|
||||||
height,
|
height,
|
||||||
depth,
|
depth,
|
||||||
internal_format,
|
internal_format,
|
||||||
|
@ -88,12 +88,12 @@ cogl_texture_3d_new_with_size (CoglContext *context,
|
|||||||
* @depth: depth of the texture in pixels.
|
* @depth: depth of the texture in pixels.
|
||||||
* @format: the #CoglPixelFormat the buffer is stored in in RAM
|
* @format: the #CoglPixelFormat the buffer is stored in in RAM
|
||||||
* @internal_format: the #CoglPixelFormat that will be used for storing
|
* @internal_format: the #CoglPixelFormat that will be used for storing
|
||||||
* the buffer on the GPU. If COGL_PIXEL_FORMAT_ANY is given then a
|
* the buffer on the GPU. If %COGL_PIXEL_FORMAT_ANY is given then a
|
||||||
* premultiplied format similar to the format of the source data will
|
* premultiplied format similar to the format of the source data will
|
||||||
* be used. The default blending equations of Cogl expect premultiplied
|
* be used. The default blending equations of Cogl expect premultiplied
|
||||||
* color data; the main use of passing a non-premultiplied format here
|
* color data; the main use of passing a non-premultiplied format here
|
||||||
* is if you have non-premultiplied source data and are going to adjust
|
* is if you have non-premultiplied source data and are going to adjust
|
||||||
* the blend mode (see cogl_material_set_blend()) or use the data for
|
* the blend mode (see cogl_pipeline_set_blend()) or use the data for
|
||||||
* something other than straight blending.
|
* something other than straight blending.
|
||||||
* @rowstride: the memory offset in bytes between the starts of
|
* @rowstride: the memory offset in bytes between the starts of
|
||||||
* scanlines in @data or 0 to infer it from the width and format
|
* scanlines in @data or 0 to infer it from the width and format
|
||||||
@ -131,6 +131,40 @@ cogl_texture_3d_new_from_data (CoglContext *context,
|
|||||||
const guint8 *data,
|
const guint8 *data,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_texture_3d_new_from_bitmap:
|
||||||
|
* @bitmap: A #CoglBitmap object.
|
||||||
|
* @height: height of the texture in pixels.
|
||||||
|
* @depth: depth of the texture in pixels.
|
||||||
|
* @internal_format: the #CoglPixelFormat that will be used for storing
|
||||||
|
* the buffer on the GPU. If %COGL_PIXEL_FORMAT_ANY is given then a
|
||||||
|
* premultiplied format similar to the format of the source data will
|
||||||
|
* be used. The default blending equations of Cogl expect premultiplied
|
||||||
|
* color data; the main use of passing a non-premultiplied format here
|
||||||
|
* is if you have non-premultiplied source data and are going to adjust
|
||||||
|
* the blend mode (see cogl_pipeline_set_blend()) or use the data for
|
||||||
|
* something other than straight blending.
|
||||||
|
* @error: A GError return location.
|
||||||
|
*
|
||||||
|
* Creates a new 3D texture and initializes it with the images in
|
||||||
|
* @bitmap. The images are assumed to be packed together after one
|
||||||
|
* another in the increasing y axis. The height of individual image is
|
||||||
|
* given as @height and the number of images is given in @depth. The
|
||||||
|
* actual height of the bitmap can be larger than @height × @depth. In
|
||||||
|
* this case it assumes there is padding between the images.
|
||||||
|
*
|
||||||
|
* Return value: the newly created texture or %NULL if
|
||||||
|
* there was an error.
|
||||||
|
* Since: 2.0
|
||||||
|
* Stability: unstable
|
||||||
|
*/
|
||||||
|
CoglTexture3D *
|
||||||
|
cogl_texture_3d_new_from_bitmap (CoglBitmap *bitmap,
|
||||||
|
unsigned int height,
|
||||||
|
unsigned int depth,
|
||||||
|
CoglPixelFormat internal_format,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_is_texture_3d:
|
* cogl_is_texture_3d:
|
||||||
* @object: a #CoglObject
|
* @object: a #CoglObject
|
||||||
|
@ -48,11 +48,6 @@ struct _CoglTextureRectangle
|
|||||||
gboolean is_foreign;
|
gboolean is_foreign;
|
||||||
};
|
};
|
||||||
|
|
||||||
CoglTextureRectangle *
|
|
||||||
_cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp,
|
|
||||||
CoglTextureFlags flags,
|
|
||||||
CoglPixelFormat internal_format);
|
|
||||||
|
|
||||||
CoglTextureRectangle *
|
CoglTextureRectangle *
|
||||||
_cogl_texture_rectangle_new_from_foreign (GLuint gl_handle,
|
_cogl_texture_rectangle_new_from_foreign (GLuint gl_handle,
|
||||||
GLuint width,
|
GLuint width,
|
||||||
|
@ -229,9 +229,9 @@ cogl_texture_rectangle_new_with_size (CoglContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglTextureRectangle *
|
CoglTextureRectangle *
|
||||||
_cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp,
|
cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp,
|
||||||
CoglTextureFlags flags,
|
CoglPixelFormat internal_format,
|
||||||
CoglPixelFormat internal_format)
|
GError **error)
|
||||||
{
|
{
|
||||||
CoglTextureRectangle *tex_rect;
|
CoglTextureRectangle *tex_rect;
|
||||||
CoglBitmap *dst_bmp;
|
CoglBitmap *dst_bmp;
|
||||||
@ -251,7 +251,7 @@ _cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp,
|
|||||||
if (!_cogl_texture_rectangle_can_create (cogl_bitmap_get_width (bmp),
|
if (!_cogl_texture_rectangle_can_create (cogl_bitmap_get_width (bmp),
|
||||||
cogl_bitmap_get_height (bmp),
|
cogl_bitmap_get_height (bmp),
|
||||||
internal_format,
|
internal_format,
|
||||||
NULL))
|
error))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dst_bmp = _cogl_texture_prepare_for_upload (bmp,
|
dst_bmp = _cogl_texture_prepare_for_upload (bmp,
|
||||||
|
@ -87,7 +87,7 @@ cogl_is_texture_rectangle (void *object);
|
|||||||
* @internal_format: The desired internal texture format
|
* @internal_format: The desired internal texture format
|
||||||
* @error: An optional GError pointer for reporting exceptions
|
* @error: An optional GError pointer for reporting exceptions
|
||||||
*
|
*
|
||||||
* Allocates a new #CoglRectangle texture with a given @width, @height
|
* Allocates a new #CoglTextureRectangle texture with a given @width, @height
|
||||||
* and @internal_format. This texture is a low-level texture that
|
* and @internal_format. This texture is a low-level texture that
|
||||||
* the GPU can sample from directly unlike high-level textures such
|
* the GPU can sample from directly unlike high-level textures such
|
||||||
* as #CoglTexture2DSliced and #CoglAtlasTexture.
|
* as #CoglTexture2DSliced and #CoglAtlasTexture.
|
||||||
@ -113,6 +113,38 @@ cogl_texture_rectangle_new_with_size (CoglContext *ctx,
|
|||||||
CoglPixelFormat internal_format,
|
CoglPixelFormat internal_format,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_texture_rectangle_new_from_bitmap:
|
||||||
|
* @bitmap: A #CoglBitmap
|
||||||
|
* @internal_format: the #CoglPixelFormat to use for the GPU storage of the
|
||||||
|
* texture
|
||||||
|
* @error: A return location for a GError or %NULL
|
||||||
|
*
|
||||||
|
* Allocates a new #CoglTextureRectangle texture which will be
|
||||||
|
* initialized with the pixel data from @bitmap. Internally the data
|
||||||
|
* will be stored in the format given by @internal_format. This
|
||||||
|
* texture is a low-level texture that the GPU can sample from
|
||||||
|
* directly unlike high-level textures such as #CoglTexture2DSliced
|
||||||
|
* and #CoglAtlasTexture.
|
||||||
|
*
|
||||||
|
* <note>If you want to sample from a rectangle texture from GLSL you
|
||||||
|
* should use the sampler2DRect sampler type.</note>
|
||||||
|
*
|
||||||
|
* <note>Applications wanting to use #CoglTextureRectangle should
|
||||||
|
* first check for the %COGL_FEATURE_ID_TEXTURE_RECTANGLE feature
|
||||||
|
* using cogl_has_feature().</note>
|
||||||
|
*
|
||||||
|
* Returns: A pointer to a newly allocated #CoglRectangle texture
|
||||||
|
* or if the size was too large or there wasn't enough memory
|
||||||
|
* %NULL is returned and @error set.
|
||||||
|
* Since: 2.0
|
||||||
|
* Stability: unstable
|
||||||
|
*/
|
||||||
|
CoglTextureRectangle *
|
||||||
|
cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bitmap,
|
||||||
|
CoglPixelFormat internal_format,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __COGL_TEXURE_RECTANGLE_H */
|
#endif /* __COGL_TEXURE_RECTANGLE_H */
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "cogl-framebuffer-private.h"
|
#include "cogl-framebuffer-private.h"
|
||||||
#include "cogl1-context.h"
|
#include "cogl1-context.h"
|
||||||
#include "cogl-sub-texture.h"
|
#include "cogl-sub-texture.h"
|
||||||
|
#include "cogl-primitive-texture.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -373,6 +374,7 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
|
|||||||
CoglPixelFormat internal_format)
|
CoglPixelFormat internal_format)
|
||||||
{
|
{
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
|
CoglTexture2D *tex_2d;
|
||||||
|
|
||||||
/* First try putting the texture in the atlas */
|
/* First try putting the texture in the atlas */
|
||||||
if ((tex = _cogl_atlas_texture_new_from_bitmap (bitmap,
|
if ((tex = _cogl_atlas_texture_new_from_bitmap (bitmap,
|
||||||
@ -381,11 +383,15 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
|
|||||||
return tex;
|
return tex;
|
||||||
|
|
||||||
/* If that doesn't work try a fast path 2D texture */
|
/* If that doesn't work try a fast path 2D texture */
|
||||||
if ((tex = _cogl_texture_2d_new_from_bitmap (bitmap,
|
if ((tex_2d = cogl_texture_2d_new_from_bitmap (bitmap,
|
||||||
flags,
|
|
||||||
internal_format,
|
internal_format,
|
||||||
NULL)))
|
NULL)))
|
||||||
return tex;
|
{
|
||||||
|
cogl_primitive_texture_set_auto_mipmap (COGL_PRIMITIVE_TEXTURE (tex_2d),
|
||||||
|
!(flags &
|
||||||
|
COGL_TEXTURE_NO_AUTO_MIPMAP));
|
||||||
|
return COGL_TEXTURE (tex_2d);
|
||||||
|
}
|
||||||
|
|
||||||
/* Otherwise create a sliced texture */
|
/* Otherwise create a sliced texture */
|
||||||
return
|
return
|
||||||
|
@ -314,6 +314,7 @@ COGL_TEXTURE_MAX_WASTE
|
|||||||
<TITLE>2D textures</TITLE>
|
<TITLE>2D textures</TITLE>
|
||||||
CoglTexture2D
|
CoglTexture2D
|
||||||
cogl_texture_2d_new_with_size
|
cogl_texture_2d_new_with_size
|
||||||
|
cogl_texture_2d_new_from_bitmap
|
||||||
cogl_texture_2d_new_from_data
|
cogl_texture_2d_new_from_data
|
||||||
cogl_texture_2d_new_from_foreign
|
cogl_texture_2d_new_from_foreign
|
||||||
cogl_is_texture_rectangle
|
cogl_is_texture_rectangle
|
||||||
@ -324,6 +325,7 @@ cogl_is_texture_rectangle
|
|||||||
<TITLE>Rectangle textures (non-normalized coordinates)</TITLE>
|
<TITLE>Rectangle textures (non-normalized coordinates)</TITLE>
|
||||||
CoglTextureRectangle
|
CoglTextureRectangle
|
||||||
cogl_texture_rectangle_new_with_size
|
cogl_texture_rectangle_new_with_size
|
||||||
|
cogl_texture_rectangle_new_from_bitmap
|
||||||
cogl_is_texture_rectangle
|
cogl_is_texture_rectangle
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
@ -332,6 +334,7 @@ cogl_is_texture_rectangle
|
|||||||
<TITLE>3D textures</TITLE>
|
<TITLE>3D textures</TITLE>
|
||||||
CoglTexture3D
|
CoglTexture3D
|
||||||
cogl_texture_3d_new_with_size
|
cogl_texture_3d_new_with_size
|
||||||
|
cogl_texture_3d_new_from_bitmap
|
||||||
cogl_texture_3d_new_from_data
|
cogl_texture_3d_new_from_data
|
||||||
cogl_is_texture_3d
|
cogl_is_texture_3d
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
Loading…
Reference in New Issue
Block a user