[cogl] Updates all file headers and removes lots of trailing white space

Adds missing notices, and ensures all the notices are consistent. The Cogl
blurb also now reads:

 * Cogl
 *
 * An object oriented GL/GLES Abstraction/Utility Layer
This commit is contained in:
Robert Bragg
2009-04-27 15:48:12 +01:00
parent 2d94b3f46f
commit 7e9685294e
69 changed files with 684 additions and 463 deletions

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2007 OpenedHand
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -164,7 +162,7 @@ inline static void
_cogl_unpremult_alpha_last (const guchar *src, guchar *dst)
{
guchar alpha = src[3];
dst[0] = ((((gulong) src[0] >> 16) & 0xff) * 255 ) / alpha;
dst[1] = ((((gulong) src[1] >> 8) & 0xff) * 255 ) / alpha;
dst[2] = ((((gulong) src[2] >> 0) & 0xff) * 255 ) / alpha;
@@ -175,7 +173,7 @@ inline static void
_cogl_unpremult_alpha_first (const guchar *src, guchar *dst)
{
guchar alpha = src[0];
dst[0] = alpha;
dst[1] = ((((gulong) src[1] >> 16) & 0xff) * 255 ) / alpha;
dst[2] = ((((gulong) src[2] >> 8) & 0xff) * 255 ) / alpha;
@@ -187,23 +185,23 @@ _cogl_bitmap_fallback_can_convert (CoglPixelFormat src, CoglPixelFormat dst)
{
if (src == dst)
return FALSE;
switch (src & COGL_UNORDERED_MASK)
{
case COGL_PIXEL_FORMAT_G_8:
case COGL_PIXEL_FORMAT_24:
case COGL_PIXEL_FORMAT_32:
if ((dst & COGL_UNORDERED_MASK) != COGL_PIXEL_FORMAT_24 &&
(dst & COGL_UNORDERED_MASK) != COGL_PIXEL_FORMAT_32 &&
(dst & COGL_UNORDERED_MASK) != COGL_PIXEL_FORMAT_G_8)
return FALSE;
break;
default:
return FALSE;
}
return TRUE;
}
@@ -224,11 +222,11 @@ _cogl_bitmap_fallback_convert (const CoglBitmap *bmp,
gint dst_bpp;
gint x,y;
guchar temp_rgba[4] = {0,0,0,0};
/* Make sure conversion supported */
if (!_cogl_bitmap_fallback_can_convert (bmp->format, dst_format))
return FALSE;
src_bpp = _cogl_get_format_bpp (bmp->format);
dst_bpp = _cogl_get_format_bpp (dst_format);
@@ -237,18 +235,18 @@ _cogl_bitmap_fallback_convert (const CoglBitmap *bmp,
dst_bmp->rowstride = sizeof(guchar) * dst_bpp * dst_bmp->width;
dst_bmp->format = ((bmp->format & COGL_PREMULT_BIT) |
(dst_format & COGL_UNPREMULT_MASK));
/* Allocate a new buffer to hold converted data */
dst_bmp->data = g_malloc (sizeof(guchar)
* dst_bmp->height
* dst_bmp->rowstride);
/* FIXME: Optimize */
for (y = 0; y < bmp->height; y++)
{
src = (guchar*)bmp->data + y * bmp->rowstride;
dst = (guchar*)dst_bmp->data + y * dst_bmp->rowstride;
for (x = 0; x < bmp->width; x++)
{
/* FIXME: Would be nice to at least remove this inner
@@ -273,7 +271,7 @@ _cogl_bitmap_fallback_convert (const CoglBitmap *bmp,
default:
break;
}
switch (dst_format & COGL_UNPREMULT_MASK)
{
case COGL_PIXEL_FORMAT_G_8:
@@ -293,12 +291,12 @@ _cogl_bitmap_fallback_convert (const CoglBitmap *bmp,
default:
break;
}
src += src_bpp;
dst += dst_bpp;
}
}
return TRUE;
}
@@ -310,28 +308,28 @@ _cogl_bitmap_fallback_unpremult (const CoglBitmap *bmp,
guchar *dst;
gint bpp;
gint x,y;
/* Make sure format supported for un-premultiplication */
if (!_cogl_bitmap_fallback_can_unpremult (bmp->format))
return FALSE;
bpp = _cogl_get_format_bpp (bmp->format);
/* Initialize destination bitmap */
*dst_bmp = *bmp;
dst_bmp->format = (bmp->format & COGL_UNPREMULT_MASK);
/* Allocate a new buffer to hold converted data */
dst_bmp->data = g_malloc (sizeof(guchar)
* dst_bmp->height
* dst_bmp->rowstride);
/* FIXME: Optimize */
for (y = 0; y < bmp->height; y++)
{
src = (guchar*)bmp->data + y * bmp->rowstride;
dst = (guchar*)dst_bmp->data + y * dst_bmp->rowstride;
for (x = 0; x < bmp->width; x++)
{
/* FIXME: Would be nice to at least remove this inner
@@ -351,12 +349,12 @@ _cogl_bitmap_fallback_unpremult (const CoglBitmap *bmp,
else
_cogl_unpremult_alpha_last (src, dst);
}
src += bpp;
dst += bpp;
}
}
return TRUE;
}

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2007 OpenedHand
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -222,7 +220,7 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
guchar *out_data;
guchar *out;
gint r;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (bmp == NULL)
@@ -232,7 +230,7 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
pixbuf = gdk_pixbuf_new_from_file (filename, error);
if (pixbuf == NULL)
return FALSE;
/* Get pixbuf properties */
has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
color_space = gdk_pixbuf_get_colorspace (pixbuf);
@@ -241,10 +239,10 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
bits_per_sample = gdk_pixbuf_get_bits_per_sample (pixbuf);
n_channels = gdk_pixbuf_get_n_channels (pixbuf);
/* The docs say this is the right way */
last_row_size = width * ((n_channels * bits_per_sample + 7) / 8);
/* According to current docs this should be true and so
* the translation to cogl pixel format below valid */
g_assert (bits_per_sample == 8);
@@ -253,7 +251,7 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
g_assert (n_channels == 4);
else
g_assert (n_channels == 3);
/* Translate to cogl pixel format */
switch (color_space)
{
@@ -263,19 +261,19 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
COGL_PIXEL_FORMAT_RGBA_8888 :
COGL_PIXEL_FORMAT_RGB_888;
break;
default:
/* Ouch, spec changed! */
g_object_unref (pixbuf);
return FALSE;
}
/* FIXME: Any way to destroy pixbuf but retain pixel data? */
pixels = gdk_pixbuf_get_pixels (pixbuf);
out_data = (guchar*) g_malloc (height * rowstride);
out = out_data;
/* Copy up to last row */
for (r = 0; r < height-1; ++r)
{
@@ -283,13 +281,13 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
pixels += rowstride;
out += rowstride;
}
/* Copy last row */
memcpy (out, pixels, last_row_size);
/* Destroy GdkPixbuf object */
g_object_unref (pixbuf);
/* Store bitmap info */
bmp->data = out_data; /* The stored data the same alignment constraints as a
* gdkpixbuf but stores a full rowstride in the last
@@ -299,7 +297,7 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
bmp->width = width;
bmp->height = height;
bmp->rowstride = rowstride;
return TRUE;
}
@@ -335,14 +333,14 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
if (bmp == NULL)
return FALSE;
/* Load from file using stb */
pixels = stbi_load (filename,
&width, &height, &stb_pixel_format,
STBI_rgb_alpha);
if (pixels == NULL)
return FALSE;
/* Store bitmap info */
bmp->data = g_memdup (pixels, height * width * 4);
bmp->format = COGL_PIXEL_FORMAT_RGBA_8888;

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2007 OpenedHand
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -47,7 +45,7 @@ _cogl_get_format_bpp (CoglPixelFormat format)
2, /* YUV */
1 /* G_8 */
};
return bpp_lut [format & COGL_UNORDERED_MASK];
}
@@ -59,7 +57,7 @@ _cogl_bitmap_convert_and_premult (const CoglBitmap *bmp,
CoglBitmap tmp_bmp = *bmp;
CoglBitmap new_bmp = *bmp;
gboolean new_bmp_owner = FALSE;
/* Is base format different (not considering premult status)? */
if ((bmp->format & COGL_UNPREMULT_MASK) !=
(dst_format & COGL_UNPREMULT_MASK))
@@ -71,12 +69,12 @@ _cogl_bitmap_convert_and_premult (const CoglBitmap *bmp,
if (!_cogl_bitmap_fallback_convert (&new_bmp, &tmp_bmp, dst_format))
return FALSE;
}
/* Update bitmap with new data */
new_bmp = tmp_bmp;
new_bmp_owner = TRUE;
}
/* Do we need to unpremultiply */
if ((bmp->format & COGL_PREMULT_BIT) == 0 &&
(dst_format & COGL_PREMULT_BIT) > 0)
@@ -89,19 +87,19 @@ _cogl_bitmap_convert_and_premult (const CoglBitmap *bmp,
{
if (new_bmp_owner)
g_free (new_bmp.data);
return FALSE;
}
}
/* Update bitmap with new data */
if (new_bmp_owner)
g_free (new_bmp.data);
new_bmp = tmp_bmp;
new_bmp_owner = TRUE;
}
/* Do we need to premultiply */
if ((bmp->format & COGL_PREMULT_BIT) > 0 &&
(dst_format & COGL_PREMULT_BIT) == 0)
@@ -109,13 +107,13 @@ _cogl_bitmap_convert_and_premult (const CoglBitmap *bmp,
/* FIXME: implement premultiplication */
if (new_bmp_owner)
g_free (new_bmp.data);
return FALSE;
}
/* Output new bitmap info */
*dst_bmp = new_bmp;
return TRUE;
}
@@ -133,14 +131,14 @@ _cogl_bitmap_copy_subregion (CoglBitmap *src,
guchar *dstdata;
gint bpp;
gint line;
/* Intended only for fast copies when format is equal! */
g_assert (src->format == dst->format);
bpp = _cogl_get_format_bpp (src->format);
srcdata = src->data + src_y * src->rowstride + src_x * bpp;
dstdata = dst->data + dst_y * dst->rowstride + dst_x * bpp;
for (line=0; line<height; ++line)
{
memcpy (dstdata, srcdata, width * bpp);
@@ -162,7 +160,7 @@ cogl_bitmap_new_from_file (const gchar *filename,
GError **error)
{
CoglBitmap bmp;
g_return_val_if_fail (error == NULL || *error == NULL, COGL_INVALID_HANDLE);
/* Try loading with imaging backend */
@@ -177,7 +175,7 @@ cogl_bitmap_new_from_file (const gchar *filename,
*error = NULL;
}
}
return (CoglBitmap *) g_memdup (&bmp, sizeof (CoglBitmap));
}

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2008 OpenedHand
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2008 OpenedHand
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,3 +1,26 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2008,2009 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Havoc Pennington <hp@pobox.com> for litl
*
* Copyright (C) 2009 OpenedHand
* Copyright (C) 2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,6 +19,9 @@
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Havoc Pennington <hp@pobox.com> for litl
*/
#ifdef HAVE_CONFIG_H

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Havoc Pennington <hp@pobox.com> for litl
*
* Copyright (C) 2009 OpenedHand
* Copyright (C) 2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,6 +19,9 @@
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Havoc Pennington <hp@pobox.com> for litl
*/
#ifndef __COGL_CURRENT_MATRIX_H

View File

@@ -1,3 +1,26 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2009 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

View File

@@ -1,3 +1,26 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007,2008,2009 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#define G_IMPLEMENT_INLINES
#ifdef HAVE_CONFIG_H

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2008 OpenedHand
* Copyright (C) 2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,10 +1,9 @@
/*
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007, 2008 OpenedHand
* Copyright (C) 2009 Intel Corp.
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,3 +1,29 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2008,2009 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#ifndef __COGL_MATERIAL_PRIVATE_H
#define __COGL_MATERIAL_PRIVATE_H

View File

@@ -1,3 +1,28 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2008,2009 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Havoc Pennington <hp@pobox.com> for litl
*
* Copyright (C) 2009 OpenedHand
* Copyright (C) 2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,6 +19,9 @@
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Havoc Pennington <hp@pobox.com> for litl
*/
#ifdef HAVE_CONFIG_H

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Havoc Pennington <hp@pobox.com> for litl
*
* Copyright (C) 2009 OpenedHand
* Copyright (C) 2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,6 +19,9 @@
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Havoc Pennington <hp@pobox.com> for litl
*/
#ifndef __COGL_MATRIX_STACK_H

View File

@@ -1,3 +1,29 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2008,2009 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#include <cogl-matrix.h>
#include <glib.h>

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2007 OpenedHand
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1322,9 +1320,9 @@ cogl_path_fill_preserve (void)
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_clip_ensure ();
if (ctx->path_nodes->len == 0)
return;
return;
_cogl_path_fill_nodes ();
}
@@ -1341,12 +1339,12 @@ void
cogl_path_stroke_preserve (void)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_clip_ensure ();
if (ctx->path_nodes->len == 0)
return;
_cogl_path_stroke_nodes();
}
@@ -1355,14 +1353,14 @@ cogl_path_move_to (float x,
float y)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
/* FIXME: handle multiple contours maybe? */
_cogl_path_add_node (TRUE, x, y);
ctx->path_start.x = x;
ctx->path_start.y = y;
ctx->path_pen = ctx->path_start;
}
@@ -1371,7 +1369,7 @@ cogl_path_rel_move_to (float x,
float y)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_path_move_to (ctx->path_pen.x + x,
ctx->path_pen.y + y);
}
@@ -1381,9 +1379,9 @@ cogl_path_line_to (float x,
float y)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_cogl_path_add_node (FALSE, x, y);
ctx->path_pen.x = x;
ctx->path_pen.y = y;
}
@@ -1393,7 +1391,7 @@ cogl_path_rel_line_to (float x,
float y)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_path_line_to (ctx->path_pen.x + x,
ctx->path_pen.y + y);
}
@@ -1402,7 +1400,7 @@ void
cogl_path_close (void)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_cogl_path_add_node (FALSE, ctx->path_start.x, ctx->path_start.y);
ctx->path_pen = ctx->path_start;
}
@@ -1430,9 +1428,9 @@ cogl_path_polyline (float *coords,
gint num_points)
{
gint c = 0;
cogl_path_move_to (coords[0], coords[1]);
for (c = 1; c < num_points; ++c)
cogl_path_line_to (coords[2*c], coords[2*c+1]);
}
@@ -1473,17 +1471,17 @@ _cogl_path_arc (float center_x,
float sina = 0x0;
float px = 0x0;
float py = 0x0;
/* Fix invalid angles */
if (angle_1 == angle_2 || angle_step == 0x0)
return;
if (angle_step < 0x0)
angle_step = -angle_step;
/* Walk the arc by given step */
a = angle_1;
while (a != angle_2)
{
@@ -1492,12 +1490,12 @@ _cogl_path_arc (float center_x,
px = center_x + (cosa * radius_x);
py = center_y + (sina * radius_y);
if (a == angle_1 && move_first)
cogl_path_move_to (px, py);
else
cogl_path_line_to (px, py);
if (G_LIKELY (angle_2 > angle_1))
{
a += angle_step;
@@ -1513,7 +1511,7 @@ _cogl_path_arc (float center_x,
}
/* Make sure the final point is drawn */
cosa = cosf (angle_2 * (G_PI/180.0));
sina = sinf (angle_2 * (G_PI/180.0));
@@ -1530,7 +1528,7 @@ cogl_path_arc (float center_x,
float radius_y,
float angle_1,
float angle_2)
{
{
float angle_step = 10;
/* it is documented that a move to is needed to create a freestanding
* arc
@@ -1552,7 +1550,7 @@ cogl_path_arc_rel (float center_x,
float angle_step)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_cogl_path_arc (ctx->path_pen.x + center_x,
ctx->path_pen.y + center_y,
radius_x, radius_y,
@@ -1567,15 +1565,15 @@ cogl_path_ellipse (float center_x,
float radius_y)
{
float angle_step = 10;
/* FIXME: if shows to be slow might be optimized
* by mirroring just a quarter of it */
_cogl_path_arc (center_x, center_y,
radius_x, radius_y,
0, 360,
angle_step, 1 /* move first */);
cogl_path_close();
}
@@ -1589,7 +1587,7 @@ cogl_path_round_rectangle (float x_1,
{
float inner_width = x_2 - x_1 - radius * 2;
float inner_height = y_2 - y_1 - radius * 2;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_path_move_to (x_1, y_1 + radius);
@@ -1598,7 +1596,7 @@ cogl_path_round_rectangle (float x_1,
180,
270,
arc_step);
cogl_path_line_to (ctx->path_pen.x + inner_width,
ctx->path_pen.y);
cogl_path_arc_rel (0, radius,
@@ -1606,7 +1604,7 @@ cogl_path_round_rectangle (float x_1,
-90,
0,
arc_step);
cogl_path_line_to (ctx->path_pen.x,
ctx->path_pen.y + inner_height);
@@ -1615,7 +1613,7 @@ cogl_path_round_rectangle (float x_1,
0,
90,
arc_step);
cogl_path_line_to (ctx->path_pen.x - inner_width,
ctx->path_pen.y);
cogl_path_arc_rel (0, -radius,
@@ -1623,7 +1621,7 @@ cogl_path_round_rectangle (float x_1,
90,
180,
arc_step);
cogl_path_close ();
}
@@ -1644,16 +1642,16 @@ _cogl_path_bezier3_sub (CoglBezCubic *cubic)
floatVec2 c4;
floatVec2 c5;
gint cindex;
/* Put first curve on stack */
cubics[0] = *cubic;
cindex = 0;
while (cindex >= 0)
{
c = &cubics[cindex];
/* Calculate distance of control points from their
* counterparts on the line between end points */
dif1.x = (c->p2.x * 3) - (c->p1.x * 2) - c->p4.x;
@@ -1669,12 +1667,12 @@ _cogl_path_bezier3_sub (CoglBezCubic *cubic)
dif2.x = -dif2.x;
if (dif2.y < 0)
dif2.y = -dif2.y;
/* Pick the greatest of two distances */
if (dif1.x < dif2.x) dif1.x = dif2.x;
if (dif1.y < dif2.y) dif1.y = dif2.y;
/* Cancel if the curve is flat enough */
if (dif1.x + dif1.y <= 1.0 ||
cindex == _COGL_MAX_BEZ_RECURSE_DEPTH-1)
@@ -1689,10 +1687,10 @@ _cogl_path_bezier3_sub (CoglBezCubic *cubic)
continue;
}
/* Left recursion goes on top of stack! */
cright = c; cleft = &cubics[++cindex];
/* Subdivide into 2 sub-curves */
c1.x = ((c->p1.x + c->p2.x) / 2);
c1.y = ((c->p1.y + c->p2.y) / 2);
@@ -1700,21 +1698,21 @@ _cogl_path_bezier3_sub (CoglBezCubic *cubic)
mm.y = ((c->p2.y + c->p3.y) / 2);
c5.x = ((c->p3.x + c->p4.x) / 2);
c5.y = ((c->p3.y + c->p4.y) / 2);
c2.x = ((c1.x + mm.x) / 2);
c2.y = ((c1.y + mm.y) / 2);
c4.x = ((mm.x + c5.x) / 2);
c4.y = ((mm.y + c5.y) / 2);
c3.x = ((c2.x + c4.x) / 2);
c3.y = ((c2.y + c4.y) / 2);
/* Add left recursion to stack */
cleft->p1 = c->p1;
cleft->p2 = c1;
cleft->p3 = c2;
cleft->p4 = c3;
/* Add right recursion to stack */
cright->p1 = c3;
cright->p2 = c4;
@@ -1761,7 +1759,7 @@ cogl_path_rel_curve_to (float x_1,
float y_3)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_path_curve_to (ctx->path_pen.x + x_1,
ctx->path_pen.y + y_1,
ctx->path_pen.x + x_2,
@@ -1789,17 +1787,17 @@ _cogl_path_bezier2_sub (CoglBezQuad *quad)
floatVec2 c2;
floatVec2 c3;
gint qindex;
/* Put first curve on stack */
quads[0] = *quad;
qindex = 0;
/* While stack is not empty */
while (qindex >= 0)
{
q = &quads[qindex];
/* Calculate distance of control point from its
* counterpart on the line between end points */
mid.x = ((q->p1.x + q->p3.x) / 2);
@@ -1808,7 +1806,7 @@ _cogl_path_bezier2_sub (CoglBezQuad *quad)
dif.y = (q->p2.y - mid.y);
if (dif.x < 0) dif.x = -dif.x;
if (dif.y < 0) dif.y = -dif.y;
/* Cancel if the curve is flat enough */
if (dif.x + dif.y <= 1.0 ||
qindex == _COGL_MAX_BEZ_RECURSE_DEPTH - 1)
@@ -1818,10 +1816,10 @@ _cogl_path_bezier2_sub (CoglBezQuad *quad)
_cogl_path_add_node (FALSE, q->p3.x, q->p3.y);
--qindex; continue;
}
/* Left recursion goes on top of stack! */
qright = q; qleft = &quads[++qindex];
/* Subdivide into 2 sub-curves */
c1.x = ((q->p1.x + q->p2.x) / 2);
c1.y = ((q->p1.y + q->p2.y) / 2);
@@ -1829,12 +1827,12 @@ _cogl_path_bezier2_sub (CoglBezQuad *quad)
c3.y = ((q->p2.y + q->p3.y) / 2);
c2.x = ((c1.x + c3.x) / 2);
c2.y = ((c1.y + c3.y) / 2);
/* Add left recursion onto stack */
qleft->p1 = q->p1;
qleft->p2 = c1;
qleft->p3 = c2;
/* Add right recursion onto stack */
qright->p1 = c2;
qright->p2 = c3;
@@ -1861,7 +1859,7 @@ cogl_path_curve2_to (float x_1,
/* Run subdivision */
_cogl_path_bezier2_sub (&quad);
/* Add last point */
_cogl_path_add_node (FALSE, quad.p3.x, quad.p3.y);
ctx->path_pen = quad.p3;

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2007 OpenedHand
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,18 +1,14 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By: Matthew Allum <mallum@openedhand.com>
* Emmanuele Bassi <ebassi@linux.intel.com>
*
* Copyright (C) 2007, 2008 OpenedHand
* Copyright (C) 2009 Intel Corp.
* Copyright (C) 2007,2008,2009 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.1 of the License, or (at your option) any later version.
* 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
@@ -20,7 +16,9 @@
* 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/>.
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H

View File

@@ -1,11 +1,9 @@
/*
* Clutter COGL
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2007 OpenedHand
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -26,7 +24,7 @@
#ifndef __COGL_UTIL_H
#define __COGL_UTIL_H
int
int
cogl_util_next_p2 (int a);
#endif /* __COGL_UTIL_H */

View File

@@ -1,11 +1,9 @@
/*
* Cogl.
* Cogl
*
* An OpenGL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2008 Intel Corporation.
*
* Authored By: Robert Bragg <robert@linux.intel.com>
* Copyright (C) 2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,7 +16,12 @@
* 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/>.
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#ifndef __COGL_VERTEX_BUFFER_H

View File

@@ -1,13 +1,9 @@
/*
* Cogl.
* Cogl
*
* An OpenGL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Vertex Buffer API: Handle extensible arrays of vertex attributes
*
* Copyright (C) 2008, 2009 Intel Corporation.
*
* Authored by: Robert Bragg <robert@linux.intel.com>
* Copyright (C) 2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -20,7 +16,12 @@
* 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/>.
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
/* XXX: For an overview of the functionality implemented here, please

View File

@@ -1,10 +1,9 @@
/*
* Cogl
*
* A basic GL/GLES Abstraction/Utility Layer
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007, 2008 OpenedHand
* Copyright (C) 2009 Intel Corp.
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public