This commit is contained in:
Matthew Allum 2005-03-23 21:09:57 +00:00
parent 2a24ed964a
commit 1ec99cb5e1
4 changed files with 25 additions and 11 deletions

View File

@ -1,3 +1,12 @@
2005-03-23 mallum,,, <mallum@openedhand.com>
* cltr.c: (cltr_photo_grid_populate), (cltr_photo_grid_redraw),
(cltr_photo_grid_new), (main):
* cltr.h:
Various minor tweaks
* pixbuf.c: (pixbuf_set_pixel), (pixbuf_get_pixel):
Fix RGBA ordering in set/get pixel
2005-03-23 mallum,,, <mallum@openedhand.com> 2005-03-23 mallum,,, <mallum@openedhand.com>
* cltr.c: (ctrl_photo_grid_get_trans_coords), * cltr.c: (ctrl_photo_grid_get_trans_coords),

10
cltr.c
View File

@ -497,12 +497,16 @@ cltr_photo_grid_populate(ClutterPhotoGrid *grid,
GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8,
grid->tex_data); grid->tex_data);
CLTR_GLERR();
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0,
(GLsizei)tpixb->width, (GLsizei)tpixb->width,
(GLsizei)tpixb->height, (GLsizei)tpixb->height,
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8,
tpixb->data); tpixb->data);
CLTR_GLERR();
i++; i++;
} }
while ( (cell = g_list_next(cell)) != NULL ); while ( (cell = g_list_next(cell)) != NULL );
@ -520,7 +524,7 @@ cltr_photo_grid_redraw(ClutterPhotoGrid *grid)
glLoadIdentity (); /* XXX pushmatrix */ glLoadIdentity (); /* XXX pushmatrix */
glClearColor( 0.0, 0.0, 0.0, 1.0); glClearColor( 0.6, 0.6, 0.62, 1.0);
glClear (GL_COLOR_BUFFER_BIT); glClear (GL_COLOR_BUFFER_BIT);
/* /*
@ -727,7 +731,7 @@ cltr_photo_grid_new(ClutterWindow *win,
/* Assmes cols == rows */ /* Assmes cols == rows */
grid->zoom_max = /* 1.0 + */ (float) (n_rows * 1.0); grid->zoom_max = /* 1.0 + */ (float) (n_rows * 1.0) ;
/* Below needs to go else where - some kind of texture manager/helper */ /* Below needs to go else where - some kind of texture manager/helper */
@ -777,7 +781,7 @@ main(int argc, char **argv)
win = cltr_window_new(640, 480); win = cltr_window_new(640, 480);
grid = cltr_photo_grid_new(win, 3, 3, argv[1]); grid = cltr_photo_grid_new(win, 4, 4, argv[1]);
Grid = grid; /* laaaaaazy globals */ Grid = grid; /* laaaaaazy globals */

5
cltr.h
View File

@ -29,9 +29,8 @@
GLenum err = glGetError (); /* Roundtrip */ \ GLenum err = glGetError (); /* Roundtrip */ \
if (err != GL_NO_ERROR) \ if (err != GL_NO_ERROR) \
{ \ { \
const GLubyte *message = gluErrorString (err); \ g_printerr (__FILE__ ": GL Error: %i [at %s:%d]\n", \
g_printerr (__FILE__ ": GL Error: %s [at %s:%d]\n", \ err, __func__, __LINE__); \
__func__, __LINE__); \
} \ } \
} }

View File

@ -510,7 +510,8 @@ pixbuf_set_pixel(Pixbuf *pixb, int x, int y, PixbufPixel *p)
/* ARGB_32 MSB */ /* ARGB_32 MSB */
*offset = (p->r << 0) | (p->g << 8) | (p->b << 16) | (p->a << 24); // *offset = (p->r << 0) | (p->g << 8) | (p->b << 16) | (p->a << 24);
*offset = (p->r << 24) | (p->g << 16) | (p->b << 8) | (p->a);
} }
void void
@ -520,10 +521,11 @@ pixbuf_get_pixel(Pixbuf *pixb, int x, int y, PixbufPixel *p)
/* ARGB_32 MSB */ /* ARGB_32 MSB */
p->r = *offset & 0xff; p->r = (*offset >> 24) & 0xff;
p->g = (*offset >> 8) & 0xff; p->g = (*offset >> 16) & 0xff;
p->b = (*offset >> 16) & 0xff; p->b = (*offset >> 8) & 0xff;
p->a = (*offset >> 24) & 0xff; p->a = *offset & 0xff;
} }
void /* XXX could be DEFINE */ void /* XXX could be DEFINE */