summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2008-12-29 12:36:52 -0300
committerJorge Arellano Cid <jcid@dillo.org>2008-12-29 12:36:52 -0300
commit898a112f2620bb7ea9d52763efb8755c49ff59e4 (patch)
treeaf64a114cac30151dca58e577b8f08833424d4a1 /src
parent518b3517461eb9b298b515cc505b96c09cdd4b4a (diff)
imported patch dicache-cleanup3
Diffstat (limited to 'src')
-rw-r--r--src/dicache.c20
-rw-r--r--src/dicache.h1
-rw-r--r--src/image.cc5
-rw-r--r--src/image.hh3
4 files changed, 9 insertions, 20 deletions
diff --git a/src/dicache.c b/src/dicache.c
index 3aee798e..20893ed9 100644
--- a/src/dicache.c
+++ b/src/dicache.c
@@ -80,7 +80,6 @@ static DICacheEntry *Dicache_entry_new(void)
entry->height = 0;
entry->type = DILLO_IMG_TYPE_NOTSET;
entry->cmap = NULL;
- entry->linebuf = NULL;
entry->v_imgbuf = NULL;
entry->RefCount = 1;
entry->TotalSize = 0;
@@ -191,7 +190,6 @@ static void Dicache_remove(const DilloUrl *Url, int version)
if (entry) {
/* Eliminate this dicache entry */
dFree(entry->cmap);
- dFree(entry->linebuf);
a_Bitvec_free(entry->BitVec);
a_Imgbuf_unref(entry->v_imgbuf);
dicache_size_total -= entry->TotalSize;
@@ -271,6 +269,7 @@ void a_Dicache_callback(int Op, CacheClient_t *Client)
if (DicEntry->State < DIC_Close &&
DicEntry->DecodedSize < Client->BufSize) {
DicEntry->Decoder(Op, Client);
+ DicEntry->DecodedSize = Client->BufSize; /* necessary ?? */
}
/* when the data stream is not an image 'v_imgbuf' remains NULL */
@@ -287,15 +286,13 @@ void a_Dicache_callback(int Op, CacheClient_t *Client)
for (i = 0; i < DicEntry->height; ++i)
if (a_Bitvec_get_bit(DicEntry->BitVec, (int)i) &&
!a_Bitvec_get_bit(Image->BitVec, (int)i) )
- a_Image_write(Image, DicEntry->v_imgbuf,
- DicEntry->linebuf, i, FALSE);
+ a_Image_write(Image, i);
} else {
for (i = 0; i < DicEntry->height; ++i) {
if (a_Bitvec_get_bit(DicEntry->BitVec, (int)i) ||
!a_Bitvec_get_bit(Image->BitVec, (int)i) ||
DicEntry->ScanNumber > Image->ScanNumber + 1) {
- a_Image_write(Image, DicEntry->v_imgbuf,
- DicEntry->linebuf, i, FALSE);
+ a_Image_write(Image, i);
}
if (!a_Bitvec_get_bit(DicEntry->BitVec, (int)i))
a_Bitvec_clear_bit(Image->BitVec, (int)i);
@@ -320,7 +317,7 @@ void a_Dicache_set_parms(DilloUrl *url, int version, DilloImage *Image,
{
DICacheEntry *DicEntry;
- MSG("a_Dicache_set_parms\n");
+ MSG("a_Dicache_set_parms (%s)\n", URL_STR(url));
dReturn_if_fail ( Image != NULL && width && height );
/* Find the DicEntry for this Image */
DicEntry = Dicache_get_entry_version(url, version);
@@ -328,9 +325,7 @@ void a_Dicache_set_parms(DilloUrl *url, int version, DilloImage *Image,
/* Parameters already set? */
dReturn_if_fail ( DicEntry->State < DIC_SetParms );
- /* Initialize the DicEntry */
- DicEntry->linebuf = dNew(uchar_t, width * 3);
- dReturn_if_fail ( DicEntry->linebuf != NULL );
+ MSG(" RefCount=%d version=%d\n", DicEntry->RefCount, DicEntry->version);
/* BUG: there's just one image-type now */
#define I_RGB 0
@@ -399,7 +394,7 @@ void a_Dicache_write(DilloImage *Image, DilloUrl *url, int version,
{
DICacheEntry *DicEntry;
- MSG("a_Dicache_write\n");
+ _MSG("a_Dicache_write\n");
dReturn_if_fail ( Image != NULL );
DicEntry = Dicache_get_entry_version(url, version);
dReturn_if_fail ( DicEntry != NULL );
@@ -428,8 +423,6 @@ void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client)
DicEntry->State = DIC_Close;
dFree(DicEntry->cmap);
DicEntry->cmap = NULL;
- dFree(DicEntry->linebuf);
- DicEntry->linebuf = NULL;
a_Bw_close_client(Web->bw, Client->Key);
}
@@ -477,7 +470,6 @@ void a_Dicache_freeall(void)
while ((entry = node->first)) {
node->first = entry->next;
dFree(entry->cmap);
- dFree(entry->linebuf);
a_Bitvec_free(entry->BitVec);
a_Imgbuf_unref(entry->v_imgbuf);
dicache_size_total -= entry->TotalSize;
diff --git a/src/dicache.h b/src/dicache.h
index faec2b07..4c4b93d6 100644
--- a/src/dicache.h
+++ b/src/dicache.h
@@ -27,7 +27,6 @@ struct _DICacheEntry {
uint_t width, height; /* As taken from image data */
DilloImgType type; /* Image type */
uchar_t *cmap; /* Color map */
- uchar_t *linebuf; /* Decompressed RGB buffer for one line */
void *v_imgbuf; /* Void pointer to an Imgbuf object */
uint_t TotalSize; /* Amount of memory the image takes up */
int Y; /* Current decoding row */
diff --git a/src/image.cc b/src/image.cc
index 3cb12eb0..cc41bc7c 100644
--- a/src/image.cc
+++ b/src/image.cc
@@ -128,10 +128,9 @@ void a_Image_new_scan(DilloImage *Image, void *v_imgbuf)
/*
* Implement the write method
*/
-void a_Image_write(DilloImage *Image, void *v_imgbuf,
- const uchar_t *buf, uint_t y, int decode)
+void a_Image_write(DilloImage *Image, uint_t y)
{
- MSG("a_Image_write\n");
+ _MSG("a_Image_write\n");
dReturn_if_fail ( y < Image->height );
/* Update the row in DwImage */
diff --git a/src/image.hh b/src/image.hh
index beccfb21..ea649ebc 100644
--- a/src/image.hh
+++ b/src/image.hh
@@ -63,8 +63,7 @@ void a_Image_set_parms(DilloImage *Image, void *v_imgbuf, DilloUrl *url,
DilloImgType type);
void a_Image_set_cmap(DilloImage *Image, const uchar_t *cmap);
void a_Image_new_scan(DilloImage *image, void *v_imgbuf);
-void a_Image_write(DilloImage *Image, void *v_imgbuf,
- const uchar_t *buf, uint_t y, int decode);
+void a_Image_write(DilloImage *Image, uint_t y);
void a_Image_close(DilloImage *Image);
void a_Image_imgbuf_ref(void *v_imgbuf);