disable standalone builds and drop private glib copy

This commit is contained in:
Rui Matos
2016-04-11 17:52:46 +02:00
parent 9504eac68c
commit 26c94951fc
88 changed files with 11 additions and 44879 deletions

View File

@ -25,10 +25,6 @@ AM_CPPFLAGS = \
-I$(srcdir)/driver/gl/gles \
$(NULL)
if !USE_GLIB
AM_CPPFLAGS += -I$(top_builddir)/deps/glib
endif
AM_CPPFLAGS += \
-DG_LOG_DOMAIN=\"Cogl\" \
-DCOGL_COMPILATION \
@ -418,10 +414,8 @@ cogl_sources_c = \
deprecated/cogl-texture-deprecated.c \
$(NULL)
if USE_GLIB
cogl_experimental_h += cogl-glib-source.h
cogl_sources_c += cogl-glib-source.c
endif
if SUPPORT_XLIB
cogl_deprecated_h += deprecated/cogl-clutter-xlib.h
@ -476,8 +470,6 @@ cogl_sources_c += \
winsys/cogl-winsys-egl-private.h
endif
EXTRA_DIST += stb_image.c
# glib-mkenums rules
glib_enum_h = cogl-enum-types.h
glib_enum_c = cogl-enum-types.c
@ -487,10 +479,6 @@ include $(top_srcdir)/build/autotools/Makefile.am.enums
lib_LTLIBRARIES += libcogl.la
libcogl_la_LIBADD = $(LIBM) $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
if !USE_GLIB
libcogl_la_LIBADD += $(top_builddir)/deps/glib/libglib.la
libcogl_la_LIBADD += $(top_builddir)/deps/gmodule/libgmodule.la
endif
if UNIT_TESTS
libcogl_la_LIBADD += $(top_builddir)/test-fixtures/libtest-fixtures.la
endif

View File

@ -40,7 +40,6 @@
#include <string.h>
#if defined(USE_GDKPIXBUF)
#include <gdk-pixbuf/gdk-pixbuf.h>
CoglBool
@ -135,154 +134,3 @@ _cogl_bitmap_from_file (CoglContext *ctx,
return bmp;
}
#else
#include "stb_image.c"
CoglBool
_cogl_bitmap_get_size_from_file (const char *filename,
int *width,
int *height)
{
if (width)
*width = 0;
if (height)
*height = 0;
return TRUE;
}
/* stb_image.c supports an STBI_grey_alpha format which we don't have
* a corresponding CoglPixelFormat for so as a special case we
* convert this to rgba8888.
*
* If we have a use case where this is an important format to consider
* then it could be worth adding a corresponding CoglPixelFormat
* instead.
*/
static uint8_t *
convert_ra_88_to_rgba_8888 (uint8_t *pixels,
int width,
int height)
{
int x, y;
uint8_t *buf;
size_t in_stride = width * 2;
size_t out_stride = width * 4;
buf = malloc (width * height * 4);
if (buf)
return NULL;
for (y = 0; y < height; y++)
for (x = 0; x < width; x++)
{
uint8_t *src = pixels + in_stride * y + 2 * x;
uint8_t *dst = buf + out_stride * y + 4 * x;
dst[0] = src[0];
dst[1] = src[0];
dst[2] = src[0];
dst[3] = src[1];
}
return buf;
}
static CoglBitmap *
_cogl_bitmap_new_from_stb_pixels (CoglContext *ctx,
uint8_t *pixels,
int stb_pixel_format,
int width,
int height,
CoglError **error)
{
static CoglUserDataKey bitmap_data_key;
CoglBitmap *bmp;
CoglPixelFormat cogl_format;
size_t stride;
if (pixels == NULL)
{
_cogl_set_error_literal (error,
COGL_BITMAP_ERROR,
COGL_BITMAP_ERROR_FAILED,
"Failed to load image with stb image library");
return NULL;
}
switch (stb_pixel_format)
{
case STBI_grey:
cogl_format = COGL_PIXEL_FORMAT_A_8;
break;
case STBI_grey_alpha:
{
uint8_t *tmp = pixels;
pixels = convert_ra_88_to_rgba_8888 (pixels, width, height);
free (tmp);
if (!pixels)
{
_cogl_set_error_literal (error,
COGL_BITMAP_ERROR,
COGL_BITMAP_ERROR_FAILED,
"Failed to alloc memory to convert "
"gray_alpha to rgba8888");
return NULL;
}
cogl_format = COGL_PIXEL_FORMAT_RGBA_8888;
break;
}
case STBI_rgb:
cogl_format = COGL_PIXEL_FORMAT_RGB_888;
break;
case STBI_rgb_alpha:
cogl_format = COGL_PIXEL_FORMAT_RGBA_8888;
break;
default:
g_warn_if_reached ();
return NULL;
}
stride = width * _cogl_pixel_format_get_bytes_per_pixel (cogl_format);
/* Store bitmap info */
bmp = cogl_bitmap_new_for_data (ctx,
width, height,
cogl_format,
stride,
pixels);
/* Register a destroy function so the pixel data will be freed
automatically when the bitmap object is destroyed */
cogl_object_set_user_data (COGL_OBJECT (bmp), &bitmap_data_key, pixels, free);
return bmp;
}
CoglBitmap *
_cogl_bitmap_from_file (CoglContext *ctx,
const char *filename,
CoglError **error)
{
int stb_pixel_format;
int width;
int height;
uint8_t *pixels;
pixels = stbi_load (filename,
&width, &height, &stb_pixel_format,
STBI_default);
return _cogl_bitmap_new_from_stb_pixels (ctx, pixels, stb_pixel_format,
width, height,
error);
}
#endif

File diff suppressed because it is too large Load Diff