From: Matthew Allum Date: Wed, 30 Mar 2005 16:52:02 +0000 (+0000) Subject: rename CltrImage X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c5a9ee791407e4e660ad6b284876f26d0ec0ad19;p=profile%2Fivi%2Fclutter.git rename CltrImage --- diff --git a/ChangeLog b/ChangeLog index 980416d..85aa548 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2005-03-30 mallum,,, + * cltr-photo-grid.c: (cltr_photo_grid_populate), + (cltr_photo_grid_redraw), (cltr_photo_grid_new): + * cltr-photo-grid.h: + * cltr-tex.c: (next_p2), (cltr_texture_render_to_gl_quad), + (tile_dimension), (init_tiles), (cltr_texture_new): + * cltr-tex.h: + * cltr.h: + Rename CltrImage -> CltrTexture + +2005-03-30 mallum,,, + * Makefile: * cltr-photo-grid.c: (cltr_photo_grid_populate), (cltr_photo_grid_redraw): diff --git a/cltr-photo-grid.c b/cltr-photo-grid.c index 39febef..c8ed5a2 100644 --- a/cltr-photo-grid.c +++ b/cltr-photo-grid.c @@ -245,7 +245,7 @@ cltr_photo_grid_populate(gpointer data) g_mutex_lock(Mutex_GRID); - cell->img = cltr_image_new(cell->pixb); + cell->texture = cltr_texture_new(cell->pixb); g_mutex_unlock(Mutex_GRID); @@ -466,11 +466,11 @@ cltr_photo_grid_redraw(ClutterPhotoGrid *grid) g_mutex_lock(Mutex_GRID); - cltr_image_render_to_gl_quad(cell->img, - -(thumb_w/2), - -(thumb_h/2), - (thumb_w/2), - (thumb_h/2)); + cltr_texture_render_to_gl_quad(cell->texture, + -(thumb_w/2), + -(thumb_h/2), + (thumb_w/2), + (thumb_h/2)); g_mutex_unlock(Mutex_GRID); @@ -548,7 +548,7 @@ cltr_photo_grid_new(ClutterWindow *win, grid->state = CLTR_PHOTO_GRID_STATE_LOADING; - grid->anim_n_steps = 50; /* value needs to be calced dep on rows */ + grid->anim_n_steps = 40; /* value needs to be calced dep on rows */ grid->anim_step = 0; /* diff --git a/cltr-photo-grid.h b/cltr-photo-grid.h index e80d2c9..d1a5420 100644 --- a/cltr-photo-grid.h +++ b/cltr-photo-grid.h @@ -29,11 +29,10 @@ ClutterPhotoGridCellState; struct ClutterPhotoGridCell { - Pixbuf *pixb; - float angle; - GLuint texref; - CltrImage *img; - gint anim_step; + Pixbuf *pixb; + float angle; + CltrTexture *texture; + gint anim_step; ClutterPhotoGridCellState state; }; @@ -68,12 +67,8 @@ struct ClutterPhotoGrid /* below needs better naming */ float view_min_x, view_max_x, view_min_y, view_max_y; - int tex_w; - int tex_h; - int *tex_data; - GLuint *texs; - ClutterPhotoGridState state; + }; ClutterPhotoGridCell* diff --git a/cltr-tex.c b/cltr-tex.c index 116d949..41a28ba 100644 --- a/cltr-tex.c +++ b/cltr-tex.c @@ -1,4 +1,4 @@ -#include "cltr-tex.h" +#include "cltr-texture.h" /* IDEAS or less memory @@ -27,7 +27,11 @@ next_p2 ( int a ) } void -cltr_image_render_to_gl_quad(CltrImage *img, int x1, int y1, int x2, int y2) +cltr_texture_render_to_gl_quad(CltrTexture *texture, + int x1, + int y1, + int x2, + int y2) { int qx1, qx2, qy1, qy2; int qwidth, qheight; @@ -37,27 +41,27 @@ cltr_image_render_to_gl_quad(CltrImage *img, int x1, int y1, int x2, int y2) qwidth = x2-x1; qheight = y2-y1; - for (x=0; x < img->n_x_tiles; x++) + for (x=0; x < texture->n_x_tiles; x++) { lasty = 0; - for (y=0; y < img->n_y_tiles; y++) + for (y=0; y < texture->n_y_tiles; y++) { int actual_w, actual_h; - glBindTexture(GL_TEXTURE_2D, img->tiles[i]); + glBindTexture(GL_TEXTURE_2D, texture->tiles[i]); - actual_w = img->tile_x_size[x] - img->tile_x_waste[x]; - actual_h = img->tile_y_size[y] - img->tile_y_waste[y]; + actual_w = texture->tile_x_size[x] - texture->tile_x_waste[x]; + actual_h = texture->tile_y_size[y] - texture->tile_y_waste[y]; - tx = (float) actual_w / img->tile_x_size[x]; - ty = (float) actual_h / img->tile_y_size[y]; + tx = (float) actual_w / texture->tile_x_size[x]; + ty = (float) actual_h / texture->tile_y_size[y]; qx1 = x1 + lastx; - qx2 = qx1 + ((qwidth * actual_w ) / img->width ); + qx2 = qx1 + ((qwidth * actual_w ) / texture->width ); qy1 = y1 + lasty; - qy2 = qy1 + ((qheight * actual_h) / img->height ); + qy2 = qy1 + ((qheight * actual_h) / texture->height ); glBegin (GL_QUADS); glTexCoord2f (tx, ty); glVertex2i (qx2, qy2); @@ -157,7 +161,7 @@ tile_dimension (int to_fill, } static void -init_tiles (CltrImage *texture) +init_tiles (CltrTexture *texture) { int x_pot = next_p2 (texture->width); int y_pot = next_p2 (texture->height); @@ -229,56 +233,56 @@ init_tiles (CltrImage *texture) /* End borrowed luminocity code */ -CltrImage* -cltr_image_new(Pixbuf *pixb) +CltrTexture* +cltr_texture_new(Pixbuf *pixb) { - CltrImage *img; + CltrTexture *texture; int x, y, i = 0; CLTR_MARK(); img = g_malloc0(sizeof(CltrImage)); - img->width = pixb->width; - img->height = pixb->height; - img->pixb = pixb; + texture->width = pixb->width; + texture->height = pixb->height; + texture->pixb = pixb; pixbuf_ref(pixb); init_tiles (img); - for (x=0; x < img->n_x_tiles; x++) - for (y=0; y < img->n_y_tiles; y++) + for (x=0; x < texture->n_x_tiles; x++) + for (y=0; y < texture->n_y_tiles; y++) { Pixbuf *pixtmp; int src_h, src_w; - pixtmp = pixbuf_new(img->tile_x_size[x], img->tile_y_size[y]); + pixtmp = pixbuf_new(texture->tile_x_size[x], texture->tile_y_size[y]); - src_w = img->tile_x_size[x]; - src_h = img->tile_y_size[y]; + src_w = texture->tile_x_size[x]; + src_h = texture->tile_y_size[y]; /* CLTR_DBG("%i+%i, %ix%i to %ix%i, waste %ix%i", - img->tile_x_position[x], - img->tile_y_position[y], - img->tile_x_size[x], - img->tile_y_size[y], - img->width, - img->height, - img->tile_x_waste[x], - img->tile_y_waste[y]); + texture->tile_x_position[x], + texture->tile_y_position[y], + texture->tile_x_size[x], + texture->tile_y_size[y], + texture->width, + texture->height, + texture->tile_x_waste[x], + texture->tile_y_waste[y]); */ - pixbuf_copy(img->pixb, + pixbuf_copy(texture->pixb, pixtmp, - img->tile_x_position[x], - img->tile_y_position[y], - img->tile_x_size[x], - img->tile_y_size[y], + texture->tile_x_position[x], + texture->tile_y_position[y], + texture->tile_x_size[x], + texture->tile_y_size[y], 0,0); - glBindTexture(GL_TEXTURE_2D, img->tiles[i]); + glBindTexture(GL_TEXTURE_2D, texture->tiles[i]); CLTR_GLERR(); @@ -288,7 +292,7 @@ cltr_image_new(Pixbuf *pixb) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, + glTexImage2D(GL_TEXTURE_2D, 0, /*GL_COMPRESSED_RGBA_ARB*/ GL_RGBA, pixtmp->width, pixtmp->height, 0, GL_RGBA, diff --git a/cltr-tex.h b/cltr-tex.h index 07499ef..aebd6bc 100644 --- a/cltr-tex.h +++ b/cltr-tex.h @@ -3,10 +3,14 @@ #include "cltr.h" -CltrImage* -cltr_image_new(Pixbuf *pixb); +CltrTexture* +cltr_texture_new(Pixbuf *pixb); void -cltr_image_render_to_gl_quad(CltrImage *img, int x1, int y1, int x2, int y2); +cltr_texture_render_to_gl_quad(CltrTexture *texture, + int x1, + int y1, + int x2, + int y2); #endif diff --git a/cltr.h b/cltr.h index 3425538..86bdd5f 100644 --- a/cltr.h +++ b/cltr.h @@ -98,9 +98,9 @@ CltrXEventSource; /* texture stuff */ -typedef struct CltrImage CltrImage; +typedef struct CltrTexture CltrTexture; -struct CltrImage +struct CltrTexture { Pixbuf *pixb; @@ -117,7 +117,7 @@ struct CltrImage /* ******************* */ -#include "cltr-tex.h" +#include "cltr-texture.h" #include "cltr-photo-grid.h" #endif