~ubuntu-branches/ubuntu/jaunty/ghostscript/jaunty-updates

« back to all changes in this revision

Viewing changes to base/gximage.c

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2009-01-20 16:40:45 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090120164045-lnfhi0n30o5lwhwa
Tags: 8.64.dfsg.1~svn9377-0ubuntu1
* New upstream release (SVN rev 9377)
   o Fixes many bugs concerning PDF rendering, to make the PDF printing
     workflow correctly working.
   o Fixes long-standing bugs in many drivers, like input paper tray and
     duplex options not working for the built-in PCL 4, 5, 5c, 5e, and
     6/XL drivers, PDF input not working for bjc600, bjc800, and cups
     output devices, several options not working and uninitialized
     memory with cups output device.
   o Merged nearly all patches of the Ubuntu and Debian packages upstream.
   o Fixes LP: #317810, LP: #314439, LP: #314018.
* debian/patches/03_libpaper_support.dpatch,
  debian/patches/11_gs-cjk_font_glyph_handling_fix.dpatch,
  debian/patches/12_gs-cjk_vertical_writing_metrics_fix.dpatch,
  debian/patches/13_gs-cjk_cjkps_examples.dpatch,
  debian/patches/20_bbox_segv_fix.dpatch,
  debian/patches/21_brother_7x0_gdi_fix.dpatch,
  debian/patches/22_epsn_margin_workaround.dpatch,
  debian/patches/24_gs_man_fix.dpatch,
  debian/patches/25_toolbin_insecure_tmp_usage_fix.dpatch,
  debian/patches/26_assorted_script_fixes.dpatch,
  debian/patches/29_gs_css_fix.dpatch,
  debian/patches/30_ps2pdf_man_improvement.dpatch,
  debian/patches/31_fix-gc-sigbus.dpatch,
  debian/patches/34_ftbfs-on-hurd-fix.dpatch,
  debian/patches/35_disable_libcairo.dpatch,
  debian/patches/38_pxl-duplex.dpatch,
  debian/patches/39_pxl-resolution.dpatch,
  debian/patches/42_gs-init-ps-delaybind-fix.dpatch,
  debian/patches/45_bjc600-bjc800-pdf-input.dpatch,
  debian/patches/48_cups-output-device-pdf-duplex-uninitialized-memory-fix.dpatch,
  debian/patches/50_lips4-floating-point-exception.dpatch,
  debian/patches/52_cups-device-logging.dpatch,
  debian/patches/55_pcl-input-slot-fix.dpatch,
  debian/patches/57_pxl-input-slot-fix.dpatch,
  debian/patches/60_pxl-cups-driver-pdf.dpatch,
  debian/patches/62_onebitcmyk-pdf.dpatch,
  debian/patches/65_too-big-temp-files-1.dpatch,
  debian/patches/67_too-big-temp-files-2.dpatch,
  debian/patches/70_take-into-account-data-in-stream-buffer-before-refill.dpatch:
  Removed, applied upstream.
* debian/patches/01_docdir_fix_for_debian.dpatch,
  debian/patches/02_gs_man_fix_debian.dpatch,
  debian/patches/01_docdir-fix-for-debian.dpatch,
  debian/patches/02_docdir-fix-for-debian.dpatch: Renamed patches to
  make merging with Debian easier.
* debian/patches/32_improve-handling-of-media-size-changes-from-gv.dpatch, 
  debian/patches/33_bad-params-to-xinitimage-on-large-bitmaps.dpatch:
  regenerated for new source directory structure.
* debian/rules: Corrected paths to remove cidfmap (it is in Resource/Init/
  in GS 8.64) and to install headers (source paths are psi/ and base/ now).
* debian/rules: Remove all fontmaps, as DeFoMa replaces them.
* debian/local/pdftoraster/pdftoraster.c,
  debian/local/pdftoraster/pdftoraster.convs, debian/rules: Removed
  added pdftoraster filter and use the one which comes with Ghostscript.
* debian/ghostscript.links: s/8.63/8.64/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
 
2
   All Rights Reserved.
 
3
  
 
4
   This software is provided AS-IS with no warranty, either express or
 
5
   implied.
 
6
 
 
7
   This software is distributed under license and may not be copied, modified
 
8
   or distributed except as expressly authorized under the terms of that
 
9
   license.  Refer to licensing information at http://www.artifex.com/
 
10
   or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
 
11
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
 
12
*/
 
