mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 03:52:33 +00:00
app/base/Makefile.am app/base/tile.[ch] moved tile row hints code to its
2007-10-09 Sven Neumann <sven@gimp.org> * app/base/Makefile.am * app/base/tile.[ch] * app/base/tile-rowhints.[ch]: moved tile row hints code to its own file. * app/base/tile-cache.c * app/base/tile-manager.c * app/base/tile-swap.c * app/paint-funcs/paint-funcs.c: changed accordingly. svn path=/trunk/; revision=23781
This commit is contained in:
parent
d55473d673
commit
30e5f7063b
14
ChangeLog
14
ChangeLog
|
@ -1,8 +1,20 @@
|
|||
2007-10-09 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/base/Makefile.am
|
||||
* app/base/tile.[ch]
|
||||
* app/base/tile-rowhints.[ch]: moved tile row hints code to its
|
||||
own file.
|
||||
|
||||
* app/base/tile-cache.c
|
||||
* app/base/tile-manager.c
|
||||
* app/base/tile-swap.c
|
||||
* app/paint-funcs/paint-funcs.c: changed accordingly.
|
||||
|
||||
2007-10-09 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimpitem.c
|
||||
* app/tools/gimprectangletool.c
|
||||
* app/tools/tools-utils.c: fixed gtk-doc comments.
|
||||
* app/tools/tools-utils.c: fixed ambiguous gtk-doc comments.
|
||||
|
||||
2007-10-09 Sven Neumann <sven@gimp.org>
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ libappbase_a_SOURCES = \
|
|||
tile-manager-private.h \
|
||||
tile-pyramid.c \
|
||||
tile-pyramid.h \
|
||||
tile-rowhints.c \
|
||||
tile-rowhints.h \
|
||||
tile-swap.c \
|
||||
tile-swap.h
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "tile.h"
|
||||
#include "tile-cache.h"
|
||||
#include "tile-swap.h"
|
||||
#include "tile-rowhints.h"
|
||||
#include "tile-private.h"
|
||||
|
||||
|
||||
|
|
|
@ -25,11 +25,12 @@
|
|||
#include "base-types.h"
|
||||
|
||||
#include "tile.h"
|
||||
#include "tile-private.h"
|
||||
#include "tile-cache.h"
|
||||
#include "tile-manager.h"
|
||||
#include "tile-manager-private.h"
|
||||
#include "tile-rowhints.h"
|
||||
#include "tile-swap.h"
|
||||
#include "tile-private.h"
|
||||
|
||||
|
||||
static inline gint
|
||||
|
|
263
app/base/tile-rowhints.c
Normal file
263
app/base/tile-rowhints.c
Normal file
|
@ -0,0 +1,263 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "base-types.h"
|
||||
|
||||
#include "tile.h"
|
||||
#include "tile-rowhints.h"
|
||||
#include "tile-private.h"
|
||||
|
||||
|
||||
/* Sanity checks on tile hinting code */
|
||||
/* #define HINTS_SANITY */
|
||||
|
||||
|
||||
void
|
||||
tile_allocate_rowhints (Tile *tile)
|
||||
{
|
||||
if (! tile->rowhint)
|
||||
tile->rowhint = g_slice_alloc0 (sizeof (TileRowHint) * TILE_HEIGHT);
|
||||
}
|
||||
|
||||
TileRowHint
|
||||
tile_get_rowhint (Tile *tile,
|
||||
gint yoff)
|
||||
{
|
||||
if (! tile->rowhint)
|
||||
return TILEROWHINT_UNKNOWN;
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
if (yoff < tile_eheight(tile) && yoff >= 0)
|
||||
{
|
||||
return tile->rowhint[yoff];
|
||||
}
|
||||
else
|
||||
{
|
||||
g_error ("GET_ROWHINT OUT OF RANGE");
|
||||
}
|
||||
|
||||
return TILEROWHINT_OUTOFRANGE;
|
||||
#else
|
||||
return tile->rowhint[yoff];
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
tile_set_rowhint (Tile *tile,
|
||||
gint yoff,
|
||||
TileRowHint rowhint)
|
||||
{
|
||||
#ifdef HINTS_SANITY
|
||||
if (yoff < tile_eheight (tile) && yoff >= 0)
|
||||
{
|
||||
tile->rowhint[yoff] = rowhint;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_error ("SET_ROWHINT OUT OF RANGE");
|
||||
}
|
||||
#else
|
||||
|
||||
tile->rowhint[yoff] = rowhint;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
tile_update_rowhints (Tile *tile,
|
||||
gint start,
|
||||
gint rows)
|
||||
{
|
||||
const guchar *ptr;
|
||||
gint bpp, ewidth;
|
||||
gint x, y;
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
g_assert (tile != NULL);
|
||||
#endif
|
||||
|
||||
tile_allocate_rowhints (tile);
|
||||
|
||||
bpp = tile_bpp (tile);
|
||||
ewidth = tile_ewidth (tile);
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
case 1:
|
||||
case 3:
|
||||
for (y = start; y < start + rows; y++)
|
||||
tile_set_rowhint (tile, y, TILEROWHINT_OPAQUE);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
#ifdef HINTS_SANITY
|
||||
g_assert (tile != NULL);
|
||||
#endif
|
||||
|
||||
ptr = tile_data_pointer (tile, 0, start);
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
g_assert (ptr != NULL);
|
||||
#endif
|
||||
|
||||
for (y = start; y < start + rows; y++)
|
||||
{
|
||||
TileRowHint hint = tile_get_rowhint (tile, y);
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
if (hint == TILEROWHINT_BROKEN)
|
||||
g_error ("BROKEN y=%d", y);
|
||||
if (hint == TILEROWHINT_OUTOFRANGE)
|
||||
g_error ("OOR y=%d", y);
|
||||
if (hint == TILEROWHINT_UNDEFINED)
|
||||
g_error ("UNDEFINED y=%d - bpp=%d ew=%d eh=%d",
|
||||
y, bpp, ewidth, eheight);
|
||||
#endif
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
if (hint == TILEROWHINT_TRANSPARENT ||
|
||||
hint == TILEROWHINT_MIXED ||
|
||||
hint == TILEROWHINT_OPAQUE)
|
||||
{
|
||||
goto next_row4;
|
||||
}
|
||||
|
||||
if (hint != TILEROWHINT_UNKNOWN)
|
||||
{
|
||||
g_error ("MEGABOGUS y=%d - bpp=%d ew=%d eh=%d",
|
||||
y, bpp, ewidth, eheight);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (hint == TILEROWHINT_UNKNOWN)
|
||||
{
|
||||
const guchar alpha = ptr[3];
|
||||
|
||||
/* row is all-opaque or all-transparent? */
|
||||
if (alpha == 0 || alpha == 255)
|
||||
{
|
||||
if (ewidth > 1)
|
||||
{
|
||||
for (x = 1; x < ewidth; x++)
|
||||
{
|
||||
if (ptr[x * 4 + 3] != alpha)
|
||||
{
|
||||
tile_set_rowhint (tile, y, TILEROWHINT_MIXED);
|
||||
goto next_row4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tile_set_rowhint (tile, y,
|
||||
(alpha == 0) ?
|
||||
TILEROWHINT_TRANSPARENT :
|
||||
TILEROWHINT_OPAQUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
tile_set_rowhint (tile, y, TILEROWHINT_MIXED);
|
||||
}
|
||||
}
|
||||
|
||||
next_row4:
|
||||
ptr += 4 * ewidth;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
#ifdef HINTS_SANITY
|
||||
g_assert (tile != NULL);
|
||||
#endif
|
||||
|
||||
ptr = tile_data_pointer (tile, 0, start);
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
g_assert (ptr != NULL);
|
||||
#endif
|
||||
|
||||
for (y = start; y < start + rows; y++)
|
||||
{
|
||||
TileRowHint hint = tile_get_rowhint (tile, y);
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
if (hint == TILEROWHINT_BROKEN)
|
||||
g_error ("BROKEN y=%d",y);
|
||||
if (hint == TILEROWHINT_OUTOFRANGE)
|
||||
g_error ("OOR y=%d",y);
|
||||
if (hint == TILEROWHINT_UNDEFINED)
|
||||
g_error ("UNDEFINED y=%d - bpp=%d ew=%d eh=%d",
|
||||
y, bpp, ewidth, eheight);
|
||||
#endif
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
if (hint == TILEROWHINT_TRANSPARENT ||
|
||||
hint == TILEROWHINT_MIXED ||
|
||||
hint == TILEROWHINT_OPAQUE)
|
||||
{
|
||||
goto next_row2;
|
||||
}
|
||||
|
||||
if (hint != TILEROWHINT_UNKNOWN)
|
||||
{
|
||||
g_error ("MEGABOGUS y=%d - bpp=%d ew=%d eh=%d",
|
||||
y, bpp, ewidth, eheight);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (hint == TILEROWHINT_UNKNOWN)
|
||||
{
|
||||
const guchar alpha = ptr[1];
|
||||
|
||||
/* row is all-opaque or all-transparent? */
|
||||
if (alpha == 0 || alpha == 255)
|
||||
{
|
||||
if (ewidth > 1)
|
||||
{
|
||||
for (x = 1; x < ewidth; x++)
|
||||
{
|
||||
if (ptr[x * 2 + 1] != alpha)
|
||||
{
|
||||
tile_set_rowhint (tile, y, TILEROWHINT_MIXED);
|
||||
goto next_row2;
|
||||
}
|
||||
}
|
||||
}
|
||||
tile_set_rowhint (tile, y,
|
||||
(alpha == 0) ?
|
||||
TILEROWHINT_TRANSPARENT :
|
||||
TILEROWHINT_OPAQUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
tile_set_rowhint (tile, y, TILEROWHINT_MIXED);
|
||||
}
|
||||
}
|
||||
|
||||
next_row2:
|
||||
ptr += 2 * ewidth;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_return_if_reached ();
|
||||
break;
|
||||
}
|
||||
}
|
49
app/base/tile-rowhints.h
Normal file
49
app/base/tile-rowhints.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __TILE_ROWHINTS_H__
|
||||
#define __TILE_ROWHINTS_H__
|
||||
|
||||
|
||||
/*
|
||||
* Explicit guchar type rather than enum since gcc chooses an int
|
||||
* representation but arrays of TileRowHints are quite space-critical
|
||||
* in GIMP.
|
||||
*/
|
||||
typedef guchar TileRowHint;
|
||||
|
||||
#define TILEROWHINT_UNKNOWN 0
|
||||
#define TILEROWHINT_OPAQUE 1
|
||||
#define TILEROWHINT_TRANSPARENT 2
|
||||
#define TILEROWHINT_MIXED 3
|
||||
#define TILEROWHINT_OUTOFRANGE 4
|
||||
#define TILEROWHINT_UNDEFINED 5
|
||||
#define TILEROWHINT_BROKEN 6
|
||||
|
||||
TileRowHint tile_get_rowhint (Tile *tile,
|
||||
gint yoff);
|
||||
void tile_set_rowhint (Tile *tile,
|
||||
gint yoff,
|
||||
TileRowHint rowhint);
|
||||
void tile_allocate_rowhints (Tile *tile);
|
||||
void tile_update_rowhints (Tile *tile,
|
||||
gint start,
|
||||
gint rows);
|
||||
|
||||
|
||||
#endif /* __TILE_ROWHINTS_H__ */
|
|
@ -49,8 +49,9 @@
|
|||
#endif
|
||||
|
||||
#include "tile.h"
|
||||
#include "tile-private.h"
|
||||
#include "tile-rowhints.h"
|
||||
#include "tile-swap.h"
|
||||
#include "tile-private.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
|
244
app/base/tile.c
244
app/base/tile.c
|
@ -23,10 +23,11 @@
|
|||
#include "base-types.h"
|
||||
|
||||
#include "tile.h"
|
||||
#include "tile-private.h"
|
||||
#include "tile-cache.h"
|
||||
#include "tile-manager.h"
|
||||
#include "tile-rowhints.h"
|
||||
#include "tile-swap.h"
|
||||
#include "tile-private.h"
|
||||
|
||||
|
||||
/* Uncomment for verbose debugging on copy-on-write logic */
|
||||
|
@ -35,9 +36,6 @@
|
|||
/* Uncomment to enable global counters to profile the tile system. */
|
||||
/* #define TILE_PROFILING */
|
||||
|
||||
/* Sanity checks on tile hinting code */
|
||||
/* #define HINTS_SANITY */
|
||||
|
||||
|
||||
/* This is being used from tile-swap, but just for debugging purposes. */
|
||||
static gint tile_ref_count = 0;
|
||||
|
@ -49,10 +47,8 @@ static gint tile_count = 0;
|
|||
static gint tile_share_count = 0;
|
||||
static gint tile_active_count = 0;
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
static gint tile_exist_peak = 0;
|
||||
static gint tile_exist_count = 0;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -60,237 +56,6 @@ static gint tile_exist_count = 0;
|
|||
static void tile_destroy (Tile *tile);
|
||||
|
||||
|
||||
void
|
||||
tile_allocate_rowhints (Tile *tile)
|
||||
{
|
||||
if (! tile->rowhint)
|
||||
tile->rowhint = g_slice_alloc0 (sizeof (TileRowHint) * TILE_HEIGHT);
|
||||
}
|
||||
|
||||
TileRowHint
|
||||
tile_get_rowhint (Tile *tile,
|
||||
gint yoff)
|
||||
{
|
||||
if (! tile->rowhint)
|
||||
return TILEROWHINT_UNKNOWN;
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
if (yoff < tile_eheight(tile) && yoff >= 0)
|
||||
{
|
||||
return tile->rowhint[yoff];
|
||||
}
|
||||
else
|
||||
{
|
||||
g_error ("GET_ROWHINT OUT OF RANGE");
|
||||
}
|
||||
|
||||
return TILEROWHINT_OUTOFRANGE;
|
||||
#else
|
||||
return tile->rowhint[yoff];
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
tile_set_rowhint (Tile *tile,
|
||||
gint yoff,
|
||||
TileRowHint rowhint)
|
||||
{
|
||||
#ifdef HINTS_SANITY
|
||||
if (yoff < tile_eheight(tile) && yoff >= 0)
|
||||
{
|
||||
tile->rowhint[yoff] = rowhint;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_error("SET_ROWHINT OUT OF RANGE");
|
||||
}
|
||||
#else
|
||||
|
||||
tile->rowhint[yoff] = rowhint;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
tile_update_rowhints (Tile *tile,
|
||||
gint start,
|
||||
gint rows)
|
||||
{
|
||||
const guchar *ptr;
|
||||
gint bpp, ewidth;
|
||||
gint x, y;
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
g_assert (tile != NULL);
|
||||
#endif
|
||||
|
||||
tile_allocate_rowhints (tile);
|
||||
|
||||
bpp = tile_bpp (tile);
|
||||
ewidth = tile_ewidth (tile);
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
case 1:
|
||||
case 3:
|
||||
for (y = start; y < start + rows; y++)
|
||||
tile_set_rowhint (tile, y, TILEROWHINT_OPAQUE);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
#ifdef HINTS_SANITY
|
||||
g_assert (tile != NULL);
|
||||
#endif
|
||||
|
||||
ptr = tile_data_pointer (tile, 0, start);
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
g_assert (ptr != NULL);
|
||||
#endif
|
||||
|
||||
for (y = start; y < start + rows; y++)
|
||||
{
|
||||
TileRowHint hint = tile_get_rowhint (tile, y);
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
if (hint == TILEROWHINT_BROKEN)
|
||||
g_error ("BROKEN y=%d", y);
|
||||
if (hint == TILEROWHINT_OUTOFRANGE)
|
||||
g_error ("OOR y=%d", y);
|
||||
if (hint == TILEROWHINT_UNDEFINED)
|
||||
g_error ("UNDEFINED y=%d - bpp=%d ew=%d eh=%d",
|
||||
y, bpp, ewidth, eheight);
|
||||
#endif
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
if (hint == TILEROWHINT_TRANSPARENT ||
|
||||
hint == TILEROWHINT_MIXED ||
|
||||
hint == TILEROWHINT_OPAQUE)
|
||||
{
|
||||
goto next_row4;
|
||||
}
|
||||
|
||||
if (hint != TILEROWHINT_UNKNOWN)
|
||||
{
|
||||
g_error ("MEGABOGUS y=%d - bpp=%d ew=%d eh=%d",
|
||||
y, bpp, ewidth, eheight);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (hint == TILEROWHINT_UNKNOWN)
|
||||
{
|
||||
const guchar alpha = ptr[3];
|
||||
|
||||
/* row is all-opaque or all-transparent? */
|
||||
if (alpha == 0 || alpha == 255)
|
||||
{
|
||||
if (ewidth > 1)
|
||||
{
|
||||
for (x = 1; x < ewidth; x++)
|
||||
{
|
||||
if (ptr[x * 4 + 3] != alpha)
|
||||
{
|
||||
tile_set_rowhint (tile, y, TILEROWHINT_MIXED);
|
||||
goto next_row4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tile_set_rowhint (tile, y,
|
||||
(alpha == 0) ?
|
||||
TILEROWHINT_TRANSPARENT :
|
||||
TILEROWHINT_OPAQUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
tile_set_rowhint (tile, y, TILEROWHINT_MIXED);
|
||||
}
|
||||
}
|
||||
|
||||
next_row4:
|
||||
ptr += 4 * ewidth;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
#ifdef HINTS_SANITY
|
||||
g_assert (tile != NULL);
|
||||
#endif
|
||||
|
||||
ptr = tile_data_pointer (tile, 0, start);
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
g_assert (ptr != NULL);
|
||||
#endif
|
||||
|
||||
for (y = start; y < start + rows; y++)
|
||||
{
|
||||
TileRowHint hint = tile_get_rowhint (tile, y);
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
if (hint == TILEROWHINT_BROKEN)
|
||||
g_error ("BROKEN y=%d",y);
|
||||
if (hint == TILEROWHINT_OUTOFRANGE)
|
||||
g_error ("OOR y=%d",y);
|
||||
if (hint == TILEROWHINT_UNDEFINED)
|
||||
g_error ("UNDEFINED y=%d - bpp=%d ew=%d eh=%d",
|
||||
y, bpp, ewidth, eheight);
|
||||
#endif
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
if (hint == TILEROWHINT_TRANSPARENT ||
|
||||
hint == TILEROWHINT_MIXED ||
|
||||
hint == TILEROWHINT_OPAQUE)
|
||||
{
|
||||
goto next_row2;
|
||||
}
|
||||
|
||||
if (hint != TILEROWHINT_UNKNOWN)
|
||||
{
|
||||
g_error ("MEGABOGUS y=%d - bpp=%d ew=%d eh=%d",
|
||||
y, bpp, ewidth, eheight);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (hint == TILEROWHINT_UNKNOWN)
|
||||
{
|
||||
const guchar alpha = ptr[1];
|
||||
|
||||
/* row is all-opaque or all-transparent? */
|
||||
if (alpha == 0 || alpha == 255)
|
||||
{
|
||||
if (ewidth > 1)
|
||||
{
|
||||
for (x = 1; x < ewidth; x++)
|
||||
{
|
||||
if (ptr[x * 2 + 1] != alpha)
|
||||
{
|
||||
tile_set_rowhint (tile, y, TILEROWHINT_MIXED);
|
||||
goto next_row2;
|
||||
}
|
||||
}
|
||||
}
|
||||
tile_set_rowhint (tile, y,
|
||||
(alpha == 0) ?
|
||||
TILEROWHINT_TRANSPARENT :
|
||||
TILEROWHINT_OPAQUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
tile_set_rowhint (tile, y, TILEROWHINT_MIXED);
|
||||
}
|
||||
}
|
||||
|
||||
next_row2:
|
||||
ptr += 2 * ewidth;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_return_if_reached ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Tile *
|
||||
tile_new (gint bpp)
|
||||
{
|
||||
|
@ -406,12 +171,10 @@ tile_alloc (Tile *tile)
|
|||
tile->data = g_new (guchar, tile->size);
|
||||
|
||||
#ifdef TILE_PROFILING
|
||||
#ifdef HINTS_SANITY
|
||||
tile_exist_count++;
|
||||
if (tile_exist_count > tile_exist_peak)
|
||||
tile_exist_peak = tile_exist_count;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -452,11 +215,8 @@ tile_destroy (Tile *tile)
|
|||
#ifdef TILE_PROFILING
|
||||
tile_count--;
|
||||
|
||||
#ifdef HINTS_SANITY
|
||||
tile_exist_count--;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
gint
|
||||
|
|
|
@ -24,24 +24,9 @@
|
|||
#define TILE_HEIGHT 64
|
||||
|
||||
|
||||
/* explicit guchar type rather than enum since gcc chooses an int
|
||||
* representation but arrays of TileRowHints are quite space-critical
|
||||
* in GIMP.
|
||||
*/
|
||||
typedef guchar TileRowHint;
|
||||
|
||||
#define TILEROWHINT_UNKNOWN 0
|
||||
#define TILEROWHINT_OPAQUE 1
|
||||
#define TILEROWHINT_TRANSPARENT 2
|
||||
#define TILEROWHINT_MIXED 3
|
||||
#define TILEROWHINT_OUTOFRANGE 4
|
||||
#define TILEROWHINT_UNDEFINED 5
|
||||
#define TILEROWHINT_BROKEN 6
|
||||
|
||||
|
||||
/* Returns a newly allocated Tile with all fields initialized to "good" values.
|
||||
*/
|
||||
Tile * tile_new (gint bpp);
|
||||
Tile * tile_new (gint bpp);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -53,37 +38,27 @@ Tile * tile_new (gint bpp);
|
|||
* write access. (This is a hack, and should be handled better.)
|
||||
*/
|
||||
|
||||
void tile_lock (Tile *tile);
|
||||
void tile_release (Tile *tile,
|
||||
gboolean dirty);
|
||||
void tile_lock (Tile *tile);
|
||||
void tile_release (Tile *tile,
|
||||
gboolean dirty);
|
||||
|
||||
/* Allocate the data for the tile.
|
||||
*/
|
||||
void tile_alloc (Tile *tile);
|
||||
void tile_alloc (Tile *tile);
|
||||
|
||||
/* Return the size in bytes of the tiles data.
|
||||
*/
|
||||
gint tile_size (Tile *tile);
|
||||
gint tile_size (Tile *tile);
|
||||
|
||||
gint tile_ewidth (Tile *tile);
|
||||
gint tile_eheight (Tile *tile);
|
||||
gint tile_bpp (Tile *tile);
|
||||
gint tile_ewidth (Tile *tile);
|
||||
gint tile_eheight (Tile *tile);
|
||||
gint tile_bpp (Tile *tile);
|
||||
|
||||
gboolean tile_is_valid (Tile *tile);
|
||||
gboolean tile_is_valid (Tile *tile);
|
||||
|
||||
TileRowHint tile_get_rowhint (Tile *tile,
|
||||
gint yoff);
|
||||
void tile_set_rowhint (Tile *tile,
|
||||
gint yoff,
|
||||
TileRowHint rowhint);
|
||||
void tile_allocate_rowhints (Tile *tile);
|
||||
void tile_update_rowhints (Tile *tile,
|
||||
gint start,
|
||||
gint rows);
|
||||
|
||||
void * tile_data_pointer (Tile *tile,
|
||||
gint xoff,
|
||||
gint yoff);
|
||||
void * tile_data_pointer (Tile *tile,
|
||||
gint xoff,
|
||||
gint yoff);
|
||||
|
||||
gint tile_global_refcount (void);
|
||||
|
||||
|
@ -94,12 +69,12 @@ gint tile_global_refcount (void);
|
|||
* discarded.
|
||||
*/
|
||||
|
||||
void tile_attach (Tile *tile,
|
||||
void *tm,
|
||||
gint tile_num);
|
||||
void tile_detach (Tile *tile,
|
||||
void *tm,
|
||||
gint tile_num);
|
||||
void tile_attach (Tile *tile,
|
||||
void *tm,
|
||||
gint tile_num);
|
||||
void tile_detach (Tile *tile,
|
||||
void *tm,
|
||||
gint tile_num);
|
||||
|
||||
|
||||
#endif /* __TILE_H__ */
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "base/pixel-region.h"
|
||||
#include "base/temp-buf.h"
|
||||
#include "base/tile-manager.h"
|
||||
#include "base/tile-rowhints.h"
|
||||
#include "base/tile.h"
|
||||
|
||||
#include "composite/gimp-composite.h"
|
||||
|
|
Loading…
Reference in a new issue