summaryrefslogtreecommitdiffstats
path: root/libdimension/gl.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-11-14 21:20:43 -0500
committerTavian Barnes <tavianator@gmail.com>2010-11-14 21:20:43 -0500
commit8fe33a340b8979a73fa84f201c15519a9b5d0266 (patch)
tree12cdbb1c1b9a48f533ab36980602785be1e1deeb /libdimension/gl.c
parent20a55aa78050d94b187d4edfaac91ea00efea505 (diff)
downloaddimension-8fe33a340b8979a73fa84f201c15519a9b5d0266.tar.xz
Document libdimension with Doxygen.
Diffstat (limited to 'libdimension/gl.c')
-rw-r--r--libdimension/gl.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/libdimension/gl.c b/libdimension/gl.c
index b09509e..2b26938 100644
--- a/libdimension/gl.c
+++ b/libdimension/gl.c
@@ -18,13 +18,18 @@
* <http://www.gnu.org/licenses/>. *
*************************************************************************/
+/**
+ * @file
+ * OpenGL import/export.
+ */
+
#include "dimension.h"
#include <GL/gl.h>
#include <stdlib.h>
#include <stdint.h>
-/* GL optimizer callback */
-static void dmnsn_gl_optimizer_fn(dmnsn_canvas *canvas,
+/** GL optimizer callback. */
+static void dmnsn_gl_optimizer_fn(const dmnsn_canvas *canvas,
dmnsn_canvas_optimizer optimizer,
size_t x, size_t y);
@@ -44,7 +49,7 @@ dmnsn_gl_optimize_canvas(dmnsn_canvas *canvas)
optimizer.free_fn = &dmnsn_free;
/* Allocate a buffer to hold RGB values */
- optimizer.ptr = dmnsn_malloc(4*canvas->x*canvas->y*sizeof(GLushort));
+ optimizer.ptr = dmnsn_malloc(4*canvas->width*canvas->height*sizeof(GLushort));
/* Set a new optimizer */
dmnsn_optimize_canvas(canvas, optimizer);
@@ -60,8 +65,8 @@ dmnsn_gl_write_canvas(const dmnsn_canvas *canvas)
dmnsn_sRGB sRGB;
dmnsn_color color;
- size_t width = canvas->x;
- size_t height = canvas->y;
+ size_t width = canvas->width;
+ size_t height = canvas->height;
/* Check if we can optimize this */
DMNSN_ARRAY_FOREACH (dmnsn_canvas_optimizer *, i, canvas->optimizers) {
@@ -160,12 +165,12 @@ dmnsn_gl_read_canvas(size_t x0, size_t y0,
/* GL optimizer callback */
static void
-dmnsn_gl_optimizer_fn(dmnsn_canvas *canvas, dmnsn_canvas_optimizer optimizer,
- size_t x, size_t y)
+dmnsn_gl_optimizer_fn(const dmnsn_canvas *canvas,
+ dmnsn_canvas_optimizer optimizer, size_t x, size_t y)
{
dmnsn_color color;
dmnsn_sRGB sRGB;
- GLushort *pixel = (GLushort *)optimizer.ptr + 4*(y*canvas->x + x);
+ GLushort *pixel = (GLushort *)optimizer.ptr + 4*(y*canvas->width + x);
color = dmnsn_get_pixel(canvas, x, y);
sRGB = dmnsn_sRGB_from_color(color);