home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / sharewar / dos / program / gs300sr1 / gs300sr1.exe / GXCPATH.C < prev    next >
C/C++ Source or Header  |  1994-07-27  |  17KB  |  532 lines

  1. /* Copyright (C) 1991, 1992, 1993, 1994 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* gxcpath.c */
  20. /* Implementation of clipping paths */
  21. #include "gx.h"
  22. #include "gserrors.h"
  23. #include "gsstruct.h"
  24. #include "gxdevice.h"
  25. #include "gxfixed.h"
  26. #include "gzpath.h"
  27. #include "gxcpath.h"
  28.  
  29. /* Imported from gxacpath.c */
  30. extern int gx_cpath_intersect_slow(P4(gs_state *, gx_clip_path *,
  31.   gx_path *, int));
  32.  
  33. /* Forward references */
  34. private void gx_clip_list_from_rectangle(P2(gx_clip_list *, gs_fixed_rect *));
  35. private int gx_clip_list_add_to_path(P2(gx_clip_list *, gx_path *));
  36.  
  37. /* Structure types */
  38. public_st_clip_rect();
  39. private_st_clip_list();
  40. public_st_clip_path();
  41. public_st_device_clip();
  42.  
  43. /* GC procedures for gx_clip_path */
  44. #define cptr ((gx_clip_path *)vptr)
  45. private ENUM_PTRS_BEGIN(clip_path_enum_ptrs) ;
  46.     if ( index < st_clip_list_max_ptrs )
  47.       { gs_ptr_type_t ret = clip_list_enum_ptrs(&cptr->list, sizeof(cptr->list), index, pep);
  48.         if ( ret == 0 )    /* don't stop early */
  49.           ret = ptr_struct_type, *pep = 0;
  50.         return ret;
  51.       }
  52.     return (*st_path.enum_ptrs)(&cptr->path, sizeof(cptr->path), index - st_clip_list_max_ptrs, pep);
  53. ENUM_PTRS_END
  54. private RELOC_PTRS_BEGIN(clip_path_reloc_ptrs) {
  55.     clip_list_reloc_ptrs(&cptr->list, sizeof(gx_clip_list), gcst);
  56.     (*st_path.reloc_ptrs)(&cptr->path, sizeof(gx_path), gcst);
  57. } RELOC_PTRS_END
  58. #undef cptr
  59.  
  60. /* GC procedures for gx_device_clip */
  61. #define cptr ((gx_device_clip *)vptr)
  62. private ENUM_PTRS_BEGIN(device_clip_enum_ptrs) {
  63.     if ( index < st_clip_list_max_ptrs + 1 )
  64.       return clip_list_enum_ptrs(&cptr->list, sizeof(gx_clip_list),
  65.                      index - 1, pep);
  66.     return (*st_device_forward.enum_ptrs)(vptr, sizeof(gx_device_forward),
  67.                           index - (st_clip_list_max_ptrs + 1), pep);
  68.     }
  69.     case 0:
  70.         *pep = (cptr->current == &cptr->list.single ? NULL :
  71.             (void *)cptr->current);
  72.         break;
  73. ENUM_PTRS_END
  74. private RELOC_PTRS_BEGIN(device_clip_reloc_ptrs) {
  75.     if ( cptr->current == &cptr->list.single )
  76.       cptr->current =
  77.         &((gx_device_clip *)gs_reloc_struct_ptr(vptr, gcst))->list.single;
  78.     else
  79.       RELOC_PTR(gx_device_clip, current);
  80.     clip_list_reloc_ptrs(&cptr->list, sizeof(gx_clip_list), gcst);
  81.     (*st_device_forward.reloc_ptrs)(vptr, sizeof(gx_device_forward), gcst);
  82. } RELOC_PTRS_END
  83. #undef cptr
  84.  
  85. /* Define an empty clip list. */
  86. private const gx_clip_list clip_list_empty =
  87. {  { 0, 0, min_int, max_int, 0, 0 },
  88.    0, 0, 0
  89. };
  90.  
  91. /* Debugging */
  92.  
  93. #ifdef DEBUG
  94. /* Validate a clipping path. */
  95. void        /* only exported for gxacpath.c */
  96. clip_list_validate(gx_clip_list *clp)
  97. {    gx_clip_rect *prev = clp->head;
  98.     gx_clip_rect *ptr = prev;
  99.     bool wrong = false;
  100.     while ( ptr != 0 )
  101.       { if ( ptr->ymin > ptr->ymax || ptr->xmin > ptr->xmax ||
  102.         !(ptr->ymin >= prev->ymax ||
  103.           (ptr->ymin == prev->ymin && ptr->ymax == prev->ymax &&
  104.            ptr->xmin >= prev->xmax))
  105.         )
  106.           { clip_rect_print('q', "WRONG:", ptr);
  107.         wrong = true;
  108.           }
  109.         prev = ptr, ptr = ptr->next;
  110.       }
  111. }
  112. #endif
  113.  
  114. /* ------ Clipping path accessing ------ */
  115.  
  116. /* Initialize a clipping path. */
  117. int
  118. gx_cpath_init(gx_clip_path *pcpath, gs_memory_t *mem)
  119. {    static /*const*/ gs_fixed_rect null_rect = { { 0, 0 }, { 0, 0 } };
  120.     return gx_cpath_from_rectangle(pcpath, &null_rect, mem); /* does a gx_path_init */
  121. }
  122.  
  123. /* Return the path of a clipping path. */
  124. int
  125. gx_cpath_path(gx_clip_path *pcpath, gx_path *ppath)
  126. {    if ( !pcpath->segments_valid )
  127.     {    int code = gx_clip_list_add_to_path(&pcpath->list, &pcpath->path);
  128.         if ( code < 0 ) return code;
  129.         pcpath->segments_valid = 1;
  130.     }
  131.     *ppath = pcpath->path;
  132.     return 0;
  133. }
  134.  
  135. /* Return the quick-check rectangle for a clipping path. */
  136. int
  137. gx_cpath_box_for_check(const gx_clip_path *pcpath, gs_fixed_rect *pbox)
  138. {    *pbox = pcpath->cbox;
  139.     return 0;
  140. }
  141.  
  142. /* Test if a clipping path includes a rectangle. */
  143. /* The rectangle need not be oriented correctly, i.e. x0 > x1 is OK. */
  144. int
  145. gx_cpath_includes_rectangle(register const gx_clip_path *pcpath,
  146.   fixed x0, fixed y0, fixed x1, fixed y1)
  147. {    return
  148.         (x0 <= x1 ?
  149.             (pcpath->cbox.p.x <= x0 && x1 <= pcpath->cbox.q.x) :
  150.             (pcpath->cbox.p.x <= x1 && x0 <= pcpath->cbox.q.x)) &&
  151.         (y0 <= y1 ?
  152.             (pcpath->cbox.p.y <= y0 && y1 <= pcpath->cbox.q.y) :
  153.             (pcpath->cbox.p.y <= y1 && y0 <= pcpath->cbox.q.y));
  154. }
  155.  
  156. /* Release a clipping path. */
  157. void
  158. gx_cpath_release(gx_clip_path *pcpath)
  159. {    if ( !pcpath->shares_list )
  160.         gx_clip_list_free(&pcpath->list, pcpath->path.memory);
  161.     gx_path_release(&pcpath->path);
  162. }
  163.  
  164. /* Share a clipping path. */
  165. void
  166. gx_cpath_share(gx_clip_path *pcpath)
  167. {    gx_path_share(&pcpath->path);
  168.     pcpath->shares_list = 1;
  169. }
  170.  
  171. /* Create a rectangular clipping path. */
  172. /* The supplied rectangle may not be oriented correctly, */
  173. /* but it will be oriented correctly upon return. */
  174. int
  175. gx_cpath_from_rectangle(gx_clip_path *pcpath, gs_fixed_rect *pbox,
  176.   gs_memory_t *mem)
  177. {    gx_clip_list_from_rectangle(&pcpath->list, pbox);
  178.     /* Set offset for GC */
  179.     pcpath->list.container_offset = offset_of(gx_clip_path, list);
  180.     pcpath->cbox = *pbox;
  181.     pcpath->segments_valid = 0;
  182.     pcpath->shares_list = 0;
  183.     gx_path_init(&pcpath->path, mem);
  184.     pcpath->path.bbox = *pbox;
  185.     return 0;
  186. }
  187.  
  188. /* Intersect a new clipping path with an old one. */
  189. /* Note that it may overwrite its path argument; return 1 in this case, */
  190. /* otherwise 0 for success, <0 for failure as usual. */
  191. int
  192. gx_cpath_intersect(gs_state *pgs, gx_clip_path *pcpath, gx_path *ppath,
  193.   int rule)
  194. {    gs_fixed_rect old_box, new_box;
  195.     int code;
  196.     if ( gx_cpath_is_rectangle(pcpath, &old_box) &&
  197.         gx_path_is_rectangle(ppath, &new_box)
  198.        )
  199.        {    int changed = 0;
  200.         /* Intersect the two rectangles if necessary. */
  201.         if ( old_box.p.x > new_box.p.x )
  202.             new_box.p.x = old_box.p.x, changed = 1;
  203.         if ( old_box.p.y > new_box.p.y )
  204.             new_box.p.y = old_box.p.y, changed = 1;
  205.         if ( old_box.q.x < new_box.q.x )
  206.             new_box.q.x = old_box.q.x, changed = 1;
  207.         if ( old_box.q.y < new_box.q.y )
  208.             new_box.q.y = old_box.q.y, changed = 1;
  209.         if ( changed )
  210.            {    /* Store the new rectangle back into the new path. */
  211.             register segment *pseg =
  212.                 (segment *)ppath->first_subpath;
  213. #define set_pt(pqx,pqy)\
  214.   pseg->pt.x = new_box.pqx.x, pseg->pt.y = new_box.pqy.y
  215.             set_pt(p, p); pseg = pseg->next;
  216.             set_pt(q, p); pseg = pseg->next;
  217.             set_pt(q, q); pseg = pseg->next;
  218.             set_pt(p, q); pseg = pseg->next;
  219.             if ( pseg != 0 ) /* might be an open rectangle */
  220.               set_pt(p, p);
  221. #undef set_pt
  222.            }
  223.         ppath->bbox = new_box;
  224.         gx_clip_list_from_rectangle(&pcpath->list, &new_box);
  225.         pcpath->cbox = new_box;
  226.         pcpath->path = *ppath;
  227.         pcpath->segments_valid = 1;
  228.         code = 1;
  229.        }
  230.     else
  231.        {    /* Not a rectangle.  Intersect the slow way. */
  232.         code = gx_cpath_intersect_slow(pgs, pcpath, ppath, rule);
  233.        }
  234.     return code;
  235. }
  236.  
  237. /* ------ Clipping list routines ------ */
  238.  
  239. /* Initialize a clip list. */
  240. void
  241. gx_clip_list_init(gx_clip_list *clp)
  242. {    int offset = clp->container_offset;    /* preserve this */
  243.     *clp = clip_list_empty;
  244.     clp->container_offset = offset;
  245. }
  246.  
  247. /* Initialize a clip list to a rectangle. */
  248. /* The supplied rectangle may not be oriented correctly, */
  249. /* but it will be oriented correctly upon return. */
  250. private void
  251. gx_clip_list_from_rectangle(register gx_clip_list *clp,
  252.   register gs_fixed_rect *rp)
  253. {    gx_clip_list_init(clp);
  254.     if ( rp->p.x > rp->q.x )
  255.       { fixed t = rp->p.x; rp->p.x = rp->q.x; rp->q.x = t; }
  256.     if ( rp->p.y > rp->q.y )
  257.       { fixed t = rp->p.y; rp->p.y = rp->q.y; rp->q.y = t; }
  258.     clp->single.xmin = fixed2int_var(rp->p.x);
  259.     clp->single.ymin = fixed2int_var(rp->p.y);
  260.     clp->single.xmax = fixed2int_var_ceiling(rp->q.x);
  261.     clp->single.ymax = fixed2int_var_ceiling(rp->q.y);
  262.     clp->count = 1;
  263. }
  264.  
  265. /* Add a clip list to a path. */
  266. /* The current implementation is very inefficient. */
  267. private int
  268. gx_clip_list_add_to_path(gx_clip_list *clp, gx_path *ppath)
  269. {    const gx_clip_rect *rp;
  270.     int code = -1;
  271.     for ( rp = (clp->count <= 1 ? &clp->single : clp->head); rp != 0;
  272.           rp = rp->next
  273.         )
  274.     {    if ( rp->xmin < rp->xmax && rp->ymin < rp->ymax )
  275.         {    code = gx_path_add_rectangle(ppath,
  276.                     int2fixed(rp->xmin),
  277.                     int2fixed(rp->ymin),
  278.                     int2fixed(rp->xmax),
  279.                     int2fixed(rp->ymax));
  280.             if ( code < 0 )
  281.                 return code;
  282.         }
  283.     }
  284.     if ( code < 0 )
  285.     {    /* We didn't have any rectangles. */
  286.         code = gx_path_add_point(ppath, fixed_0, fixed_0);
  287.     }
  288.     return code;
  289. }
  290.  
  291. /* Free a clip list. */
  292. void
  293. gx_clip_list_free(gx_clip_list *clp, gs_memory_t *mem)
  294. {    gx_clip_rect *rp = clp->tail;
  295.     while ( rp != 0 )
  296.     {    gx_clip_rect *prev = rp->prev;
  297.         gs_free_object(mem, rp, "gx_clip_list_free");
  298.         rp = prev;
  299.     }
  300.     gx_clip_list_init(clp);
  301. }
  302.  
  303. /* ------ Rectangle list clipper ------ */
  304.  
  305. /* Device for clipping with a region. */
  306. private dev_proc_open_device(clip_open);
  307. private dev_proc_fill_rectangle(clip_fill_rectangle);
  308. private dev_proc_tile_rectangle(clip_tile_rectangle);
  309. private dev_proc_copy_mono(clip_copy_mono);
  310. private dev_proc_copy_color(clip_copy_color);
  311. private dev_proc_get_bits(clip_get_bits);
  312.  
  313. /* The device descriptor. */
  314. private const gx_device_clip gs_clip_device =
  315. {    sizeof(gx_device_clip),
  316.     0,            /* &...dev.std_procs */
  317.     "clipper",
  318.     0, 0, 1, 1, no_margins, dci_black_and_white, dev_init_misc,
  319.     {    clip_open,
  320.         gx_forward_get_initial_matrix,
  321.         gx_default_sync_output,
  322.         gx_default_output_page,
  323.         gx_default_close_device,
  324.         gx_forward_map_rgb_color,
  325.         gx_forward_map_color_rgb,
  326.         clip_fill_rectangle,
  327.         clip_tile_rectangle,
  328.         clip_copy_mono,
  329.         clip_copy_color,
  330.         gx_default_draw_line,
  331.         clip_get_bits,
  332.         gx_forward_get_params,
  333.         gx_forward_put_params,
  334.         gx_forward_map_cmyk_color,
  335.         gx_forward_get_xfont_procs,
  336.         gx_forward_get_xfont_device,
  337.         gx_forward_map_rgb_alpha_color
  338.     }
  339. };
  340. #define rdev ((gx_device_clip *)dev)
  341.  
  342. /* Make a clipping device. */
  343. void
  344. gx_make_clip_device(gx_device_clip *dev, void *container,
  345.   const gx_clip_list *list)
  346. {    *dev = gs_clip_device;
  347.     dev->procs = &dev->std_procs;
  348.     dev->list = *list;
  349.     dev->list.container_offset = (char *)&dev->list - (char *)container;
  350. }
  351.  
  352. /* Declare and initialize the cursor variables. */
  353. #ifdef DEBUG
  354. private ulong clip_loops, clip_in, clip_down, clip_up, clip_x, clip_no_x;
  355. private uint clip_interval = 100;
  356. # define inc(v) v++
  357. # define print_clip()\
  358.     if ( clip_loops % clip_interval == 0 )\
  359.       if_debug10('q', "[q]rect=(%d,%d),(%d,%d)\n     loops=%ld in=%ld down=%ld up=%ld x=%ld no_x=%ld\n",\
  360.          x, y, x + w, y + h,\
  361.          clip_loops, clip_in, clip_down, clip_up, clip_x, clip_no_x)
  362. #else
  363. # define inc(v) 0
  364. # define print_clip() DO_NOTHING
  365. #endif
  366. #define DECLARE_CLIP\
  367.   register gx_clip_rect *rptr = rdev->current;\
  368.   gx_device *tdev = rdev->target;
  369. /* Check whether the rectangle x,y,w,h falls within the current entry. */
  370. #define xywh_is_in_ryptr()\
  371.   (y >= rptr->ymin && y + h <= rptr->ymax &&\
  372.    x >= rptr->xmin && x + w <= rptr->xmax)
  373. #ifdef DEBUG
  374. #  define xywh_in_ryptr() (xywh_is_in_ryptr() ? (inc(clip_in), 1) : 0)
  375. #else
  376. #  define xywh_in_ryptr() xywh_is_in_ryptr()
  377. #endif
  378. /*
  379.  * Warp the cursor forward or backward to the first rectangle row that
  380.  * could include a given y value.  Assumes rptr is set, and updates it.
  381.  * Specifically, after warp_cursor, y < rptr->ymax and either
  382.  * rptr->prev == 0 or y >= rptr->prev->ymax.  Note that y <= rptr->ymin
  383.  * is possible.
  384.  */
  385. #define warp_cursor(y)\
  386.   if ( (y) >= rptr->ymax )\
  387.    { if ( (rptr = rptr->next) == 0 ) return 0;\
  388.      while ( inc(clip_up), (y) >= rptr->ymax ) rptr = rptr->next;\
  389.    }\
  390.   else while ( rptr->prev != 0 && (y) < rptr->prev->ymax )\
  391.    { inc(clip_down); rptr = rptr->prev; }
  392. /*
  393.  * Enumerate the rectangles of the x,w,y,h argument that fall within
  394.  * the clipping region.  Usage:
  395.  *    BEGIN_CLIP
  396.  *        (adjust for yc > y if necessary)
  397.  *    FOR_CLIP
  398.  *        ... xc, yc, xec, yec ... [must be an expression statement]
  399.  *    NEXT_CLIP
  400.  *        (about to set yc to yec)
  401.  *    END_CLIP
  402.  */
  403. #define BEGIN_CLIP\
  404.     if ( w <= 0 || h <= 0 ) return 0;\
  405.     inc(clip_loops);\
  406.    {    int yc;\
  407.     const int xe = x + w, ye = y + h;\
  408.     warp_cursor(y);\
  409.     rdev->current = rptr;\
  410.     yc = rptr->ymin;\
  411.     if ( yc < y ) yc = y;\
  412.     else if ( yc >= ye ) return 0;
  413. #define FOR_CLIP\
  414.     for ( ; ; )\
  415.        {    const int ymax = rptr->ymax;\
  416.         int yec = ymax;\
  417.         if ( yec > ye ) yec = ye;\
  418.         if_debug2('Q', "[Q]yc=%d yec=%d\n", yc, yec);\
  419.         do \
  420.            {    int xc = rptr->xmin;\
  421.             int xec = rptr->xmax;\
  422.             if ( xc < x ) xc = x;\
  423.             if ( xec > xe ) xec = xe;\
  424.             if ( xec > xc )\
  425.                {    int code;\
  426.                 clip_rect_print('Q', "match", rptr);\
  427.                 if_debug2('Q', "[Q]xc=%d xec=%d\n", xc, xec);\
  428.                 inc(clip_x);\
  429.                 code =
  430. #define NEXT_CLIP\
  431.                 if ( code < 0 ) return code;\
  432.                }\
  433.             else inc(clip_no_x);\
  434.            }\
  435.         while ( (rptr = rptr->next) != 0 && rptr->ymax == ymax );\
  436.         if ( rptr == 0 || (yec = rptr->ymin) >= ye ) break;
  437. #define END_CLIP\
  438.         yc = yec;\
  439.        }\
  440.     print_clip();\
  441.    }
  442.  
  443. /* Open a clipping device */
  444. private int
  445. clip_open(register gx_device *dev)
  446. {    gx_device *tdev = rdev->target;
  447.     /* Initialize the cursor. */
  448.     rdev->current =
  449.       (rdev->list.head == 0 ? &rdev->list.single : rdev->list.head);
  450.     rdev->color_info = tdev->color_info;
  451.     return 0;
  452. }
  453.  
  454. /* Fill a rectangle */
  455. private int
  456. clip_fill_rectangle(gx_device *dev, int x, int y, int w, int h,
  457.   gx_color_index color)
  458. {    DECLARE_CLIP
  459.     dev_proc_fill_rectangle((*fill)) = dev_proc(tdev, fill_rectangle);
  460.     if ( xywh_in_ryptr() )
  461.         return (*fill)(tdev, x, y, w, h, color);
  462.     BEGIN_CLIP
  463.     FOR_CLIP
  464.         (*fill)(tdev, xc, yc, xec - xc, yec - yc, color);
  465.     NEXT_CLIP
  466.     END_CLIP
  467.     return 0;
  468. }
  469.  
  470. /* Tile a rectangle */
  471. private int
  472. clip_tile_rectangle(gx_device *dev, const gx_tile_bitmap *tile,
  473.   int x, int y, int w, int h,
  474.   gx_color_index color0, gx_color_index color1, int phase_x, int phase_y)
  475. {    DECLARE_CLIP
  476.     dev_proc_tile_rectangle((*fill)) = dev_proc(tdev, tile_rectangle);
  477.     if ( xywh_in_ryptr() )
  478.         return (*fill)(tdev, tile, x, y, w, h, color0, color1, phase_x, phase_y);
  479.     BEGIN_CLIP
  480.     FOR_CLIP
  481.         (*fill)(tdev, tile, xc, yc, xec - xc, yec - yc, color0, color1, phase_x, phase_y);
  482.     NEXT_CLIP
  483.     END_CLIP
  484.     return 0;
  485. }
  486.  
  487. /* Copy a monochrome rectangle */
  488. private int
  489. clip_copy_mono(gx_device *dev,
  490.   const byte *data, int sourcex, int raster, gx_bitmap_id id,
  491.   int x, int y, int w, int h,
  492.   gx_color_index color0, gx_color_index color1)
  493. {    DECLARE_CLIP
  494.     dev_proc_copy_mono((*copy)) = dev_proc(tdev, copy_mono);
  495.     if ( xywh_in_ryptr() )
  496.         return (*copy)(tdev, data, sourcex, raster, id, x, y, w, h, color0, color1);
  497.     BEGIN_CLIP
  498.         if ( yc > y ) data += (yc - y) * raster;
  499.     FOR_CLIP
  500.         (*copy)(tdev, data, sourcex + xc - x, raster, gx_no_bitmap_id, xc, yc, xec - xc, yec - yc, color0, color1);
  501.     NEXT_CLIP
  502.         data += (yec - yc) * raster;
  503.     END_CLIP
  504.     return 0;
  505. }
  506.  
  507. /* Copy a color rectangle */
  508. private int
  509. clip_copy_color(gx_device *dev,
  510.   const byte *data, int sourcex, int raster, gx_bitmap_id id,
  511.   int x, int y, int w, int h)
  512. {    DECLARE_CLIP
  513.     dev_proc_copy_color((*copy)) = dev_proc(tdev, copy_color);
  514.     if ( xywh_in_ryptr() )
  515.         return (*copy)(tdev, data, sourcex, raster, id, x, y, w, h);
  516.     BEGIN_CLIP
  517.         if ( yc > y ) data += (yc - y) * raster;
  518.     FOR_CLIP
  519.         (*copy)(tdev, data, sourcex + xc - x, raster, gx_no_bitmap_id, xc, yc, xec - xc, yec - yc);
  520.     NEXT_CLIP
  521.         data += (yec - yc) * raster;
  522.     END_CLIP
  523.     return 0;
  524. }
  525.  
  526. /* Get bits back from the device. */
  527. private int
  528. clip_get_bits(gx_device *dev, int y, byte *data, byte **actual_data)
  529. {    gx_device *tdev = rdev->target;
  530.     return (*dev_proc(tdev, get_bits))(tdev, y, data, actual_data);
  531. }
  532.