13
 
 
14
/* $Id: gximage.c 8767 2008-05-21 19:46:47Z giles $ */
 
15
/* Generic image support */
 
16
#include "memory_.h"
 
17
#include "gx.h"
 
18
#include "gscspace.h"
 
19
#include "gserrors.h"
 
20
#include "gsmatrix.h"
 
21
#include "gsutil.h"
 
22
#include "gxcolor2.h"           /* for lookup map */
 
23
#include "gxiparam.h"
 
24
#include "stream.h"
 
25
 
 
26
/* ---------------- Generic image support ---------------- */
 
27
 
 
28
/* Structure descriptors */
 
29
public_st_gs_image_common();
 
30
public_st_gs_data_image();
 
31
public_st_gs_pixel_image();
 
32
 
 
33
/* Initialize the common parts of image structures. */
 
34
void
 
35
gs_image_common_t_init(gs_image_common_t * pic)
 
36
{
 
37
    gs_make_identity(&pic->ImageMatrix);
 
38
}
 
39
void
 
40
gs_data_image_t_init(gs_data_image_t * pim, int num_components)
 
41
{
 
42
    int i;
 
43
 
 
44
    gs_image_common_t_init((gs_image_common_t *) pim);
 
45
    pim->Width = pim->Height = 0;
 
46
    pim->BitsPerComponent = 1;
 
47
    if (num_components >= 0) {
 
48
        for (i = 0; i < num_components * 2; i += 2)
 
49
            pim->Decode[i] = 0, pim->Decode[i + 1] = 1;
 
50
    } else {
 
51
        for (i = 0; i < num_components * -2; i += 2)
 
52
            pim->Decode[i] = 1, pim->Decode[i + 1] = 0;
 
53
    }
 
54
    pim->Interpolate = false;
 
55
}
 
56
void
 
57
gs_pixel_image_t_init(gs_pixel_image_t * pim,
 
58
                      gs_color_space * color_space)
 
59
{
 
60
    int num_components;
 
61
 
 
62
    if (color_space == 0 ||
 
63
        (num_components =
 
64
         gs_color_space_num_components(color_space)) < 0
 
65
        )
 
66
        num_components = 0;
 
67
    gs_data_image_t_init((gs_data_image_t *) pim, num_components);
 
68
    pim->format = gs_image_format_chunky;
 
69
    pim->ColorSpace = color_space;
 
70
    pim->CombineWithColor = false;
 
71
}
 
72
 
 
73
/* Initialize the common part of an image-processing enumerator. */
 
74
int
 
75
gx_image_enum_common_init(gx_image_enum_common_t * piec,
 
76
                          const gs_data_image_t * pic,
 
77
                          const gx_image_enum_procs_t * piep,
 
78
                          gx_device * dev, int num_components,
 
79
                          gs_image_format_t format)
 
80
{
 
81
    int bpc = pic->BitsPerComponent;
 
82
    int i;
 
83
 
 
84
    piec->image_type = pic->type;
 
85
    piec->procs = piep;
 
86
    piec->dev = dev;
 
87
    piec->id = gs_next_ids(dev->memory, 1);
 
88
    piec->skipping = false;
 
89
    switch (format) {
 
90
        case gs_image_format_chunky:
 
91
            piec->num_planes = 1;
 
92
            piec->plane_depths[0] = bpc * num_components;
 
93
            break;
 
94
        case gs_image_format_component_planar:
 
95
            piec->num_planes = num_components;
 
96
            for (i = 0; i < num_components; ++i)
 
97
                piec->plane_depths[i] = bpc;
 
98
            break;
 
99
        case gs_image_format_bit_planar:
 
100
            piec->num_planes = bpc * num_components;
 
101
            for (i = 0; i < piec->num_planes; ++i)
 
102
                piec->plane_depths[i] = 1;
 
103
            break;
 
104
        default:
 
105
            return_error(gs_error_rangecheck);
 
106
    }
 
107
    for (i = 0; i < piec->num_planes; ++i)
 
108
        piec->plane_widths[i] = pic->Width;
 
109
    return 0;
 
110
}
 
111
 
 
112
/* Compute the source size of an ordinary image with explicit data. */
 
113
int
 
114
gx_data_image_source_size(const gs_imager_state * pis,
 
115
                          const gs_image_common_t * pim, gs_int_point * psize)
 
