Commit 65f1edb1 authored by Daniel Egger's avatar Daniel Egger
Browse files

Removed the JIT calculation of the tile_shift value and replaced it by a

 * app/image_render.c:
 * app/tile.h: Removed the JIT calculation of the tile_shift
 value and replaced it by a constant called TILE_SHIFT in tile.h.
 This gives the compiler a better chance to optimize the code.
 Also added a few consts all over the place to give the compiler
 some hints.
parent 5be2937c
2000-10-24 Daniel Egger <egger@suse.de>
* app/image_render.c:
* app/tile.h: Removed the JIT calculation of the tile_shift
value and replaced it by a constant called TILE_SHIFT in tile.h.
This gives the compiler a better chance to optimize the code.
Also added a few consts all over the place to give the compiler
some hints.
2000-10-24 Simon Budig <simon@gimp.org>
 
* gimp_splash.ppm A new splash-screen (not for 1.2...) :-)
......
......@@ -2,8 +2,12 @@
#define __TILE_H__
/* We make one big assumptions about the tilesize at several places
in the code: All tiles are squares! */
#define TILE_WIDTH 64
#define TILE_HEIGHT 64
#define TILE_SHIFT 6 /* This has to be the lg(TILE_WIDTH) to the base of 2 */
/* Uncomment for verbose debugging on copy-on-write logic
#define TILE_DEBUG
......
......@@ -61,7 +61,6 @@ guchar *temp_buf = NULL;
static guint check_mod;
static guint check_shift;
static guint tile_shift;
static guchar check_combos[6][2] =
{
{ 204, 255 },
......@@ -83,9 +82,6 @@ render_setup (int check_type,
/* based on the tile size, determine the tile shift amount
* (assume here that tile_height and tile_width are equal)
*/
tile_shift = 0;
while ((1 << tile_shift) < TILE_WIDTH)
tile_shift++;
/* allocate a buffer for arranging information from a row of tiles */
if (!tile_buf)
......@@ -560,24 +556,19 @@ render_image_rgb (RenderInfo *info)
{
guchar *src;
guchar *dest;
int byte_order;
int y, ye;
int x, xe;
int initial;
int y, x;
gboolean initial;
float error;
float step;
const int ye = info->y + info->h;
const int xe = info->x + info->w;
const float step = 1.0 / info->scaley;
y = info->y;
ye = info->y + info->h;
xe = info->x + info->w;
step = 1.0 / info->scaley;
error = y * step;
error -= (int)error - step;
initial = TRUE;
byte_order = info->byte_order;
info->src = render_image_tile_fault (info);
for (; y < ye; y++)
......@@ -630,20 +621,17 @@ render_image_rgb_a (RenderInfo *info)
gulong r, g, b;
guint a;
int dark_light;
int byte_order;
int y, ye;
int x, xe;
gboolean byte_order;
int y, x;
int initial;
float error;
float step;
const int ye = info->y + info->h;
const int xe = info->x + info->w;
const float step = 1.0 / info->scaley;
alpha = info->alpha;
y = info->y;
ye = info->y + info->h;
xe = info->x + info->w;
step = 1.0 / info->scaley;
error = y * step;
error -= ((int)error) - step;
......@@ -840,16 +828,14 @@ render_image_tile_fault (RenderInfo *info)
x += step;
data += step * bpp;
if ((x >> tile_shift) != tilex)
if ((x >> TILE_SHIFT) != tilex)
{
tile_release (tile, FALSE);
tilex += 1;
tile = tile_manager_get_tile (info->src_tiles, srctilex=x,
srctiley=info->src_y, TRUE, FALSE);
if (!tile)
return tile_buf;
data = tile_data_pointer (tile,
x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
......
......@@ -61,7 +61,6 @@ guchar *temp_buf = NULL;
static guint check_mod;
static guint check_shift;
static guint tile_shift;
static guchar check_combos[6][2] =
{
{ 204, 255 },
......@@ -83,9 +82,6 @@ render_setup (int check_type,
/* based on the tile size, determine the tile shift amount
* (assume here that tile_height and tile_width are equal)
*/
tile_shift = 0;
while ((1 << tile_shift) < TILE_WIDTH)
tile_shift++;
/* allocate a buffer for arranging information from a row of tiles */
if (!tile_buf)
......@@ -560,24 +556,19 @@ render_image_rgb (RenderInfo *info)
{
guchar *src;
guchar *dest;
int byte_order;
int y, ye;
int x, xe;
int initial;
int y, x;
gboolean initial;
float error;
float step;
const int ye = info->y + info->h;
const int xe = info->x + info->w;
const float step = 1.0 / info->scaley;
y = info->y;
ye = info->y + info->h;
xe = info->x + info->w;
step = 1.0 / info->scaley;
error = y * step;
error -= (int)error - step;
initial = TRUE;
byte_order = info->byte_order;
info->src = render_image_tile_fault (info);
for (; y < ye; y++)
......@@ -630,20 +621,17 @@ render_image_rgb_a (RenderInfo *info)
gulong r, g, b;
guint a;
int dark_light;
int byte_order;
int y, ye;
int x, xe;
gboolean byte_order;
int y, x;
int initial;
float error;
float step;
const int ye = info->y + info->h;
const int xe = info->x + info->w;
const float step = 1.0 / info->scaley;
alpha = info->alpha;
y = info->y;
ye = info->y + info->h;
xe = info->x + info->w;
step = 1.0 / info->scaley;
error = y * step;
error -= ((int)error) - step;
......@@ -840,16 +828,14 @@ render_image_tile_fault (RenderInfo *info)
x += step;
data += step * bpp;
if ((x >> tile_shift) != tilex)
if ((x >> TILE_SHIFT) != tilex)
{
tile_release (tile, FALSE);
tilex += 1;
tile = tile_manager_get_tile (info->src_tiles, srctilex=x,
srctiley=info->src_y, TRUE, FALSE);
if (!tile)
return tile_buf;
data = tile_data_pointer (tile,
x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
......
......@@ -61,7 +61,6 @@ guchar *temp_buf = NULL;
static guint check_mod;
static guint check_shift;
static guint tile_shift;
static guchar check_combos[6][2] =
{
{ 204, 255 },
......@@ -83,9 +82,6 @@ render_setup (int check_type,
/* based on the tile size, determine the tile shift amount
* (assume here that tile_height and tile_width are equal)
*/
tile_shift = 0;
while ((1 << tile_shift) < TILE_WIDTH)
tile_shift++;
/* allocate a buffer for arranging information from a row of tiles */
if (!tile_buf)
......@@ -560,24 +556,19 @@ render_image_rgb (RenderInfo *info)
{
guchar *src;
guchar *dest;
int byte_order;
int y, ye;
int x, xe;
int initial;
int y, x;
gboolean initial;
float error;
float step;
const int ye = info->y + info->h;
const int xe = info->x + info->w;
const float step = 1.0 / info->scaley;
y = info->y;
ye = info->y + info->h;
xe = info->x + info->w;
step = 1.0 / info->scaley;
error = y * step;
error -= (int)error - step;
initial = TRUE;
byte_order = info->byte_order;
info->src = render_image_tile_fault (info);
for (; y < ye; y++)
......@@ -630,20 +621,17 @@ render_image_rgb_a (RenderInfo *info)
gulong r, g, b;
guint a;
int dark_light;
int byte_order;
int y, ye;
int x, xe;
gboolean byte_order;
int y, x;
int initial;
float error;
float step;
const int ye = info->y + info->h;
const int xe = info->x + info->w;
const float step = 1.0 / info->scaley;
alpha = info->alpha;
y = info->y;
ye = info->y + info->h;
xe = info->x + info->w;
step = 1.0 / info->scaley;
error = y * step;
error -= ((int)error) - step;
......@@ -840,16 +828,14 @@ render_image_tile_fault (RenderInfo *info)
x += step;
data += step * bpp;
if ((x >> tile_shift) != tilex)
if ((x >> TILE_SHIFT) != tilex)
{
tile_release (tile, FALSE);
tilex += 1;
tile = tile_manager_get_tile (info->src_tiles, srctilex=x,
srctiley=info->src_y, TRUE, FALSE);
if (!tile)
return tile_buf;
data = tile_data_pointer (tile,
x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
......
......@@ -2,8 +2,12 @@
#define __TILE_H__
/* We make one big assumptions about the tilesize at several places
in the code: All tiles are squares! */
#define TILE_WIDTH 64
#define TILE_HEIGHT 64
#define TILE_SHIFT 6 /* This has to be the lg(TILE_WIDTH) to the base of 2 */
/* Uncomment for verbose debugging on copy-on-write logic
#define TILE_DEBUG
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment