summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2017-03-20 16:57:33 -0400
committerRobin Watts <Robin.Watts@artifex.com>2017-03-20 17:11:50 -0400
commit87b0a4d253ab1549b351389f658238fe32a28da1 (patch)
treecf5339c58dd4f3eb4ccccb05567362322d82a22f
parent19773c2cd9fd554ba2a2ce188a4f550cbdc2fa39 (diff)
downloadmupdf-87b0a4d253ab1549b351389f658238fe32a28da1.tar.xz
Remove fz_drop_image_base.
-rw-r--r--include/mupdf/fitz/image.h9
-rw-r--r--include/mupdf/fitz/store.h2
-rw-r--r--source/fitz/image.c21
-rw-r--r--source/fitz/store.c5
-rw-r--r--source/gprf/gprf-doc.c1
5 files changed, 10 insertions, 28 deletions
diff --git a/include/mupdf/fitz/image.h b/include/mupdf/fitz/image.h
index 92f7e853..fe68fb31 100644
--- a/include/mupdf/fitz/image.h
+++ b/include/mupdf/fitz/image.h
@@ -52,15 +52,6 @@ fz_pixmap *fz_get_pixmap_from_image(fz_context *ctx, fz_image *image, const fz_i
void fz_drop_image(fz_context *ctx, fz_image *image);
/*
- fz_drop_image_base: Drop a reference to the base class
- of an image (for internal use in derived image classes
- only).
-
- image: The image to drop a reference to.
-*/
-void fz_drop_image_base(fz_context *ctx, fz_image *image);
-
-/*
fz_keep_image: Increment the reference count of an image.
image: The image to take a reference to.
diff --git a/include/mupdf/fitz/store.h b/include/mupdf/fitz/store.h
index 15d550be..f081e987 100644
--- a/include/mupdf/fitz/store.h
+++ b/include/mupdf/fitz/store.h
@@ -56,7 +56,7 @@ void *fz_keep_storable(fz_context *, const fz_storable *);
void fz_drop_storable(fz_context *, const fz_storable *);
void *fz_keep_key_storable(fz_context *, const fz_key_storable *);
-void fz_drop_key_storable(fz_context *, const fz_key_storable *);
+int fz_drop_key_storable(fz_context *, const fz_key_storable *);
void *fz_keep_key_storable_key(fz_context *, const fz_key_storable *);
void fz_drop_key_storable_key(fz_context *, const fz_key_storable *);
diff --git a/source/fitz/image.c b/source/fitz/image.c
index 58cd876d..261c9f09 100644
--- a/source/fitz/image.c
+++ b/source/fitz/image.c
@@ -109,7 +109,12 @@ static fz_store_type fz_image_store_type =
void
fz_drop_image(fz_context *ctx, fz_image *image)
{
- fz_drop_key_storable(ctx, &image->key_storable);
+ if (fz_drop_key_storable(ctx, &image->key_storable))
+ {
+ fz_drop_colorspace(ctx, image->colorspace);
+ fz_drop_image(ctx, image->mask);
+ fz_free(ctx, image);
+ }
}
static void
@@ -373,17 +378,6 @@ fz_drop_image_imp(fz_context *ctx, fz_storable *image_)
image->drop_image(ctx, image);
}
-void
-fz_drop_image_base(fz_context *ctx, fz_image *image)
-{
- if (!image)
- return;
-
- fz_drop_colorspace(ctx, image->colorspace);
- fz_drop_image(ctx, image->mask);
- fz_free(ctx, image);
-}
-
static void
drop_compressed_image(fz_context *ctx, fz_image *image_)
{
@@ -391,7 +385,6 @@ drop_compressed_image(fz_context *ctx, fz_image *image_)
fz_drop_pixmap(ctx, image->tile);
fz_drop_compressed_buffer(ctx, image->buffer);
- fz_drop_image_base(ctx, &image->super);
}
static void
@@ -400,7 +393,6 @@ drop_pixmap_image(fz_context *ctx, fz_image *image_)
fz_pixmap_image *image = (fz_pixmap_image *)image_;
fz_drop_pixmap(ctx, image->tile);
- fz_drop_image_base(ctx, &image->super);
}
static fz_pixmap *
@@ -1089,7 +1081,6 @@ static void drop_display_list_image(fz_context *ctx, fz_image *image_)
if (image == NULL)
return;
fz_drop_display_list(ctx, image->list);
- fz_drop_image_base(ctx, &image->super);
}
static size_t
diff --git a/source/fitz/store.c b/source/fitz/store.c
index b3996686..620bf0ea 100644
--- a/source/fitz/store.c
+++ b/source/fitz/store.c
@@ -168,7 +168,7 @@ do_reap(fz_context *ctx)
}
}
-void fz_drop_key_storable(fz_context *ctx, const fz_key_storable *sc)
+int fz_drop_key_storable(fz_context *ctx, const fz_key_storable *sc)
{
/* Explicitly drop const to allow us to use const
* sanely throughout the code. */
@@ -177,7 +177,7 @@ void fz_drop_key_storable(fz_context *ctx, const fz_key_storable *sc)
int unlock = 1;
if (s == NULL)
- return;
+ return 0;
if (s->storable.refs > 0)
(void)Memento_dropRef(s);
@@ -211,6 +211,7 @@ void fz_drop_key_storable(fz_context *ctx, const fz_key_storable *sc)
*/
if (drop)
s->storable.drop(ctx, &s->storable);
+ return drop;
}
void *fz_keep_key_storable_key(fz_context *ctx, const fz_key_storable *sc)
diff --git a/source/gprf/gprf-doc.c b/source/gprf/gprf-doc.c
index 0a831441..83519982 100644
--- a/source/gprf/gprf-doc.c
+++ b/source/gprf/gprf-doc.c
@@ -175,7 +175,6 @@ fz_drop_image_gprf_imp(fz_context *ctx, fz_storable *image_)
fz_drop_gprf_file(ctx, image->file);
fz_drop_separations(ctx, image->separations);
- fz_drop_image_base(ctx, &image->super);
}
static inline unsigned char *cmyk_to_rgba(unsigned char *out, uint32_t c, uint32_t m, uint32_t y, uint32_t k)