116
{
 
117
    const gs_data_image_t *pdi = (const gs_data_image_t *)pim;
 
118
 
 
119
    psize->x = pdi->Width;
 
120
    psize->y = pdi->Height;
 
121
    return 0;
 
122
}
 
123
 
 
124
/* Process the next piece of an image with no source data. */
 
125
/* This procedure should never be called. */
 
126
int
 
127
gx_no_plane_data(gx_image_enum_common_t * info,
 
128
                 const gx_image_plane_t * planes, int height,
 
129
                 int *height_used)
 
130
{
 
131
    return_error(gs_error_Fatal);
 
132
}
 
133
 
 
134
/* Clean up after processing an image with no source data. */
 
135
/* This procedure may be called, but should do nothing. */
 
136
int
 
137
gx_ignore_end_image(gx_image_enum_common_t * info, bool draw_last)
 
138
{
 
139
    return 0;
 
140
}
 
141
 
 
142
/* ---------------- Client procedures ---------------- */
 
143
 
 
144
int
 
145
gx_image_data(gx_image_enum_common_t * info, const byte ** plane_data,
 
146
              int data_x, uint raster, int height)
 
147
{
 
148
    int num_planes = info->num_planes;
 
149
    gx_image_plane_t planes[GS_IMAGE_MAX_COMPONENTS];
 
150
    int i;
 
151
 
 
152
#ifdef DEBUG
 
153
    if (num_planes > GS_IMAGE_MAX_COMPONENTS) {
 
154
        lprintf2("num_planes=%d > GS_IMAGE_MAX_COMPONENTS=%d!\n",
 
155
                 num_planes, GS_IMAGE_MAX_COMPONENTS);
 
156
        return_error(gs_error_Fatal);
 
157
    }
 
158
#endif
 
159
    for (i = 0; i < num_planes; ++i) {
 
160
        planes[i].data = plane_data[i];
 
161
        planes[i].data_x = data_x;
 
162
        planes[i].raster = raster;
 
163
    }
 
164
    return gx_image_plane_data(info, planes, height);
 
165
}
 
166
 
 
167
int
 
168
gx_image_plane_data(gx_image_enum_common_t * info,
 
169
                    const gx_image_plane_t * planes, int height)
 
170
{
 
171
    int ignore_rows_used;
 
172
 
 
173
    return gx_image_plane_data_rows(info, planes, height, &ignore_rows_used);
 
174
}
 
175
 
 
176
int
 
177
gx_image_plane_data_rows(gx_image_enum_common_t * info,
 
178
                         const gx_image_plane_t * planes, int height,
 
179
                         int *rows_used)
 
180
{
 
181
    return info->procs->plane_data(info, planes, height, rows_used);
 
182
}
 
183
 
 
184
int
 
185
gx_image_flush(gx_image_enum_common_t * info)
 
186
{
 
187
    int (*flush)(gx_image_enum_common_t *) = info->procs->flush;
 
188
 
 
189
    return (flush ? flush(info) : 0);
 
190
}
 
191
 
 
192
bool
 
193
gx_image_planes_wanted(const gx_image_enum_common_t *info, byte *wanted)
 
194
{
 
195
    bool (*planes_wanted)(const gx_image_enum_common_t *, byte *) =
 
196
        info->procs->planes_wanted;
 
197
 
 
198
    if (planes_wanted)
 
199
        return planes_wanted(info, wanted);
 
200
    else {
 
201
        memset(wanted, 0xff, info->num_planes);
 
202
        return true;
 
203
    }
 
204
}
 
205
 
 
206
int
 
207
gx_image_end(gx_image_enum_common_t * info, bool draw_last)
 
208
{
 
209
    return info->procs->end_image(info, draw_last);
 
210
}
 
211
 
 
212
/* ---------------- Serialization ---------------- */
 
213
 
 
214
/*
 
215
 * Define dummy sput/sget/release procedures for image types that don't
 
216
 * implement these functions.
 
217
 */
 
218
 
 
219
int
 
220
gx_image_no_sput(const gs_image_common_t *pic, stream *s,
 
221
                 const gs_color_space **ppcs)
 
222
{
 
223
    return_error(gs_error_rangecheck);
 
224
}
 
225
 
 
226
int
 
227
gx_image_no_sget(gs_image_common_t *pic, stream *s,
 
228
                 gs_color_space *pcs)
 
229
{
 
230
    return_error(gs_error_rangecheck);
 
231
}
 
232
 
 
233
void
 
234
gx_image_default_release(gs_image_common_t *pic, gs_memory_t *mem)
 
235
{
 
236
    gs_free_object(mem, pic, "gx_image_default_release");
 
237
}
 
238
 
 
239
#ifdef DEBUG
 
240
static void
 
241
debug_b_print_matrix(const gs_pixel_image_t *pim)
 
242
{
 
243
    if_debug6('b', "      ImageMatrix=[%g %g %g %g %g %g]\n",
 
244
              pim->ImageMatrix.xx, pim->ImageMatrix.xy,
 
245
              pim->ImageMatrix.yx, pim->ImageMatrix.yy,
 
246
              pim->ImageMatrix.tx, pim->ImageMatrix.ty);
 
247
}
 
248
static void
 
249
debug_b_print_decode(const gs_pixel_image_t *pim, int num_decode)
 
250
{
 
251
    if (gs_debug_c('b')) {
 
252
        const char *str = "      Decode=[";
 
253
        int i;
 
254
 
 
255
        for (i = 0; i < num_decode; str = " ", ++i)
 
256
            dprintf2("%s%g", str, pim->Decode[i]);
 
257
        dputs("]\n");
 
258
    }
 
259
}
 
260
#else
 
261
#  define debug_b_print_matrix(pim) DO_NOTHING
 
262
#  define debug_b_print_decode(pim, num_decode) DO_NOTHING
 
263
#endif
 
264
 
 
265
/* Test whether an image has a default ImageMatrix. */
 
266
bool
 
267
gx_image_matrix_is_default(const gs_data_image_t *pid)
 
268
{
 
269
    return (is_xxyy(&pid->ImageMatrix) &&
 
270
            pid->ImageMatrix.xx == pid->Width &&
 
271
            pid->ImageMatrix.yy == -pid->Height &&
 
272
            is_fzero(pid->ImageMatrix.tx) &&
 
273
            pid->ImageMatrix.ty == pid->Height);
 
274
}
 
275
 
 
276
/* Put a variable-length uint on a stream. */
 
277
void
 
278
sput_variable_uint(stream *s, uint w)
 
279
{
 
280
    for (; w > 0x7f; w >>= 7)
 
281
        sputc(s, (byte)(w | 0x80));
 
282
    sputc(s, (byte)w);
 
283
}
 
284
 
 
285
/*
 
286
 * Write generic pixel image parameters.  The format is the following,
 
287
 * encoded as a variable-length uint in the usual way:
 
288
 *      xxxFEDCCBBBBA
 
289
 *          A = 0 if standard ImageMatrix, 1 if explicit ImageMatrix
 
290
 *          BBBB = BitsPerComponent - 1
 
291
 *          CC = format
 
292
 *          D = 0 if standard (0..1) Decode, 1 if explicit Decode
 
293
 *          E = Interpolate
 
294
 *          F = CombineWithColor
 
295
 *          xxx = extra information from caller
 
296
 */
 
297
#define PI_ImageMatrix 0x001
 
298
#define PI_BPC_SHIFT 1
 
299
#define PI_BPC_MASK 0xf
 
300
#define PI_FORMAT_SHIFT 5
 
301
#define PI_FORMAT_MASK 0x3
 
302
#define PI_Decode 0x080
 
303
#define PI_Interpolate 0x100
 
304
#define PI_CombineWithColor 0x200
 
305
#define PI_BITS 10
 
306
/*
 
307
 *      Width, encoded as a variable-length uint
 
308
 *      Height, encoded ditto
 
309
 *      ImageMatrix (if A = 1), per gs_matrix_store/fetch
 
310
 *      Decode (if D = 1): blocks of up to 4 components
 
311
 *          aabbccdd, where each xx is decoded as:
 
312
 *              00 = default, 01 = swapped default,
 
313
 *              10 = (0,V), 11 = (U,V)
 
314
 *          non-defaulted components (up to 8 floats)
 
315
 */
 
316
int
 
317
gx_pixel_image_sput(const gs_pixel_image_t *pim, stream *s,
 
318
                    const gs_color_space **ppcs, int extra)
 
319
{
 
320
    const gs_color_space *pcs = pim->ColorSpace;
 
321
    int bpc = pim->BitsPerComponent;
 
322
    int num_components = gs_color_space_num_components(pcs);
 
323
    int num_decode;
 
324
    uint control = extra << PI_BITS;
 
325
    float decode_default_1 = 1;
 
326
    int i;
 
327
    uint ignore;
 
328
 
 
329
    /* Construct the control word. */
 
330
 
 
331
    if (!gx_image_matrix_is_default((const gs_data_image_t *)pim))
 
332
        control |= PI_ImageMatrix;
 
333
    switch (pim->format) {
 
334
    case gs_image_format_chunky:
 
335
    case gs_image_format_component_planar:
 
336
        switch (bpc) {
 
337
        case 1: case 2: case 4: case 8: case 12: break;
 
338
        default: return_error(gs_error_rangecheck);
 
339
        }
 
340
        break;
 
341
    case gs_image_format_bit_planar:
 
342
        if (bpc < 1 || bpc > 8)
 
343
            return_error(gs_error_rangecheck);
 
344
    }
 
345
    control |= (bpc - 1) << PI_BPC_SHIFT;
 
346
    control |= pim->format << PI_FORMAT_SHIFT;
 
347
    num_decode = num_components * 2;
 
348
    if (gs_color_space_get_index(pcs) == gs_color_space_index_Indexed)
 
349
        decode_default_1 = (float)pcs->params.indexed.hival;
 
350
    for (i = 0; i < num_decode; ++i)
 
351
        if (pim->Decode[i] != DECODE_DEFAULT(i, decode_default_1)) {
 
352
            control |= PI_Decode;
 
353
            break;
 
354
        }
 
355
    if (pim->Interpolate)
 
356
        control |= PI_Interpolate;
 
357
    if (pim->CombineWithColor)
 
358
        control |= PI_CombineWithColor;
 
359
 
 
360
    /* Write the encoding on the stream. */
 
361
 
 
362
    if_debug3('b', "[b]put control=0x%x, Width=%d, Height=%d\n",
 
363
              control, pim->Width, pim->Height);
 
364
    sput_variable_uint(s, control);
 
365
    sput_variable_uint(s, (uint)pim->Width);
 
366
    sput_variable_uint(s, (uint)pim->Height);
 
367
    if (control & PI_ImageMatrix) {
 
368
        debug_b_print_matrix(pim);
 
369
        sput_matrix(s, &pim->ImageMatrix);
 
370
    }
 
371
    if (control & PI_Decode) {
 
372
        int i;
 
373
        uint dflags = 1;
 
374
        float decode[8];
 
375
        int di = 0;
 
376
 
 
377
        debug_b_print_decode(pim, num_decode);
 
378
        for (i = 0; i < num_decode; i += 2) {
 
379
            float u = pim->Decode[i], v = pim->Decode[i + 1];
 
380
            float dv = DECODE_DEFAULT(i + 1, decode_default_1);
 
381
 
 
382
            if (dflags >= 0x100) {
 
383
                sputc(s, (byte)(dflags & 0xff));
 
384
                sputs(s, (const byte *)decode, di * sizeof(float), &ignore);
 
385
                dflags = 1;
 
386
                di = 0;
 
387
            }
 
388
            dflags <<= 2;
 
389
            if (u == 0 && v == dv)
 
390
                DO_NOTHING;
 
391
            else if (u == dv && v == 0)
 
392
                dflags += 1;
 
393
            else {
 
394
                if (u != 0) {
 
395
                    dflags++;
 
396
                    decode[di++] = u;
 
397
                }
 
398
                dflags += 2;
 
399
                decode[di++] = v;
 
400
            }
 
401
        }
 
402
        sputc(s, (byte)((dflags << (8 - num_decode)) & 0xff));
 
403
        sputs(s, (const byte *)decode, di * sizeof(float), &ignore);
 
404
    }
 
405
    *ppcs = pcs;
 
406
    return 0;
 
407
}
 
408
 
 
409
/* Set an image's ImageMatrix to the default. */
 
410
void
 
411
gx_image_matrix_set_default(gs_data_image_t *pid)
 
412
{
 
413
    pid->ImageMatrix.xx = (float)pid->Width;
 
414
    pid->ImageMatrix.xy = 0;
 
415
    pid->ImageMatrix.yx = 0;
 
416
    pid->ImageMatrix.yy = (float)-pid->Height;
 
417
    pid->ImageMatrix.tx = 0;
 
418
    pid->ImageMatrix.ty = (float)pid->Height;
 
419
}
 
420
 
 
421
/* Get a variable-length uint from a stream. */
 
422
int
 
423
sget_variable_uint(stream *s, uint *pw)
 
