summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-07-08 21:56:32 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-07-13 12:35:50 +0100
commitaf71e7717e3eb89f6ebaa6b43b1267341dc15116 (patch)
treeab6e458df36706b4aaa9ad35d009bed2ced29ae6
parentcc3e4c6ec96c3319abaae889198f0fbab8e1f90d (diff)
png: Fix support of depth-30 images
Rename the variable depth to bpc to prevent future confusion. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/cairo-png.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/cairo-png.c b/src/cairo-png.c
index e176043d..5cb132e0 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -178,7 +178,7 @@ write_png (cairo_surface_t *surface,
png_byte **volatile rows = NULL;
png_color_16 white;
int png_color_type;
- int depth;
+ int bpc;
status = _cairo_surface_acquire_source_image (surface,
&image,
@@ -235,26 +235,26 @@ write_png (cairo_surface_t *surface,
switch (clone->format) {
case CAIRO_FORMAT_ARGB32:
- depth = 8;
+ bpc = 8;
if (_cairo_image_analyze_transparency (clone) == CAIRO_IMAGE_IS_OPAQUE)
png_color_type = PNG_COLOR_TYPE_RGB;
else
png_color_type = PNG_COLOR_TYPE_RGB_ALPHA;
break;
case CAIRO_FORMAT_RGB30:
- depth = 30;
+ bpc = 10;
png_color_type = PNG_COLOR_TYPE_RGB;
break;
case CAIRO_FORMAT_RGB24:
- depth = 8;
+ bpc = 8;
png_color_type = PNG_COLOR_TYPE_RGB;
break;
case CAIRO_FORMAT_A8:
- depth = 8;
+ bpc = 8;
png_color_type = PNG_COLOR_TYPE_GRAY;
break;
case CAIRO_FORMAT_A1:
- depth = 1;
+ bpc = 1;
png_color_type = PNG_COLOR_TYPE_GRAY;
#ifndef WORDS_BIGENDIAN
png_set_packswap (png);
@@ -269,13 +269,13 @@ write_png (cairo_surface_t *surface,
png_set_IHDR (png, info,
clone->width,
- clone->height, depth,
+ clone->height, bpc,
png_color_type,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT,
PNG_FILTER_TYPE_DEFAULT);
- white.gray = (1 << depth) - 1;
+ white.gray = (1 << bpc) - 1;
white.red = white.blue = white.green = white.gray;
png_set_bKGD (png, info, &white);