424
{
 
425
    uint w = 0;
 
426
    int shift = 0;
 
427
    int ch;
 
428
 
 
429
    for (; (ch = sgetc(s)) >= 0x80; shift += 7)
 
430
        w += (ch & 0x7f) << shift;
 
431
    if (ch < 0)
 
432
        return_error(gs_error_ioerror);
 
433
    *pw = w + (ch << shift);
 
434
    return 0;
 
435
}
 
436
 
 
437
/*
 
438
 * Read generic pixel image parameters.
 
439
 */
 
440
int
 
441
gx_pixel_image_sget(gs_pixel_image_t *pim, stream *s,
 
442
                    gs_color_space *pcs)
 
443
{
 
444
    uint control;
 
445
    float decode_default_1 = 1;
 
446
    int num_components, num_decode;
 
447
    int i;
 
448
    int code;
 
449
    uint ignore;
 
450
 
 
451
    if ((code = sget_variable_uint(s, &control)) < 0 ||
 
452
        (code = sget_variable_uint(s, (uint *)&pim->Width)) < 0 ||
 
453
        (code = sget_variable_uint(s, (uint *)&pim->Height)) < 0
 
454
        )
 
455
        return code;
 
456
    if_debug3('b', "[b]get control=0x%x, Width=%d, Height=%d\n",
 
457
              control, pim->Width, pim->Height);
 
458
    if (control & PI_ImageMatrix) {
 
459
        if ((code = sget_matrix(s, &pim->ImageMatrix)) < 0)
 
460
            return code;
 
461
        debug_b_print_matrix(pim);
 
462
    } else
 
463
        gx_image_matrix_set_default((gs_data_image_t *)pim);
 
464
    pim->BitsPerComponent = ((control >> PI_BPC_SHIFT) & PI_BPC_MASK) + 1;
 
465
    pim->format = (control >> PI_FORMAT_SHIFT) & PI_FORMAT_MASK;
 
466
    pim->ColorSpace = pcs;
 
467
    num_components = gs_color_space_num_components(pcs);
 
468
    num_decode = num_components * 2;
 
469
    if (gs_color_space_get_index(pcs) == gs_color_space_index_Indexed)
 
470
        decode_default_1 = (float)pcs->params.indexed.hival;
 
471
    if (control & PI_Decode) {
 
472
        uint dflags = 0x10000;
 
473
        float *dp = pim->Decode;
 
474
 
 
475
        for (i = 0; i < num_decode; i += 2, dp += 2, dflags <<= 2) {
 
476
            if (dflags >= 0x10000) {
 
477
                dflags = sgetc(s) + 0x100;
 
478
                if (dflags < 0x100)
 
479
                    return_error(gs_error_ioerror);
 
480
            }
 
481
            switch (dflags & 0xc0) {
 
482
            case 0x00:
 
483
                dp[0] = 0, dp[1] = DECODE_DEFAULT(i + 1, decode_default_1);
 
484
                break;
 
485
            case 0x40:
 
486
                dp[0] = DECODE_DEFAULT(i + 1, decode_default_1), dp[1] = 0;
 
487
                break;
 
488
            case 0x80:
 
489
                dp[0] = 0;
 
490
                if (sgets(s, (byte *)(dp + 1), sizeof(float), &ignore) < 0)
 
491
                    return_error(gs_error_ioerror);
 
492
                break;
 
493
            case 0xc0:
 
494
                if (sgets(s, (byte *)dp, sizeof(float) * 2, &ignore) < 0)
 
495
                    return_error(gs_error_ioerror);
 
496
                break;
 
497
            }
 
498
        }
 
499
        debug_b_print_decode(pim, num_decode);
 
500
    } else {
 
501
        for (i = 0; i < num_decode; ++i)
 
502
            pim->Decode[i] = DECODE_DEFAULT(i, decode_default_1);
 
503
    }
 
504
    pim->Interpolate = (control & PI_Interpolate) != 0;
 
505
    pim->CombineWithColor = (control & PI_CombineWithColor) != 0;
 
506
    return control >> PI_BITS;
 
507
}
 
508
 
 
509
/*
 
510
 * Release a pixel image object.  Currently this just frees the object.
 
511
 */
 
512
void
 
513
gx_pixel_image_release(gs_pixel_image_t *pic, gs_memory_t *mem)
 
514
{
 
515
    gx_image_default_release((gs_image_common_t *)pic, mem);
 
516
}