• R/O
  • SSH
  • HTTPS

opfc: Commit


Commit MetaInfo

Revision910 (tree)
Zeit2011-03-24 18:12:34
Autorsho-otani

Log Message

Fixed for GS 9.0x

Ändern Zusammenfassung

Diff

--- gdevopvp/trunk/src/gdevopvp.c (revision 909)
+++ gdevopvp/trunk/src/gdevopvp.c (revision 910)
@@ -86,34 +86,34 @@
8686
8787 #include "opvp_common.h"
8888
89-#define ENABLE_SIMPLE_MODE 1
90-#define ENABLE_SKIP_RASTER 1
91-#define ENABLE_AUTO_REVERSE 1
89+#define ENABLE_SIMPLE_MODE 1
90+#define ENABLE_SKIP_RASTER 1
91+#define ENABLE_AUTO_REVERSE 1
9292
9393 /* ----- data types/macros ----- */
9494
9595 /* for debug */
96-#ifdef printf
97-#undef printf
96+#ifdef printf
97+#undef printf
9898 #endif
99-#ifdef fprintf
100-#undef fprintf
99+#ifdef fprintf
100+#undef fprintf
101101 #endif
102102
103103 /* buffer */
104-#define OPVP_BUFF_SIZE 1024
104+#define OPVP_BUFF_SIZE 1024
105105
106106 /* ROP */
107-#define OPVP_0_2_ROP_S 0xCC
108-#define OPVP_0_2_ROP_P 0xF0
109-#define OPVP_0_2_ROP_OR 0xB8
107+#define OPVP_0_2_ROP_S 0xCC
108+#define OPVP_0_2_ROP_P 0xF0
109+#define OPVP_0_2_ROP_OR 0xB8
110110
111111 /* paper */
112-#define PS_DPI 72
113-#define MMPI 25.4
114-#define TOLERANCE 3.0
112+#define PS_DPI 72
113+#define MMPI 25.4
114+#define TOLERANCE 3.0
115115
116-typedef struct {
116+typedef struct {
117117 const char *region;
118118 const char *name;
119119 float width;
@@ -120,23 +120,23 @@
120120 float height;
121121 } OPVP_Paper;
122122
123-#define X_DPI 300
124-#define Y_DPI 300
123+#define X_DPI 300
124+#define Y_DPI 300
125125
126126 #define MAX_PATH_POINTS 1000
127127
128128 /* driver */
129-typedef struct gx_device_opvp_s {
129+typedef struct gx_device_opvp_s {
130130 gx_device_vector_common;
131131 } gx_device_opvp;
132132
133-typedef struct gx_device_oprp_s {
133+typedef struct gx_device_oprp_s {
134134 gx_device_common;
135135 gx_prn_device_common;
136136 } gx_device_oprp;
137137
138138 /* point (internal) */
139-typedef struct {
139+typedef struct {
140140 floatp x;
141141 floatp y;
142142 } _fPoint;
@@ -144,69 +144,69 @@
144144 /* ----- private function prototypes ----- */
145145
146146 /* Utilities */
147-static int opvp_startpage(gx_device *);
148-static int opvp_endpage(void);
149-static char *opvp_alloc_string(char **, const char *);
150-static char *opvp_cat_string(char **, const char *);
151-static char *opvp_adjust_num_string(char *);
152-static char **opvp_gen_dynamic_lib_name(void);
153-static char *opvp_to_utf8(char *);
154-#define opvp_check_in_page(pdev) \
155- ((beginPage) || (inkjet) ? 0 \
156- : (*vdev_proc(pdev, beginpage))((gx_device_vector*)pdev))
157-static int opvp_get_papertable_index(gx_device *);
158-static char *opvp_get_sizestring(float, float);
159-/* not used static const char *opvp_get_papersize_region(gx_device *);*/
160-/* not used static const char *opvp_get_papersize_name(gx_device *);*/
161-/* not used static char *opvp_get_papersize_inch(gx_device *);*/
162-/* not used static const char *opvp_get_papersize(gx_device *);*/
163-static char *opvp_get_mediasize(gx_device *);
164-static char *opvp_gen_page_info(gx_device *);
165-static char *opvp_gen_doc_info(gx_device *);
166-static char *opvp_gen_job_info(gx_device *);
167-static int opvp_set_brush_color(gx_device_opvp *, gx_color_index,
147+static int opvp_startpage(gx_device *);
148+static int opvp_endpage(void);
149+static char *opvp_alloc_string(char **, const char *);
150+static char *opvp_cat_string(char **, const char *);
151+static char *opvp_adjust_num_string(char *);
152+static char **opvp_gen_dynamic_lib_name(void);
153+static char *opvp_to_utf8(char *);
154+#define opvp_check_in_page(pdev) \
155+ ((beginPage) || (inkjet) ? 0 \
156+ : (*vdev_proc(pdev, beginpage))((gx_device_vector*)pdev))
157+static int opvp_get_papertable_index(gx_device *);
158+static char *opvp_get_sizestring(float, float);
159+/* not used static const char *opvp_get_papersize_region(gx_device *);*/
160+/* not used static const char *opvp_get_papersize_name(gx_device *);*/
161+/* not used static char *opvp_get_papersize_inch(gx_device *);*/
162+/* not used static const char *opvp_get_papersize(gx_device *);*/
163+static char *opvp_get_mediasize(gx_device *);
164+static char *opvp_gen_page_info(gx_device *);
165+static char *opvp_gen_doc_info(gx_device *);
166+static char *opvp_gen_job_info(gx_device *);
167+static int opvp_set_brush_color(gx_device_opvp *, gx_color_index,
168168 opvp_brush_t *);
169-static int opvp_draw_image(gx_device_opvp *, int,
169+static int opvp_draw_image(gx_device_opvp *, int,
170170 int, int, int, int, int, int, const byte *);
171171
172172 /* load/unload vector driver */
173-static int opvp_load_vector_driver(void);
174-static int opvp_unload_vector_driver(void);
175-static int prepare_open(gx_device *);
173+static int opvp_load_vector_driver(void);
174+static int opvp_unload_vector_driver(void);
175+static int prepare_open(gx_device *);
176176
177177 /* driver procs */
178-static int opvp_open(gx_device *);
179-static int oprp_open(gx_device *);
180-static void opvp_get_initial_matrix(gx_device *, gs_matrix *);
181-static int opvp_output_page(gx_device *, int, int);
182-static int opvp_close(gx_device *);
178+static int opvp_open(gx_device *);
179+static int oprp_open(gx_device *);
180+static void opvp_get_initial_matrix(gx_device *, gs_matrix *);
181+static int opvp_output_page(gx_device *, int, int);
182+static int opvp_close(gx_device *);
183183 #if GS_VERSION_MAJOR >= 8
184-static gx_color_index opvp_map_rgb_color(gx_device *, const gx_color_value *); /* modified for gs 8.15 */
184+static gx_color_index opvp_map_rgb_color(gx_device *, const gx_color_value *); /* modified for gs 8.15 */
185185 #else
186-static gx_color_index opvp_map_rgb_color(gx_device *, gx_color_value,
187- gx_color_value, gx_color_value);
186+static gx_color_index opvp_map_rgb_color(gx_device *, gx_color_value,
187+ gx_color_value, gx_color_value);
188188 #endif
189-static int opvp_map_color_rgb(gx_device *, gx_color_index, gx_color_value *);
190-static int opvp_copy_mono(gx_device *, const byte *, int, int,
189+static int opvp_map_color_rgb(gx_device *, gx_color_index, gx_color_value *);
190+static int opvp_copy_mono(gx_device *, const byte *, int, int,
191191 gx_bitmap_id, int, int, int, int,
192192 gx_color_index, gx_color_index);
193-static int opvp_copy_color(gx_device *, const byte *, int, int,
193+static int opvp_copy_color(gx_device *, const byte *, int, int,
194194 gx_bitmap_id, int, int, int, int);
195-static int _get_params(gs_param_list *);
196-static int opvp_get_params(gx_device *, gs_param_list *);
197-static int oprp_get_params(gx_device *, gs_param_list *);
198-static int _put_params(gs_param_list *);
199-static int opvp_put_params(gx_device *, gs_param_list *);
200-static int oprp_put_params(gx_device *, gs_param_list *);
201-static int opvp_fill_path(gx_device *, const gs_imager_state *, gx_path *,
202- const gx_fill_params *, const gx_device_color *,
203- const gx_clip_path *);
204-static int opvp_stroke_path(gx_device *, const gs_imager_state *, gx_path *,
205- const gx_stroke_params *, const gx_drawing_color *,
206- const gx_clip_path *);
207-static int opvp_fill_mask(gx_device *, const byte *, int, int, gx_bitmap_id,
208- int, int, int, int, const gx_drawing_color *,
209- int, gs_logical_operation_t, const gx_clip_path *);
195+static int _get_params(gs_param_list *);
196+static int opvp_get_params(gx_device *, gs_param_list *);
197+static int oprp_get_params(gx_device *, gs_param_list *);
198+static int _put_params(gs_param_list *);
199+static int opvp_put_params(gx_device *, gs_param_list *);
200+static int oprp_put_params(gx_device *, gs_param_list *);
201+static int opvp_fill_path(gx_device *, const gs_imager_state *, gx_path *,
202+ const gx_fill_params *, const gx_device_color *,
203+ const gx_clip_path *);
204+static int opvp_stroke_path(gx_device *, const gs_imager_state *, gx_path *,
205+ const gx_stroke_params *, const gx_drawing_color *,
206+ const gx_clip_path *);
207+static int opvp_fill_mask(gx_device *, const byte *, int, int, gx_bitmap_id,
208+ int, int, int, int, const gx_drawing_color *,
209+ int, gs_logical_operation_t, const gx_clip_path *);
210210
211211 /* available color spaces */
212212
@@ -222,75 +222,75 @@
222222 };
223223
224224 /* vector driver procs */
225-static int opvp_beginpage(gx_device_vector *);
226-static int opvp_setlinewidth(gx_device_vector *, floatp);
227-static int opvp_setlinecap(gx_device_vector *, gs_line_cap);
228-static int opvp_setlinejoin(gx_device_vector *, gs_line_join);
229-static int opvp_setmiterlimit(gx_device_vector *, floatp);
230-static int opvp_setdash(gx_device_vector *, const float *, uint, floatp);
231-static int opvp_setflat(gx_device_vector *, floatp);
232-static int opvp_setlogop(gx_device_vector *, gs_logical_operation_t,
233- gs_logical_operation_t);
225+static int opvp_beginpage(gx_device_vector *);
226+static int opvp_setlinewidth(gx_device_vector *, floatp);
227+static int opvp_setlinecap(gx_device_vector *, gs_line_cap);
228+static int opvp_setlinejoin(gx_device_vector *, gs_line_join);
229+static int opvp_setmiterlimit(gx_device_vector *, floatp);
230+static int opvp_setdash(gx_device_vector *, const float *, uint, floatp);
231+static int opvp_setflat(gx_device_vector *, floatp);
232+static int opvp_setlogop(gx_device_vector *, gs_logical_operation_t,
233+ gs_logical_operation_t);
234234 #if GS_VERSION_MAJOR >= 8
235-static int opvp_can_handle_hl_color(gx_device_vector *, const gs_imager_state *, const gx_drawing_color *);
236-static int opvp_setfillcolor(gx_device_vector *, const gs_imager_state *, const gx_drawing_color *);
237-static int opvp_setstrokecolor(gx_device_vector *, const gs_imager_state *,const gx_drawing_color *);
235+static int opvp_can_handle_hl_color(gx_device_vector *, const gs_imager_state *, const gx_drawing_color *);
236+static int opvp_setfillcolor(gx_device_vector *, const gs_imager_state *, const gx_drawing_color *);
237+static int opvp_setstrokecolor(gx_device_vector *, const gs_imager_state *,const gx_drawing_color *);
238238 #else
239-static int opvp_setfillcolor(gx_device_vector *, const gx_drawing_color *);
240-static int opvp_setstrokecolor(gx_device_vector *, const gx_drawing_color *);
239+static int opvp_setfillcolor(gx_device_vector *, const gx_drawing_color *);
240+static int opvp_setstrokecolor(gx_device_vector *, const gx_drawing_color *);
241241 #endif
242-static int opvp_vector_dopath(gx_device_vector *, const gx_path *,
243- gx_path_type_t, const gs_matrix *);
244-static int opvp_vector_dorect(gx_device_vector *, fixed, fixed, fixed, fixed,
245- gx_path_type_t);
246-static int opvp_beginpath(gx_device_vector *, gx_path_type_t);
247-static int opvp_moveto(gx_device_vector *, floatp, floatp, floatp, floatp,
248- gx_path_type_t);
249-static int opvp_lineto(gx_device_vector *, floatp, floatp, floatp, floatp,
250- gx_path_type_t);
251-static int opvp_curveto(gx_device_vector *, floatp, floatp, floatp, floatp,
252- floatp, floatp, floatp, floatp, gx_path_type_t);
253-static int opvp_closepath(gx_device_vector *, floatp, floatp, floatp, floatp,
254- gx_path_type_t);
255-static int opvp_endpath(gx_device_vector *, gx_path_type_t);
242+static int opvp_vector_dopath(gx_device_vector *, const gx_path *,
243+ gx_path_type_t, const gs_matrix *);
244+static int opvp_vector_dorect(gx_device_vector *, fixed, fixed, fixed, fixed,
245+ gx_path_type_t);
246+static int opvp_beginpath(gx_device_vector *, gx_path_type_t);
247+static int opvp_moveto(gx_device_vector *, floatp, floatp, floatp, floatp,
248+ gx_path_type_t);
249+static int opvp_lineto(gx_device_vector *, floatp, floatp, floatp, floatp,
250+ gx_path_type_t);
251+static int opvp_curveto(gx_device_vector *, floatp, floatp, floatp, floatp,
252+ floatp, floatp, floatp, floatp, gx_path_type_t);
253+static int opvp_closepath(gx_device_vector *, floatp, floatp, floatp, floatp,
254+ gx_path_type_t);
255+static int opvp_endpath(gx_device_vector *, gx_path_type_t);
256256
257257 /* ----- Paper definition ----- */
258-OPVP_Paper paperTable[] =
258+OPVP_Paper paperTable[] =
259259 {
260260 #if 0
261- {"jpn","hagaki",100/MMPI*PS_DPI,148/MMPI*PS_DPI},
262- {"iso","a6" ,105/MMPI*PS_DPI,148/MMPI*PS_DPI},
263- {"jis","b6" ,128/MMPI*PS_DPI,182/MMPI*PS_DPI},
264- {"jpn","oufuku",148/MMPI*PS_DPI,200/MMPI*PS_DPI},
265- {"iso","a5" ,148/MMPI*PS_DPI,210/MMPI*PS_DPI},
266- {"jis","b5" ,182/MMPI*PS_DPI,257/MMPI*PS_DPI},
267- {"iso","a4" ,210/MMPI*PS_DPI,297/MMPI*PS_DPI},
268- {"na" ,"letter", 8.5*PS_DPI, 11*PS_DPI},/* 215.9x279.4 */
269- {"na" ,"legal" , 8.5*PS_DPI, 14*PS_DPI},/* 215.9x355.6 */
270- {"jis","b4" ,257/MMPI*PS_DPI,364/MMPI*PS_DPI},
271- {"iso","a3" ,297/MMPI*PS_DPI,420/MMPI*PS_DPI},
261+ {"jpn","hagaki",100/MMPI*PS_DPI,148/MMPI*PS_DPI},
262+ {"iso","a6" ,105/MMPI*PS_DPI,148/MMPI*PS_DPI},
263+ {"jis","b6" ,128/MMPI*PS_DPI,182/MMPI*PS_DPI},
264+ {"jpn","oufuku",148/MMPI*PS_DPI,200/MMPI*PS_DPI},
265+ {"iso","a5" ,148/MMPI*PS_DPI,210/MMPI*PS_DPI},
266+ {"jis","b5" ,182/MMPI*PS_DPI,257/MMPI*PS_DPI},
267+ {"iso","a4" ,210/MMPI*PS_DPI,297/MMPI*PS_DPI},
268+ {"na" ,"letter", 8.5*PS_DPI, 11*PS_DPI},/* 215.9x279.4 */
269+ {"na" ,"legal" , 8.5*PS_DPI, 14*PS_DPI},/* 215.9x355.6 */
270+ {"jis","b4" ,257/MMPI*PS_DPI,364/MMPI*PS_DPI},
271+ {"iso","a3" ,297/MMPI*PS_DPI,420/MMPI*PS_DPI},
272272 #else
273273 #include "opvp_media.def"
274274 #endif
275- {NULL ,NULL , 0, 0}
275+ {NULL ,NULL , 0, 0}
276276 };
277277
278278 /* ----- Driver definition ----- */
279279
280280 /* Driver procedures */
281-static dev_proc_open_device(opvp_open);
282-static dev_proc_open_device(oprp_open);
283-static dev_proc_output_page(opvp_output_page);
284-static dev_proc_print_page(oprp_print_page);
285-static dev_proc_close_device(opvp_close);
286-static dev_proc_get_params(opvp_get_params);
287-static dev_proc_get_params(oprp_get_params);
288-static dev_proc_put_params(opvp_put_params);
289-static dev_proc_put_params(oprp_put_params);
290-static dev_proc_fill_rectangle(opvp_fill_rectangle);
291-static dev_proc_begin_image(opvp_begin_image);
292-static image_enum_proc_plane_data(opvp_image_plane_data);
293-static image_enum_proc_end_image(opvp_image_end_image);
281+static dev_proc_open_device(opvp_open);
282+static dev_proc_open_device(oprp_open);
283+static dev_proc_output_page(opvp_output_page);
284+static dev_proc_print_page(oprp_print_page);
285+static dev_proc_close_device(opvp_close);
286+static dev_proc_get_params(opvp_get_params);
287+static dev_proc_get_params(oprp_get_params);
288+static dev_proc_put_params(opvp_put_params);
289+static dev_proc_put_params(oprp_put_params);
290+static dev_proc_fill_rectangle(opvp_fill_rectangle);
291+static dev_proc_begin_image(opvp_begin_image);
292+static image_enum_proc_plane_data(opvp_image_plane_data);
293+static image_enum_proc_end_image(opvp_image_end_image);
294294
295295 gs_public_st_suffix_add0_final(
296296 st_device_opvp,
@@ -302,21 +302,21 @@
302302 st_device_vector
303303 );
304304
305-#define opvp_initial_values \
305+#define opvp_initial_values \
306306 NULL, /* *vectorDriver */\
307307 NULL, /* *printerModel */\
308308 NULL, /* *handle */\
309309 NULL, /* (*OpenPrinter)() */\
310310 NULL, /* *ErrorNo */\
311- -1, /* outputFD */\
312- 0, /* nApiEntry */\
311+ -1, /* outputFD */\
312+ 0, /* nApiEntry */\
313313 NULL, /* *apiEntry */\
314- -1, /* printerContext */\
314+ -1, /* printerContext */\
315315 NULL, /* *jobInfo */\
316316 NULL /* *docInfo */
317317
318318 /* device procs */
319-#define opvp_procs \
319+#define opvp_procs \
320320 {\
321321 opvp_open,\
322322 opvp_get_initial_matrix,\
@@ -371,7 +371,7 @@
371371
372372
373373 /* vector procs */
374-static gx_device_vector_procs opvp_vector_procs =
374+static gx_device_vector_procs opvp_vector_procs =
375375 {
376376 /* Page management */
377377 opvp_beginpage,
@@ -385,7 +385,7 @@
385385 opvp_setlogop,
386386 /* Other state */
387387 #if GS_VERSION_MAJOR >= 8
388- opvp_can_handle_hl_color, /* added for gs 8.15 */
388+ opvp_can_handle_hl_color, /* added for gs 8.15 */
389389 #endif
390390 opvp_setfillcolor,
391391 opvp_setstrokecolor,
@@ -400,52 +400,52 @@
400400 opvp_endpath
401401 };
402402
403-const gx_device_opvp gs_opvp_device =
403+const gx_device_opvp gs_opvp_device =
404404 {
405405 std_device_dci_type_body(
406- gx_device_opvp,
407- 0,
408- "opvp",
409- &st_device_opvp,
410- DEFAULT_WIDTH_10THS_A4 * X_DPI / 10,
411- DEFAULT_HEIGHT_10THS_A4 * Y_DPI / 10,
412- X_DPI,
413- Y_DPI,
414- 3,
415- 24,
416- 255,
417- 255,
418- 256,
419- 256
406+ gx_device_opvp,
407+ 0,
408+ "opvp",
409+ &st_device_opvp,
410+ DEFAULT_WIDTH_10THS_A4 * X_DPI / 10,
411+ DEFAULT_HEIGHT_10THS_A4 * Y_DPI / 10,
412+ X_DPI,
413+ Y_DPI,
414+ 3,
415+ 24,
416+ 255,
417+ 255,
418+ 256,
419+ 256
420420 ),
421421 opvp_procs
422422 };
423423
424424 /* for inkjet */
425-static gx_device_procs prn_oprp_procs =
425+static gx_device_procs prn_oprp_procs =
426426 prn_color_params_procs(
427- oprp_open,
428- opvp_output_page,
429- opvp_close,
430- opvp_map_rgb_color,
431- opvp_map_color_rgb,
432- oprp_get_params,
433- oprp_put_params
427+ oprp_open,
428+ opvp_output_page,
429+ opvp_close,
430+ opvp_map_rgb_color,
431+ opvp_map_color_rgb,
432+ oprp_get_params,
433+ oprp_put_params
434434 );
435435
436436 const gx_device_oprp gs_oprp_device =
437437 {
438438 prn_device_std_margins_body(
439- gx_device_oprp,
440- prn_oprp_procs,
441- "oprp",
442- DEFAULT_WIDTH_10THS_A4,
443- DEFAULT_HEIGHT_10THS_A4,
444- X_DPI,
445- Y_DPI,
446- 0, 0, 0, 0, 0, 0,
447- 24,
448- oprp_print_page
439+ gx_device_oprp,
440+ prn_oprp_procs,
441+ "oprp",
442+ DEFAULT_WIDTH_10THS_A4,
443+ DEFAULT_HEIGHT_10THS_A4,
444+ X_DPI,
445+ Y_DPI,
446+ 0, 0, 0, 0, 0, 0,
447+ 24,
448+ oprp_print_page
449449 )
450450 };
451451
@@ -457,9 +457,9 @@
457457 static void *handle = NULL;
458458 static opvp_dc_t (*OpenPrinter)(opvp_int_t,const opvp_char_t*,
459459 const opvp_int_t[2],
460- opvp_api_procs_t**) = NULL;
460+ opvp_api_procs_t**) = NULL;
461461 static int (*OpenPrinter_0_2)(int,char*,int*,
462- OPVP_api_procs**) = NULL;
462+ OPVP_api_procs**) = NULL;
463463 static opvp_int_t *ErrorNo = NULL;
464464 static opvp_int_t outputFD = -1;
465465 static opvp_int_t nApiEntry = 0;
@@ -537,25 +537,25 @@
537537 {
538538 switch(*ErrorNo) {
539539 case OPVP_FATALERROR_0_2:
540- return OPVP_FATALERROR;
541- break;
540+ return OPVP_FATALERROR;
541+ break;
542542 case OPVP_BADREQUEST_0_2:
543- return OPVP_BADREQUEST;
544- break;
543+ return OPVP_BADREQUEST;
544+ break;
545545 case OPVP_BADCONTEXT_0_2:
546- return OPVP_BADCONTEXT;
547- break;
546+ return OPVP_BADCONTEXT;
547+ break;
548548 case OPVP_NOTSUPPORTED_0_2:
549- return OPVP_NOTSUPPORTED;
550- break;
549+ return OPVP_NOTSUPPORTED;
550+ break;
551551 case OPVP_JOBCANCELED_0_2:
552- return OPVP_JOBCANCELED;
553- break;
552+ return OPVP_JOBCANCELED;
553+ break;
554554 case OPVP_PARAMERROR_0_2:
555- return OPVP_PARAMERROR;
556- break;
555+ return OPVP_PARAMERROR;
556+ break;
557557 default:
558- break;
558+ break;
559559 }
560560 /* unknown error no */
561561 /* return FATALERROR instead */
@@ -569,13 +569,13 @@
569569
570570 if ((r = apiEntry_0_2->StartPage(printerContext,
571571 /* discard const */(char *)pageInfo)) != OPVP_OK) {
572- /* error */
573- return r;
572+ /* error */
573+ return r;
574574 }
575575 /* initialize ROP */
576576 if (apiEntry_0_2->SetROP != NULL) {
577- apiEntry_0_2->SetROP(printerContext,
578- OPVP_0_2_ROP_P);
577+ apiEntry_0_2->SetROP(printerContext,
578+ OPVP_0_2_ROP_P);
579579 }
580580 return OPVP_OK;
581581 }
@@ -586,13 +586,13 @@
586586 int r;
587587
588588 if ((r = apiEntry_0_2->InitGS(printerContext)) != OPVP_OK) {
589- /* error */
590- return r;
589+ /* error */
590+ return r;
591591 }
592592 /* initialize ROP */
593593 if (apiEntry_0_2->SetROP != NULL) {
594- apiEntry_0_2->SetROP(printerContext,
595- OPVP_0_2_ROP_P);
594+ apiEntry_0_2->SetROP(printerContext,
595+ OPVP_0_2_ROP_P);
596596 }
597597 return OPVP_OK;
598598 }
@@ -605,20 +605,20 @@
605605 int i;
606606
607607 if ((r = apiEntry_0_2->QueryColorSpace(printerContext,
608- (OPVP_ColorSpace *)pcspace,pnum)) != OPVP_OK) {
609- /* error */
610- return r;
608+ (OPVP_ColorSpace *)pcspace,pnum)) != OPVP_OK) {
609+ /* error */
610+ return r;
611611 }
612612 /* translate cspaces */
613613 for (i = 0;i < *pnum;i++) {
614- if (pcspace[i]
615- > sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
616- /* unknown color space */
617- /* set DEVICERGB instead */
618- pcspace[i] = OPVP_CSPACE_DEVICERGB;
619- } else {
620- pcspace[i] = cspace_0_2_to_1_0[pcspace[i]];
621- }
614+ if (pcspace[i]
615+ >= sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
616+ /* unknown color space */
617+ /* set DEVICERGB instead */
618+ pcspace[i] = OPVP_CSPACE_DEVICERGB;
619+ } else {
620+ pcspace[i] = cspace_0_2_to_1_0[pcspace[i]];
621+ }
622622 }
623623 return OPVP_OK;
624624 }
@@ -627,15 +627,15 @@
627627 SetColorSpaceWrapper(opvp_dc_t printerContext, opvp_cspace_t cspace)
628628 {
629629 if (cspace == OPVP_CSPACE_DEVICEKRGB) {
630- /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
631- *ErrorNo = OPVP_NOTSUPPORTED_0_2;
632- return -1;
630+ /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
631+ *ErrorNo = OPVP_NOTSUPPORTED_0_2;
632+ return -1;
633633 }
634634 if (cspace
635- > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
636- /* unknown color space */
637- *ErrorNo = OPVP_PARAMERROR_0_2;
638- return -1;
635+ >= sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
636+ /* unknown color space */
637+ *ErrorNo = OPVP_PARAMERROR_0_2;
638+ return -1;
639639 }
640640 return apiEntry_0_2->SetColorSpace(printerContext,
641641 cspace_1_0_to_0_2[cspace]);
@@ -648,16 +648,16 @@
648648
649649 if ((r = apiEntry_0_2->GetColorSpace(printerContext,
650650 (OPVP_ColorSpace *)pcspace)) != OPVP_OK) {
651- /* error */
652- return r;
651+ /* error */
652+ return r;
653653 }
654654 if (*pcspace
655- > sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
656- /* unknown color space */
657- /* set DEVICERGB instead */
658- *pcspace = OPVP_CSPACE_DEVICERGB;
655+ >= sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
656+ /* unknown color space */
657+ /* set DEVICERGB instead */
658+ *pcspace = OPVP_CSPACE_DEVICERGB;
659659 } else {
660- *pcspace = cspace_0_2_to_1_0[*pcspace];
660+ *pcspace = cspace_0_2_to_1_0[*pcspace];
661661 }
662662 return r;
663663 }
@@ -668,18 +668,18 @@
668668 OPVP_Brush brush_0_2;
669669
670670 if (brush == NULL) {
671- *ErrorNo = OPVP_PARAMERROR_0_2;
672- return -1;
671+ *ErrorNo = OPVP_PARAMERROR_0_2;
672+ return -1;
673673 }
674674 if (brush->colorSpace == OPVP_CSPACE_DEVICEKRGB) {
675- /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
676- return OPVP_NOTSUPPORTED;
675+ /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
676+ return OPVP_NOTSUPPORTED;
677677 }
678678 if (brush->colorSpace
679- > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
680- /* unknown color space */
681- *ErrorNo = OPVP_PARAMERROR_0_2;
682- return -1;
679+ >= sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
680+ /* unknown color space */
681+ *ErrorNo = OPVP_PARAMERROR_0_2;
682+ return -1;
683683 }
684684 brush_0_2.colorSpace = cspace_1_0_to_0_2[brush->colorSpace];
685685 brush_0_2.xorg = brush->xorg;
@@ -695,18 +695,18 @@
695695 OPVP_Brush brush_0_2;
696696
697697 if (brush == NULL) {
698- *ErrorNo = OPVP_PARAMERROR_0_2;
699- return -1;
698+ *ErrorNo = OPVP_PARAMERROR_0_2;
699+ return -1;
700700 }
701701 if (brush->colorSpace == OPVP_CSPACE_DEVICEKRGB) {
702- /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
703- return OPVP_NOTSUPPORTED;
702+ /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
703+ return OPVP_NOTSUPPORTED;
704704 }
705705 if (brush->colorSpace
706- > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
707- /* unknown color space */
708- *ErrorNo = OPVP_PARAMERROR_0_2;
709- return -1;
706+ >= sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
707+ /* unknown color space */
708+ *ErrorNo = OPVP_PARAMERROR_0_2;
709+ return -1;
710710 }
711711 brush_0_2.colorSpace = cspace_1_0_to_0_2[brush->colorSpace];
712712 brush_0_2.xorg = brush->xorg;
@@ -722,19 +722,19 @@
722722 OPVP_Brush brush_0_2;
723723
724724 if (brush == NULL) {
725- *ErrorNo = OPVP_PARAMERROR_0_2;
726- return -1;
725+ *ErrorNo = OPVP_PARAMERROR_0_2;
726+ return -1;
727727 }
728728 if (brush->colorSpace == OPVP_CSPACE_DEVICEKRGB) {
729- /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
730- *ErrorNo = OPVP_NOTSUPPORTED_0_2;
731- return -1;
729+ /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
730+ *ErrorNo = OPVP_NOTSUPPORTED_0_2;
731+ return -1;
732732 }
733733 if (brush->colorSpace
734- > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
735- /* unknown color space */
736- *ErrorNo = OPVP_PARAMERROR_0_2;
737- return -1;
734+ >= sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
735+ /* unknown color space */
736+ *ErrorNo = OPVP_PARAMERROR_0_2;
737+ return -1;
738738 }
739739 brush_0_2.colorSpace = cspace_1_0_to_0_2[brush->colorSpace];
740740 brush_0_2.xorg = brush->xorg;
@@ -762,28 +762,28 @@
762762 int depth;
763763
764764 if (imageFormat == OPVP_IFORMAT_MASK) {
765- if (apiEntry_0_2->GetPaintMode != NULL) {
766- apiEntry_0_2->GetPaintMode(printerContext,
767- &paintmode_0_2);
768- }
769- if (paintmode_0_2 != OPVP_paintModeTransparent) {
770- if (apiEntry_0_2->SetROP != NULL) {
771- apiEntry_0_2->SetROP(printerContext,
772- OPVP_0_2_ROP_S);
773- }
774- }
775- else {
776- if (apiEntry_0_2->SetROP != NULL) {
777- apiEntry_0_2->SetROP(printerContext,
778- OPVP_0_2_ROP_OR);
779- }
780- }
781- depth = 1;
765+ if (apiEntry_0_2->GetPaintMode != NULL) {
766+ apiEntry_0_2->GetPaintMode(printerContext,
767+ &paintmode_0_2);
768+ }
769+ if (paintmode_0_2 != OPVP_paintModeTransparent) {
770+ if (apiEntry_0_2->SetROP != NULL) {
771+ apiEntry_0_2->SetROP(printerContext,
772+ OPVP_0_2_ROP_S);
773+ }
774+ }
775+ else {
776+ if (apiEntry_0_2->SetROP != NULL) {
777+ apiEntry_0_2->SetROP(printerContext,
778+ OPVP_0_2_ROP_OR);
779+ }
780+ }
781+ depth = 1;
782782 } else {
783- if (apiEntry_0_2->SetROP != NULL) {
784- apiEntry_0_2->SetROP(printerContext,OPVP_0_2_ROP_S);
785- }
786- depth = colorDepth_0_2[colorSpace];
783+ if (apiEntry_0_2->SetROP != NULL) {
784+ apiEntry_0_2->SetROP(printerContext,OPVP_0_2_ROP_S);
785+ }
786+ depth = colorDepth_0_2[colorSpace];
787787 }
788788
789789 OPVP_I2FIX(0,rect.p0.x);
@@ -790,16 +790,16 @@
790790 OPVP_I2FIX(0,rect.p0.y);
791791 OPVP_I2FIX(destinationWidth,rect.p1.x);
792792 OPVP_I2FIX(destinationHeight,rect.p1.y);
793- if (imageFormat > sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
794- /* illegal image format */
795- *ErrorNo = OPVP_PARAMERROR_0_2;
796- return -1;
793+ if (imageFormat >= sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
794+ /* illegal image format */
795+ *ErrorNo = OPVP_PARAMERROR_0_2;
796+ return -1;
797797 }
798798 iformat_0_2 = iformat_1_0_to_0_2[imageFormat];
799799 r = apiEntry_0_2->DrawImage(printerContext,sourceWidth,sourceHeight,
800- depth,iformat_0_2,rect,
801- sourcePitch*sourceHeight,
802- /* remove const */ (void *)imagedata);
800+ depth,iformat_0_2,rect,
801+ sourcePitch*sourceHeight,
802+ /* remove const */ (void *)imagedata);
803803
804804 if (apiEntry_0_2->SetROP != NULL) {
805805 apiEntry_0_2->SetROP(printerContext,OPVP_0_2_ROP_P);
@@ -825,26 +825,26 @@
825825 int depth;
826826
827827 if (imageFormat == OPVP_IFORMAT_MASK) {
828- if (apiEntry_0_2->GetPaintMode != NULL) {
829- apiEntry_0_2->GetPaintMode(printerContext,
830- &paintmode_0_2);
831- }
832- if (paintmode_0_2 != OPVP_paintModeTransparent) {
833- if (apiEntry_0_2->SetROP != NULL) {
834- apiEntry_0_2->SetROP(printerContext,OPVP_0_2_ROP_S);
835- }
836- }
837- else {
838- if (apiEntry_0_2->SetROP != NULL) {
839- apiEntry_0_2->SetROP(printerContext,OPVP_0_2_ROP_OR);
840- }
841- }
842- depth = 1;
828+ if (apiEntry_0_2->GetPaintMode != NULL) {
829+ apiEntry_0_2->GetPaintMode(printerContext,
830+ &paintmode_0_2);
831+ }
832+ if (paintmode_0_2 != OPVP_paintModeTransparent) {
833+ if (apiEntry_0_2->SetROP != NULL) {
834+ apiEntry_0_2->SetROP(printerContext,OPVP_0_2_ROP_S);
835+ }
836+ }
837+ else {
838+ if (apiEntry_0_2->SetROP != NULL) {
839+ apiEntry_0_2->SetROP(printerContext,OPVP_0_2_ROP_OR);
840+ }
841+ }
842+ depth = 1;
843843 } else {
844- if (apiEntry_0_2->SetROP != NULL) {
845- apiEntry_0_2->SetROP(printerContext,OPVP_0_2_ROP_S);
846- }
847- depth = colorDepth_0_2[colorSpace];
844+ if (apiEntry_0_2->SetROP != NULL) {
845+ apiEntry_0_2->SetROP(printerContext,OPVP_0_2_ROP_S);
846+ }
847+ depth = colorDepth_0_2[colorSpace];
848848 }
849849
850850 OPVP_I2FIX(0,rect.p0.x);
@@ -851,15 +851,15 @@
851851 OPVP_I2FIX(0,rect.p0.y);
852852 OPVP_I2FIX(destinationWidth,rect.p1.x);
853853 OPVP_I2FIX(destinationHeight,rect.p1.y);
854- if (imageFormat > sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
855- /* illegal image format */
856- *ErrorNo = OPVP_PARAMERROR_0_2;
857- return -1;
854+ if (imageFormat >= sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
855+ /* illegal image format */
856+ *ErrorNo = OPVP_PARAMERROR_0_2;
857+ return -1;
858858 }
859859 iformat_0_2 = iformat_1_0_to_0_2[imageFormat];
860860 r = apiEntry_0_2->StartDrawImage(printerContext,
861- sourceWidth,sourceHeight,
862- depth,iformat_0_2,rect);
861+ sourceWidth,sourceHeight,
862+ depth,iformat_0_2,rect);
863863
864864 return r;
865865 }
@@ -873,7 +873,7 @@
873873
874874 /* make sure rop is pattern copy */
875875 if (apiEntry_0_2->SetROP != NULL) {
876- apiEntry_0_2->SetROP(printerContext,OPVP_0_2_ROP_P);
876+ apiEntry_0_2->SetROP(printerContext,OPVP_0_2_ROP_P);
877877 }
878878
879879 return r;
@@ -898,12 +898,12 @@
898898 opvp_char_t *infoBuf)
899899 {
900900 if (queryflag & OPVP_QF_MEDIACOPY) {
901- *ErrorNo = OPVP_NOTSUPPORTED;
902- return -1;
901+ *ErrorNo = OPVP_NOTSUPPORTED;
902+ return -1;
903903 }
904904 if (queryflag & OPVP_QF_PRINTREGION) {
905- queryflag &= ~OPVP_QF_PRINTREGION;
906- queryflag |= 0x0020000;
905+ queryflag &= ~OPVP_QF_PRINTREGION;
906+ queryflag |= 0x0020000;
907907 }
908908 return apiEntry_0_2->QueryDeviceInfo(printerContext,queryflag,
909909 *buflen,(char *)infoBuf);
@@ -935,236 +935,236 @@
935935 opvp_dc_t dc = -1;
936936
937937 if (OpenPrinter != NULL) {
938- dc = (*OpenPrinter)(outputFD,printerModel,apiVersion,apiProcs);
938+ dc = (*OpenPrinter)(outputFD,printerModel,apiVersion,apiProcs);
939939 } else {
940- /* try version 0.2 */
940+ /* try version 0.2 */
941941
942- if (OpenPrinter_0_2 != NULL) {
943- static opvp_api_procs_t tEntry;
944- int nApiEntry;
942+ if (OpenPrinter_0_2 != NULL) {
943+ static opvp_api_procs_t tEntry;
944+ int nApiEntry;
945945
946- dc = (*OpenPrinter_0_2)(outputFD,
947- /* remove const */
948- (char *)printerModel,
949- &nApiEntry,&apiEntry_0_2);
950- /* setting functions */
951- tEntry.opvpClosePrinter
952- = apiEntry_0_2->ClosePrinter;
953- tEntry.opvpStartJob
954- = (opvp_result_t (*)(opvp_int_t,
955- const opvp_char_t*))
956- apiEntry_0_2->StartJob;
957- tEntry.opvpEndJob = apiEntry_0_2->EndJob;
958- tEntry.opvpAbortJob = NULL;
959- tEntry.opvpStartDoc
960- = (opvp_result_t (*)(opvp_dc_t,
961- const opvp_char_t*))
962- apiEntry_0_2->StartDoc;
963- tEntry.opvpEndDoc = apiEntry_0_2->EndDoc;
964- if (apiEntry_0_2->StartPage != NULL) {
965- tEntry.opvpStartPage = StartPageWrapper;
966- } else {
967- tEntry.opvpStartPage = NULL;
968- }
969- tEntry.opvpEndPage = apiEntry_0_2->EndPage;
946+ dc = (*OpenPrinter_0_2)(outputFD,
947+ /* remove const */
948+ (char *)printerModel,
949+ &nApiEntry,&apiEntry_0_2);
950+ /* setting functions */
951+ tEntry.opvpClosePrinter
952+ = apiEntry_0_2->ClosePrinter;
953+ tEntry.opvpStartJob
954+ = (opvp_result_t (*)(opvp_int_t,
955+ const opvp_char_t*))
956+ apiEntry_0_2->StartJob;
957+ tEntry.opvpEndJob = apiEntry_0_2->EndJob;
958+ tEntry.opvpAbortJob = NULL;
959+ tEntry.opvpStartDoc
960+ = (opvp_result_t (*)(opvp_dc_t,
961+ const opvp_char_t*))
962+ apiEntry_0_2->StartDoc;
963+ tEntry.opvpEndDoc = apiEntry_0_2->EndDoc;
964+ if (apiEntry_0_2->StartPage != NULL) {
965+ tEntry.opvpStartPage = StartPageWrapper;
966+ } else {
967+ tEntry.opvpStartPage = NULL;
968+ }
969+ tEntry.opvpEndPage = apiEntry_0_2->EndPage;
970970
971- if (apiEntry_0_2->QueryDeviceCapability != NULL) {
972- tEntry.opvpQueryDeviceCapability
973- = QueryDeviceCapabilityWrapper;
974- } else {
975- tEntry.opvpQueryDeviceCapability = NULL;
976- }
971+ if (apiEntry_0_2->QueryDeviceCapability != NULL) {
972+ tEntry.opvpQueryDeviceCapability
973+ = QueryDeviceCapabilityWrapper;
974+ } else {
975+ tEntry.opvpQueryDeviceCapability = NULL;
976+ }
977977
978- if (apiEntry_0_2->QueryDeviceInfo != NULL) {
979- tEntry.opvpQueryDeviceInfo = QueryDeviceInfoWrapper;
980- } else {
981- tEntry.opvpQueryDeviceInfo = NULL;
982- }
978+ if (apiEntry_0_2->QueryDeviceInfo != NULL) {
979+ tEntry.opvpQueryDeviceInfo = QueryDeviceInfoWrapper;
980+ } else {
981+ tEntry.opvpQueryDeviceInfo = NULL;
982+ }
983983
984- tEntry.opvpResetCTM = apiEntry_0_2->ResetCTM;
985- tEntry.opvpSetCTM = (opvp_result_t (*)(opvp_dc_t,
986- const opvp_ctm_t*))
987- apiEntry_0_2->SetCTM;
988- tEntry.opvpGetCTM = (opvp_result_t (*)(opvp_dc_t,opvp_ctm_t*))
989- apiEntry_0_2->GetCTM;
990- if (apiEntry_0_2->InitGS != NULL) {
991- tEntry.opvpInitGS = InitGSWrapper;
992- } else {
993- tEntry.opvpInitGS = NULL;
994- }
995- tEntry.opvpSaveGS = apiEntry_0_2->SaveGS;
996- tEntry.opvpRestoreGS = apiEntry_0_2->RestoreGS;
997- if (apiEntry_0_2->QueryColorSpace != NULL) {
998- tEntry.opvpQueryColorSpace = QueryColorSpaceWrapper;
999- } else {
1000- tEntry.opvpQueryColorSpace = NULL;
1001- }
1002- if (apiEntry_0_2->SetColorSpace != NULL) {
1003- tEntry.opvpSetColorSpace = SetColorSpaceWrapper;
1004- } else {
1005- tEntry.opvpSetColorSpace = NULL;
1006- }
1007- if (apiEntry_0_2->GetColorSpace != NULL) {
1008- tEntry.opvpGetColorSpace = GetColorSpaceWrapper;
1009- } else {
1010- tEntry.opvpGetColorSpace = NULL;
1011- }
1012- tEntry.opvpSetFillMode
1013- = (opvp_result_t (*)(opvp_dc_t,opvp_fillmode_t))
1014- apiEntry_0_2->SetFillMode;
1015- tEntry.opvpGetFillMode
1016- = (opvp_result_t (*)(opvp_dc_t,opvp_fillmode_t*))
1017- apiEntry_0_2->GetFillMode;
1018- tEntry.opvpSetAlphaConstant = apiEntry_0_2->SetAlphaConstant;
1019- tEntry.opvpGetAlphaConstant = apiEntry_0_2->GetAlphaConstant;
1020- tEntry.opvpSetLineWidth = apiEntry_0_2->SetLineWidth;
1021- tEntry.opvpGetLineWidth = apiEntry_0_2->GetLineWidth;
1022- if (apiEntry_0_2->SetLineDash != NULL) {
1023- tEntry.opvpSetLineDash = SetLineDashWrapper;
1024- } else {
1025- tEntry.opvpSetLineDash = NULL;
1026- }
1027- if (apiEntry_0_2->GetLineDash != NULL) {
1028- tEntry.opvpGetLineDash = GetLineDashWrapper;
1029- } else {
1030- tEntry.opvpGetLineDash = NULL;
1031- }
1032- tEntry.opvpSetLineDashOffset
1033- = apiEntry_0_2->SetLineDashOffset;
1034- tEntry.opvpGetLineDashOffset
1035- = apiEntry_0_2->GetLineDashOffset;
1036- tEntry.opvpSetLineStyle
1037- = (opvp_result_t (*)(opvp_dc_t,opvp_linestyle_t))
1038- apiEntry_0_2->SetLineStyle;
1039- tEntry.opvpGetLineStyle
1040- = (opvp_result_t (*)(opvp_dc_t,opvp_linestyle_t*))
1041- apiEntry_0_2->GetLineStyle;
1042- tEntry.opvpSetLineCap
1043- = (opvp_result_t (*)(opvp_dc_t,opvp_linecap_t))
1044- apiEntry_0_2->SetLineCap;
1045- tEntry.opvpGetLineCap
1046- = (opvp_result_t (*)(opvp_dc_t,opvp_linecap_t*))
1047- apiEntry_0_2->GetLineCap;
1048- tEntry.opvpSetLineJoin
1049- = (opvp_result_t (*)(opvp_dc_t,opvp_linejoin_t))
1050- apiEntry_0_2->SetLineJoin;
1051- tEntry.opvpGetLineJoin
1052- = (opvp_result_t (*)(opvp_dc_t,opvp_linejoin_t*))
1053- apiEntry_0_2->GetLineJoin;
1054- tEntry.opvpSetMiterLimit = apiEntry_0_2->SetMiterLimit;
1055- tEntry.opvpGetMiterLimit = apiEntry_0_2->GetMiterLimit;
1056- tEntry.opvpSetPaintMode
1057- = (opvp_result_t (*)(opvp_dc_t,opvp_paintmode_t))
1058- apiEntry_0_2->SetPaintMode;
1059- tEntry.opvpGetPaintMode
1060- = (opvp_result_t (*)(opvp_dc_t,opvp_paintmode_t*))
1061- apiEntry_0_2->GetPaintMode;
1062- if (apiEntry_0_2->SetStrokeColor != NULL) {
1063- tEntry.opvpSetStrokeColor = SetStrokeColorWrapper;
1064- } else {
1065- tEntry.opvpSetStrokeColor = NULL;
1066- }
1067- if (apiEntry_0_2->SetFillColor != NULL) {
1068- tEntry.opvpSetFillColor = SetFillColorWrapper;
1069- } else {
1070- tEntry.opvpSetFillColor = NULL;
1071- }
1072- if (apiEntry_0_2->SetBgColor != NULL) {
1073- tEntry.opvpSetBgColor = SetBgColorWrapper;
1074- } else {
1075- tEntry.opvpSetBgColor = NULL;
1076- }
1077- tEntry.opvpNewPath = apiEntry_0_2->NewPath;
1078- tEntry.opvpEndPath = apiEntry_0_2->EndPath;
1079- tEntry.opvpStrokePath = apiEntry_0_2->StrokePath;
1080- tEntry.opvpFillPath = apiEntry_0_2->FillPath;
1081- tEntry.opvpStrokeFillPath = apiEntry_0_2->StrokeFillPath;
1082- tEntry.opvpSetClipPath
1083- = (opvp_result_t (*)(opvp_dc_t,opvp_cliprule_t))
1084- apiEntry_0_2->SetClipPath;
1085- tEntry.opvpResetClipPath = apiEntry_0_2->ResetClipPath;
1086- tEntry.opvpSetCurrentPoint = apiEntry_0_2->SetCurrentPoint;
1087- tEntry.opvpLinePath
1088- = (opvp_result_t (*)(opvp_dc_t,
1089- opvp_pathmode_t,opvp_int_t,
1090- const opvp_point_t*))
1091- apiEntry_0_2->LinePath;
1092- tEntry.opvpPolygonPath
1093- = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1094- const opvp_int_t*,
1095- const opvp_point_t*))
1096- apiEntry_0_2->PolygonPath;
1097- tEntry.opvpRectanglePath
1098- = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1099- const opvp_rectangle_t*))
1100- apiEntry_0_2->RectanglePath;
1101- tEntry.opvpRoundRectanglePath
1102- = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1103- const opvp_roundrectangle_t*))
1104- apiEntry_0_2->RoundRectanglePath;
1105- tEntry.opvpBezierPath
1106- = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1107- const opvp_point_t*))
1108- apiEntry_0_2->BezierPath;
1109- tEntry.opvpArcPath
1110- = (opvp_result_t (*)(opvp_dc_t,opvp_arcmode_t,
1111- opvp_arcdir_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,
1112- opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,
1113- opvp_fix_t))apiEntry_0_2->ArcPath;
1114- if (apiEntry_0_2->DrawImage != NULL) {
1115- tEntry.opvpDrawImage = DrawImageWrapper;
1116- } else {
1117- tEntry.opvpDrawImage = NULL;
1118- }
1119- if (apiEntry_0_2->StartDrawImage != NULL) {
1120- tEntry.opvpStartDrawImage = StartDrawImageWrapper;
1121- } else {
1122- tEntry.opvpStartDrawImage = NULL;
1123- }
1124- tEntry.opvpTransferDrawImage =
1125- (opvp_result_t (*)(opvp_dc_t,opvp_int_t,const void*))
1126- apiEntry_0_2->TransferDrawImage;
1127- if (apiEntry_0_2->EndDrawImage != NULL) {
1128- tEntry.opvpEndDrawImage = EndDrawImageWrapper;
1129- } else {
1130- tEntry.opvpEndDrawImage = NULL;
1131- }
1132- tEntry.opvpStartScanline = apiEntry_0_2->StartScanline;
1133- tEntry.opvpScanline
1134- = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1135- const opvp_int_t*))
1136- apiEntry_0_2->Scanline;
1137- tEntry.opvpEndScanline = apiEntry_0_2->EndScanline;
1138- tEntry.opvpStartRaster = apiEntry_0_2->StartRaster;
1139- tEntry.opvpTransferRasterData
1140- = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1141- const opvp_byte_t*))
1142- apiEntry_0_2->TransferRasterData;
1143- tEntry.opvpSkipRaster = apiEntry_0_2->SkipRaster;
1144- tEntry.opvpEndRaster = apiEntry_0_2->EndRaster;
1145- tEntry.opvpStartStream = apiEntry_0_2->StartStream;
1146- tEntry.opvpTransferStreamData
1147- = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1148- const void *))
1149- apiEntry_0_2->TransferStreamData;
1150- tEntry.opvpEndStream = apiEntry_0_2->EndStream;
984+ tEntry.opvpResetCTM = apiEntry_0_2->ResetCTM;
985+ tEntry.opvpSetCTM = (opvp_result_t (*)(opvp_dc_t,
986+ const opvp_ctm_t*))
987+ apiEntry_0_2->SetCTM;
988+ tEntry.opvpGetCTM = (opvp_result_t (*)(opvp_dc_t,opvp_ctm_t*))
989+ apiEntry_0_2->GetCTM;
990+ if (apiEntry_0_2->InitGS != NULL) {
991+ tEntry.opvpInitGS = InitGSWrapper;
992+ } else {
993+ tEntry.opvpInitGS = NULL;
994+ }
995+ tEntry.opvpSaveGS = apiEntry_0_2->SaveGS;
996+ tEntry.opvpRestoreGS = apiEntry_0_2->RestoreGS;
997+ if (apiEntry_0_2->QueryColorSpace != NULL) {
998+ tEntry.opvpQueryColorSpace = QueryColorSpaceWrapper;
999+ } else {
1000+ tEntry.opvpQueryColorSpace = NULL;
1001+ }
1002+ if (apiEntry_0_2->SetColorSpace != NULL) {
1003+ tEntry.opvpSetColorSpace = SetColorSpaceWrapper;
1004+ } else {
1005+ tEntry.opvpSetColorSpace = NULL;
1006+ }
1007+ if (apiEntry_0_2->GetColorSpace != NULL) {
1008+ tEntry.opvpGetColorSpace = GetColorSpaceWrapper;
1009+ } else {
1010+ tEntry.opvpGetColorSpace = NULL;
1011+ }
1012+ tEntry.opvpSetFillMode
1013+ = (opvp_result_t (*)(opvp_dc_t,opvp_fillmode_t))
1014+ apiEntry_0_2->SetFillMode;
1015+ tEntry.opvpGetFillMode
1016+ = (opvp_result_t (*)(opvp_dc_t,opvp_fillmode_t*))
1017+ apiEntry_0_2->GetFillMode;
1018+ tEntry.opvpSetAlphaConstant = apiEntry_0_2->SetAlphaConstant;
1019+ tEntry.opvpGetAlphaConstant = apiEntry_0_2->GetAlphaConstant;
1020+ tEntry.opvpSetLineWidth = apiEntry_0_2->SetLineWidth;
1021+ tEntry.opvpGetLineWidth = apiEntry_0_2->GetLineWidth;
1022+ if (apiEntry_0_2->SetLineDash != NULL) {
1023+ tEntry.opvpSetLineDash = SetLineDashWrapper;
1024+ } else {
1025+ tEntry.opvpSetLineDash = NULL;
1026+ }
1027+ if (apiEntry_0_2->GetLineDash != NULL) {
1028+ tEntry.opvpGetLineDash = GetLineDashWrapper;
1029+ } else {
1030+ tEntry.opvpGetLineDash = NULL;
1031+ }
1032+ tEntry.opvpSetLineDashOffset
1033+ = apiEntry_0_2->SetLineDashOffset;
1034+ tEntry.opvpGetLineDashOffset
1035+ = apiEntry_0_2->GetLineDashOffset;
1036+ tEntry.opvpSetLineStyle
1037+ = (opvp_result_t (*)(opvp_dc_t,opvp_linestyle_t))
1038+ apiEntry_0_2->SetLineStyle;
1039+ tEntry.opvpGetLineStyle
1040+ = (opvp_result_t (*)(opvp_dc_t,opvp_linestyle_t*))
1041+ apiEntry_0_2->GetLineStyle;
1042+ tEntry.opvpSetLineCap
1043+ = (opvp_result_t (*)(opvp_dc_t,opvp_linecap_t))
1044+ apiEntry_0_2->SetLineCap;
1045+ tEntry.opvpGetLineCap
1046+ = (opvp_result_t (*)(opvp_dc_t,opvp_linecap_t*))
1047+ apiEntry_0_2->GetLineCap;
1048+ tEntry.opvpSetLineJoin
1049+ = (opvp_result_t (*)(opvp_dc_t,opvp_linejoin_t))
1050+ apiEntry_0_2->SetLineJoin;
1051+ tEntry.opvpGetLineJoin
1052+ = (opvp_result_t (*)(opvp_dc_t,opvp_linejoin_t*))
1053+ apiEntry_0_2->GetLineJoin;
1054+ tEntry.opvpSetMiterLimit = apiEntry_0_2->SetMiterLimit;
1055+ tEntry.opvpGetMiterLimit = apiEntry_0_2->GetMiterLimit;
1056+ tEntry.opvpSetPaintMode
1057+ = (opvp_result_t (*)(opvp_dc_t,opvp_paintmode_t))
1058+ apiEntry_0_2->SetPaintMode;
1059+ tEntry.opvpGetPaintMode
1060+ = (opvp_result_t (*)(opvp_dc_t,opvp_paintmode_t*))
1061+ apiEntry_0_2->GetPaintMode;
1062+ if (apiEntry_0_2->SetStrokeColor != NULL) {
1063+ tEntry.opvpSetStrokeColor = SetStrokeColorWrapper;
1064+ } else {
1065+ tEntry.opvpSetStrokeColor = NULL;
1066+ }
1067+ if (apiEntry_0_2->SetFillColor != NULL) {
1068+ tEntry.opvpSetFillColor = SetFillColorWrapper;
1069+ } else {
1070+ tEntry.opvpSetFillColor = NULL;
1071+ }
1072+ if (apiEntry_0_2->SetBgColor != NULL) {
1073+ tEntry.opvpSetBgColor = SetBgColorWrapper;
1074+ } else {
1075+ tEntry.opvpSetBgColor = NULL;
1076+ }
1077+ tEntry.opvpNewPath = apiEntry_0_2->NewPath;
1078+ tEntry.opvpEndPath = apiEntry_0_2->EndPath;
1079+ tEntry.opvpStrokePath = apiEntry_0_2->StrokePath;
1080+ tEntry.opvpFillPath = apiEntry_0_2->FillPath;
1081+ tEntry.opvpStrokeFillPath = apiEntry_0_2->StrokeFillPath;
1082+ tEntry.opvpSetClipPath
1083+ = (opvp_result_t (*)(opvp_dc_t,opvp_cliprule_t))
1084+ apiEntry_0_2->SetClipPath;
1085+ tEntry.opvpResetClipPath = apiEntry_0_2->ResetClipPath;
1086+ tEntry.opvpSetCurrentPoint = apiEntry_0_2->SetCurrentPoint;
1087+ tEntry.opvpLinePath
1088+ = (opvp_result_t (*)(opvp_dc_t,
1089+ opvp_pathmode_t,opvp_int_t,
1090+ const opvp_point_t*))
1091+ apiEntry_0_2->LinePath;
1092+ tEntry.opvpPolygonPath
1093+ = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1094+ const opvp_int_t*,
1095+ const opvp_point_t*))
1096+ apiEntry_0_2->PolygonPath;
1097+ tEntry.opvpRectanglePath
1098+ = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1099+ const opvp_rectangle_t*))
1100+ apiEntry_0_2->RectanglePath;
1101+ tEntry.opvpRoundRectanglePath
1102+ = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1103+ const opvp_roundrectangle_t*))
1104+ apiEntry_0_2->RoundRectanglePath;
1105+ tEntry.opvpBezierPath
1106+ = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1107+ const opvp_point_t*))
1108+ apiEntry_0_2->BezierPath;
1109+ tEntry.opvpArcPath
1110+ = (opvp_result_t (*)(opvp_dc_t,opvp_arcmode_t,
1111+ opvp_arcdir_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,
1112+ opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,
1113+ opvp_fix_t))apiEntry_0_2->ArcPath;
1114+ if (apiEntry_0_2->DrawImage != NULL) {
1115+ tEntry.opvpDrawImage = DrawImageWrapper;
1116+ } else {
1117+ tEntry.opvpDrawImage = NULL;
1118+ }
1119+ if (apiEntry_0_2->StartDrawImage != NULL) {
1120+ tEntry.opvpStartDrawImage = StartDrawImageWrapper;
1121+ } else {
1122+ tEntry.opvpStartDrawImage = NULL;
1123+ }
1124+ tEntry.opvpTransferDrawImage =
1125+ (opvp_result_t (*)(opvp_dc_t,opvp_int_t,const void*))
1126+ apiEntry_0_2->TransferDrawImage;
1127+ if (apiEntry_0_2->EndDrawImage != NULL) {
1128+ tEntry.opvpEndDrawImage = EndDrawImageWrapper;
1129+ } else {
1130+ tEntry.opvpEndDrawImage = NULL;
1131+ }
1132+ tEntry.opvpStartScanline = apiEntry_0_2->StartScanline;
1133+ tEntry.opvpScanline
1134+ = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1135+ const opvp_int_t*))
1136+ apiEntry_0_2->Scanline;
1137+ tEntry.opvpEndScanline = apiEntry_0_2->EndScanline;
1138+ tEntry.opvpStartRaster = apiEntry_0_2->StartRaster;
1139+ tEntry.opvpTransferRasterData
1140+ = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1141+ const opvp_byte_t*))
1142+ apiEntry_0_2->TransferRasterData;
1143+ tEntry.opvpSkipRaster = apiEntry_0_2->SkipRaster;
1144+ tEntry.opvpEndRaster = apiEntry_0_2->EndRaster;
1145+ tEntry.opvpStartStream = apiEntry_0_2->StartStream;
1146+ tEntry.opvpTransferStreamData
1147+ = (opvp_result_t (*)(opvp_dc_t,opvp_int_t,
1148+ const void *))
1149+ apiEntry_0_2->TransferStreamData;
1150+ tEntry.opvpEndStream = apiEntry_0_2->EndStream;
11511151
1152- *apiProcs = &tEntry;
1152+ *apiProcs = &tEntry;
11531153
1154- GetLastError = GetLastError_0_2;
1155- }
1154+ GetLastError = GetLastError_0_2;
1155+ }
11561156 }
11571157 return dc;
11581158 }
11591159
11601160 /* for image */
1161-static const
1161+static const
11621162 gx_image_enum_procs_t opvp_image_enum_procs =
11631163 {
11641164 opvp_image_plane_data,
11651165 opvp_image_end_image
11661166 };
1167-typedef enum _FastImageSupportMode {
1167+typedef enum _FastImageSupportMode {
11681168 FastImageDisable,
11691169 FastImageNoCTM,
11701170 FastImageNoRotate,
@@ -1186,17 +1186,17 @@
11861186 /* added for image gamma correction */
11871187 typedef struct bbox_image_enum_s {
11881188 gx_image_enum_common;
1189-/* gs_memory_t *memory; */
1189+/* gs_memory_t *memory; */
11901190 gs_matrix matrix; /* map from image space to device dpace */
11911191 const gx_clip_path *pcpath;
11921192 gx_image_enum_common_t *target_info;
11931193 bool params_are_const;
1194- int x0, x1;
1195- int y, height;
1194+ int x0, x1;
1195+ int y, height;
11961196 } bbox_image_enum;
11971197
11981198 /* The following is already defined in stdpre.h */
1199-/*#define min(a, b) (((a) < (b))? (a) : (b))*/
1199+/*#define min(a, b) (((a) < (b))? (a) : (b))*/
12001200
12011201
12021202 /* ----- Utilities ----- */
@@ -1207,27 +1207,27 @@
12071207 InitGS(void)
12081208 {
12091209 if (apiEntry->opvpInitGS != NULL) {
1210- if (apiEntry->opvpInitGS(printerContext) != OPVP_OK) {
1211- return -1;
1212- }
1210+ if (apiEntry->opvpInitGS(printerContext) != OPVP_OK) {
1211+ return -1;
1212+ }
12131213 }
12141214 if (apiEntry->opvpSetColorSpace != NULL) {
1215- if (apiEntry->opvpSetColorSpace(printerContext,colorSpace)
1216- != OPVP_OK) {
1217- return -1;
1218- }
1215+ if (apiEntry->opvpSetColorSpace(printerContext,colorSpace)
1216+ != OPVP_OK) {
1217+ return -1;
1218+ }
12191219 }
12201220 if (apiEntry->opvpSetPaintMode != NULL) {
1221- if (apiEntry->opvpSetPaintMode(printerContext,
1222- OPVP_PAINTMODE_TRANSPARENT) != OPVP_OK) {
1223- return -1;
1224- }
1221+ if (apiEntry->opvpSetPaintMode(printerContext,
1222+ OPVP_PAINTMODE_TRANSPARENT) != OPVP_OK) {
1223+ return -1;
1224+ }
12251225 }
12261226 if (apiEntry->opvpSetAlphaConstant != NULL) {
1227- if (apiEntry->opvpSetAlphaConstant(printerContext,1.0)
1228- != OPVP_OK) {
1229- return -1;
1230- }
1227+ if (apiEntry->opvpSetAlphaConstant(printerContext,1.0)
1228+ != OPVP_OK) {
1229+ return -1;
1230+ }
12311231 }
12321232
12331233 /* other properties are set by GhostScript */
@@ -1234,12 +1234,12 @@
12341234 return 0;
12351235 }
12361236
1237-static int
1237+static int
12381238 opvp_startpage(gx_device *dev)
12391239 {
1240- int ecode = 0;
1240+ int ecode = 0;
12411241 opvp_result_t r = -1;
1242- static char *page_info = NULL;
1242+ static char *page_info = NULL;
12431243
12441244 /* page info */
12451245 page_info = opvp_alloc_string(&page_info, OPVP_INFO_PREFIX);
@@ -1247,64 +1247,64 @@
12471247
12481248 /* call StartPage */
12491249 if (printerContext != -1) {
1250- if (apiEntry->opvpStartPage)
1251- r = apiEntry->opvpStartPage(printerContext,
1252- (opvp_char_t *)opvp_to_utf8(page_info));
1253- if (r != OPVP_OK) {
1254- ecode = -1;
1255- } else {
1256- ecode = InitGS();
1257- }
1250+ if (apiEntry->opvpStartPage)
1251+ r = apiEntry->opvpStartPage(printerContext,
1252+ (opvp_char_t *)opvp_to_utf8(page_info));
1253+ if (r != OPVP_OK) {
1254+ ecode = -1;
1255+ } else {
1256+ ecode = InitGS();
1257+ }
12581258 }
12591259
12601260 return ecode;
12611261 }
12621262
1263-static int
1263+static int
12641264 opvp_endpage(void)
12651265 {
1266- int ecode = 0;
1266+ int ecode = 0;
12671267 opvp_result_t r = -1;
12681268
12691269 /* call EndPage */
12701270 if (printerContext != -1) {
1271- if (apiEntry->opvpEndPage)
1272- r = apiEntry->opvpEndPage(printerContext);
1273- if (r != OPVP_OK) {
1274- ecode = -1;
1275- }
1271+ if (apiEntry->opvpEndPage)
1272+ r = apiEntry->opvpEndPage(printerContext);
1273+ if (r != OPVP_OK) {
1274+ ecode = -1;
1275+ }
12761276 }
12771277
12781278 return ecode;
12791279 }
12801280
1281-static char *
1281+static char *
12821282 opvp_alloc_string(char **destin, const char *source)
12831283 {
12841284 if (!destin) return NULL;
12851285
12861286 if (*destin) {
1287- if (source) {
1288- *destin = realloc(*destin, strlen(source)+1);
1289- } else {
1290- free(*destin);
1291- *destin = NULL;
1292- }
1287+ if (source) {
1288+ *destin = realloc(*destin, strlen(source)+1);
1289+ } else {
1290+ free(*destin);
1291+ *destin = NULL;
1292+ }
12931293 } else {
1294- if (source) {
1295- *destin = malloc(strlen(source)+1);
1296- }
1294+ if (source) {
1295+ *destin = malloc(strlen(source)+1);
1296+ }
12971297 }
12981298 if (*destin && source) {
1299- if (*destin != source) {
1300- strcpy(*destin, source);
1301- }
1299+ if (*destin != source) {
1300+ strcpy(*destin, source);
1301+ }
13021302 }
13031303
13041304 return *destin;
13051305 }
13061306
1307-static char *
1307+static char *
13081308 opvp_cat_string(char **destin, const char *string)
13091309 {
13101310 if (!destin) return NULL;
@@ -1311,14 +1311,14 @@
13111311 if (!(*destin)) return opvp_alloc_string(destin, string);
13121312
13131313 if (string) {
1314- *destin = realloc(*destin, strlen(*destin) +strlen(string)+1);
1315- strcat(*destin, string);
1314+ *destin = realloc(*destin, strlen(*destin) +strlen(string)+1);
1315+ strcat(*destin, string);
13161316 }
13171317
13181318 return *destin;
13191319 }
13201320
1321-static char *
1321+static char *
13221322 opvp_adjust_num_string(char *num_string)
13231323 {
13241324 char *pp;
@@ -1327,27 +1327,27 @@
13271327 if (!num_string) return NULL;
13281328
13291329 if ((pp = strrchr(num_string, '.'))) {
1330- for (lp = &(num_string[strlen(num_string)-1]); lp > pp; lp--) {
1331- if (*lp == '0') {
1332- *lp = '\0';
1333- } else {
1334- break;
1335- }
1336- }
1337- if (lp == pp) *lp = '\0';
1330+ for (lp = &(num_string[strlen(num_string)-1]); lp > pp; lp--) {
1331+ if (*lp == '0') {
1332+ *lp = '\0';
1333+ } else {
1334+ break;
1335+ }
1336+ }
1337+ if (lp == pp) *lp = '\0';
13381338 }
13391339
13401340 return num_string;
13411341 }
13421342
1343-static char **
1343+static char **
13441344 opvp_gen_dynamic_lib_name(void)
13451345 {
1346- static char *buff[5] = {NULL,NULL,NULL,NULL,NULL};
1346+ static char *buff[5] = {NULL,NULL,NULL,NULL,NULL};
13471347 char tbuff[OPVP_BUFF_SIZE];
13481348
13491349 if (!vectorDriver) {
1350- return NULL;
1350+ return NULL;
13511351 }
13521352
13531353 memset((void*)tbuff, 0, OPVP_BUFF_SIZE);
@@ -1375,7 +1375,7 @@
13751375 return buff;
13761376 }
13771377
1378-static char *
1378+static char *
13791379 opvp_to_utf8(char *string)
13801380 {
13811381 char *locale;
@@ -1382,41 +1382,41 @@
13821382 iconv_t cd;
13831383 char *buff = NULL;
13841384 size_t ib, ob;
1385- int complete = false;
1385+ int complete = false;
13861386 char *ibuff, *obuff;
13871387 char *ostring = NULL;
13881388
13891389 if (string) {
1390- ib = strlen(string);
1391- if (ib > 0) {
1392- ob = ib * 4;
1393- buff = malloc(ob+1);
1394- setlocale(LC_CTYPE, "");
1390+ ib = strlen(string);
1391+ if (ib > 0) {
1392+ ob = ib * 4;
1393+ buff = malloc(ob+1);
1394+ setlocale(LC_CTYPE, "");
13951395 #ifdef CODESET
1396- locale = nl_langinfo(CODESET);
1396+ locale = nl_langinfo(CODESET);
13971397 #else
1398- locale = "UTF-8";
1398+ locale = "UTF-8";
13991399 #endif /* CODESET */
1400- if (locale) {
1401- if (strcmp(locale, "C") && buff) {
1402- if ((cd = iconv_open("UTF-8", locale)) != (iconv_t)-1) {
1403- ibuff = string;
1404- obuff = buff;
1405- if (iconv(cd, &ibuff, &ib, &obuff, &ob) != -1) {
1406- *obuff = 0;
1407- complete = true;
1408- }
1409- iconv_close(cd);
1410- }
1411- }
1412- }
1413- }
1400+ if (locale) {
1401+ if (strcmp(locale, "C") && buff) {
1402+ if ((cd = iconv_open("UTF-8", locale)) != (iconv_t)-1) {
1403+ ibuff = string;
1404+ obuff = buff;
1405+ if (iconv(cd, &ibuff, &ib, &obuff, &ob) != -1) {
1406+ *obuff = 0;
1407+ complete = true;
1408+ }
1409+ iconv_close(cd);
1410+ }
1411+ }
1412+ }
1413+ }
14141414 }
14151415
14161416 if (complete) {
1417- ostring = opvp_alloc_string(&ostring, buff);
1417+ ostring = opvp_alloc_string(&ostring, buff);
14181418 } else {
1419- ostring = string;
1419+ ostring = string;
14201420 }
14211421
14221422 if (buff) free(buff);
@@ -1429,20 +1429,20 @@
14291429 return (float)fabs((double)f);
14301430 }
14311431
1432-static int
1432+static int
14331433 opvp_get_papertable_index(gx_device *pdev)
14341434 {
1435- int i;
1435+ int i;
14361436 float width, height;
14371437 bool landscape;
14381438 float paper_w, paper_h;
14391439 float prev = -1;
1440- int paper = -1;
1441- int candidate = -1;
1442- int smaller = -1;
1443- int larger = -1;
1444- int s_candi = -1;
1445- int l_candi = -1;
1440+ int paper = -1;
1441+ int candidate = -1;
1442+ int smaller = -1;
1443+ int larger = -1;
1444+ int s_candi = -1;
1445+ int l_candi = -1;
14461446 float h_delta = TOLERANCE;
14471447 float sw_delta = TOLERANCE;
14481448 float sh_delta = TOLERANCE;
@@ -1459,98 +1459,98 @@
14591459 height = (landscape ? pdev->MediaSize[0] : pdev->MediaSize[1]);
14601460
14611461 for (i=0; paperTable[i].name != NULL; i++) {
1462- paper_w = paperTable[i].width;
1463- paper_h = paperTable[i].height;
1464- if (width == paper_w) {
1465- if (height == paper_h) {
1466- paper = i;
1467- match = true;
1468- break;
1469- } else if ((f = opvp_fabsf(height - paper_h)) < TOLERANCE) {
1470- if (f < h_delta) {
1471- h_delta = f;
1472- candidate = i;
1473- }
1474- }
1475- } else if (candidate != -1) {
1476- paper = candidate;
1477- match = true;
1478- break;
1479- } else if (prev != paper_w) {
1480- prev = paper_w;
1481- if (paper_w < width) {
1482- if ((f = opvp_fabsf(width - paper_w)) < TOLERANCE) {
1483- if (f < sw_delta) {
1484- sw_delta = f;
1485- smaller = i;
1486- }
1487- }
1488- } else {
1489- if ((f = opvp_fabsf(width - paper_w)) < TOLERANCE) {
1490- if (f < lw_delta) {
1491- lw_delta = f;
1492- larger = i;
1493- }
1494- }
1495- }
1496- }
1462+ paper_w = paperTable[i].width;
1463+ paper_h = paperTable[i].height;
1464+ if (width == paper_w) {
1465+ if (height == paper_h) {
1466+ paper = i;
1467+ match = true;
1468+ break;
1469+ } else if ((f = opvp_fabsf(height - paper_h)) < TOLERANCE) {
1470+ if (f < h_delta) {
1471+ h_delta = f;
1472+ candidate = i;
1473+ }
1474+ }
1475+ } else if (candidate != -1) {
1476+ paper = candidate;
1477+ match = true;
1478+ break;
1479+ } else if (prev != paper_w) {
1480+ prev = paper_w;
1481+ if (paper_w < width) {
1482+ if ((f = opvp_fabsf(width - paper_w)) < TOLERANCE) {
1483+ if (f < sw_delta) {
1484+ sw_delta = f;
1485+ smaller = i;
1486+ }
1487+ }
1488+ } else {
1489+ if ((f = opvp_fabsf(width - paper_w)) < TOLERANCE) {
1490+ if (f < lw_delta) {
1491+ lw_delta = f;
1492+ larger = i;
1493+ }
1494+ }
1495+ }
1496+ }
14971497 }
14981498 if (!match) {
1499- paper = i;
1500- if (smaller != -1) {
1501- paper_w = paperTable[smaller].width;
1502- for (i = smaller; paperTable[i].width == paper_w; i++) {
1503- paper_h = paperTable[i].height;
1504- if (height == paper_h) {
1505- sh_delta = 0;
1506- s_candi = i;
1507- break;
1508- } else if ((f = opvp_fabsf(height - paper_h)) < TOLERANCE) {
1509- if (f < sh_delta) {
1510- sh_delta = f;
1511- s_candi = i;
1512- }
1513- }
1514- }
1515- }
1516- if (larger != -1) {
1517- paper_w = paperTable[larger].width;
1518- for (i = larger; paperTable[i].width == paper_w; i++) {
1519- paper_h = paperTable[i].height;
1520- if (height == paper_h) {
1521- lh_delta = 0;
1522- l_candi = i;
1523- break;
1524- } else if ((f = opvp_fabsf(height - paper_h)) < TOLERANCE) {
1525- if (f < lh_delta) {
1526- lh_delta = f;
1527- l_candi = i;
1528- }
1529- }
1530- }
1531- }
1532- if (s_candi != -1) {
1533- if (l_candi != -1) {
1534- if ((sw_delta + sh_delta)
1535- < (lw_delta + lh_delta)) {
1536- paper = s_candi;
1537- } else {
1538- paper = l_candi;
1539- }
1540- } else {
1541- paper = s_candi;
1542- }
1543- } else {
1544- if (l_candi != -1) {
1545- paper = l_candi;
1546- }
1547- }
1499+ paper = i;
1500+ if (smaller != -1) {
1501+ paper_w = paperTable[smaller].width;
1502+ for (i = smaller; paperTable[i].width == paper_w; i++) {
1503+ paper_h = paperTable[i].height;
1504+ if (height == paper_h) {
1505+ sh_delta = 0;
1506+ s_candi = i;
1507+ break;
1508+ } else if ((f = opvp_fabsf(height - paper_h)) < TOLERANCE) {
1509+ if (f < sh_delta) {
1510+ sh_delta = f;
1511+ s_candi = i;
1512+ }
1513+ }
1514+ }
1515+ }
1516+ if (larger != -1) {
1517+ paper_w = paperTable[larger].width;
1518+ for (i = larger; paperTable[i].width == paper_w; i++) {
1519+ paper_h = paperTable[i].height;
1520+ if (height == paper_h) {
1521+ lh_delta = 0;
1522+ l_candi = i;
1523+ break;
1524+ } else if ((f = opvp_fabsf(height - paper_h)) < TOLERANCE) {
1525+ if (f < lh_delta) {
1526+ lh_delta = f;
1527+ l_candi = i;
1528+ }
1529+ }
1530+ }
1531+ }
1532+ if (s_candi != -1) {
1533+ if (l_candi != -1) {
1534+ if ((sw_delta + sh_delta)
1535+ < (lw_delta + lh_delta)) {
1536+ paper = s_candi;
1537+ } else {
1538+ paper = l_candi;
1539+ }
1540+ } else {
1541+ paper = s_candi;
1542+ }
1543+ } else {
1544+ if (l_candi != -1) {
1545+ paper = l_candi;
1546+ }
1547+ }
15481548 }
15491549
15501550 return paper;
15511551 }
15521552
1553-static char *
1553+static char *
15541554 opvp_get_sizestring(float width, float height)
15551555 {
15561556 char nbuff[OPVP_BUFF_SIZE];
@@ -1565,18 +1565,18 @@
15651565 snprintf(nbuff1, OPVP_BUFF_SIZE / 2 - 1, "%.3f", width);
15661566 snprintf(nbuff2, OPVP_BUFF_SIZE / 2 - 1, "%.3f", height);
15671567 snprintf(nbuff, OPVP_BUFF_SIZE - 1, "%sx%s",
1568- opvp_adjust_num_string(nbuff1),
1569- opvp_adjust_num_string(nbuff2));
1568+ opvp_adjust_num_string(nbuff1),
1569+ opvp_adjust_num_string(nbuff2));
15701570
15711571 return opvp_alloc_string(&buff, nbuff);
15721572 }
15731573
1574-static char *
1574+static char *
15751575 opvp_get_mediasize(gx_device *pdev)
15761576 {
1577- int i;
1577+ int i;
15781578 char wbuff[OPVP_BUFF_SIZE];
1579- static char *buff = NULL;
1579+ static char *buff = NULL;
15801580 const char *region;
15811581 const char *name;
15821582 float width;
@@ -1587,44 +1587,44 @@
15871587 i = opvp_get_papertable_index(pdev);
15881588
15891589 if (paperTable[i].name) {
1590- region = paperTable[i].region;
1591- name = paperTable[i].name;
1592- width = paperTable[i].width / PS_DPI;
1593- height = paperTable[i].height / PS_DPI;
1594- if((strcmp(region, "na" ) == 0) ||
1595- (strcmp(region, "asme") == 0) ||
1596- (strcmp(region, "roc" ) == 0) ||
1597- (strcmp(region, "oe" ) == 0)) {
1598- unit = "in";
1599- } else {
1600- width *= MMPI;
1601- height *= MMPI;
1602- unit = "mm";
1603- }
1590+ region = paperTable[i].region;
1591+ name = paperTable[i].name;
1592+ width = paperTable[i].width / PS_DPI;
1593+ height = paperTable[i].height / PS_DPI;
1594+ if((strcmp(region, "na" ) == 0) ||
1595+ (strcmp(region, "asme") == 0) ||
1596+ (strcmp(region, "roc" ) == 0) ||
1597+ (strcmp(region, "oe" ) == 0)) {
1598+ unit = "in";
1599+ } else {
1600+ width *= MMPI;
1601+ height *= MMPI;
1602+ unit = "mm";
1603+ }
16041604 } else {
1605- landscape = (pdev->MediaSize[0] < pdev->MediaSize[1] ?
1606- false : true);
1607- region = "custom";
1608- name = "opvp";
1609- width = (landscape ? pdev->MediaSize[1] : pdev->MediaSize[0])
1610- / PS_DPI;
1611- height = (landscape ? pdev->MediaSize[0] : pdev->MediaSize[1])
1612- / PS_DPI;
1613- unit = "in";
1605+ landscape = (pdev->MediaSize[0] < pdev->MediaSize[1] ?
1606+ false : true);
1607+ region = "custom";
1608+ name = "opvp";
1609+ width = (landscape ? pdev->MediaSize[1] : pdev->MediaSize[0])
1610+ / PS_DPI;
1611+ height = (landscape ? pdev->MediaSize[0] : pdev->MediaSize[1])
1612+ / PS_DPI;
1613+ unit = "in";
16141614 }
16151615 memset((void*)wbuff, 0, OPVP_BUFF_SIZE);
16161616 snprintf(wbuff, OPVP_BUFF_SIZE - 1, "%s_%s_%s%s", region, name,
1617- opvp_get_sizestring(width, height),
1618- unit);
1617+ opvp_get_sizestring(width, height),
1618+ unit);
16191619 buff = opvp_alloc_string(&buff, wbuff);
16201620
16211621 return buff;
16221622 }
16231623
1624-static char *
1624+static char *
16251625 opvp_gen_page_info(gx_device *dev)
16261626 {
1627- static char *buff = NULL;
1627+ static char *buff = NULL;
16281628 int num_copies = 1;
16291629 bool landscape;
16301630 char tbuff[OPVP_BUFF_SIZE];
@@ -1631,15 +1631,15 @@
16311631
16321632 /* copies */
16331633 if (!inkjet) {
1634- if (dev->IgnoreNumCopies) {
1635- num_copies = 1;
1636- } else if (dev->NumCopies_set > 0) {
1637- num_copies = dev->NumCopies;
1638- }
1634+ if (dev->IgnoreNumCopies) {
1635+ num_copies = 1;
1636+ } else if (dev->NumCopies_set > 0) {
1637+ num_copies = dev->NumCopies;
1638+ }
16391639 }
16401640
16411641 landscape = (dev->MediaSize[0] < dev->MediaSize[1] ? false
1642- : true);
1642+ : true);
16431643 memset((void*)tbuff, 0, OPVP_BUFF_SIZE);
16441644 snprintf(tbuff, OPVP_BUFF_SIZE - 1,
16451645 "MediaCopy=%d;DeviceResolution=deviceResolution_%s;"
@@ -1654,19 +1654,19 @@
16541654 return buff;
16551655 }
16561656
1657-static char *
1657+static char *
16581658 opvp_gen_doc_info(gx_device *dev)
16591659 {
16601660 return opvp_gen_page_info(dev);
16611661 }
16621662
1663-static char *
1663+static char *
16641664 opvp_gen_job_info(gx_device *dev)
16651665 {
16661666 return opvp_gen_doc_info(dev);
16671667 }
16681668
1669-static int
1669+static int
16701670 opvp_set_brush_color(gx_device_opvp *pdev, gx_color_index color,
16711671 opvp_brush_t *brush)
16721672 {
@@ -1676,47 +1676,47 @@
16761676
16771677 code = opvp_map_color_rgb((gx_device *)pdev, color, rgb);
16781678 if (code) {
1679- ecode = -1;
1679+ ecode = -1;
16801680 } else {
16811681 #if ENABLE_SIMPLE_MODE
1682- brush->colorSpace = colorSpace;
1682+ brush->colorSpace = colorSpace;
16831683 #else
1684- opvp_result_t r = -1;
1685- /* call GetColorSpace */
1686- if (apiEntry->opvpGetColorSpace) {
1687- r = apiEntry->opvpGetColorSpace(printerContext,
1688- &(brush->colorSpace));
1689- }
1690- if (r != OPVP_OK) {
1691- brush->colorSpace = OPVP_CSPACE_DEVICEKRGB;
1692- }
1684+ opvp_result_t r = -1;
1685+ /* call GetColorSpace */
1686+ if (apiEntry->opvpGetColorSpace) {
1687+ r = apiEntry->opvpGetColorSpace(printerContext,
1688+ &(brush->colorSpace));
1689+ }
1690+ if (r != OPVP_OK) {
1691+ brush->colorSpace = OPVP_CSPACE_DEVICEKRGB;
1692+ }
16931693 #endif
1694- brush->pbrush = NULL;
1695- brush->xorg = brush->yorg = 0;
1696- brush->color[3] = (color == gx_no_color_index ? -1 : 0);
1697- brush->color[2] = rgb[0];
1698- brush->color[1] = rgb[1];
1699- brush->color[0] = rgb[2];
1694+ brush->pbrush = NULL;
1695+ brush->xorg = brush->yorg = 0;
1696+ brush->color[3] = (color == gx_no_color_index ? -1 : 0);
1697+ brush->color[2] = rgb[0];
1698+ brush->color[1] = rgb[1];
1699+ brush->color[0] = rgb[2];
17001700 }
17011701
17021702 return ecode;
17031703 }
17041704
1705-static int
1705+static int
17061706 opvp_draw_image(
17071707 gx_device_opvp *pdev,
1708- int depth,
1709- int sw,
1710- int sh,
1711- int dw,
1712- int dh,
1713- int raster,
1714- int mask,
1708+ int depth,
1709+ int sw,
1710+ int sh,
1711+ int dw,
1712+ int dh,
1713+ int raster,
1714+ int mask,
17151715 const byte *data)
17161716 {
1717- opvp_result_t r = -1;
1718- int ecode = 0;
1719- int count;
1717+ opvp_result_t r = -1;
1718+ int ecode = 0;
1719+ int count;
17201720
17211721 /* check page-in */
17221722 if (opvp_check_in_page(pdev)) return -1;
@@ -1726,41 +1726,41 @@
17261726
17271727 /* call DrawImage */
17281728 if (apiEntry->opvpDrawImage) {
1729- r = apiEntry->opvpDrawImage(printerContext,
1730- sw,sh,
1731- raster,
1732- mask ? OPVP_IFORMAT_MASK : OPVP_IFORMAT_RAW,
1733- dw,dh,
1734- /* discard 'const' qualifier */
1735- (void *)data);
1729+ r = apiEntry->opvpDrawImage(printerContext,
1730+ sw,sh,
1731+ raster,
1732+ mask ? OPVP_IFORMAT_MASK : OPVP_IFORMAT_RAW,
1733+ dw,dh,
1734+ /* discard 'const' qualifier */
1735+ (void *)data);
17361736 }
17371737 if (r != OPVP_OK) {
1738- /* call StartDrawImage */
1739- if (apiEntry->opvpStartDrawImage) {
1740- r = apiEntry->opvpStartDrawImage(printerContext,
1741- sw,sh,
1742- raster,
1743- mask ? OPVP_IFORMAT_MASK : OPVP_IFORMAT_RAW,
1744- dw,dh);
1745- }
1746- if (r == OPVP_OK) {
1747- /* call TansferDrawImage */
1748- if (apiEntry->opvpTransferDrawImage) {
1749- r = apiEntry->opvpTransferDrawImage(
1750- printerContext,
1751- count,
1752- /* discard 'const' qualifier */
1753- (void *)data);
1754- }
1755- if (r != OPVP_OK) ecode = -1;
1738+ /* call StartDrawImage */
1739+ if (apiEntry->opvpStartDrawImage) {
1740+ r = apiEntry->opvpStartDrawImage(printerContext,
1741+ sw,sh,
1742+ raster,
1743+ mask ? OPVP_IFORMAT_MASK : OPVP_IFORMAT_RAW,
1744+ dw,dh);
1745+ }
1746+ if (r == OPVP_OK) {
1747+ /* call TansferDrawImage */
1748+ if (apiEntry->opvpTransferDrawImage) {
1749+ r = apiEntry->opvpTransferDrawImage(
1750+ printerContext,
1751+ count,
1752+ /* discard 'const' qualifier */
1753+ (void *)data);
1754+ }
1755+ if (r != OPVP_OK) ecode = -1;
17561756
1757- /* call EndDrawImage */
1758- if (apiEntry->opvpEndDrawImage) {
1759- apiEntry->opvpEndDrawImage(printerContext);
1760- }
1761- } else {
1762- ecode = 0; /* continue... */
1763- }
1757+ /* call EndDrawImage */
1758+ if (apiEntry->opvpEndDrawImage) {
1759+ apiEntry->opvpEndDrawImage(printerContext);
1760+ }
1761+ } else {
1762+ ecode = 0; /* continue... */
1763+ }
17641764 }
17651765
17661766 return ecode;
@@ -1771,51 +1771,51 @@
17711771 /*
17721772 * load vector-driver
17731773 */
1774-static int
1774+static int
17751775 opvp_load_vector_driver(void)
17761776 {
17771777 char **list = NULL;
1778- int i;
1778+ int i;
17791779 void *h;
17801780
17811781 if (handle) {
1782- opvp_unload_vector_driver();
1782+ opvp_unload_vector_driver();
17831783 }
17841784
17851785 if (vectorDriver) {
1786- list = opvp_gen_dynamic_lib_name();
1786+ list = opvp_gen_dynamic_lib_name();
17871787 }
17881788
17891789 if (list) {
1790- i = 0;
1791- while (list[i]) {
1792- if ((h = dlopen(list[i],RTLD_NOW))) {
1793- OpenPrinter = dlsym(h,"opvpOpenPrinter");
1794- ErrorNo = dlsym(h,"opvpErrorNo");
1795- if (OpenPrinter && ErrorNo) {
1796- handle = h;
1797- break;
1798- }
1799- OpenPrinter = NULL;
1800- ErrorNo = NULL;
1801- /* try version 0.2 driver */
1802- OpenPrinter_0_2 = dlsym(h,"OpenPrinter");
1803- ErrorNo = dlsym(h,"errorno");
1804- if (OpenPrinter_0_2 && ErrorNo) {
1805- handle = h;
1806- break;
1807- }
1808- OpenPrinter_0_2 = NULL;
1809- ErrorNo = NULL;
1810- }
1811- i++;
1812- }
1790+ i = 0;
1791+ while (list[i]) {
1792+ if ((h = dlopen(list[i],RTLD_NOW))) {
1793+ OpenPrinter = dlsym(h,"opvpOpenPrinter");
1794+ ErrorNo = dlsym(h,"opvpErrorNo");
1795+ if (OpenPrinter && ErrorNo) {
1796+ handle = h;
1797+ break;
1798+ }
1799+ OpenPrinter = NULL;
1800+ ErrorNo = NULL;
1801+ /* try version 0.2 driver */
1802+ OpenPrinter_0_2 = dlsym(h,"OpenPrinter");
1803+ ErrorNo = dlsym(h,"errorno");
1804+ if (OpenPrinter_0_2 && ErrorNo) {
1805+ handle = h;
1806+ break;
1807+ }
1808+ OpenPrinter_0_2 = NULL;
1809+ ErrorNo = NULL;
1810+ }
1811+ i++;
1812+ }
18131813 }
18141814
18151815 if (handle) {
1816- return 0;
1816+ return 0;
18171817 } else {
1818- return -1;
1818+ return -1;
18191819 }
18201820 }
18211821
@@ -1822,14 +1822,14 @@
18221822 /*
18231823 * unload vector-driver
18241824 */
1825-static int
1825+static int
18261826 opvp_unload_vector_driver(void)
18271827 {
18281828 if (handle) {
1829- dlclose(handle);
1830- handle = NULL;
1831- OpenPrinter = NULL;
1832- ErrorNo = NULL;
1829+ dlclose(handle);
1830+ handle = NULL;
1831+ OpenPrinter = NULL;
1832+ ErrorNo = NULL;
18331833 }
18341834 return 0;
18351835 }
@@ -1837,7 +1837,7 @@
18371837 /*
18381838 * prepare open
18391839 */
1840-static int
1840+static int
18411841 prepare_open(gx_device *dev)
18421842 {
18431843 int ecode = 0;
@@ -1855,113 +1855,113 @@
18551855
18561856 /* load vector driver */
18571857 if (!ecode) {
1858- if ((code = opvp_load_vector_driver())) {
1859- ecode = code;
1860- }
1858+ if ((code = opvp_load_vector_driver())) {
1859+ ecode = code;
1860+ }
18611861 }
18621862
18631863 /* prepare array of function pointer for PDAPI */
18641864 if (!ecode) {
1865- if (!apiEntry) {
1866- if (!(apiEntry = calloc(sizeof(opvp_api_procs_t), 1))) {
1867- ecode = -1;
1868- }
1869- } else {
1870- memset(apiEntry, 0, sizeof(opvp_api_procs_t));
1871- }
1865+ if (!apiEntry) {
1866+ if (!(apiEntry = calloc(sizeof(opvp_api_procs_t), 1))) {
1867+ ecode = -1;
1868+ }
1869+ } else {
1870+ memset(apiEntry, 0, sizeof(opvp_api_procs_t));
1871+ }
18721872 }
18731873
18741874 /* call opvpOpenPrinter as dummy */
18751875 if (!ecode) {
1876- opvp_dc_t dc;
1877- opvp_int_t apiVersion[2];
1876+ opvp_dc_t dc;
1877+ opvp_int_t apiVersion[2];
18781878
1879- /* require version 1.0 */
1880- apiVersion[0] = 1;
1881- apiVersion[1] = 0;
1882- dc = OpenPrinterWrapper(dumFD, (opvp_char_t *)printerModel,
1883- apiVersion,&api_entry);
1884- if (dc == -1) {
1885- ecode = -1;
1886- } else {
1887- dumContext = dc;
1888- }
1879+ /* require version 1.0 */
1880+ apiVersion[0] = 1;
1881+ apiVersion[1] = 0;
1882+ dc = OpenPrinterWrapper(dumFD, (opvp_char_t *)printerModel,
1883+ apiVersion,&api_entry);
1884+ if (dc == -1) {
1885+ ecode = -1;
1886+ } else {
1887+ dumContext = dc;
1888+ }
18891889 }
18901890
18911891 /* set apiEntry */
18921892 if (!ecode) {
1893- nApiEntry = sizeof(opvp_api_procs_t)/sizeof(void *);
1894- memcpy(apiEntry, api_entry, nApiEntry*sizeof(void *));
1893+ nApiEntry = sizeof(opvp_api_procs_t)/sizeof(void *);
1894+ memcpy(apiEntry, api_entry, nApiEntry*sizeof(void *));
18951895 } else {
1896- if (apiEntry) free(apiEntry);
1897- apiEntry = NULL;
1896+ if (apiEntry) free(apiEntry);
1897+ apiEntry = NULL;
18981898 }
18991899
19001900 /* check vector fucntion */
19011901 if (apiEntry) {
1902- if (!inkjet) {
1903- if (!(apiEntry->opvpNewPath) ||
1904- !(apiEntry->opvpEndPath) ||
1905- !(apiEntry->opvpStrokePath) ||
1906- !(apiEntry->opvpSetCurrentPoint) ||
1907- !(apiEntry->opvpLinePath) ||
1908- !(apiEntry->opvpBezierPath)) {
1909- /* NOT avail vector drawing mode */
1910- vector = false;
1911- }
1912- }
1913- /* call GetColorSpace */
1914- if (apiEntry->opvpGetColorSpace) {
1915- r = apiEntry->opvpGetColorSpace(dumContext, &cspace);
1916- }
1917- if (cspace == OPVP_CSPACE_BW) {
1918- /* mono-color */
1919- colorSpace = cspace;
1920- dev->color_info.num_components = 1;
1921- dev->color_info.depth = 1;
1922- dev->color_info.max_gray = 0;
1923- dev->color_info.max_color = 0;
1924- dev->color_info.dither_grays = 1;
1925- dev->color_info.dither_colors = 1;
1926- } else if (cspace == OPVP_CSPACE_DEVICEGRAY) {
1927- /* gray-scale */
1928- colorSpace = cspace;
1929- dev->color_info.num_components = 1;
1930- dev->color_info.depth = 8;
1931- dev->color_info.max_gray = 255;
1932- dev->color_info.max_color = 255;
1933- dev->color_info.dither_grays = 256;
1934- dev->color_info.dither_colors = 256;
1935- } else {
1936- /* rgb color */
1937- colorSpace = OPVP_CSPACE_STANDARDRGB;
1938- dev->color_info.num_components = 3;
1939- dev->color_info.depth = 24;
1940- dev->color_info.max_gray = 255;
1941- dev->color_info.max_color = 255;
1942- dev->color_info.dither_grays = 256;
1943- dev->color_info.dither_colors = 256;
1944- }
1902+ if (!inkjet) {
1903+ if (!(apiEntry->opvpNewPath) ||
1904+ !(apiEntry->opvpEndPath) ||
1905+ !(apiEntry->opvpStrokePath) ||
1906+ !(apiEntry->opvpSetCurrentPoint) ||
1907+ !(apiEntry->opvpLinePath) ||
1908+ !(apiEntry->opvpBezierPath)) {
1909+ /* NOT avail vector drawing mode */
1910+ vector = false;
1911+ }
1912+ }
1913+ /* call GetColorSpace */
1914+ if (apiEntry->opvpGetColorSpace) {
1915+ r = apiEntry->opvpGetColorSpace(dumContext, &cspace);
1916+ }
1917+ if (cspace == OPVP_CSPACE_BW) {
1918+ /* mono-color */
1919+ colorSpace = cspace;
1920+ dev->color_info.num_components = 1;
1921+ dev->color_info.depth = 1;
1922+ dev->color_info.max_gray = 0;
1923+ dev->color_info.max_color = 0;
1924+ dev->color_info.dither_grays = 1;
1925+ dev->color_info.dither_colors = 1;
1926+ } else if (cspace == OPVP_CSPACE_DEVICEGRAY) {
1927+ /* gray-scale */
1928+ colorSpace = cspace;
1929+ dev->color_info.num_components = 1;
1930+ dev->color_info.depth = 8;
1931+ dev->color_info.max_gray = 255;
1932+ dev->color_info.max_color = 255;
1933+ dev->color_info.dither_grays = 256;
1934+ dev->color_info.dither_colors = 256;
1935+ } else {
1936+ /* rgb color */
1937+ colorSpace = OPVP_CSPACE_STANDARDRGB;
1938+ dev->color_info.num_components = 3;
1939+ dev->color_info.depth = 24;
1940+ dev->color_info.max_gray = 255;
1941+ dev->color_info.max_color = 255;
1942+ dev->color_info.dither_grays = 256;
1943+ dev->color_info.dither_colors = 256;
1944+ }
19451945 #if GS_VERSION_MAJOR >= 8
1946- dev->procs.get_color_mapping_procs = NULL;
1947- dev->procs.get_color_comp_index = NULL;
1948- gx_device_fill_in_procs(dev);
1946+ dev->procs.get_color_mapping_procs = NULL;
1947+ dev->procs.get_color_comp_index = NULL;
1948+ gx_device_fill_in_procs(dev);
19491949 #endif
19501950 }
19511951
19521952 /* call Closerinter as dummy */
19531953 if (dumContext != -1) {
1954- /* call ClosePrinter */
1955- if (apiEntry->opvpClosePrinter) {
1956- apiEntry->opvpClosePrinter(dumContext);
1957- }
1958- dumContext = -1;
1954+ /* call ClosePrinter */
1955+ if (apiEntry->opvpClosePrinter) {
1956+ apiEntry->opvpClosePrinter(dumContext);
1957+ }
1958+ dumContext = -1;
19591959 }
19601960
19611961 /* close device for dummy */
19621962 if (dumFD != -1) {
1963- close(dumFD);
1964- dumFD = -1;
1963+ close(dumFD);
1964+ dumFD = -1;
19651965 }
19661966
19671967 /* un-load vector driver */
@@ -1974,7 +1974,7 @@
19741974 /*
19751975 * open device
19761976 */
1977-static int
1977+static int
19781978 opvp_open(gx_device *dev)
19791979 {
19801980 gx_device_opvp *pdev = (gx_device_opvp *)dev;
@@ -1995,95 +1995,101 @@
19951995 /* prepare open : load and open as dummy */
19961996 code = prepare_open(dev);
19971997 if (code) {
1998- ecode = code;
1999- return ecode;
1998+ ecode = code;
1999+ return ecode;
20002000 }
20012001
20022002 /* set margins */
20032003 if (zoomAuto) {
2004- margin_width = (margins[0] + margins[2])
2005- * dev->HWResolution[0];
2006- margin_height = (margins[1] + margins[3])
2007- * dev->HWResolution[1];
2008- zoom[0] = (dev->width - margin_width) / dev->width;
2009- zoom[1] = (dev->height - margin_height) / dev->height;
2010- if (zoom[0] < zoom[1]) {
2011- zoom[1] = zoom[0];
2012- } else {
2013- zoom[0] = zoom[1];
2014- }
2004+ margin_width = (margins[0] + margins[2])
2005+ * dev->HWResolution[0];
2006+ margin_height = (margins[1] + margins[3])
2007+ * dev->HWResolution[1];
2008+ zoom[0] = (dev->width - margin_width) / dev->width;
2009+ zoom[1] = (dev->height - margin_height) / dev->height;
2010+ if (zoom[0] < zoom[1]) {
2011+ zoom[1] = zoom[0];
2012+ } else {
2013+ zoom[0] = zoom[1];
2014+ }
20152015 }
20162016 if (inkjet) {
2017- if ((margins[0] != 0) ||
2018- (margins[1] != 0) || (margins[3] != 0)) {
2019- shift[0] = margins[0] * dev->HWResolution[0];
2020- shift[1] = (margins[1] + margins[3])
2021- * dev->HWResolution[1];
2022- zooming = true;
2023- }
2024- dev->width -= margins[2] * dev->HWResolution[0];
2025- dev->height -= margins[1] * dev->HWResolution[1];
2017+ if ((margins[0] != 0) ||
2018+ (margins[1] != 0) || (margins[3] != 0)) {
2019+ shift[0] = margins[0] * dev->HWResolution[0];
2020+ shift[1] = (margins[1] + margins[3])
2021+ * dev->HWResolution[1];
2022+ zooming = true;
2023+ }
2024+ dev->width -= margins[2] * dev->HWResolution[0];
2025+ dev->height -= margins[1] * dev->HWResolution[1];
20262026 } else {
2027- if ((margins[0] != 0) || (margins[1] != 0)) {
2028- shift[0] = margins[0] * dev->HWResolution[0];
2029- shift[1] = margins[3] * dev->HWResolution[1];
2030- zooming = true;
2031- }
2032- adj_margins[0] = 0;
2033- adj_margins[3] = 0;
2034- adj_margins[1] = dev->height * zoom[1] / dev->HWResolution[1]
2035- - (dev->MediaSize[1] / PS_DPI
2036- - (margins[1] + margins[3]));
2037- if (adj_margins[1] < 0) adj_margins[0] = 0;
2038- adj_margins[2] = dev->width * zoom[0] / dev->HWResolution[0]
2039- - (dev->MediaSize[0] / PS_DPI
2040- - (margins[0] + margins[2]));
2041- if (adj_margins[2] < 0) adj_margins[2] = 0;
2042- gx_device_set_margins(dev, adj_margins, true);
2027+ if ((margins[0] != 0) || (margins[1] != 0)) {
2028+ shift[0] = margins[0] * dev->HWResolution[0];
2029+ shift[1] = margins[3] * dev->HWResolution[1];
2030+ zooming = true;
2031+ }
2032+ adj_margins[0] = 0;
2033+ adj_margins[3] = 0;
2034+ adj_margins[1] = dev->height * zoom[1] / dev->HWResolution[1]
2035+ - (dev->MediaSize[1] / PS_DPI
2036+ - (margins[1] + margins[3]));
2037+ if (adj_margins[1] < 0) adj_margins[0] = 0;
2038+ adj_margins[2] = dev->width * zoom[0] / dev->HWResolution[0]
2039+ - (dev->MediaSize[0] / PS_DPI
2040+ - (margins[0] + margins[2]));
2041+ if (adj_margins[2] < 0) adj_margins[2] = 0;
2042+ gx_device_set_margins(dev, adj_margins, true);
20432043 }
20442044 if ((zoom[0] != 1) || (zoom[1] != 1)) zooming = true;
20452045
20462046 /* open file for output device */
20472047 if (!inkjet) {
2048- pdev->v_memory = gs_memory_stable(pdev->memory);
2049- /* open output stream */
2050- code = gdev_vector_open_file_options((gx_device_vector*)dev,
2051- 512,
2052- (VECTOR_OPEN_FILE_SEQUENTIAL
2053- |VECTOR_OPEN_FILE_BBOX
2054- ));
2055- if (code < 0) {
2056- ecode = code;
2057- return ecode;
2058- }
2048+ pdev->v_memory = gs_memory_stable(pdev->memory);
2049+ /* open output stream */
2050+ code = gdev_vector_open_file_options((gx_device_vector*)dev,
2051+ 512,
2052+ (VECTOR_OPEN_FILE_SEQUENTIAL
2053+ |VECTOR_OPEN_FILE_BBOX
2054+ ));
2055+ if (code < 0) {
2056+ ecode = code;
2057+ return ecode;
2058+ }
20592059 #if GS_VERSION_MAJOR >= 8
2060- if (pdev->bbox_device != NULL) {
2061- if (pdev->bbox_device->memory == NULL) {
2062- pdev->bbox_device->memory = gs_memory_stable(dev->memory);
2063- }
2064- }
2060+ if (pdev->bbox_device != NULL) {
2061+ if (pdev->bbox_device->memory == NULL) {
2062+ pdev->bbox_device->memory = gs_memory_stable(dev->memory);
2063+ }
2064+#if GS_VERSION_MAJOR >= 9
2065+ if (pdev->bbox_device->device_icc_profile == NULL) {
2066+ pdev->bbox_device->device_icc_profile =
2067+ pdev->device_icc_profile;
2068+ }
20652069 #endif
2066- outputFD = fileno(pdev->file);
2070+ }
2071+#endif
2072+ outputFD = fileno(pdev->file);
20672073 } else {
2068- /* open printer device */
2069- code = gdev_prn_open(dev);
2070- if (code < 0) {
2071- ecode = ecode;
2072- return ecode;
2073- }
2074- /* open output stream */
2075- code = gdev_prn_open_printer_seekable(dev, true, false);
2076- if (code < 0) {
2077- ecode = code;
2078- return ecode;
2079- }
2080- outputFD = fileno(rdev->file);
2074+ /* open printer device */
2075+ code = gdev_prn_open(dev);
2076+ if (code < 0) {
2077+ ecode = ecode;
2078+ return ecode;
2079+ }
2080+ /* open output stream */
2081+ code = gdev_prn_open_printer_seekable(dev, true, false);
2082+ if (code < 0) {
2083+ ecode = code;
2084+ return ecode;
2085+ }
2086+ outputFD = fileno(rdev->file);
20812087 }
20822088
20832089 /* RE-load vector driver */
20842090 if ((code = opvp_load_vector_driver())) {
2085- ecode = code;
2086- return ecode;
2091+ ecode = code;
2092+ return ecode;
20872093 }
20882094
20892095 /* call opvpOpenPrinter */
@@ -2093,20 +2099,20 @@
20932099 dc = OpenPrinterWrapper(outputFD,(opvp_char_t *)printerModel,
20942100 apiVersion,&api_entry);
20952101 if (!apiEntry) {
2096- if (!(apiEntry = calloc(sizeof(opvp_api_procs_t), 1))) {
2097- ecode = -1;
2098- }
2102+ if (!(apiEntry = calloc(sizeof(opvp_api_procs_t), 1))) {
2103+ ecode = -1;
2104+ }
20992105 } else {
2100- memset(apiEntry, 0, sizeof(opvp_api_procs_t));
2106+ memset(apiEntry, 0, sizeof(opvp_api_procs_t));
21012107 }
21022108 if (dc == -1) {
2103- ecode = -1;
2104- if (apiEntry) free(apiEntry);
2105- apiEntry = NULL;
2106- opvp_unload_vector_driver();
2107- if (inkjet) gdev_prn_close(dev);
2108- else gdev_vector_close_file((gx_device_vector *)pdev);
2109- return ecode;
2109+ ecode = -1;
2110+ if (apiEntry) free(apiEntry);
2111+ apiEntry = NULL;
2112+ opvp_unload_vector_driver();
2113+ if (inkjet) gdev_prn_close(dev);
2114+ else gdev_vector_close_file((gx_device_vector *)pdev);
2115+ return ecode;
21102116 }
21112117 printerContext = dc;
21122118 nApiEntry = sizeof(opvp_api_procs_t)/sizeof(void *);
@@ -2114,92 +2120,92 @@
21142120
21152121 /* initialize */
21162122 if ((!ecode) && (!inkjet)) {
2117- pdev->vec_procs = &opvp_vector_procs;
2118- if (vector) gdev_vector_init((gx_device_vector *)pdev);
2123+ pdev->vec_procs = &opvp_vector_procs;
2124+ if (vector) gdev_vector_init((gx_device_vector *)pdev);
21192125 }
21202126
21212127 if (apiEntry->opvpQueryColorSpace) {
2122- int n = sizeof(cspace_available);
2123- int nn = n;
2124- opvp_cspace_t *p = malloc(n*sizeof(opvp_cspace_t));
2128+ int n = sizeof(cspace_available);
2129+ int nn = n;
2130+ opvp_cspace_t *p = malloc(n*sizeof(opvp_cspace_t));
21252131
2126- if ((r = apiEntry->opvpQueryColorSpace(printerContext,&nn,p))
2127- == OPVP_PARAMERROR && nn > n) {
2128- /* realloc buffer and retry */
2129- p = realloc(p,nn*sizeof(opvp_cspace_t));
2130- r = apiEntry->opvpQueryColorSpace(printerContext,&nn,p);
2131- }
2132- if (r == OPVP_OK) {
2133- int i;
2132+ if ((r = apiEntry->opvpQueryColorSpace(printerContext,&nn,p))
2133+ == OPVP_PARAMERROR && nn > n) {
2134+ /* realloc buffer and retry */
2135+ p = realloc(p,nn*sizeof(opvp_cspace_t));
2136+ r = apiEntry->opvpQueryColorSpace(printerContext,&nn,p);
2137+ }
2138+ if (r == OPVP_OK) {
2139+ int i;
21342140
2135- for (i = 0;i < nn;i++) {
2136- if (p[i] < sizeof(cspace_available)) {
2137- cspace_available[p[i]] = 1;
2138- }
2139- }
2140- }
2141- free(p);
2141+ for (i = 0;i < nn;i++) {
2142+ if (p[i] < sizeof(cspace_available)) {
2143+ cspace_available[p[i]] = 1;
2144+ }
2145+ }
2146+ }
2147+ free(p);
21422148 }
21432149 /* start job */
21442150 if (!ecode) {
2145- /* job info */
2146- if (jobInfo) {
2147- if (strlen(jobInfo) > 0) {
2148- job_info = opvp_alloc_string(&job_info,jobInfo);
2149- }
2150- }
2151- tmp_info = opvp_alloc_string(&tmp_info,opvp_gen_job_info(dev));
2152- if (tmp_info) {
2153- if (strlen(tmp_info) > 0) {
2154- if (job_info) {
2155- if (strlen(job_info) > 0) {
2156- opvp_cat_string(&job_info, ";");
2157- }
2158- }
2159- job_info = opvp_cat_string(&job_info,OPVP_INFO_PREFIX);
2160- job_info = opvp_cat_string(&job_info,tmp_info);
2161- }
2162- }
2151+ /* job info */
2152+ if (jobInfo) {
2153+ if (strlen(jobInfo) > 0) {
2154+ job_info = opvp_alloc_string(&job_info,jobInfo);
2155+ }
2156+ }
2157+ tmp_info = opvp_alloc_string(&tmp_info,opvp_gen_job_info(dev));
2158+ if (tmp_info) {
2159+ if (strlen(tmp_info) > 0) {
2160+ if (job_info) {
2161+ if (strlen(job_info) > 0) {
2162+ opvp_cat_string(&job_info, ";");
2163+ }
2164+ }
2165+ job_info = opvp_cat_string(&job_info,OPVP_INFO_PREFIX);
2166+ job_info = opvp_cat_string(&job_info,tmp_info);
2167+ }
2168+ }
21632169
2164- /* call StartJob */
2165- if (apiEntry->opvpStartJob) {
2166- r = apiEntry->opvpStartJob(printerContext,
2167- (opvp_char_t *)opvp_to_utf8(job_info));
2168- }
2169- if (r != OPVP_OK) {
2170- ecode = -1;
2171- }
2170+ /* call StartJob */
2171+ if (apiEntry->opvpStartJob) {
2172+ r = apiEntry->opvpStartJob(printerContext,
2173+ (opvp_char_t *)opvp_to_utf8(job_info));
2174+ }
2175+ if (r != OPVP_OK) {
2176+ ecode = -1;
2177+ }
21722178 }
21732179
21742180 /* start doc */
21752181 if (!ecode) {
2176- /* doc info */
2177- if (docInfo) {
2178- if (strlen(docInfo) > 0) {
2179- doc_info = opvp_alloc_string(&doc_info,docInfo);
2180- }
2181- }
2182- tmp_info = opvp_alloc_string(&tmp_info, opvp_gen_doc_info(dev));
2183- if (tmp_info) {
2184- if (strlen(tmp_info) > 0) {
2185- if (doc_info) {
2186- if (strlen(doc_info) > 0) {
2187- opvp_cat_string(&doc_info, ";");
2188- }
2189- }
2190- doc_info = opvp_cat_string(&doc_info,OPVP_INFO_PREFIX);
2191- doc_info = opvp_cat_string(&doc_info,tmp_info);
2192- }
2193- }
2182+ /* doc info */
2183+ if (docInfo) {
2184+ if (strlen(docInfo) > 0) {
2185+ doc_info = opvp_alloc_string(&doc_info,docInfo);
2186+ }
2187+ }
2188+ tmp_info = opvp_alloc_string(&tmp_info, opvp_gen_doc_info(dev));
2189+ if (tmp_info) {
2190+ if (strlen(tmp_info) > 0) {
2191+ if (doc_info) {
2192+ if (strlen(doc_info) > 0) {
2193+ opvp_cat_string(&doc_info, ";");
2194+ }
2195+ }
2196+ doc_info = opvp_cat_string(&doc_info,OPVP_INFO_PREFIX);
2197+ doc_info = opvp_cat_string(&doc_info,tmp_info);
2198+ }
2199+ }
21942200
2195- /* call StartDoc */
2196- if (apiEntry->opvpStartDoc) {
2197- r = apiEntry->opvpStartDoc(printerContext,
2198- (opvp_char_t *)opvp_to_utf8(doc_info));
2199- }
2200- if (r != OPVP_OK) {
2201- ecode = -1;
2202- }
2201+ /* call StartDoc */
2202+ if (apiEntry->opvpStartDoc) {
2203+ r = apiEntry->opvpStartDoc(printerContext,
2204+ (opvp_char_t *)opvp_to_utf8(doc_info));
2205+ }
2206+ if (r != OPVP_OK) {
2207+ ecode = -1;
2208+ }
22032209 }
22042210
22052211 if (tmp_info) opvp_alloc_string(&tmp_info, NULL);
@@ -2212,7 +2218,7 @@
22122218 /*
22132219 * open device for inkjet
22142220 */
2215-static int
2221+static int
22162222 oprp_open(gx_device *dev)
22172223 {
22182224 /* set inkjet mode */
@@ -2227,7 +2233,7 @@
22272233 /*
22282234 * get initial matrix
22292235 */
2230-static void
2236+static void
22312237 opvp_get_initial_matrix(gx_device *dev, gs_matrix *pmat)
22322238 {
22332239 gx_device_opvp *pdev = (gx_device_opvp *)dev;
@@ -2235,31 +2241,31 @@
22352241
22362242 gx_default_get_initial_matrix(dev,pmat);
22372243 if (zooming) {
2238- /* gs matrix */
2239- pmat->xx *= zoom[0];
2240- pmat->xy *= zoom[1];
2241- pmat->yx *= zoom[0];
2242- pmat->yy *= zoom[1];
2243- pmat->tx = pmat->tx * zoom[0] + shift[0];
2244- pmat->ty = pmat->ty * zoom[1] + shift[1];
2244+ /* gs matrix */
2245+ pmat->xx *= zoom[0];
2246+ pmat->xy *= zoom[1];
2247+ pmat->yx *= zoom[0];
2248+ pmat->yy *= zoom[1];
2249+ pmat->tx = pmat->tx * zoom[0] + shift[0];
2250+ pmat->ty = pmat->ty * zoom[1] + shift[1];
22452251 }
22462252
22472253 if (pdev->is_open) {
2248- /* call ResetCTM */
2249- if (apiEntry->opvpResetCTM) {
2250- apiEntry->opvpResetCTM(printerContext);
2251- } else {
2252- /* call SetCTM */
2253- omat.a = 1;
2254- omat.b = 0;
2255- omat.c = 0;
2256- omat.d = 1;
2257- omat.e = 0;
2258- omat.f = 0;
2259- if (apiEntry->opvpSetCTM) {
2260- apiEntry->opvpSetCTM(printerContext, &omat);
2261- }
2262- }
2254+ /* call ResetCTM */
2255+ if (apiEntry->opvpResetCTM) {
2256+ apiEntry->opvpResetCTM(printerContext);
2257+ } else {
2258+ /* call SetCTM */
2259+ omat.a = 1;
2260+ omat.b = 0;
2261+ omat.c = 0;
2262+ omat.d = 1;
2263+ omat.e = 0;
2264+ omat.f = 0;
2265+ if (apiEntry->opvpSetCTM) {
2266+ apiEntry->opvpSetCTM(printerContext, &omat);
2267+ }
2268+ }
22632269 }
22642270
22652271 return;
@@ -2268,7 +2274,7 @@
22682274 /*
22692275 * output page
22702276 */
2271-static int
2277+static int
22722278 opvp_output_page(gx_device *dev, int num_copies, int flush)
22732279 {
22742280 gx_device_opvp *pdev = (gx_device_opvp *)dev;
@@ -2283,18 +2289,18 @@
22832289 /* check page-in */
22842290 if (opvp_check_in_page(pdev)) return -1;
22852291 #endif
2286- /* end page */
2287- code = opvp_endpage();
2288- if (code) ecode = code;
2292+ /* end page */
2293+ code = opvp_endpage();
2294+ if (code) ecode = code;
22892295
2290- pdev->in_page = false;
2291- beginPage = false;
2296+ pdev->in_page = false;
2297+ beginPage = false;
22922298 #ifdef OPVP_IGNORE_BLANK_PAGE
22932299 }
22942300 #endif
22952301
22962302 if (vector) {
2297- gdev_vector_reset((gx_device_vector *)pdev);
2303+ gdev_vector_reset((gx_device_vector *)pdev);
22982304 }
22992305
23002306 code = gx_finish_output_page(dev, num_copies, flush);
@@ -2306,7 +2312,7 @@
23062312 /*
23072313 * print page
23082314 */
2309-static int
2315+static int
23102316 oprp_print_page(gx_device_printer *pdev, FILE *prn_stream)
23112317 {
23122318 int ecode = 0;
@@ -2338,9 +2344,9 @@
23382344
23392345 /* start page */
23402346 if (!ecode) {
2341- code = opvp_startpage((gx_device *)pdev);
2342- if (code) ecode = code;
2343- else start_page = true;
2347+ code = opvp_startpage((gx_device *)pdev);
2348+ if (code) ecode = code;
2349+ else start_page = true;
23442350 }
23452351
23462352 /* moveto origin */
@@ -2349,85 +2355,85 @@
23492355
23502356 /* call StartRaster */
23512357 if (!ecode) {
2352- if (apiEntry->opvpStartRaster) {
2353- r = apiEntry->opvpStartRaster(printerContext,rasterWidth);
2354- }
2355- if (r != OPVP_OK) {
2356- ecode = r;
2357- } else {
2358- start_raster = true;
2359- }
2358+ if (apiEntry->opvpStartRaster) {
2359+ r = apiEntry->opvpStartRaster(printerContext,rasterWidth);
2360+ }
2361+ if (r != OPVP_OK) {
2362+ ecode = r;
2363+ } else {
2364+ start_raster = true;
2365+ }
23602366 }
23612367
23622368 /* line */
23632369 for (line = 0; (line < scan_lines) && (!ecode); line++) {
2364- /* get raster data */
2365- if (!ecode) {
2366- code = gdev_prn_get_bits(pdev, line, buff, &data);
2367- if (code) {
2368- ecode = code;
2369- break;
2370- }
2371- }
2370+ /* get raster data */
2371+ if (!ecode) {
2372+ code = gdev_prn_get_bits(pdev, line, buff, &data);
2373+ if (code) {
2374+ ecode = code;
2375+ break;
2376+ }
2377+ }
23722378 #if ENABLE_SKIP_RASTER
2373- /* check support SkipRaster */
2374- if (apiEntry->opvpSkipRaster) {
2375- /* check all white */
2376- if (pdev->color_info.depth > 8) {
2377- for (check = 0xff, i = 0; i < raster_size; i++)
2378- {
2379- check &= data[i];
2380- if (check != 0xff) break;
2381- }
2382- /* if all white call SkipRaster */
2383- if (check == 0xff) {
2384- r = apiEntry->opvpSkipRaster(printerContext, 1);
2385- if (r == OPVP_OK) continue;
2386- }
2387- } else {
2388- for (check = 0, i = 0; i < raster_size; i++) {
2389- check |= data[i];
2390- if (check) break;
2391- }
2392- /* if all zero call SkipRaster */
2393- if (check) {
2394- r = apiEntry->opvpSkipRaster(printerContext, 1);
2395- if (r == OPVP_OK) continue;
2396- }
2397- }
2398- }
2379+ /* check support SkipRaster */
2380+ if (apiEntry->opvpSkipRaster) {
2381+ /* check all white */
2382+ if (pdev->color_info.depth > 8) {
2383+ for (check = 0xff, i = 0; i < raster_size; i++)
2384+ {
2385+ check &= data[i];
2386+ if (check != 0xff) break;
2387+ }
2388+ /* if all white call SkipRaster */
2389+ if (check == 0xff) {
2390+ r = apiEntry->opvpSkipRaster(printerContext, 1);
2391+ if (r == OPVP_OK) continue;
2392+ }
2393+ } else {
2394+ for (check = 0, i = 0; i < raster_size; i++) {
2395+ check |= data[i];
2396+ if (check) break;
2397+ }
2398+ /* if all zero call SkipRaster */
2399+ if (check) {
2400+ r = apiEntry->opvpSkipRaster(printerContext, 1);
2401+ if (r == OPVP_OK) continue;
2402+ }
2403+ }
2404+ }
23992405 #endif
2400- /* call TransferRasterData */
2401- if (!ecode) {
2402- if (apiEntry->opvpTransferRasterData) {
2403- r = apiEntry->opvpTransferRasterData(printerContext,
2404- raster_size,
2405- data);
2406- }
2407- if (r != OPVP_OK) ecode = r;
2408- }
2406+ /* call TransferRasterData */
2407+ if (!ecode) {
2408+ if (apiEntry->opvpTransferRasterData) {
2409+ r = apiEntry->opvpTransferRasterData(printerContext,
2410+ raster_size,
2411+ data);
2412+ }
2413+ if (r != OPVP_OK) ecode = r;
2414+ }
24092415 }
24102416
24112417 /* call EndRaster */
24122418 if (start_raster) {
2413- if (apiEntry->opvpEndRaster) {
2414- r = apiEntry->opvpEndRaster(printerContext);
2415- }
2416- if (r != OPVP_OK) ecode = r;
2417- start_raster = false;
2419+ if (apiEntry->opvpEndRaster) {
2420+ r = apiEntry->opvpEndRaster(printerContext);
2421+ }
2422+ if (r != OPVP_OK) ecode = r;
2423+ start_raster = false;
24182424 }
24192425
24202426 /* end page */
24212427 if (start_page) {
2422- code = opvp_endpage();
2423- if (code) ecode = code;
2424- start_page = false;
2428+ code = opvp_endpage();
2429+ if (code) ecode = code;
2430+ start_page = false;
24252431 }
24262432
24272433 /* free buffer */
24282434 if (buff) {
2429- free(buff);
2430- buff = NULL;
2435+ free(buff);
2436+ buff = NULL;
24312437 }
24322438
24332439 return ecode;
@@ -2436,7 +2442,7 @@
24362442 /*
24372443 * close device
24382444 */
2439-static int
2445+static int
24402446 opvp_close(gx_device *dev)
24412447 {
24422448 gx_device_opvp *pdev = (gx_device_opvp *)dev;
@@ -2444,21 +2450,21 @@
24442450
24452451 /* finalize */
24462452 if (printerContext != -1) {
2447- /* call EndDoc */
2448- if (apiEntry->opvpEndDoc) {
2449- apiEntry->opvpEndDoc(printerContext);
2450- }
2453+ /* call EndDoc */
2454+ if (apiEntry->opvpEndDoc) {
2455+ apiEntry->opvpEndDoc(printerContext);
2456+ }
24512457
2452- /* call EndJob */
2453- if (apiEntry->opvpEndJob) {
2454- apiEntry->opvpEndJob(printerContext);
2455- }
2458+ /* call EndJob */
2459+ if (apiEntry->opvpEndJob) {
2460+ apiEntry->opvpEndJob(printerContext);
2461+ }
24562462
2457- /* call ClosePrinter */
2458- if (apiEntry->opvpClosePrinter) {
2459- apiEntry->opvpClosePrinter(printerContext);
2460- }
2461- printerContext = -1;
2463+ /* call ClosePrinter */
2464+ if (apiEntry->opvpClosePrinter) {
2465+ apiEntry->opvpClosePrinter(printerContext);
2466+ }
2467+ printerContext = -1;
24622468 }
24632469
24642470 /* unload vector driver */
@@ -2467,11 +2473,11 @@
24672473 opvp_unload_vector_driver();
24682474
24692475 if (inkjet) {
2470- /* close printer */
2471- gdev_prn_close(dev);
2476+ /* close printer */
2477+ gdev_prn_close(dev);
24722478 } else {
2473- /* close output stream */
2474- gdev_vector_close_file((gx_device_vector *)pdev);
2479+ /* close output stream */
2480+ gdev_vector_close_file((gx_device_vector *)pdev);
24752481 }
24762482 outputFD = -1;
24772483
@@ -2482,15 +2488,15 @@
24822488 * map rgb color
24832489 */
24842490 #if GS_VERSION_MAJOR >= 8
2485-static gx_color_index
2491+static gx_color_index
24862492 opvp_map_rgb_color(gx_device *dev,
2487- const gx_color_value *prgb /* modified for gs 8.15 */)
2493+ const gx_color_value *prgb /* modified for gs 8.15 */)
24882494 #else
2489-static gx_color_index
2495+static gx_color_index
24902496 opvp_map_rgb_color(gx_device *dev,
2491- gx_color_value r,
2492- gx_color_value g,
2493- gx_color_value b)
2497+ gx_color_value r,
2498+ gx_color_value g,
2499+ gx_color_value b)
24942500 #endif
24952501 {
24962502 opvp_cspace_t cs;
@@ -2518,80 +2524,80 @@
25182524 cs = colorSpace;
25192525 #else
25202526 if (pdev->is_open) {
2521- /* call GetColorSpace */
2522- if (apiEntry->opvpGetColorSpace) {
2523- r = apiEntry->opvpGetColorSpace(printerContext, &cs);
2524- }
2525- if (r != OPVP_OK) {
2526- if (pdev->color_info.depth > 32) {
2527- cs = OPVP_CSPACE_STANDARDRGB64;
2528- } else if (pdev->color_info.depth > 8 ) {
2529- cs = OPVP_CSPACE_STANDARDRGB;
2530- } else if (pdev->color_info.depth > 1 ) {
2531- cs = OPVP_CSPACE_DEVICEGRAY;
2532- } else {
2533- cs = OPVP_CSPACE_BW;
2534- }
2535- }
2527+ /* call GetColorSpace */
2528+ if (apiEntry->opvpGetColorSpace) {
2529+ r = apiEntry->opvpGetColorSpace(printerContext, &cs);
2530+ }
2531+ if (r != OPVP_OK) {
2532+ if (pdev->color_info.depth > 32) {
2533+ cs = OPVP_CSPACE_STANDARDRGB64;
2534+ } else if (pdev->color_info.depth > 8 ) {
2535+ cs = OPVP_CSPACE_STANDARDRGB;
2536+ } else if (pdev->color_info.depth > 1 ) {
2537+ cs = OPVP_CSPACE_DEVICEGRAY;
2538+ } else {
2539+ cs = OPVP_CSPACE_BW;
2540+ }
2541+ }
25362542 }
25372543 #endif
25382544
25392545 switch (cs) {
25402546 case OPVP_CSPACE_STANDARDRGB64:
2541- /* unsupported */
2542- if (sizeof(gx_color_index) >= 6) {
2543- return (long long)b
2544- + ((long long)g << 16)
2545- + ((long long)b << 32);
2546- } else {
2547- return gx_color_value_to_byte(b)
2548- + ((uint)gx_color_value_to_byte(g) << 8)
2549- + ((ulong)gx_color_value_to_byte(r) << 16);
2550- }
2551- break;
2547+ /* unsupported */
2548+ if (sizeof(gx_color_index) >= 6) {
2549+ return (long long)b
2550+ + ((long long)g << 16)
2551+ + ((long long)b << 32);
2552+ } else {
2553+ return gx_color_value_to_byte(b)
2554+ + ((uint)gx_color_value_to_byte(g) << 8)
2555+ + ((ulong)gx_color_value_to_byte(r) << 16);
2556+ }
2557+ break;
25522558 case OPVP_CSPACE_DEVICECMYK:
25532559 case OPVP_CSPACE_DEVICECMY:
2554- /* unsupported */
2555- c = gx_color_value_to_byte(~r);
2556- m = gx_color_value_to_byte(~g);
2557- y = gx_color_value_to_byte(~b);
2558- if (cs == OPVP_CSPACE_DEVICECMYK) {
2559- k = (c<m ? (c<y ? c : y) : (m<y ? m : y));
2560- c -= k;
2561- m -= k;
2562- y -= k;
2563- } else {
2564- k = 0;
2565- }
2566- return (k + (y << 8) + (m << 16) + (c << 24));
2567- break;
2560+ /* unsupported */
2561+ c = gx_color_value_to_byte(~r);
2562+ m = gx_color_value_to_byte(~g);
2563+ y = gx_color_value_to_byte(~b);
2564+ if (cs == OPVP_CSPACE_DEVICECMYK) {
2565+ k = (c<m ? (c<y ? c : y) : (m<y ? m : y));
2566+ c -= k;
2567+ m -= k;
2568+ y -= k;
2569+ } else {
2570+ k = 0;
2571+ }
2572+ return (k + (y << 8) + (m << 16) + (c << 24));
2573+ break;
25682574 case OPVP_CSPACE_DEVICEGRAY:
25692575 #if GS_VERSION_MAJOR >= 8
2570- {
2571- gx_color_value rgb[3];
2572- rgb[0] = rgb[1] = rgb[2] = r;
2573- return gx_default_gray_map_rgb_color(dev, rgb);
2574- }
2576+ {
2577+ gx_color_value rgb[3];
2578+ rgb[0] = rgb[1] = rgb[2] = r;
2579+ return gx_default_gray_map_rgb_color(dev, rgb);
2580+ }
25752581 #else
2576- return gx_default_gray_map_rgb_color(dev, r, g, b);
2582+ return gx_default_gray_map_rgb_color(dev, r, g, b);
25772583 #endif
2578- break;
2584+ break;
25792585 case OPVP_CSPACE_BW :
25802586 #if GS_VERSION_MAJOR >= 8
2581- return gx_default_b_w_map_rgb_color(dev, prgb);
2587+ return gx_default_b_w_map_rgb_color(dev, prgb);
25822588 #else
2583- return gx_default_b_w_map_rgb_color(dev, r, g, b);
2589+ return gx_default_b_w_map_rgb_color(dev, r, g, b);
25842590 #endif
2585- break;
2591+ break;
25862592 case OPVP_CSPACE_STANDARDRGB:
25872593 case OPVP_CSPACE_DEVICEKRGB:
25882594 default:
25892595 #if GS_VERSION_MAJOR >= 8
2590- return gx_default_rgb_map_rgb_color(dev, prgb);
2596+ return gx_default_rgb_map_rgb_color(dev, prgb);
25912597 #else
2592- return gx_default_rgb_map_rgb_color(dev, r, g, b);
2598+ return gx_default_rgb_map_rgb_color(dev, r, g, b);
25932599 #endif
2594- break;
2600+ break;
25952601 }
25962602 }
25972603
@@ -2598,7 +2604,7 @@
25982604 /*
25992605 * map color rgb
26002606 */
2601-static int
2607+static int
26022608 opvp_map_color_rgb(gx_device *dev, gx_color_index color,
26032609 gx_color_value prgb[3])
26042610 {
@@ -2614,63 +2620,63 @@
26142620 #else
26152621 /* call GetColorSpace */
26162622 if (pdev->is_open) {
2617- if (apiEntry->opvpGetColorSpace) {
2618- r = apiEntry->opvpGetColorSpace(printerContext, &cs);
2619- }
2620- if (r != OPVP_OK) {
2621- if (pdev->color_info.depth > 32) {
2622- cs = OPVP_CSPACE_STANDARDRGB64;
2623- } else if (pdev->color_info.depth > 8 ) {
2624- cs = OPVP_CSPACE_STANDARDRGB;
2625- } else if (pdev->color_info.depth > 1 ) {
2626- cs = OPVP_CSPACE_DEVICEGRAY;
2627- } else {
2628- cs = OPVP_CSPACE_BW;
2629- }
2630- }
2623+ if (apiEntry->opvpGetColorSpace) {
2624+ r = apiEntry->opvpGetColorSpace(printerContext, &cs);
2625+ }
2626+ if (r != OPVP_OK) {
2627+ if (pdev->color_info.depth > 32) {
2628+ cs = OPVP_CSPACE_STANDARDRGB64;
2629+ } else if (pdev->color_info.depth > 8 ) {
2630+ cs = OPVP_CSPACE_STANDARDRGB;
2631+ } else if (pdev->color_info.depth > 1 ) {
2632+ cs = OPVP_CSPACE_DEVICEGRAY;
2633+ } else {
2634+ cs = OPVP_CSPACE_BW;
2635+ }
2636+ }
26312637 }
26322638 #endif
26332639
26342640 switch (cs) {
26352641 case OPVP_CSPACE_STANDARDRGB64:
2636- /* unsupported */
2637- if (sizeof(gx_color_index) >= 6) {
2638- prgb[0] = ((long long)color >> 32) & 0xffff;
2639- prgb[1] = ((long long)color >> 16) & 0xffff;
2640- prgb[2] = color & 0xffff;
2641- } else {
2642- prgb[0] = gx_color_value_from_byte((color >> 16) & 0xff);
2643- prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
2644- prgb[2] = gx_color_value_from_byte(color & 0xff);
2645- }
2646- break;
2642+ /* unsupported */
2643+ if (sizeof(gx_color_index) >= 6) {
2644+ prgb[0] = ((long long)color >> 32) & 0xffff;
2645+ prgb[1] = ((long long)color >> 16) & 0xffff;
2646+ prgb[2] = color & 0xffff;
2647+ } else {
2648+ prgb[0] = gx_color_value_from_byte((color >> 16) & 0xff);
2649+ prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
2650+ prgb[2] = gx_color_value_from_byte(color & 0xff);
2651+ }
2652+ break;
26472653 case OPVP_CSPACE_DEVICECMYK:
26482654 case OPVP_CSPACE_DEVICECMY:
2649- /* unsupported */
2650- c = gx_color_value_from_byte((color >> 24) & 0xff);
2651- m = gx_color_value_from_byte((color >> 16) & 0xff);
2652- y = gx_color_value_from_byte((color >> 8) & 0xff);
2653- if (cs == OPVP_CSPACE_DEVICECMYK) {
2654- k = gx_color_value_from_byte(color & 0xff);
2655- c += k; if (c > 255) c = 255;
2656- m += k; if (m > 255) m = 255;
2657- y += k; if (y > 255) y = 255;
2658- }
2659- prgb[0] = gx_color_value_from_byte(~c & 0xff);
2660- prgb[1] = gx_color_value_from_byte(~m & 0xff);
2661- prgb[2] = gx_color_value_from_byte(~y & 0xff);
2662- break;
2655+ /* unsupported */
2656+ c = gx_color_value_from_byte((color >> 24) & 0xff);
2657+ m = gx_color_value_from_byte((color >> 16) & 0xff);
2658+ y = gx_color_value_from_byte((color >> 8) & 0xff);
2659+ if (cs == OPVP_CSPACE_DEVICECMYK) {
2660+ k = gx_color_value_from_byte(color & 0xff);
2661+ c += k; if (c > 255) c = 255;
2662+ m += k; if (m > 255) m = 255;
2663+ y += k; if (y > 255) y = 255;
2664+ }
2665+ prgb[0] = gx_color_value_from_byte(~c & 0xff);
2666+ prgb[1] = gx_color_value_from_byte(~m & 0xff);
2667+ prgb[2] = gx_color_value_from_byte(~y & 0xff);
2668+ break;
26632669 case OPVP_CSPACE_DEVICEGRAY:
2664- return gx_default_gray_map_color_rgb(dev, color, prgb);
2665- break;
2670+ return gx_default_gray_map_color_rgb(dev, color, prgb);
2671+ break;
26662672 case OPVP_CSPACE_BW:
2667- return gx_default_b_w_map_color_rgb(dev, color, prgb);
2668- break;
2673+ return gx_default_b_w_map_color_rgb(dev, color, prgb);
2674+ break;
26692675 case OPVP_CSPACE_STANDARDRGB:
26702676 case OPVP_CSPACE_DEVICEKRGB:
26712677 default:
2672- return gx_default_rgb_map_color_rgb(dev, color, prgb);
2673- break;
2678+ return gx_default_rgb_map_color_rgb(dev, color, prgb);
2679+ break;
26742680 }
26752681
26762682 return 0;
@@ -2679,7 +2685,7 @@
26792685 /*
26802686 * fill rectangle
26812687 */
2682-static int
2688+static int
26832689 opvp_fill_rectangle(
26842690 gx_device *dev,
26852691 int x,
@@ -2696,7 +2702,7 @@
26962702 opvp_point_t point;
26972703
26982704 if (vector) {
2699- return gdev_vector_fill_rectangle( dev, x, y, w, h, color);
2705+ return gdev_vector_fill_rectangle( dev, x, y, w, h, color);
27002706 }
27012707
27022708 /* check page-in */
@@ -2705,7 +2711,7 @@
27052711 #if !(ENABLE_SIMPLE_MODE)
27062712 /* call SaveGS */
27072713 if (apiEntry->opvpSaveGS) {
2708- apiEntry->opvpSaveGS(printerContext);
2714+ apiEntry->opvpSaveGS(printerContext);
27092715 }
27102716 #endif
27112717
@@ -2714,7 +2720,7 @@
27142720
27152721 /* call SetFillColor */
27162722 if (apiEntry->opvpSetFillColor) {
2717- apiEntry->opvpSetFillColor(printerContext, &brush);
2723+ apiEntry->opvpSetFillColor(printerContext, &brush);
27182724 }
27192725
27202726 /* call SetCurrentPoint */
@@ -2721,33 +2727,33 @@
27212727 OPVP_I2FIX(x, point.x);
27222728 OPVP_I2FIX(y, point.y);
27232729 if (apiEntry->opvpSetCurrentPoint) {
2724- apiEntry->opvpSetCurrentPoint(printerContext,point.x, point.y);
2730+ apiEntry->opvpSetCurrentPoint(printerContext,point.x, point.y);
27252731 }
27262732
27272733 /* draw image */
27282734 code = opvp_draw_image(pdev,
2729- 1,
2730- 2, 2,
2731- w, h,
2732- 4,
2733- 0,
2734- data);
2735+ 1,
2736+ 2, 2,
2737+ w, h,
2738+ 4,
2739+ 0,
2740+ data);
27352741 if (code) {
2736- ecode = code;
2742+ ecode = code;
27372743 }
27382744
27392745 /* restore fill color */
27402746 if (vectorFillColor) {
2741- /* call SetFillColor */
2742- if (apiEntry->opvpSetFillColor) {
2743- apiEntry->opvpSetFillColor(printerContext,vectorFillColor);
2744- }
2747+ /* call SetFillColor */
2748+ if (apiEntry->opvpSetFillColor) {
2749+ apiEntry->opvpSetFillColor(printerContext,vectorFillColor);
2750+ }
27452751 }
27462752
27472753 #if !(ENABLE_SIMPLE_MODE)
27482754 /* call RestoreGS */
27492755 if (apiEntry->opvpRestoreGS) {
2750- apiEntry->opvpRestoreGS(printerContext);
2756+ apiEntry->opvpRestoreGS(printerContext);
27512757 }
27522758 #endif
27532759
@@ -2757,7 +2763,7 @@
27572763 /*
27582764 * copy mono
27592765 */
2760-static int
2766+static int
27612767 opvp_copy_mono(
27622768 gx_device *dev,
27632769 const byte *data,
@@ -2793,65 +2799,65 @@
27932799
27942800 /* data offset */
27952801 if (data_x) {
2796- byte_offset = data_x >> 3;
2797- bit_shift = data_x & 0x07;
2798- if (bit_shift) bit_mask <<= (8 - bit_shift);
2802+ byte_offset = data_x >> 3;
2803+ bit_shift = data_x & 0x07;
2804+ if (bit_shift) bit_mask <<= (8 - bit_shift);
27992805
2800- byte_length = ((w + 7) >> 3);
2801- adj_raster = ((byte_length + 3) >> 2) << 2;
2806+ byte_length = ((w + 7) >> 3);
2807+ adj_raster = ((byte_length + 3) >> 2) << 2;
28022808
2803- buff = mybuf = calloc(adj_raster, h);
2804- if (!mybuf) {
2805- /* memory error */
2806- return -1;
2807- }
2808- s = &(data[byte_offset]);
2809- d = mybuf;
2810- if (bit_shift) {
2811- for (i = 0;i < h; i++, d += adj_raster, s+= raster) {
2812- for (j = 0; j < byte_length; j++) {
2813- d[j] = ((s[j] & ~bit_mask) << bit_shift)
2814- | ((s[j + 1] & bit_mask) >> (8 - bit_shift));
2815- }
2816- }
2817- } else {
2818- for (i = 0;i < h; i++, d += adj_raster, s+= raster) {
2819- for (j = 0; j < byte_length; j++) {
2820- d[j] = s[j];
2821- }
2822- }
2823- }
2824- byte_offset = 0;
2809+ buff = mybuf = calloc(adj_raster, h);
2810+ if (!mybuf) {
2811+ /* memory error */
2812+ return -1;
2813+ }
2814+ s = &(data[byte_offset]);
2815+ d = mybuf;
2816+ if (bit_shift) {
2817+ for (i = 0;i < h; i++, d += adj_raster, s+= raster) {
2818+ for (j = 0; j < byte_length; j++) {
2819+ d[j] = ((s[j] & ~bit_mask) << bit_shift)
2820+ | ((s[j + 1] & bit_mask) >> (8 - bit_shift));
2821+ }
2822+ }
2823+ } else {
2824+ for (i = 0;i < h; i++, d += adj_raster, s+= raster) {
2825+ for (j = 0; j < byte_length; j++) {
2826+ d[j] = s[j];
2827+ }
2828+ }
2829+ }
2830+ byte_offset = 0;
28252831 }
28262832
28272833 #if !(ENABLE_SIMPLE_MODE)
28282834 /* call SaveGS */
28292835 if (apiEntry->opvpSaveGS) {
2830- apiEntry->opvpSaveGS(printerContext);
2836+ apiEntry->opvpSaveGS(printerContext);
28312837 }
28322838 #endif
28332839 if (one == gx_no_color_index) {
2834- gx_color_index tc;
2840+ gx_color_index tc;
28352841
2836- reverse = (!reverse);
2837- tc = zero;
2838- zero = one;
2839- one = tc;
2842+ reverse = (!reverse);
2843+ tc = zero;
2844+ zero = one;
2845+ one = tc;
28402846 }
28412847
28422848 if (zero != gx_no_color_index) {
2843- /* not mask */
2844- /* Set PaintMode */
2845- if (apiEntry->opvpSetPaintMode) {
2846- apiEntry->opvpSetPaintMode(printerContext,OPVP_PAINTMODE_OPAQUE);
2847- }
2848- /* zero-color */
2849- opvp_set_brush_color(pdev, zero, &brush);
2849+ /* not mask */
2850+ /* Set PaintMode */
2851+ if (apiEntry->opvpSetPaintMode) {
2852+ apiEntry->opvpSetPaintMode(printerContext,OPVP_PAINTMODE_OPAQUE);
2853+ }
2854+ /* zero-color */
2855+ opvp_set_brush_color(pdev, zero, &brush);
28502856
2851- /* call SetBgColor */
2852- if (apiEntry->opvpSetBgColor) {
2853- apiEntry->opvpSetBgColor(printerContext, &brush);
2854- }
2857+ /* call SetBgColor */
2858+ if (apiEntry->opvpSetBgColor) {
2859+ apiEntry->opvpSetBgColor(printerContext, &brush);
2860+ }
28552861 }
28562862
28572863 /* one-color */
@@ -2859,67 +2865,67 @@
28592865
28602866 /* call SetFillColor */
28612867 if (apiEntry->opvpSetFillColor) {
2862- apiEntry->opvpSetFillColor(printerContext, &brush);
2868+ apiEntry->opvpSetFillColor(printerContext, &brush);
28632869 }
28642870
28652871 if (reverse) {
2866- /* 0/1 reverse image */
2867- int n = adj_raster*h;
2872+ /* 0/1 reverse image */
2873+ int n = adj_raster*h;
28682874
2869- if (buff == data) {
2870- /* buff was not allocated from this function yet */
2871- /* allocate here */
2872- if ((mybuf = malloc(n)) == 0) return -1;
2873- }
2874- for (i = 0;i < n;i++) {
2875- mybuf[i] = ~buff[i];
2876- }
2877- buff = mybuf;
2875+ if (buff == data) {
2876+ /* buff was not allocated from this function yet */
2877+ /* allocate here */
2878+ if ((mybuf = malloc(n)) == 0) return -1;
2879+ }
2880+ for (i = 0;i < n;i++) {
2881+ mybuf[i] = ~buff[i];
2882+ }
2883+ buff = mybuf;
28782884 }
28792885 /* call SetCurrentPoint */
28802886 OPVP_I2FIX(x, point.x);
28812887 OPVP_I2FIX(y, point.y);
28822888 if (apiEntry->opvpSetCurrentPoint) {
2883- apiEntry->opvpSetCurrentPoint(printerContext,point.x, point.y);
2889+ apiEntry->opvpSetCurrentPoint(printerContext,point.x, point.y);
28842890 }
28852891
28862892 /* draw image */
28872893 code = opvp_draw_image(pdev,
2888- 1,
2889- w, h,
2890- w, h,
2891- adj_raster,
2892- 1,
2893- &(buff[byte_offset]));
2894+ 1,
2895+ w, h,
2896+ w, h,
2897+ adj_raster,
2898+ 1,
2899+ &(buff[byte_offset]));
28942900 if (code) {
2895- ecode = code;
2901+ ecode = code;
28962902 }
28972903
28982904 if (zero != gx_no_color_index) {
2899- /* restore PaintMode */
2900- if (apiEntry->opvpSetPaintMode) {
2901- apiEntry->opvpSetPaintMode(printerContext,
2902- OPVP_PAINTMODE_TRANSPARENT);
2903- }
2905+ /* restore PaintMode */
2906+ if (apiEntry->opvpSetPaintMode) {
2907+ apiEntry->opvpSetPaintMode(printerContext,
2908+ OPVP_PAINTMODE_TRANSPARENT);
2909+ }
29042910 }
29052911 /* restore fill color */
29062912 if (vectorFillColor) {
2907- /* call SetFillColor */
2908- if (apiEntry->opvpSetFillColor) {
2909- apiEntry->opvpSetFillColor(printerContext,vectorFillColor);
2910- }
2913+ /* call SetFillColor */
2914+ if (apiEntry->opvpSetFillColor) {
2915+ apiEntry->opvpSetFillColor(printerContext,vectorFillColor);
2916+ }
29112917 }
29122918
29132919 #if !(ENABLE_SIMPLE_MODE)
29142920 /* call RestoreGS */
29152921 if (apiEntry->opvpRestoreGS) {
2916- apiEntry->opvpRestoreGS(printerContext);
2922+ apiEntry->opvpRestoreGS(printerContext);
29172923 }
29182924 #endif
29192925
29202926 if (buff != data) {
2921- /* buff was allocated from this function */
2922- if (mybuf) free(mybuf);
2927+ /* buff was allocated from this function */
2928+ if (mybuf) free(mybuf);
29232929 }
29242930
29252931 return ecode;
@@ -2928,7 +2934,7 @@
29282934 /*
29292935 * copy color
29302936 */
2931-static int
2937+static int
29322938 opvp_copy_color(
29332939 gx_device *dev,
29342940 const byte *data,
@@ -2959,28 +2965,28 @@
29592965
29602966 /* data offset */
29612967 if (data_x) {
2962- depth = pdev->color_info.depth;
2963- pixel = (depth + 7) >> 3;
2964- byte_length = pixel * w;
2965- adj_raster = ((byte_length + 3) >> 2) << 2;
2968+ depth = pdev->color_info.depth;
2969+ pixel = (depth + 7) >> 3;
2970+ byte_length = pixel * w;
2971+ adj_raster = ((byte_length + 3) >> 2) << 2;
29662972
2967- buff = mybuf = malloc(adj_raster * h);
2968- if (!mybuf) {
2969- /* memory error */
2970- return -1;
2971- }
2972- s = &(data[data_x*pixel]);
2973- d = mybuf;
2974- for (i = 0;i < h; i++, d += adj_raster, s += raster) {
2975- memcpy(d, s, byte_length);
2976- }
2977- data_x = 0;
2973+ buff = mybuf = malloc(adj_raster * h);
2974+ if (!mybuf) {
2975+ /* memory error */
2976+ return -1;
2977+ }
2978+ s = &(data[data_x*pixel]);
2979+ d = mybuf;
2980+ for (i = 0;i < h; i++, d += adj_raster, s += raster) {
2981+ memcpy(d, s, byte_length);
2982+ }
2983+ data_x = 0;
29782984 }
29792985
29802986 #if !(ENABLE_SIMPLE_MODE)
29812987 /* call SaveGS */
29822988 if (apiEntry->opvpSaveGS) {
2983- apiEntry->opvpSaveGS(printerContext);
2989+ apiEntry->opvpSaveGS(printerContext);
29842990 }
29852991 #endif
29862992
@@ -2988,19 +2994,19 @@
29882994 OPVP_I2FIX(x, point.x);
29892995 OPVP_I2FIX(y, point.y);
29902996 if (apiEntry->opvpSetCurrentPoint) {
2991- apiEntry->opvpSetCurrentPoint(printerContext, point.x, point.y);
2997+ apiEntry->opvpSetCurrentPoint(printerContext, point.x, point.y);
29922998 }
29932999
29943000 /* draw image */
29953001 code = opvp_draw_image(pdev,
2996- pdev->color_info.depth,
2997- w, h,
2998- w, h,
2999- adj_raster,
3000- 0,
3001- &(buff[data_x]));
3002+ pdev->color_info.depth,
3003+ w, h,
3004+ w, h,
3005+ adj_raster,
3006+ 0,
3007+ &(buff[data_x]));
30023008 if (code) {
3003- ecode = code;
3009+ ecode = code;
30043010 }
30053011
30063012
@@ -3007,13 +3013,13 @@
30073013 #if !(ENABLE_SIMPLE_MODE)
30083014 /* call RestoreGS */
30093015 if (apiEntry->opvpRestoreGS) {
3010- apiEntry->opvpRestoreGS(printerContext);
3016+ apiEntry->opvpRestoreGS(printerContext);
30113017 }
30123018 #endif
30133019
30143020 if (buff != data) {
3015- /* buff was allocated from this function */
3016- if (mybuf) free(mybuf);
3021+ /* buff was allocated from this function */
3022+ if (mybuf) free(mybuf);
30173023 }
30183024
30193025 return ecode;
@@ -3022,7 +3028,7 @@
30223028 /*
30233029 * get params
30243030 */
3025-static int
3031+static int
30263032 _get_params(gs_param_list *plist)
30273033 {
30283034 int code;
@@ -3077,24 +3083,24 @@
30773083 /* fast image support */
30783084 switch (FastImageMode) {
30793085 case FastImageNoCTM:
3080- opvp_alloc_string(&fastImage, "NoCTM");
3081- break;
3086+ opvp_alloc_string(&fastImage, "NoCTM");
3087+ break;
30823088 case FastImageNoRotate:
3083- opvp_alloc_string(&fastImage, "NoRotateCTM");
3084- break;
3089+ opvp_alloc_string(&fastImage, "NoRotateCTM");
3090+ break;
30853091 case FastImageRightAngle:
3086- opvp_alloc_string(&fastImage, "RightAngleCTM");
3087- break;
3092+ opvp_alloc_string(&fastImage, "RightAngleCTM");
3093+ break;
30883094 case FastImageReverseAngle:
3089- opvp_alloc_string(&fastImage, "ReverseAngleCTM");
3090- break;
3095+ opvp_alloc_string(&fastImage, "ReverseAngleCTM");
3096+ break;
30913097 case FastImageAll:
3092- opvp_alloc_string(&fastImage, "All");
3093- break;
3098+ opvp_alloc_string(&fastImage, "All");
3099+ break;
30943100 case FastImageDisable:
30953101 default:
3096- opvp_alloc_string(&fastImage, NULL);
3097- break;
3102+ opvp_alloc_string(&fastImage, NULL);
3103+ break;
30983104 }
30993105 pname = "FastImage";
31003106 fips.data = (byte *)fastImage;
@@ -3149,7 +3155,7 @@
31493155 /*
31503156 * get params for vector
31513157 */
3152-static int
3158+static int
31533159 opvp_get_params(gx_device *dev, gs_param_list *plist)
31543160 {
31553161 int code;
@@ -3165,7 +3171,7 @@
31653171 /*
31663172 * get params for inkjet
31673173 */
3168-static int
3174+static int
31693175 oprp_get_params(gx_device *dev, gs_param_list *plist)
31703176 {
31713177 int code;
@@ -3181,7 +3187,7 @@
31813187 /*
31823188 * put params
31833189 */
3184-static int
3190+static int
31853191 _put_params(gs_param_list *plist)
31863192 {
31873193 int code;
@@ -3204,17 +3210,17 @@
32043210 code = param_read_string(plist, pname, &vdps);
32053211 switch (code) {
32063212 case 0:
3207- buff = realloc(buff, vdps.size + 1);
3208- memcpy(buff, vdps.data, vdps.size);
3209- buff[vdps.size] = 0;
3210- opvp_alloc_string(&vectorDriver, buff);
3211- break;
3213+ buff = realloc(buff, vdps.size + 1);
3214+ memcpy(buff, vdps.data, vdps.size);
3215+ buff[vdps.size] = 0;
3216+ opvp_alloc_string(&vectorDriver, buff);
3217+ break;
32123218 case 1:
3213- /* opvp_alloc_string(&vectorDriver, NULL);*/
3214- break;
3219+ /* opvp_alloc_string(&vectorDriver, NULL);*/
3220+ break;
32153221 default:
3216- ecode = code;
3217- param_signal_error(plist, pname, ecode);
3222+ ecode = code;
3223+ param_signal_error(plist, pname, ecode);
32183224 }
32193225
32203226 /* printer model name */
@@ -3222,17 +3228,17 @@
32223228 code = param_read_string(plist, pname, &pmps);
32233229 switch (code) {
32243230 case 0:
3225- buff = realloc(buff, pmps.size + 1);
3226- memcpy(buff, pmps.data, pmps.size);
3227- buff[pmps.size] = 0;
3228- opvp_alloc_string(&printerModel, buff);
3229- break;
3231+ buff = realloc(buff, pmps.size + 1);
3232+ memcpy(buff, pmps.data, pmps.size);
3233+ buff[pmps.size] = 0;
3234+ opvp_alloc_string(&printerModel, buff);
3235+ break;
32303236 case 1:
3231- /*opvp_alloc_string(&printerModel, NULL);*/
3232- break;
3237+ /*opvp_alloc_string(&printerModel, NULL);*/
3238+ break;
32333239 default:
3234- ecode = code;
3235- param_signal_error(plist, pname, ecode);
3240+ ecode = code;
3241+ param_signal_error(plist, pname, ecode);
32363242 }
32373243
32383244 /* job info */
@@ -3240,17 +3246,17 @@
32403246 code = param_read_string(plist, pname, &jips);
32413247 switch (code) {
32423248 case 0:
3243- buff = realloc(buff, jips.size + 1);
3244- memcpy(buff, jips.data, jips.size);
3245- buff[jips.size] = 0;
3246- opvp_alloc_string(&jobInfo, buff);
3247- break;
3249+ buff = realloc(buff, jips.size + 1);
3250+ memcpy(buff, jips.data, jips.size);
3251+ buff[jips.size] = 0;
3252+ opvp_alloc_string(&jobInfo, buff);
3253+ break;
32483254 case 1:
3249- /*opvp_alloc_string(&jobInfo, NULL);*/
3250- break;
3255+ /*opvp_alloc_string(&jobInfo, NULL);*/
3256+ break;
32513257 default:
3252- ecode = code;
3253- param_signal_error(plist, pname, ecode);
3258+ ecode = code;
3259+ param_signal_error(plist, pname, ecode);
32543260 }
32553261
32563262 /* doc info */
@@ -3258,17 +3264,17 @@
32583264 code = param_read_string(plist, pname, &dips);
32593265 switch (code) {
32603266 case 0:
3261- buff = realloc(buff, dips.size + 1);
3262- memcpy(buff, dips.data, dips.size);
3263- buff[dips.size] = 0;
3264- opvp_alloc_string(&docInfo, buff);
3265- break;
3267+ buff = realloc(buff, dips.size + 1);
3268+ memcpy(buff, dips.data, dips.size);
3269+ buff[dips.size] = 0;
3270+ opvp_alloc_string(&docInfo, buff);
3271+ break;
32663272 case 1:
3267- /*opvp_alloc_string(&docInfo, NULL);*/
3268- break;
3273+ /*opvp_alloc_string(&docInfo, NULL);*/
3274+ break;
32693275 default:
3270- ecode = code;
3271- param_signal_error(plist, pname, ecode);
3276+ ecode = code;
3277+ param_signal_error(plist, pname, ecode);
32723278 }
32733279
32743280 /* fast image support */
@@ -3276,30 +3282,30 @@
32763282 code = param_read_string(plist, pname, &fips);
32773283 switch (code) {
32783284 case 0:
3279- buff = realloc(buff, fips.size + 1);
3280- memcpy(buff, fips.data, fips.size);
3281- buff[fips.size] = 0;
3282- opvp_alloc_string(&fastImage, buff);
3283- if (strcasecmp(fastImage,"NoCTM")==0) {
3284- FastImageMode = FastImageNoCTM;
3285- } else if (strncasecmp(fastImage,"NoRotate",8)==0) {
3286- FastImageMode = FastImageNoRotate;
3287- } else if (strncasecmp(fastImage,"Right",5)==0) {
3288- FastImageMode = FastImageRightAngle;
3289- } else if (strncasecmp(fastImage,"Reverse",7)==0) {
3290- FastImageMode = FastImageReverseAngle;
3291- } else if (strncasecmp(fastImage,"All",3)==0) {
3292- FastImageMode = FastImageAll;
3293- } else {
3294- FastImageMode = FastImageDisable;
3295- }
3296- break;
3285+ buff = realloc(buff, fips.size + 1);
3286+ memcpy(buff, fips.data, fips.size);
3287+ buff[fips.size] = 0;
3288+ opvp_alloc_string(&fastImage, buff);
3289+ if (strcasecmp(fastImage,"NoCTM")==0) {
3290+ FastImageMode = FastImageNoCTM;
3291+ } else if (strncasecmp(fastImage,"NoRotate",8)==0) {
3292+ FastImageMode = FastImageNoRotate;
3293+ } else if (strncasecmp(fastImage,"Right",5)==0) {
3294+ FastImageMode = FastImageRightAngle;
3295+ } else if (strncasecmp(fastImage,"Reverse",7)==0) {
3296+ FastImageMode = FastImageReverseAngle;
3297+ } else if (strncasecmp(fastImage,"All",3)==0) {
3298+ FastImageMode = FastImageAll;
3299+ } else {
3300+ FastImageMode = FastImageDisable;
3301+ }
3302+ break;
32973303 case 1:
3298- /*opvp_alloc_string(&fastImage, NULL);*/
3299- break;
3304+ /*opvp_alloc_string(&fastImage, NULL);*/
3305+ break;
33003306 default:
3301- ecode = code;
3302- param_signal_error(plist, pname, ecode);
3307+ ecode = code;
3308+ param_signal_error(plist, pname, ecode);
33033309 }
33043310
33053311 /* margins */
@@ -3307,61 +3313,61 @@
33073313 code = param_read_string(plist, pname, &mlps);
33083314 switch (code) {
33093315 case 0:
3310- buff = realloc(buff, mlps.size + 1);
3311- memcpy(buff, mlps.data, mlps.size);
3312- buff[mlps.size] = 0;
3313- margins[0] = atof(buff);
3314- break;
3316+ buff = realloc(buff, mlps.size + 1);
3317+ memcpy(buff, mlps.data, mlps.size);
3318+ buff[mlps.size] = 0;
3319+ margins[0] = atof(buff);
3320+ break;
33153321 case 1:
3316- break;
3322+ break;
33173323 default:
3318- ecode = code;
3319- param_signal_error(plist, pname, ecode);
3324+ ecode = code;
3325+ param_signal_error(plist, pname, ecode);
33203326 }
33213327 pname = "MarginTop";
33223328 code = param_read_string(plist, pname, &mtps);
33233329 switch (code) {
33243330 case 0:
3325- buff = realloc(buff, mtps.size + 1);
3326- memcpy(buff, mtps.data, mtps.size);
3327- buff[mtps.size] = 0;
3328- margins[3] = atof(buff);
3329- break;
3331+ buff = realloc(buff, mtps.size + 1);
3332+ memcpy(buff, mtps.data, mtps.size);
3333+ buff[mtps.size] = 0;
3334+ margins[3] = atof(buff);
3335+ break;
33303336 case 1:
3331- break;
3337+ break;
33323338 default:
3333- ecode = code;
3334- param_signal_error(plist, pname, ecode);
3339+ ecode = code;
3340+ param_signal_error(plist, pname, ecode);
33353341 }
33363342 pname = "MarginRight";
33373343 code = param_read_string(plist, pname, &mrps);
33383344 switch (code) {
33393345 case 0:
3340- buff = realloc(buff, mrps.size + 1);
3341- memcpy(buff, mrps.data, mrps.size);
3342- buff[mrps.size] = 0;
3343- margins[2] = atof(buff);
3344- break;
3346+ buff = realloc(buff, mrps.size + 1);
3347+ memcpy(buff, mrps.data, mrps.size);
3348+ buff[mrps.size] = 0;
3349+ margins[2] = atof(buff);
3350+ break;
33453351 case 1:
3346- break;
3352+ break;
33473353 default:
3348- ecode = code;
3349- param_signal_error(plist, pname, ecode);
3354+ ecode = code;
3355+ param_signal_error(plist, pname, ecode);
33503356 }
33513357 pname = "MarginBottom";
33523358 code = param_read_string(plist, pname, &mbps);
33533359 switch (code) {
33543360 case 0:
3355- buff = realloc(buff, mbps.size + 1);
3356- memcpy(buff, mbps.data, mbps.size);
3357- buff[mbps.size] = 0;
3358- margins[1] = atof(buff);
3359- break;
3361+ buff = realloc(buff, mbps.size + 1);
3362+ memcpy(buff, mbps.data, mbps.size);
3363+ buff[mbps.size] = 0;
3364+ margins[1] = atof(buff);
3365+ break;
33603366 case 1:
3361- break;
3367+ break;
33623368 default:
3363- ecode = code;
3364- param_signal_error(plist, pname, ecode);
3369+ ecode = code;
3370+ param_signal_error(plist, pname, ecode);
33653371 }
33663372
33673373 /* zoom */
@@ -3369,26 +3375,26 @@
33693375 code = param_read_string(plist, pname, &zmps);
33703376 switch (code) {
33713377 case 0:
3372- buff = realloc(buff, zmps.size + 1);
3373- memcpy(buff, zmps.data, zmps.size);
3374- buff[zmps.size] = 0;
3375- if (strncasecmp(buff, "Auto", 4)) {
3376- zoom[0] = atof(buff);
3377- if (zoom[0] > 0) {
3378- zoom[1] = zoom[0];
3379- } else {
3380- zoom[0] = zoom[1] = 1;
3381- }
3382- } else {
3383- zoom[0] = zoom[1] = 1;
3384- zoomAuto = true;
3385- }
3386- break;
3378+ buff = realloc(buff, zmps.size + 1);
3379+ memcpy(buff, zmps.data, zmps.size);
3380+ buff[zmps.size] = 0;
3381+ if (strncasecmp(buff, "Auto", 4)) {
3382+ zoom[0] = atof(buff);
3383+ if (zoom[0] > 0) {
3384+ zoom[1] = zoom[0];
3385+ } else {
3386+ zoom[0] = zoom[1] = 1;
3387+ }
3388+ } else {
3389+ zoom[0] = zoom[1] = 1;
3390+ zoomAuto = true;
3391+ }
3392+ break;
33873393 case 1:
3388- break;
3394+ break;
33893395 default:
3390- ecode = code;
3391- param_signal_error(plist, pname, ecode);
3396+ ecode = code;
3397+ param_signal_error(plist, pname, ecode);
33923398 }
33933399
33943400 if (buff) free(buff);
@@ -3399,7 +3405,7 @@
33993405 /*
34003406 * put params for vector
34013407 */
3402-static int
3408+static int
34033409 opvp_put_params(gx_device *dev, gs_param_list *plist)
34043410 {
34053411 int code;
@@ -3415,7 +3421,7 @@
34153421 /*
34163422 * put params for inkjet
34173423 */
3418-static int
3424+static int
34193425 oprp_put_params(gx_device *dev, gs_param_list *plist)
34203426 {
34213427 int code;
@@ -3487,7 +3493,7 @@
34873493 /*
34883494 * fill path
34893495 */
3490-static int
3496+static int
34913497 opvp_fill_path(
34923498 gx_device *dev,
34933499 const gs_imager_state *pis,
@@ -3505,19 +3511,19 @@
35053511 }
35063512 /* check clippath support */
35073513 if (!(apiEntry->opvpSetClipPath)) {
3508- /* get clipping box area */
3509- gx_cpath_inner_box(pxpath,&inner);
3510- gx_cpath_outer_box(pxpath,&outer);
3511- /* check difference between inner-box and outer-box */
3512- if ((inner.p.x != outer.p.x) || (inner.p.y != outer.p.y) ||
3513- (inner.q.x != outer.q.x) || (inner.q.y != outer.q.y)) {
3514- /* set draw by image */
3515- draw_image = true;
3516- }
3514+ /* get clipping box area */
3515+ gx_cpath_inner_box(pxpath,&inner);
3516+ gx_cpath_outer_box(pxpath,&outer);
3517+ /* check difference between inner-box and outer-box */
3518+ if ((inner.p.x != outer.p.x) || (inner.p.y != outer.p.y) ||
3519+ (inner.q.x != outer.q.x) || (inner.q.y != outer.q.y)) {
3520+ /* set draw by image */
3521+ draw_image = true;
3522+ }
35173523 }
35183524
35193525 if (!vector || draw_image) {
3520- return gx_default_fill_path(dev, pis, ppath, params, pdevc, pxpath);
3526+ return gx_default_fill_path(dev, pis, ppath, params, pdevc, pxpath);
35213527 }
35223528
35233529 return gdev_vector_fill_path(dev, pis, ppath, params, pdevc, pxpath);
@@ -3526,7 +3532,7 @@
35263532 /*
35273533 * stroke path
35283534 */
3529-static int
3535+static int
35303536 opvp_stroke_path(
35313537 gx_device *dev,
35323538 const gs_imager_state *pis,
@@ -3545,30 +3551,30 @@
35453551 }
35463552 /* check clippath support */
35473553 if (!(apiEntry->opvpSetClipPath)) {
3548- /* get clipping box area */
3549- gx_cpath_inner_box(pxpath,&inner);
3550- gx_cpath_outer_box(pxpath,&outer);
3551- /* check difference between inner-box and outer-box */
3552- if ((inner.p.x != outer.p.x) || (inner.p.y != outer.p.y) ||
3553- (inner.q.x != outer.q.x) || (inner.q.y != outer.q.y)) {
3554- /* set draw by image */
3555- draw_image = true;
3556- }
3554+ /* get clipping box area */
3555+ gx_cpath_inner_box(pxpath,&inner);
3556+ gx_cpath_outer_box(pxpath,&outer);
3557+ /* check difference between inner-box and outer-box */
3558+ if ((inner.p.x != outer.p.x) || (inner.p.y != outer.p.y) ||
3559+ (inner.q.x != outer.q.x) || (inner.q.y != outer.q.y)) {
3560+ /* set draw by image */
3561+ draw_image = true;
3562+ }
35573563 }
35583564
35593565 if (!vector || draw_image) {
3560- return gx_default_stroke_path(dev, pis, ppath,
3561- params, pdcolor, pxpath);
3566+ return gx_default_stroke_path(dev, pis, ppath,
3567+ params, pdcolor, pxpath);
35623568 }
35633569
35643570 return gdev_vector_stroke_path(dev, pis, ppath,
3565- params, pdcolor, pxpath);
3571+ params, pdcolor, pxpath);
35663572 }
35673573
35683574 /*
35693575 * fill mask
35703576 */
3571-static int
3577+static int
35723578 opvp_fill_mask(
35733579 gx_device *dev,
35743580 const byte *data,
@@ -3585,23 +3591,23 @@
35853591 const gx_clip_path *pcpath)
35863592 {
35873593 if (vector) {
3588-#if GS_VERSION_MAJOR >= 8 /* for gs 8.15 */
3589- gdev_vector_update_fill_color((gx_device_vector *)dev, NULL, pdcolor);
3594+#if GS_VERSION_MAJOR >= 8 /* for gs 8.15 */
3595+ gdev_vector_update_fill_color((gx_device_vector *)dev, NULL, pdcolor);
35903596 #else
3591- gdev_vector_update_fill_color((gx_device_vector *)dev, pdcolor);
3597+ gdev_vector_update_fill_color((gx_device_vector *)dev, pdcolor);
35923598 #endif
3593- gdev_vector_update_clip_path((gx_device_vector *)dev, pcpath);
3594- gdev_vector_update_log_op((gx_device_vector *)dev, lop);
3599+ gdev_vector_update_clip_path((gx_device_vector *)dev, pcpath);
3600+ gdev_vector_update_log_op((gx_device_vector *)dev, lop);
35953601 }
35963602
35973603 return gx_default_fill_mask(dev, data, data_x, raster, id,
3598- x, y, w, h, pdcolor, depth, lop, pcpath);
3604+ x, y, w, h, pdcolor, depth, lop, pcpath);
35993605 }
36003606
36013607 /*
36023608 * begin image
36033609 */
3604-static int
3610+static int
36053611 opvp_begin_image(
36063612 gx_device *dev,
36073613 const gs_imager_state *pis,
@@ -3610,7 +3616,7 @@
36103616 const gs_int_rect *prect,
36113617 const gx_drawing_color *pdcolor,
36123618 const gx_clip_path *pcpath,
3613- gs_memory_t *mem,
3619+ gs_memory_t *mem,
36143620 gx_image_enum_common_t **pinfo)
36153621 {
36163622 gx_device_vector *vdev =(gx_device_vector *)dev;
@@ -3639,344 +3645,348 @@
36393645 color_index = 0;
36403646
36413647 vinfo = gs_alloc_struct(mem, gdev_vector_image_enum_t,
3642- &st_vector_image_enum,
3643- "opvp_begin_image");
3648+ &st_vector_image_enum,
3649+ "opvp_begin_image");
36443650
36453651 if (vinfo) {
3646- memcpy(imageDecode,pim->Decode,sizeof(pim->Decode));
3647- vinfo->memory =mem;
3648- code = gdev_vector_begin_image(vdev, pis, pim, format, prect,
3649- pdcolor, pcpath, mem,
3650- &opvp_image_enum_procs,
3651- vinfo);
3652- if (code) ecode = code;
3652+ memcpy(imageDecode,pim->Decode,sizeof(pim->Decode));
3653+ vinfo->memory =mem;
3654+ code = gdev_vector_begin_image(vdev, pis, pim, format, prect,
3655+ pdcolor, pcpath, mem,
3656+ &opvp_image_enum_procs,
3657+ vinfo);
3658+ if (code) ecode = code;
36533659
3654- if (!ecode) {
3655- /* bits per pixel */
3656- for (bits_per_pixel=0, p=0; p < vinfo->num_planes; p++) {
3657- bits_per_pixel += vinfo->plane_depths[p];
3658- }
3660+ if (!ecode) {
3661+ /* bits per pixel */
3662+ for (bits_per_pixel=0, p=0; p < vinfo->num_planes; p++) {
3663+ bits_per_pixel += vinfo->plane_depths[p];
3664+ }
36593665
3660- /* for indexed color */
3661- if (!(pim->ImageMask)) {
3662- color_index = gs_color_space_get_index(pcs);
3663- if (color_index == gs_color_space_index_Indexed) {
3664- base_color_index
3665- = gs_color_space_indexed_base_space(pcs)->type->index;
3666- if (((pcs->params.indexed.hival + 1) > 256)
3667- || (bits_per_pixel != 8 && bits_per_pixel != 1)) {
3668- return gx_default_begin_image(
3669- dev, pis, pim, format,
3670- prect, pdcolor, pcpath,
3671- mem, pinfo);
3672- } else if (base_color_index
3673- == gs_color_space_index_DeviceCMYK) {
3674- /* for CMYK indexed color */
3675- int count;
3676- const unsigned char *p
3677- = pcs->params.indexed.lookup.table.data;
3678- frac rgb[3];
3666+ /* for indexed color */
3667+ if (!(pim->ImageMask)) {
3668+ color_index = gs_color_space_get_index(pcs);
3669+ if (color_index == gs_color_space_index_Indexed) {
3670+ base_color_index
3671+ = gs_color_space_indexed_base_space(pcs)->type->index;
3672+ if (((pcs->params.indexed.hival + 1) > 256)
3673+ || (bits_per_pixel != 8 && bits_per_pixel != 1)) {
3674+ return gx_default_begin_image(
3675+ dev, pis, pim, format,
3676+ prect, pdcolor, pcpath,
3677+ mem, pinfo);
3678+ } else if (base_color_index
3679+ == gs_color_space_index_DeviceCMYK) {
3680+ /* for CMYK indexed color */
3681+ int count;
3682+ const unsigned char *p
3683+ = pcs->params.indexed.lookup.table.data;
3684+ frac rgb[3];
36793685
3680- for(count = 0;count <
3681- (pcs->params.indexed.hival + 1); count++) {
3682- memset(rgb, 0, sizeof(rgb));
3683- color_cmyk_to_rgb(
3684- byte2frac((*(p + 0 + (count * 4)))),
3685- byte2frac((*(p + 1 + (count * 4)))),
3686- byte2frac((*(p + 2 + (count * 4)))),
3687- byte2frac((*(p + 3 + (count * 4)))),
3688- pis, rgb);
3689- *(palette + 0 + (count * 3)) = frac2byte(rgb[0]);
3690- *(palette + 1 + (count * 3)) = frac2byte(rgb[1]);
3691- *(palette + 2 + (count * 3)) = frac2byte(rgb[2]);
3692- }
3686+ for(count = 0;count <
3687+ (pcs->params.indexed.hival + 1); count++) {
3688+ memset(rgb, 0, sizeof(rgb));
3689+ color_cmyk_to_rgb(
3690+ byte2frac((*(p + 0 + (count * 4)))),
3691+ byte2frac((*(p + 1 + (count * 4)))),
3692+ byte2frac((*(p + 2 + (count * 4)))),
3693+ byte2frac((*(p + 3 + (count * 4)))),
3694+#if GS_VERSION_MAJOR >= 9
3695+ pis, rgb, mem);
3696+#else
3697+ pis, rgb);
3698+#endif
3699+ *(palette + 0 + (count * 3)) = frac2byte(rgb[0]);
3700+ *(palette + 1 + (count * 3)) = frac2byte(rgb[1]);
3701+ *(palette + 2 + (count * 3)) = frac2byte(rgb[2]);
3702+ }
36933703
3694- bits_per_pixel = 24;
3695- } else if (base_color_index
3696- == gs_color_space_index_DeviceRGB ||
3697- base_color_index == gs_color_space_index_CIEABC) {
3698- /* for RGB or CalRGB indexed color */
3699- memcpy(palette, pcs->params.indexed.lookup.table.data,\
3700- pcs->params.indexed.lookup.table.size);
3701- bits_per_pixel = 24;
3702- } else if (base_color_index
3703- == gs_color_space_index_DeviceGray ||
3704- base_color_index == gs_color_space_index_CIEA) {
3705- /* for Gray or CalGray indexed color */
3706- memcpy(palette, pcs->params.indexed.lookup.table.data,\
3707- pcs->params.indexed.lookup.table.size);
3708- bits_per_pixel = 8;
3709- } else {
3710- /* except CMYK and RGB */
3711- return gx_default_begin_image(
3712- dev, pis, pim, format,
3713- prect, pdcolor, pcpath,
3714- mem, pinfo);
3715- }
3716- }
3717- }
3704+ bits_per_pixel = 24;
3705+ } else if (base_color_index
3706+ == gs_color_space_index_DeviceRGB ||
3707+ base_color_index == gs_color_space_index_CIEABC) {
3708+ /* for RGB or CalRGB indexed color */
3709+ memcpy(palette, pcs->params.indexed.lookup.table.data,\
3710+ pcs->params.indexed.lookup.table.size);
3711+ bits_per_pixel = 24;
3712+ } else if (base_color_index
3713+ == gs_color_space_index_DeviceGray ||
3714+ base_color_index == gs_color_space_index_CIEA) {
3715+ /* for Gray or CalGray indexed color */
3716+ memcpy(palette, pcs->params.indexed.lookup.table.data,\
3717+ pcs->params.indexed.lookup.table.size);
3718+ bits_per_pixel = 8;
3719+ } else {
3720+ /* except CMYK and RGB */
3721+ return gx_default_begin_image(
3722+ dev, pis, pim, format,
3723+ prect, pdcolor, pcpath,
3724+ mem, pinfo);
3725+ }
3726+ }
3727+ }
37183728
37193729 #if ENABLE_AUTO_REVERSE
3720- if (bits_per_pixel % 8 == 0) {
3721- can_reverse = true;
3722- }
3730+ if (bits_per_pixel % 8 == 0) {
3731+ can_reverse = true;
3732+ }
37233733 #endif
3724- /* adjust matrix */
3725- reverse_image = false;
3726- gs_matrix_invert(&pim->ImageMatrix, &mtx);
3727- gs_matrix_multiply(&mtx, &ctm_only(pis), &mtx);
3728- switch (FastImageMode) {
3729- case FastImageNoCTM:
3730- if ((mtx.xy==0)&&(mtx.yx==0)&& (mtx.yy>=0)) {
3731- if (mtx.xx>=0) {
3732- mag[0] = mtx.xx;
3733- mag[1] = mtx.yy;
3734- mtx.xx = 1;
3735- mtx.yy = 1;
3736- supported_angle = true;
3737- } else if (can_reverse) {
3738- mtx.xx *= -1;
3739- mag[0] = mtx.xx;
3740- mag[1] = mtx.yy;
3741- mtx.xx = 1;
3742- mtx.yy = 1;
3743- mtx.tx -= vinfo->width
3744- * mag[0];
3745- supported_angle = true;
3746- reverse_image = true;
3747- }
3748- }
3749- break;
3750- case FastImageNoRotate:
3751- if ((mtx.xy==0)&&(mtx.yx==0)&& (mtx.yy>=0)) {
3752- if (mtx.xx>=0) {
3753- supported_angle = true;
3754- } else if (can_reverse) {
3755- mtx.xx *= -1;
3756- mtx.tx -= vinfo->width
3757- * mtx.xx;
3758- supported_angle = true;
3759- reverse_image = true;
3760- }
3761- }
3762- break;
3763- case FastImageRightAngle:
3764- if ((mtx.xy==0)&&(mtx.yx==0)) {
3765- if (((mtx.xx>=0)&&(mtx.yy>=0))||
3766- ((mtx.xx<=0)&&(mtx.yy<=0))){
3767- supported_angle = true;
3768- } else if (can_reverse) {
3769- mtx.xx *= -1;
3770- mtx.tx -= vinfo->width
3771- * mtx.xx;
3772- supported_angle = true;
3773- reverse_image = true;
3774- }
3775- } else if ((mtx.xx==0)&&(mtx.yy==0)) {
3776- if (((mtx.xy>=0)&&(mtx.yx<=0))||
3777- ((mtx.xy<=0)&&(mtx.yx>=0))){
3778- supported_angle = true;
3779- } else if (can_reverse) {
3780- mtx.xy *= -1;
3781- mtx.ty -= vinfo->height
3782- * mtx.xy;
3783- supported_angle = true;
3784- reverse_image = true;
3785- }
3786- }
3787- break;
3788- case FastImageReverseAngle:
3789- if (((mtx.xy==0)&&(mtx.yx==0))||
3790- ((mtx.xx==0)&&(mtx.yy==0))) {
3791- supported_angle = true;
3792- }
3793- break;
3794- case FastImageAll:
3795- supported_angle = true;
3796- break;
3797- case FastImageDisable:
3798- default:
3799- break;
3800- }
3801- }
3734+ /* adjust matrix */
3735+ reverse_image = false;
3736+ gs_matrix_invert(&pim->ImageMatrix, &mtx);
3737+ gs_matrix_multiply(&mtx, &ctm_only(pis), &mtx);
3738+ switch (FastImageMode) {
3739+ case FastImageNoCTM:
3740+ if ((mtx.xy==0)&&(mtx.yx==0)&& (mtx.yy>=0)) {
3741+ if (mtx.xx>=0) {
3742+ mag[0] = mtx.xx;
3743+ mag[1] = mtx.yy;
3744+ mtx.xx = 1;
3745+ mtx.yy = 1;
3746+ supported_angle = true;
3747+ } else if (can_reverse) {
3748+ mtx.xx *= -1;
3749+ mag[0] = mtx.xx;
3750+ mag[1] = mtx.yy;
3751+ mtx.xx = 1;
3752+ mtx.yy = 1;
3753+ mtx.tx -= vinfo->width
3754+ * mag[0];
3755+ supported_angle = true;
3756+ reverse_image = true;
3757+ }
3758+ }
3759+ break;
3760+ case FastImageNoRotate:
3761+ if ((mtx.xy==0)&&(mtx.yx==0)&& (mtx.yy>=0)) {
3762+ if (mtx.xx>=0) {
3763+ supported_angle = true;
3764+ } else if (can_reverse) {
3765+ mtx.xx *= -1;
3766+ mtx.tx -= vinfo->width
3767+ * mtx.xx;
3768+ supported_angle = true;
3769+ reverse_image = true;
3770+ }
3771+ }
3772+ break;
3773+ case FastImageRightAngle:
3774+ if ((mtx.xy==0)&&(mtx.yx==0)) {
3775+ if (((mtx.xx>=0)&&(mtx.yy>=0))||
3776+ ((mtx.xx<=0)&&(mtx.yy<=0))){
3777+ supported_angle = true;
3778+ } else if (can_reverse) {
3779+ mtx.xx *= -1;
3780+ mtx.tx -= vinfo->width
3781+ * mtx.xx;
3782+ supported_angle = true;
3783+ reverse_image = true;
3784+ }
3785+ } else if ((mtx.xx==0)&&(mtx.yy==0)) {
3786+ if (((mtx.xy>=0)&&(mtx.yx<=0))||
3787+ ((mtx.xy<=0)&&(mtx.yx>=0))){
3788+ supported_angle = true;
3789+ } else if (can_reverse) {
3790+ mtx.xy *= -1;
3791+ mtx.ty -= vinfo->height
3792+ * mtx.xy;
3793+ supported_angle = true;
3794+ reverse_image = true;
3795+ }
3796+ }
3797+ break;
3798+ case FastImageReverseAngle:
3799+ if (((mtx.xy==0)&&(mtx.yx==0))||
3800+ ((mtx.xx==0)&&(mtx.yy==0))) {
3801+ supported_angle = true;
3802+ }
3803+ break;
3804+ case FastImageAll:
3805+ supported_angle = true;
3806+ break;
3807+ case FastImageDisable:
3808+ default:
3809+ break;
3810+ }
3811+ }
38023812
3803- if ((!ecode) && supported_angle) {
3804- if ((!prect) &&
3805- ((vinfo->num_planes == 1) ||
3806- ((vinfo->num_planes == 3) &&
3807- (vinfo->plane_depths[0] == 8) &&
3808- (vinfo->plane_depths[1] == 8) &&
3809- (vinfo->plane_depths[2] == 8))
3810- )
3811- ) {
3812- /*
3813- * avail only
3814- * 1 plane image
3815- * or
3816- * 3 planes 24 bits color image
3817- * (8 bits per plane)
3818- */
3819- if (apiEntry->opvpStartDrawImage) {
3820- draw_image = true;
3821- }
3822- }
3823- }
3813+ if ((!ecode) && supported_angle) {
3814+ if ((!prect) &&
3815+ ((vinfo->num_planes == 1) ||
3816+ ((vinfo->num_planes == 3) &&
3817+ (vinfo->plane_depths[0] == 8) &&
3818+ (vinfo->plane_depths[1] == 8) &&
3819+ (vinfo->plane_depths[2] == 8))
3820+ )
3821+ ) {
3822+ /*
3823+ * avail only
3824+ * 1 plane image
3825+ * or
3826+ * 3 planes 24 bits color image
3827+ * (8 bits per plane)
3828+ */
3829+ if (apiEntry->opvpStartDrawImage) {
3830+ draw_image = true;
3831+ }
3832+ }
3833+ }
38243834 }
38253835
38263836 if (draw_image) {
3827- *pinfo = (gx_image_enum_common_t *)vinfo;
3837+ *pinfo = (gx_image_enum_common_t *)vinfo;
38283838
3829- if (!ecode) {
3830- if (!pim->ImageMask) {
3831- /* call SetPaintMode */
3832- if (apiEntry->opvpSetPaintMode) {
3833- apiEntry->opvpSetPaintMode(printerContext,
3834- OPVP_PAINTMODE_OPAQUE);
3835- change_paint_mode = true;
3836- }
3837- /* set color space */
3838- if (apiEntry->opvpSetColorSpace != NULL) {
3839- opvp_cspace_t ncspace;
3839+ if (!ecode) {
3840+ if (!pim->ImageMask) {
3841+ /* call SetPaintMode */
3842+ if (apiEntry->opvpSetPaintMode) {
3843+ apiEntry->opvpSetPaintMode(printerContext,
3844+ OPVP_PAINTMODE_OPAQUE);
3845+ change_paint_mode = true;
3846+ }
3847+ /* set color space */
3848+ if (apiEntry->opvpSetColorSpace != NULL) {
3849+ opvp_cspace_t ncspace;
38403850
3841- savedColorSpace = colorSpace;
3842- switch (bits_per_pixel) {
3843- case 1:
3844- ncspace = OPVP_CSPACE_DEVICEGRAY;
3845- bits_per_pixel = 8;
3846- if (!cspace_available[ncspace]) {
3847- ncspace = OPVP_CSPACE_STANDARDRGB;
3848- bits_per_pixel = 24;
3849- }
3850- break;
3851- case 8:
3852- ncspace = OPVP_CSPACE_DEVICEGRAY;
3853- if (!cspace_available[ncspace]) {
3854- ncspace = OPVP_CSPACE_STANDARDRGB;
3855- bits_per_pixel = 24;
3856- }
3857- break;
3858- case 24:
3859- ncspace = OPVP_CSPACE_DEVICERGB;
3860- if (!cspace_available[ncspace]) {
3861- ncspace = OPVP_CSPACE_STANDARDRGB;
3862- }
3863- break;
3864- default:
3865- r = -1;
3866- goto fallthrough;
3867- break;
3868- }
3869- if (ncspace != colorSpace) {
3870- if (apiEntry->opvpSetColorSpace(printerContext,ncspace)
3871- != OPVP_OK) {
3872- r = -1;
3873- goto fallthrough;
3874- }
3875- colorSpace = ncspace;
3876- change_cspace = true;
3877- }
3878- }
3879- }
3880- }
3881- if (!ecode) {
3882- if (supported_angle) {
3883- /* moveto */
3884- opvp_moveto(vdev, 0, 0, mtx.tx, mtx.ty, 0);
3885- }
3886- if ((supported_angle) && (FastImageMode != FastImageNoCTM)) {
3887- /* call SetCTM */
3888- ctm.a = mtx.xx;
3889- ctm.b = mtx.xy;
3890- ctm.c = mtx.yx;
3891- ctm.d = mtx.yy;
3892- ctm.e = mtx.tx;
3893- ctm.f = mtx.ty;
3894- if (apiEntry->opvpSetCTM) {
3895- r = apiEntry->opvpSetCTM(printerContext, &ctm);
3896- }
3897- else r = -1;
3898- if (r != OPVP_OK) ecode = r;
3899- }
3900- }
3901- if (!ecode) {
3902- int dw,dh;
3851+ savedColorSpace = colorSpace;
3852+ switch (bits_per_pixel) {
3853+ case 1:
3854+ ncspace = OPVP_CSPACE_DEVICEGRAY;
3855+ bits_per_pixel = 8;
3856+ if (!cspace_available[ncspace]) {
3857+ ncspace = OPVP_CSPACE_STANDARDRGB;
3858+ bits_per_pixel = 24;
3859+ }
3860+ break;
3861+ case 8:
3862+ ncspace = OPVP_CSPACE_DEVICEGRAY;
3863+ if (!cspace_available[ncspace]) {
3864+ ncspace = OPVP_CSPACE_STANDARDRGB;
3865+ bits_per_pixel = 24;
3866+ }
3867+ break;
3868+ case 24:
3869+ ncspace = OPVP_CSPACE_DEVICERGB;
3870+ if (!cspace_available[ncspace]) {
3871+ ncspace = OPVP_CSPACE_STANDARDRGB;
3872+ }
3873+ break;
3874+ default:
3875+ r = -1;
3876+ goto fallthrough;
3877+ break;
3878+ }
3879+ if (ncspace != colorSpace) {
3880+ if (apiEntry->opvpSetColorSpace(printerContext,ncspace)
3881+ != OPVP_OK) {
3882+ r = -1;
3883+ goto fallthrough;
3884+ }
3885+ colorSpace = ncspace;
3886+ change_cspace = true;
3887+ }
3888+ }
3889+ }
3890+ }
3891+ if (!ecode) {
3892+ if (supported_angle) {
3893+ /* moveto */
3894+ opvp_moveto(vdev, 0, 0, mtx.tx, mtx.ty, 0);
3895+ }
3896+ if ((supported_angle) && (FastImageMode != FastImageNoCTM)) {
3897+ /* call SetCTM */
3898+ ctm.a = mtx.xx;
3899+ ctm.b = mtx.xy;
3900+ ctm.c = mtx.yx;
3901+ ctm.d = mtx.yy;
3902+ ctm.e = mtx.tx;
3903+ ctm.f = mtx.ty;
3904+ if (apiEntry->opvpSetCTM) {
3905+ r = apiEntry->opvpSetCTM(printerContext, &ctm);
3906+ }
3907+ else r = -1;
3908+ if (r != OPVP_OK) ecode = r;
3909+ }
3910+ }
3911+ if (!ecode) {
3912+ int dw,dh;
39033913
3904- /* image size */
3905- if (mag[0] != 1) {
3906- dw = floor(vinfo->width * mag[0]+0.5);
3907- } else {
3908- dw = vinfo->width;
3909- }
3910- if (mag[1] != 1) {
3911- dh = floor(vinfo->height * mag[1]+0.5);
3912- } else {
3913- dh = vinfo->height;
3914- }
3915- /* call StartDrawImage */
3916- if (apiEntry->opvpStartDrawImage) {
3917- opvp_int_t adj_raster;
3914+ /* image size */
3915+ if (mag[0] != 1) {
3916+ dw = floor(vinfo->width * mag[0]+0.5);
3917+ } else {
3918+ dw = vinfo->width;
3919+ }
3920+ if (mag[1] != 1) {
3921+ dh = floor(vinfo->height * mag[1]+0.5);
3922+ } else {
3923+ dh = vinfo->height;
3924+ }
3925+ /* call StartDrawImage */
3926+ if (apiEntry->opvpStartDrawImage) {
3927+ opvp_int_t adj_raster;
39183928
3919- adj_raster = bits_per_pixel*vinfo->width;
3920- adj_raster = ((adj_raster+31) >> 5) << 2;
3921- r = apiEntry->opvpStartDrawImage(
3922- printerContext,
3923- vinfo->width,
3924- vinfo->height,
3925- adj_raster,
3926- pim->ImageMask ?
3927- OPVP_IFORMAT_MASK:
3928- OPVP_IFORMAT_RAW,
3929- dw,dh);
3930- if(r != OPVP_OK) {
3931- if (apiEntry->opvpEndDrawImage) {
3932- apiEntry->opvpEndDrawImage(printerContext);
3933- }
3934- }
3935- }
3929+ adj_raster = bits_per_pixel*vinfo->width;
3930+ adj_raster = ((adj_raster+31) >> 5) << 2;
3931+ r = apiEntry->opvpStartDrawImage(
3932+ printerContext,
3933+ vinfo->width,
3934+ vinfo->height,
3935+ adj_raster,
3936+ pim->ImageMask ?
3937+ OPVP_IFORMAT_MASK:
3938+ OPVP_IFORMAT_RAW,
3939+ dw,dh);
3940+ if(r != OPVP_OK) {
3941+ if (apiEntry->opvpEndDrawImage) {
3942+ apiEntry->opvpEndDrawImage(printerContext);
3943+ }
3944+ }
3945+ }
39363946
3937- /* bugfix for 32bit CMYK image print error */
3947+ /* bugfix for 32bit CMYK image print error */
39383948 fallthrough:
3939- if(r != OPVP_OK) {
3940- if (change_paint_mode) {
3941- /* restore paint mode */
3942- if (apiEntry->opvpSetPaintMode) {
3943- apiEntry->opvpSetPaintMode(printerContext,
3944- OPVP_PAINTMODE_TRANSPARENT);
3945- }
3946- change_paint_mode = false;
3947- }
3948- if (change_cspace) {
3949- /* restore color space */
3950- colorSpace = savedColorSpace;
3951- if (apiEntry->opvpSetColorSpace) {
3952- apiEntry->opvpSetColorSpace(printerContext,
3953- colorSpace);
3954- }
3955- change_cspace = false;
3956- }
3957- if(apiEntry->opvpResetCTM) {
3958- apiEntry->opvpResetCTM(printerContext); /* reset CTM */
3959- }
3960- return gx_default_begin_image(dev, pis, pim, format,
3961- prect, pdcolor, pcpath, mem, pinfo);
3962- }
3963- }
3949+ if(r != OPVP_OK) {
3950+ if (change_paint_mode) {
3951+ /* restore paint mode */
3952+ if (apiEntry->opvpSetPaintMode) {
3953+ apiEntry->opvpSetPaintMode(printerContext,
3954+ OPVP_PAINTMODE_TRANSPARENT);
3955+ }
3956+ change_paint_mode = false;
3957+ }
3958+ if (change_cspace) {
3959+ /* restore color space */
3960+ colorSpace = savedColorSpace;
3961+ if (apiEntry->opvpSetColorSpace) {
3962+ apiEntry->opvpSetColorSpace(printerContext,
3963+ colorSpace);
3964+ }
3965+ change_cspace = false;
3966+ }
3967+ if(apiEntry->opvpResetCTM) {
3968+ apiEntry->opvpResetCTM(printerContext); /* reset CTM */
3969+ }
3970+ return gx_default_begin_image(dev, pis, pim, format,
3971+ prect, pdcolor, pcpath, mem, pinfo);
3972+ }
3973+ }
39643974
3965- if (!ecode) {
3966- begin_image = true;
3967- }
3975+ if (!ecode) {
3976+ begin_image = true;
3977+ }
39683978
3969- return ecode;
3979+ return ecode;
39703980 }
39713981
39723982 return gx_default_begin_image(dev, pis, pim, format, prect,
3973- pdcolor, pcpath, mem, pinfo);
3983+ pdcolor, pcpath, mem, pinfo);
39743984 }
39753985
39763986 /*
39773987 * plane data
39783988 */
3979-static int
3989+static int
39803990 opvp_image_plane_data(
39813991 gx_image_enum_common_t *info,
39823992 const gx_image_plane_t *planes,
@@ -4006,7 +4016,7 @@
40064016 if (!begin_image) return 0;
40074017
40084018 for (bits_per_pixel=0, p=0; p < vinfo->num_planes; p++) {
4009- bits_per_pixel += vinfo->plane_depths[p];
4019+ bits_per_pixel += vinfo->plane_depths[p];
40104020 }
40114021
40124022 data_bytes = (bits_per_pixel * vinfo->width + 7) >> 3;
@@ -4014,380 +4024,380 @@
40144024 buf = calloc(raster_length, height);
40154025
40164026 if (vinfo->default_info) {
4017- gx_image_plane_data(vinfo->default_info, planes, height);
4027+ gx_image_plane_data(vinfo->default_info, planes, height);
40184028 }
40194029 if (vinfo->bbox_info) {
4020- gx_image_plane_data(vinfo->bbox_info, planes, height);
4030+ gx_image_plane_data(vinfo->bbox_info, planes, height);
40214031 }
40224032
40234033 if (buf) {
4024- /* Adjust image data gamma */
4025- pbe = (bbox_image_enum *)vinfo->bbox_info;
4026- tinfo = (gx_image_enum *)pbe->target_info;
4027- pis = tinfo->pis;
4034+ /* Adjust image data gamma */
4035+ pbe = (bbox_image_enum *)vinfo->bbox_info;
4036+ tinfo = (gx_image_enum *)pbe->target_info;
4037+ pis = tinfo->pis;
40284038
4029- if (vinfo->num_planes == 1) {
4030- for (h = 0; h < height; h++) {
4031- d = raster_length * h;
4032- if (reverse_image) {
4033- int bytes_per_pixel = bits_per_pixel / 8;
4034- for (x = data_bytes * (h + 1) - bytes_per_pixel;
4035- x >= data_bytes * h;
4036- x-=bytes_per_pixel,
4037- d+=bytes_per_pixel) {
4038- memcpy(buf+d, planes[0].data+x, bytes_per_pixel);
4039- }
4040- } else {
4041- memcpy(buf + d,
4042- planes[0].data
4043- + (data_bytes * h),
4044- data_bytes);
4045- }
4046- }
4047- } else {
4048- for (h = 0; h < height; h++) {
4049- d = raster_length * h;
4050- if (reverse_image) {
4051- for (x = vinfo->width * (h + 1) - 1;
4052- x >= vinfo->width * h;
4053- x--) {
4054- for (p = 0;
4055- p < vinfo->num_planes;
4056- p++, d++) {
4057- buf[d] = (byte)(planes[p].data[x]);
4058- }
4059- }
4060- } else {
4061- for (x = vinfo->width * h;
4062- x < vinfo->width * (h + 1);
4063- x++) {
4064- for (p = 0;
4065- p < vinfo->num_planes;
4066- p++, d++) {
4067- buf[d] = (byte)
4068- (planes[p].data[x]);
4069- }
4070- }
4071- }
4072- }
4073- }
4039+ if (vinfo->num_planes == 1) {
4040+ for (h = 0; h < height; h++) {
4041+ d = raster_length * h;
4042+ if (reverse_image) {
4043+ int bytes_per_pixel = bits_per_pixel / 8;
4044+ for (x = data_bytes * (h + 1) - bytes_per_pixel;
4045+ x >= data_bytes * h;
4046+ x-=bytes_per_pixel,
4047+ d+=bytes_per_pixel) {
4048+ memcpy(buf+d, planes[0].data+x, bytes_per_pixel);
4049+ }
4050+ } else {
4051+ memcpy(buf + d,
4052+ planes[0].data
4053+ + (data_bytes * h),
4054+ data_bytes);
4055+ }
4056+ }
4057+ } else {
4058+ for (h = 0; h < height; h++) {
4059+ d = raster_length * h;
4060+ if (reverse_image) {
4061+ for (x = vinfo->width * (h + 1) - 1;
4062+ x >= vinfo->width * h;
4063+ x--) {
4064+ for (p = 0;
4065+ p < vinfo->num_planes;
4066+ p++, d++) {
4067+ buf[d] = (byte)(planes[p].data[x]);
4068+ }
4069+ }
4070+ } else {
4071+ for (x = vinfo->width * h;
4072+ x < vinfo->width * (h + 1);
4073+ x++) {
4074+ for (p = 0;
4075+ p < vinfo->num_planes;
4076+ p++, d++) {
4077+ buf[d] = (byte)
4078+ (planes[p].data[x]);
4079+ }
4080+ }
4081+ }
4082+ }
4083+ }
40744084
4075- if (tinfo->masked) {
4076- bool reverse = false;
4085+ if (tinfo->masked) {
4086+ bool reverse = false;
40774087
4078- /* image mask */
4079- if (imageDecode[0] == 0) {
4080- reverse = true;
4081- }
4082- if (reverse) {
4083- for (i = 0; i < height; i++) {
4084- src_ptr = buf + raster_length * i;
4085- for (j = 0; j < data_bytes; j++) {
4086- src_ptr[j] ^= 0xff;
4087- }
4088- }
4089- }
4090- } else {
4091- if(color_index == gs_color_space_index_Indexed) {
4092- if (base_color_index == gs_color_space_index_DeviceGray ||
4093- base_color_index == gs_color_space_index_CIEA) {
4094- if (colorSpace == OPVP_CSPACE_DEVICEGRAY) {
4095- /* Convert indexed gray color -> Gray */
4096- if (bits_per_pixel == 8) { /* 8bit image */
4097- dst_bytes = data_bytes;
4098- dst_length = ((dst_bytes + 3) >> 2) << 2;
4088+ /* image mask */
4089+ if (imageDecode[0] == 0) {
4090+ reverse = true;
4091+ }
4092+ if (reverse) {
4093+ for (i = 0; i < height; i++) {
4094+ src_ptr = buf + raster_length * i;
4095+ for (j = 0; j < data_bytes; j++) {
4096+ src_ptr[j] ^= 0xff;
4097+ }
4098+ }
4099+ }
4100+ } else {
4101+ if(color_index == gs_color_space_index_Indexed) {
4102+ if (base_color_index == gs_color_space_index_DeviceGray ||
4103+ base_color_index == gs_color_space_index_CIEA) {
4104+ if (colorSpace == OPVP_CSPACE_DEVICEGRAY) {
4105+ /* Convert indexed gray color -> Gray */
4106+ if (bits_per_pixel == 8) { /* 8bit image */
4107+ dst_bytes = data_bytes;
4108+ dst_length = ((dst_bytes + 3) >> 2) << 2;
40994109
4100- tmp_buf = calloc(dst_length, height);
4101- if (tmp_buf) {
4102- for (i = 0; i < height; i++) {
4103- src_ptr = buf + raster_length * i;
4104- dst_ptr = tmp_buf + dst_length * i;
4105- for (j = 0; j < data_bytes; j++) {
4106- ppalette = palette + src_ptr[j] ;
4107- dst_ptr[j] = ppalette[0];
4108- }
4109- }
4110+ tmp_buf = calloc(dst_length, height);
4111+ if (tmp_buf) {
4112+ for (i = 0; i < height; i++) {
4113+ src_ptr = buf + raster_length * i;
4114+ dst_ptr = tmp_buf + dst_length * i;
4115+ for (j = 0; j < data_bytes; j++) {
4116+ ppalette = palette + src_ptr[j] ;
4117+ dst_ptr[j] = ppalette[0];
4118+ }
4119+ }
41104120
4111- free (buf);
4112- buf = tmp_buf;
4113- data_bytes = dst_bytes;
4114- raster_length = dst_length;
4115- vinfo->bits_per_pixel = 8;
4116- }
4117- } else { /* 1bit image */
4118- dst_bytes = vinfo->width;
4119- dst_length = ((dst_bytes + 3) >> 2) << 2;
4121+ free (buf);
4122+ buf = tmp_buf;
4123+ data_bytes = dst_bytes;
4124+ raster_length = dst_length;
4125+ vinfo->bits_per_pixel = 8;
4126+ }
4127+ } else { /* 1bit image */
4128+ dst_bytes = vinfo->width;
4129+ dst_length = ((dst_bytes + 3) >> 2) << 2;
41204130
4121- tmp_buf = calloc(dst_length, height);
4122- if (tmp_buf) {
4123- for (i = 0; i < height; i++) {
4124- src_ptr = buf + raster_length * i;
4125- dst_ptr = tmp_buf + dst_length * i;
4126- for (j = 0; j < vinfo->width; j++) {
4127- int o = ((src_ptr[j/8] & (1 << (7 - (j & 7))))
4128- != 0);
4129- ppalette = palette + o;
4130- dst_ptr[j] = ppalette[0];
4131- }
4132- }
4131+ tmp_buf = calloc(dst_length, height);
4132+ if (tmp_buf) {
4133+ for (i = 0; i < height; i++) {
4134+ src_ptr = buf + raster_length * i;
4135+ dst_ptr = tmp_buf + dst_length * i;
4136+ for (j = 0; j < vinfo->width; j++) {
4137+ int o = ((src_ptr[j/8] & (1 << (7 - (j & 7))))
4138+ != 0);
4139+ ppalette = palette + o;
4140+ dst_ptr[j] = ppalette[0];
4141+ }
4142+ }
41334143
4134- free (buf);
4135- buf = tmp_buf;
4136- data_bytes = dst_bytes;
4137- raster_length = dst_length;
4138- vinfo->bits_per_pixel = 8;
4139- }
4140- }
4141- } else {
4142- /* Convert indexed Gray color -> RGB */
4143- if (bits_per_pixel == 8) { /* 8bit image */
4144- dst_bytes = data_bytes * 3;
4145- dst_length = ((dst_bytes + 3) >> 2) << 2;
4144+ free (buf);
4145+ buf = tmp_buf;
4146+ data_bytes = dst_bytes;
4147+ raster_length = dst_length;
4148+ vinfo->bits_per_pixel = 8;
4149+ }
4150+ }
4151+ } else {
4152+ /* Convert indexed Gray color -> RGB */
4153+ if (bits_per_pixel == 8) { /* 8bit image */
4154+ dst_bytes = data_bytes * 3;
4155+ dst_length = ((dst_bytes + 3) >> 2) << 2;
41464156
4147- tmp_buf = calloc(dst_length, height);
4148- if (tmp_buf) {
4149- for (i = 0; i < height; i++) {
4150- src_ptr = buf + raster_length * i;
4151- dst_ptr = tmp_buf + dst_length * i;
4152- for (j = 0; j < data_bytes; j++) {
4153- ppalette = palette + src_ptr[j] * 3;
4154- dst_ptr[j*3] = ppalette[0]; /* R */
4155- dst_ptr[j*3 + 1] = ppalette[0]; /* G */
4156- dst_ptr[j*3 + 2] = ppalette[0]; /* B */
4157- }
4158- }
4157+ tmp_buf = calloc(dst_length, height);
4158+ if (tmp_buf) {
4159+ for (i = 0; i < height; i++) {
4160+ src_ptr = buf + raster_length * i;
4161+ dst_ptr = tmp_buf + dst_length * i;
4162+ for (j = 0; j < data_bytes; j++) {
4163+ ppalette = palette + src_ptr[j] * 3;
4164+ dst_ptr[j*3] = ppalette[0]; /* R */
4165+ dst_ptr[j*3 + 1] = ppalette[0]; /* G */
4166+ dst_ptr[j*3 + 2] = ppalette[0]; /* B */
4167+ }
4168+ }
41594169
4160- free (buf);
4161- buf = tmp_buf;
4162- data_bytes = dst_bytes;
4163- raster_length = dst_length;
4164- vinfo->bits_per_pixel = 24;
4165- }
4166- } else { /* 1bit image */
4167- dst_bytes = vinfo->width * 3;
4168- dst_length = ((dst_bytes + 3) >> 2) << 2;
4170+ free (buf);
4171+ buf = tmp_buf;
4172+ data_bytes = dst_bytes;
4173+ raster_length = dst_length;
4174+ vinfo->bits_per_pixel = 24;
4175+ }
4176+ } else { /* 1bit image */
4177+ dst_bytes = vinfo->width * 3;
4178+ dst_length = ((dst_bytes + 3) >> 2) << 2;
41694179
4170- tmp_buf = calloc(dst_length, height);
4171- if (tmp_buf) {
4172- for (i = 0; i < height; i++) {
4173- src_ptr = buf + raster_length * i;
4174- dst_ptr = tmp_buf + dst_length * i;
4175- for (j = 0; j < vinfo->width; j++) {
4176- int o = ((src_ptr[j/8] & (1 << (7 - (j & 7))))
4177- != 0);
4178- ppalette = palette + o * 3;
4179- dst_ptr[j*3] = ppalette[0]; /* R */
4180- dst_ptr[j*3 + 1] = ppalette[0]; /* G */
4181- dst_ptr[j*3 + 2] = ppalette[0]; /* B */
4182- }
4183- }
4180+ tmp_buf = calloc(dst_length, height);
4181+ if (tmp_buf) {
4182+ for (i = 0; i < height; i++) {
4183+ src_ptr = buf + raster_length * i;
4184+ dst_ptr = tmp_buf + dst_length * i;
4185+ for (j = 0; j < vinfo->width; j++) {
4186+ int o = ((src_ptr[j/8] & (1 << (7 - (j & 7))))
4187+ != 0);
4188+ ppalette = palette + o * 3;
4189+ dst_ptr[j*3] = ppalette[0]; /* R */
4190+ dst_ptr[j*3 + 1] = ppalette[0]; /* G */
4191+ dst_ptr[j*3 + 2] = ppalette[0]; /* B */
4192+ }
4193+ }
41844194
4185- free (buf);
4186- buf = tmp_buf;
4187- data_bytes = dst_bytes;
4188- raster_length = dst_length;
4189- vinfo->bits_per_pixel = 24;
4190- }
4191- }
4192- }
4193- } else {
4194- /* Convert indexed color -> RGB */
4195- if (bits_per_pixel == 8) { /* 8bit image */
4196- dst_bytes = data_bytes * 3;
4197- dst_length = ((dst_bytes + 3) >> 2) << 2;
4195+ free (buf);
4196+ buf = tmp_buf;
4197+ data_bytes = dst_bytes;
4198+ raster_length = dst_length;
4199+ vinfo->bits_per_pixel = 24;
4200+ }
4201+ }
4202+ }
4203+ } else {
4204+ /* Convert indexed color -> RGB */
4205+ if (bits_per_pixel == 8) { /* 8bit image */
4206+ dst_bytes = data_bytes * 3;
4207+ dst_length = ((dst_bytes + 3) >> 2) << 2;
41984208
4199- tmp_buf = calloc(dst_length, height);
4200- if (tmp_buf) {
4201- for (i = 0; i < height; i++) {
4202- src_ptr = buf + raster_length * i;
4203- dst_ptr = tmp_buf + dst_length * i;
4204- for (j = 0; j < data_bytes; j++) {
4205- ppalette = palette + src_ptr[j] * 3;
4206- dst_ptr[j*3] = ppalette[0]; /* R */
4207- dst_ptr[j*3 + 1] = ppalette[1]; /* G */
4208- dst_ptr[j*3 + 2] = ppalette[2]; /* B */
4209- }
4210- }
4209+ tmp_buf = calloc(dst_length, height);
4210+ if (tmp_buf) {
4211+ for (i = 0; i < height; i++) {
4212+ src_ptr = buf + raster_length * i;
4213+ dst_ptr = tmp_buf + dst_length * i;
4214+ for (j = 0; j < data_bytes; j++) {
4215+ ppalette = palette + src_ptr[j] * 3;
4216+ dst_ptr[j*3] = ppalette[0]; /* R */
4217+ dst_ptr[j*3 + 1] = ppalette[1]; /* G */
4218+ dst_ptr[j*3 + 2] = ppalette[2]; /* B */
4219+ }
4220+ }
42114221
4212- free (buf);
4213- buf = tmp_buf;
4214- data_bytes = dst_bytes;
4215- raster_length = dst_length;
4216- vinfo->bits_per_pixel = 24;
4217- }
4218- } else { /* 1bit image */
4219- dst_bytes = vinfo->width * 3;
4220- dst_length = ((dst_bytes + 3) >> 2) << 2;
4222+ free (buf);
4223+ buf = tmp_buf;
4224+ data_bytes = dst_bytes;
4225+ raster_length = dst_length;
4226+ vinfo->bits_per_pixel = 24;
4227+ }
4228+ } else { /* 1bit image */
4229+ dst_bytes = vinfo->width * 3;
4230+ dst_length = ((dst_bytes + 3) >> 2) << 2;
42214231
4222- tmp_buf = calloc(dst_length, height);
4223- if (tmp_buf) {
4224- for (i = 0; i < height; i++) {
4225- src_ptr = buf + raster_length * i;
4226- dst_ptr = tmp_buf + dst_length * i;
4227- for (j = 0; j < vinfo->width; j++) {
4228- int o = ((src_ptr[j/8] & (1 << (7 - (j & 7))))
4229- != 0);
4230- ppalette = palette + o * 3;
4231- dst_ptr[j*3] = ppalette[0]; /* R */
4232- dst_ptr[j*3 + 1] = ppalette[1]; /* G */
4233- dst_ptr[j*3 + 2] = ppalette[2]; /* B */
4234- }
4235- }
4232+ tmp_buf = calloc(dst_length, height);
4233+ if (tmp_buf) {
4234+ for (i = 0; i < height; i++) {
4235+ src_ptr = buf + raster_length * i;
4236+ dst_ptr = tmp_buf + dst_length * i;
4237+ for (j = 0; j < vinfo->width; j++) {
4238+ int o = ((src_ptr[j/8] & (1 << (7 - (j & 7))))
4239+ != 0);
4240+ ppalette = palette + o * 3;
4241+ dst_ptr[j*3] = ppalette[0]; /* R */
4242+ dst_ptr[j*3 + 1] = ppalette[1]; /* G */
4243+ dst_ptr[j*3 + 2] = ppalette[2]; /* B */
4244+ }
4245+ }
42364246
4237- free (buf);
4238- buf = tmp_buf;
4239- data_bytes = dst_bytes;
4240- raster_length = dst_length;
4241- vinfo->bits_per_pixel = 24;
4242- }
4243- }
4244- }
4245- }
4247+ free (buf);
4248+ buf = tmp_buf;
4249+ data_bytes = dst_bytes;
4250+ raster_length = dst_length;
4251+ vinfo->bits_per_pixel = 24;
4252+ }
4253+ }
4254+ }
4255+ }
42464256
4247- /* Convert Gray */
4248- if(color_index == gs_color_space_index_DeviceGray ||
4249- color_index == gs_color_space_index_CIEA) {
4250- if (colorSpace == OPVP_CSPACE_STANDARDRGB
4251- || colorSpace == OPVP_CSPACE_DEVICERGB) {
4252- /* convert to RGB */
4253- if (bits_per_pixel == 8) { /* 8bit image */
4254- dst_bytes = data_bytes * 3;
4255- dst_length = ((dst_bytes + 3) >> 2) << 2;
4257+ /* Convert Gray */
4258+ if(color_index == gs_color_space_index_DeviceGray ||
4259+ color_index == gs_color_space_index_CIEA) {
4260+ if (colorSpace == OPVP_CSPACE_STANDARDRGB
4261+ || colorSpace == OPVP_CSPACE_DEVICERGB) {
4262+ /* convert to RGB */
4263+ if (bits_per_pixel == 8) { /* 8bit image */
4264+ dst_bytes = data_bytes * 3;
4265+ dst_length = ((dst_bytes + 3) >> 2) << 2;
42564266
4257- tmp_buf = calloc(dst_length, height);
4258- if (tmp_buf) {
4259- for (i = 0; i < height; i++) {
4260- src_ptr = buf + raster_length * i;
4261- dst_ptr = tmp_buf + dst_length * i;
4262- for (j = 0; j < data_bytes; j++) {
4263- unsigned char d = floor(
4264- imageDecode[0]*255 + src_ptr[j]*
4265- (imageDecode[1]-imageDecode[0])+0.5);
4267+ tmp_buf = calloc(dst_length, height);
4268+ if (tmp_buf) {
4269+ for (i = 0; i < height; i++) {
4270+ src_ptr = buf + raster_length * i;
4271+ dst_ptr = tmp_buf + dst_length * i;
4272+ for (j = 0; j < data_bytes; j++) {
4273+ unsigned char d = floor(
4274+ imageDecode[0]*255 + src_ptr[j]*
4275+ (imageDecode[1]-imageDecode[0])+0.5);
42664276
4267- dst_ptr[j*3] = d; /* R */
4268- dst_ptr[j*3 + 1] = d; /* G */
4269- dst_ptr[j*3 + 2] = d; /* B */
4270- }
4271- }
4277+ dst_ptr[j*3] = d; /* R */
4278+ dst_ptr[j*3 + 1] = d; /* G */
4279+ dst_ptr[j*3 + 2] = d; /* B */
4280+ }
4281+ }
42724282
4273- free (buf);
4274- buf = tmp_buf;
4275- data_bytes = dst_bytes;
4276- raster_length = dst_length;
4277- vinfo->bits_per_pixel = 24;
4278- }
4279- } else { /* 1bit image */
4280- dst_bytes = vinfo->width * 3;
4281- dst_length = ((dst_bytes + 3) >> 2) << 2;
4283+ free (buf);
4284+ buf = tmp_buf;
4285+ data_bytes = dst_bytes;
4286+ raster_length = dst_length;
4287+ vinfo->bits_per_pixel = 24;
4288+ }
4289+ } else { /* 1bit image */
4290+ dst_bytes = vinfo->width * 3;
4291+ dst_length = ((dst_bytes + 3) >> 2) << 2;
42824292
4283- tmp_buf = calloc(dst_length, height);
4284- if (tmp_buf) {
4285- for (i = 0; i < height; i++) {
4286- src_ptr = buf + raster_length * i;
4287- dst_ptr = tmp_buf + dst_length * i;
4288- for (j = 0; j < vinfo->width; j++) {
4289- int o = ((src_ptr[j/8] & (1 << (7 - (j & 7))))
4290- != 0);
4291- unsigned char d = floor(
4292- imageDecode[0]*255 + o*
4293- (imageDecode[1]-imageDecode[0])*255+0.5);
4294- dst_ptr[j*3] = d; /* R */
4295- dst_ptr[j*3 + 1] = d; /* G */
4296- dst_ptr[j*3 + 2] =d; /* B */
4297- }
4298- }
4293+ tmp_buf = calloc(dst_length, height);
4294+ if (tmp_buf) {
4295+ for (i = 0; i < height; i++) {
4296+ src_ptr = buf + raster_length * i;
4297+ dst_ptr = tmp_buf + dst_length * i;
4298+ for (j = 0; j < vinfo->width; j++) {
4299+ int o = ((src_ptr[j/8] & (1 << (7 - (j & 7))))
4300+ != 0);
4301+ unsigned char d = floor(
4302+ imageDecode[0]*255 + o*
4303+ (imageDecode[1]-imageDecode[0])*255+0.5);
4304+ dst_ptr[j*3] = d; /* R */
4305+ dst_ptr[j*3 + 1] = d; /* G */
4306+ dst_ptr[j*3 + 2] =d; /* B */
4307+ }
4308+ }
42994309
4300- free (buf);
4301- buf = tmp_buf;
4302- data_bytes = dst_bytes;
4303- raster_length = dst_length;
4304- vinfo->bits_per_pixel = 24;
4305- }
4306- }
4307- } else if (colorSpace == OPVP_CSPACE_DEVICEGRAY) {
4308- if (bits_per_pixel == 1) { /* 1bit image */
4309- dst_bytes = vinfo->width;
4310- dst_length = ((dst_bytes + 3) >> 2) << 2;
4310+ free (buf);
4311+ buf = tmp_buf;
4312+ data_bytes = dst_bytes;
4313+ raster_length = dst_length;
4314+ vinfo->bits_per_pixel = 24;
4315+ }
4316+ }
4317+ } else if (colorSpace == OPVP_CSPACE_DEVICEGRAY) {
4318+ if (bits_per_pixel == 1) { /* 1bit image */
4319+ dst_bytes = vinfo->width;
4320+ dst_length = ((dst_bytes + 3) >> 2) << 2;
43114321
4312- tmp_buf = calloc(dst_length, height);
4313- if (tmp_buf) {
4314- for (i = 0; i < height; i++) {
4315- src_ptr = buf + raster_length * i;
4316- dst_ptr = tmp_buf + dst_length * i;
4317- for (j = 0; j < vinfo->width; j++) {
4318- int o = ((src_ptr[j/8] & (1 << (7 - (j & 7))))
4319- != 0);
4320- unsigned char d = floor(
4321- imageDecode[0]*255 + o*
4322- (imageDecode[1]-imageDecode[0])*255+0.5);
4323- dst_ptr[j] = d; /* R */
4324- }
4325- }
4322+ tmp_buf = calloc(dst_length, height);
4323+ if (tmp_buf) {
4324+ for (i = 0; i < height; i++) {
4325+ src_ptr = buf + raster_length * i;
4326+ dst_ptr = tmp_buf + dst_length * i;
4327+ for (j = 0; j < vinfo->width; j++) {
4328+ int o = ((src_ptr[j/8] & (1 << (7 - (j & 7))))
4329+ != 0);
4330+ unsigned char d = floor(
4331+ imageDecode[0]*255 + o*
4332+ (imageDecode[1]-imageDecode[0])*255+0.5);
4333+ dst_ptr[j] = d; /* R */
4334+ }
4335+ }
43264336
4327- free (buf);
4328- buf = tmp_buf;
4329- data_bytes = dst_bytes;
4330- raster_length = dst_length;
4331- vinfo->bits_per_pixel = 8;
4332- }
4333- }
4334- }
4335- }
4336- }
4337+ free (buf);
4338+ buf = tmp_buf;
4339+ data_bytes = dst_bytes;
4340+ raster_length = dst_length;
4341+ vinfo->bits_per_pixel = 8;
4342+ }
4343+ }
4344+ }
4345+ }
4346+ }
43374347 #if GS_VERSION_MAJOR >= 8
4338- if (vinfo->bits_per_pixel == 24) { /* 24bit RGB color */
4339- for (i = 0; i < height; i++) {
4340- ptr = buf + raster_length * i;
4341- for (j = 0; j < vinfo->width; j++) {
4342- ptr[j*3] = min(255, frac2cv(gx_map_color_frac(pis,
4343- cv2frac(ptr[j*3]), effective_transfer[0])));
4344- ptr[j*3+1] = min(255, frac2cv(gx_map_color_frac(pis,
4345- cv2frac(ptr[j*3+1]), effective_transfer[1])));
4346- ptr[j*3+2] = min(255, frac2cv(gx_map_color_frac(pis,
4347- cv2frac(ptr[j*3+2]), effective_transfer[2])));
4348- }
4349- }
4350- } else if (vinfo->bits_per_pixel == 8) { /* 8bit Gray image */
4351- for (i = 0; i < height; i++) {
4352- ptr = buf + raster_length * i;
4353- for (j=0; j < vinfo->width; j++) {
4354- ptr[j] = min(255, frac2cv(gx_map_color_frac(pis,
4355- cv2frac(ptr[j]), effective_transfer[3])));
4356- }
4357- }
4358- }
4348+ if (vinfo->bits_per_pixel == 24) { /* 24bit RGB color */
4349+ for (i = 0; i < height; i++) {
4350+ ptr = buf + raster_length * i;
4351+ for (j = 0; j < vinfo->width; j++) {
4352+ ptr[j*3] = min(255, frac2cv(gx_map_color_frac(pis,
4353+ cv2frac(ptr[j*3]), effective_transfer[0])));
4354+ ptr[j*3+1] = min(255, frac2cv(gx_map_color_frac(pis,
4355+ cv2frac(ptr[j*3+1]), effective_transfer[1])));
4356+ ptr[j*3+2] = min(255, frac2cv(gx_map_color_frac(pis,
4357+ cv2frac(ptr[j*3+2]), effective_transfer[2])));
4358+ }
4359+ }
4360+ } else if (vinfo->bits_per_pixel == 8) { /* 8bit Gray image */
4361+ for (i = 0; i < height; i++) {
4362+ ptr = buf + raster_length * i;
4363+ for (j=0; j < vinfo->width; j++) {
4364+ ptr[j] = min(255, frac2cv(gx_map_color_frac(pis,
4365+ cv2frac(ptr[j]), effective_transfer[3])));
4366+ }
4367+ }
4368+ }
43594369 #else
4360- if (vinfo->bits_per_pixel == 24) { /* 24bit RGB color */
4361- for (i = 0; i < height; i++) {
4362- ptr = buf + raster_length * i;
4363- for (j = 0; j < vinfo->width; j++) {
4364- ptr[j*3] = min(255, frac2cv(gx_map_color_frac(pis,
4365- cv2frac(ptr[j*3]), effective_transfer.colored.red)));
4366- ptr[j*3+1] = min(255, frac2cv(gx_map_color_frac(pis,
4367- cv2frac(ptr[j*3+1]), effective_transfer.colored.green)));
4368- ptr[j*3+2] = min(255, frac2cv(gx_map_color_frac(pis,
4369- cv2frac(ptr[j*3+2]), effective_transfer.colored.blue)));
4370- }
4371- }
4372- } else if (vinfo->bits_per_pixel == 8) { /* 8bit Gray image */
4373- for (i = 0; i < height; i++) {
4374- ptr = buf + raster_length * i;
4375- for (j = 0; j < vinfo->width; j++) {
4376- ptr[j] = min(255, frac2cv(gx_map_color_frac(pis,
4377- cv2frac(ptr[j]), effective_transfer.colored.gray)));
4378- }
4379- }
4380- }
4370+ if (vinfo->bits_per_pixel == 24) { /* 24bit RGB color */
4371+ for (i = 0; i < height; i++) {
4372+ ptr = buf + raster_length * i;
4373+ for (j = 0; j < vinfo->width; j++) {
4374+ ptr[j*3] = min(255, frac2cv(gx_map_color_frac(pis,
4375+ cv2frac(ptr[j*3]), effective_transfer.colored.red)));
4376+ ptr[j*3+1] = min(255, frac2cv(gx_map_color_frac(pis,
4377+ cv2frac(ptr[j*3+1]), effective_transfer.colored.green)));
4378+ ptr[j*3+2] = min(255, frac2cv(gx_map_color_frac(pis,
4379+ cv2frac(ptr[j*3+2]), effective_transfer.colored.blue)));
4380+ }
4381+ }
4382+ } else if (vinfo->bits_per_pixel == 8) { /* 8bit Gray image */
4383+ for (i = 0; i < height; i++) {
4384+ ptr = buf + raster_length * i;
4385+ for (j = 0; j < vinfo->width; j++) {
4386+ ptr[j] = min(255, frac2cv(gx_map_color_frac(pis,
4387+ cv2frac(ptr[j]), effective_transfer.colored.gray)));
4388+ }
4389+ }
4390+ }
43814391 #endif
43824392
4383- /* call TansferDrawImage */
4384- if (apiEntry->opvpTransferDrawImage) {
4385- apiEntry->opvpTransferDrawImage(printerContext,
4386- raster_length * height, (void *)buf);
4387- }
4388- if (buf) {
4389- free(buf); /* free buffer */
4390- }
4393+ /* call TansferDrawImage */
4394+ if (apiEntry->opvpTransferDrawImage) {
4395+ apiEntry->opvpTransferDrawImage(printerContext,
4396+ raster_length * height, (void *)buf);
4397+ }
4398+ if (buf) {
4399+ free(buf); /* free buffer */
4400+ }
43914401 }
43924402
43934403 vinfo->y += height;
@@ -4399,8 +4409,8 @@
43994409 /*
44004410 * end image
44014411 */
4402-static int
4403-opvp_image_end_image(gx_image_enum_common_t *info, bool draw_last)
4412+static int
4413+opvp_image_end_image(gx_image_enum_common_t *info, bool draw_last)
44044414 {
44054415 gx_device *dev = info->dev;
44064416 gx_device_vector *vdev = (gx_device_vector *)dev;
@@ -4410,47 +4420,47 @@
44104420 vinfo = (gdev_vector_image_enum_t *)info;
44114421
44124422 if (begin_image) {
4413- /* call EndDrawImage */
4414- if (apiEntry->opvpEndDrawImage) {
4415- apiEntry->opvpEndDrawImage(printerContext);
4416- }
4423+ /* call EndDrawImage */
4424+ if (apiEntry->opvpEndDrawImage) {
4425+ apiEntry->opvpEndDrawImage(printerContext);
4426+ }
44174427
4418- begin_image = false;
4428+ begin_image = false;
44194429
4420- if (FastImageMode != FastImageNoCTM) {
4421- /* call ResetCTM */
4422- if (apiEntry->opvpResetCTM) {
4423- apiEntry->opvpResetCTM(printerContext);
4424- } else {
4425- /* call SetCTM */
4426- ctm.a = 1;
4427- ctm.b = 0;
4428- ctm.c = 0;
4429- ctm.d = 1;
4430- ctm.e = 0;
4431- ctm.f = 0;
4432- if (apiEntry->opvpSetCTM) {
4433- apiEntry->opvpSetCTM(printerContext, &ctm);
4434- }
4435- }
4436- }
4437- if (change_paint_mode) {
4438- /* restore paint mode */
4439- if (apiEntry->opvpSetPaintMode) {
4440- apiEntry->opvpSetPaintMode(printerContext,
4441- OPVP_PAINTMODE_TRANSPARENT);
4442- }
4443- change_paint_mode = false;
4444- }
4445- if (change_cspace) {
4446- /* restore color space */
4447- colorSpace = savedColorSpace;
4448- if (apiEntry->opvpSetColorSpace) {
4449- apiEntry->opvpSetColorSpace(printerContext,
4450- colorSpace);
4451- }
4452- change_cspace = false;
4453- }
4430+ if (FastImageMode != FastImageNoCTM) {
4431+ /* call ResetCTM */
4432+ if (apiEntry->opvpResetCTM) {
4433+ apiEntry->opvpResetCTM(printerContext);
4434+ } else {
4435+ /* call SetCTM */
4436+ ctm.a = 1;
4437+ ctm.b = 0;
4438+ ctm.c = 0;
4439+ ctm.d = 1;
4440+ ctm.e = 0;
4441+ ctm.f = 0;
4442+ if (apiEntry->opvpSetCTM) {
4443+ apiEntry->opvpSetCTM(printerContext, &ctm);
4444+ }
4445+ }
4446+ }
4447+ if (change_paint_mode) {
4448+ /* restore paint mode */
4449+ if (apiEntry->opvpSetPaintMode) {
4450+ apiEntry->opvpSetPaintMode(printerContext,
4451+ OPVP_PAINTMODE_TRANSPARENT);
4452+ }
4453+ change_paint_mode = false;
4454+ }
4455+ if (change_cspace) {
4456+ /* restore color space */
4457+ colorSpace = savedColorSpace;
4458+ if (apiEntry->opvpSetColorSpace) {
4459+ apiEntry->opvpSetColorSpace(printerContext,
4460+ colorSpace);
4461+ }
4462+ change_cspace = false;
4463+ }
44544464 }
44554465
44564466 return gdev_vector_end_image(vdev, vinfo, draw_last, vdev->white);
@@ -4460,7 +4470,7 @@
44604470 /*
44614471 * begin page
44624472 */
4463-static int
4473+static int
44644474 opvp_beginpage(gx_device_vector *vdev)
44654475 {
44664476 gx_device_opvp *pdev = (gx_device_opvp *)vdev;
@@ -4473,10 +4483,10 @@
44734483 /* start page */
44744484 code = opvp_startpage((gx_device *)pdev);
44754485 if (code) {
4476- ecode = code;
4486+ ecode = code;
44774487 } else {
4478- pdev->in_page = true; /* added '05.12.07 */
4479- beginPage = true;
4488+ pdev->in_page = true; /* added '05.12.07 */
4489+ beginPage = true;
44804490 }
44814491
44824492 return ecode;
@@ -4485,7 +4495,7 @@
44854495 /*
44864496 * set line width
44874497 */
4488-static int
4498+static int
44894499 opvp_setlinewidth(gx_device_vector *vdev, floatp width)
44904500 {
44914501 gx_device_opvp *pdev = (gx_device_opvp *)vdev;
@@ -4499,10 +4509,10 @@
44994509 /* call SetLineWidth */
45004510 OPVP_F2FIX(width, w);
45014511 if (apiEntry->opvpSetLineWidth) {
4502- r = apiEntry->opvpSetLineWidth(printerContext, w);
4512+ r = apiEntry->opvpSetLineWidth(printerContext, w);
45034513 }
45044514 if (r != OPVP_OK) {
4505- ecode = -1;
4515+ ecode = -1;
45064516 }
45074517
45084518 return ecode;
@@ -4511,7 +4521,7 @@
45114521 /*
45124522 * set line cap
45134523 */
4514-static int
4524+static int
45154525 opvp_setlinecap(gx_device_vector *vdev, gs_line_cap cap)
45164526 {
45174527 gx_device_opvp *pdev = (gx_device_opvp *)vdev;
@@ -4524,26 +4534,26 @@
45244534
45254535 switch (cap) {
45264536 case gs_cap_butt:
4527- linecap = OPVP_LINECAP_BUTT;
4528- break;
4537+ linecap = OPVP_LINECAP_BUTT;
4538+ break;
45294539 case gs_cap_round:
4530- linecap = OPVP_LINECAP_ROUND;
4531- break;
4540+ linecap = OPVP_LINECAP_ROUND;
4541+ break;
45324542 case gs_cap_square:
4533- linecap = OPVP_LINECAP_SQUARE;
4534- break;
4543+ linecap = OPVP_LINECAP_SQUARE;
4544+ break;
45354545 case gs_cap_triangle:
45364546 default:
4537- linecap = OPVP_LINECAP_BUTT;
4538- break;
4547+ linecap = OPVP_LINECAP_BUTT;
4548+ break;
45394549 }
45404550
45414551 /* call SetLineCap */
45424552 if (apiEntry->opvpSetLineCap) {
4543- r = apiEntry->opvpSetLineCap(printerContext, linecap);
4553+ r = apiEntry->opvpSetLineCap(printerContext, linecap);
45444554 }
45454555 if (r != OPVP_OK) {
4546- ecode = -1;
4556+ ecode = -1;
45474557 }
45484558
45494559 return ecode;
@@ -4552,7 +4562,7 @@
45524562 /*
45534563 * set line join
45544564 */
4555-static int
4565+static int
45564566 opvp_setlinejoin(gx_device_vector *vdev, gs_line_join join)
45574567 {
45584568 gx_device_opvp *pdev = (gx_device_opvp *)vdev;
@@ -4565,27 +4575,27 @@
45654575
45664576 switch (join) {
45674577 case gs_join_miter:
4568- linejoin = OPVP_LINEJOIN_MITER;
4569- break;
4578+ linejoin = OPVP_LINEJOIN_MITER;
4579+ break;
45704580 case gs_join_round:
4571- linejoin = OPVP_LINEJOIN_ROUND;
4572- break;
4581+ linejoin = OPVP_LINEJOIN_ROUND;
4582+ break;
45734583 case gs_join_bevel:
4574- linejoin = OPVP_LINEJOIN_BEVEL;
4575- break;
4584+ linejoin = OPVP_LINEJOIN_BEVEL;
4585+ break;
45764586 case gs_join_none:
45774587 case gs_join_triangle:
45784588 default:
4579- linejoin = OPVP_LINEJOIN_MITER;
4580- break;
4589+ linejoin = OPVP_LINEJOIN_MITER;
4590+ break;
45814591 }
45824592
45834593 /* call SetLineJoin */
45844594 if (apiEntry->opvpSetLineJoin) {
4585- r = apiEntry->opvpSetLineJoin(printerContext, linejoin);
4595+ r = apiEntry->opvpSetLineJoin(printerContext, linejoin);
45864596 }
45874597 if (r != OPVP_OK) {
4588- ecode = -1;
4598+ ecode = -1;
45894599 }
45904600
45914601 return ecode;
@@ -4594,7 +4604,7 @@
45944604 /*
45954605 * set miter limit
45964606 */
4597-static int
4607+static int
45984608 opvp_setmiterlimit(gx_device_vector *vdev, floatp limit)
45994609 {
46004610 gx_device_opvp *pdev = (gx_device_opvp *)vdev;
@@ -4608,10 +4618,10 @@
46084618 /* call SetMiterLimit */
46094619 OPVP_F2FIX(limit, l);
46104620 if (apiEntry->opvpSetMiterLimit) {
4611- r = apiEntry->opvpSetMiterLimit(printerContext, l);
4621+ r = apiEntry->opvpSetMiterLimit(printerContext, l);
46124622 }
46134623 if (r != OPVP_OK) {
4614- ecode = -1;
4624+ ecode = -1;
46154625 }
46164626
46174627 return ecode;
@@ -4620,7 +4630,7 @@
46204630 /*
46214631 * set dash
46224632 */
4623-static int
4633+static int
46244634 opvp_setdash(
46254635 gx_device_vector *vdev,
46264636 const float *pattern,
@@ -4639,48 +4649,48 @@
46394649
46404650 /* pattern */
46414651 if (count) {
4642- p = calloc(sizeof(opvp_fix_t), count);
4643- if (p) {
4644- for (i = 0; i < count; i++) {
4645- OPVP_F2FIX(pattern[i], p[i]);
4646- }
4647- } else {
4648- ecode = -1;
4649- }
4652+ p = calloc(sizeof(opvp_fix_t), count);
4653+ if (p) {
4654+ for (i = 0; i < count; i++) {
4655+ OPVP_F2FIX(pattern[i], p[i]);
4656+ }
4657+ } else {
4658+ ecode = -1;
4659+ }
46504660 }
46514661
46524662 /* call SetLineDash */
46534663 if (!ecode) {
4654- if (apiEntry->opvpSetLineDash) {
4655- r = apiEntry->opvpSetLineDash(printerContext, count,p);
4656- }
4657- if (r != OPVP_OK) {
4658- ecode = -1;
4659- }
4664+ if (apiEntry->opvpSetLineDash) {
4665+ r = apiEntry->opvpSetLineDash(printerContext, count,p);
4666+ }
4667+ if (r != OPVP_OK) {
4668+ ecode = -1;
4669+ }
46604670 }
46614671
46624672 /* call SetLineDashOffset */
46634673 if (!ecode) {
4664- OPVP_F2FIX(offset, o);
4665- if (apiEntry->opvpSetLineDashOffset) {
4666- r = apiEntry->opvpSetLineDashOffset(printerContext, o);
4667- }
4668- if (r != OPVP_OK) {
4669- ecode = -1;
4670- }
4674+ OPVP_F2FIX(offset, o);
4675+ if (apiEntry->opvpSetLineDashOffset) {
4676+ r = apiEntry->opvpSetLineDashOffset(printerContext, o);
4677+ }
4678+ if (r != OPVP_OK) {
4679+ ecode = -1;
4680+ }
46714681 }
46724682
46734683 /* call SetLineStyle */
46744684 if (!ecode) {
4675- if (apiEntry->opvpSetLineStyle) {
4676- r = apiEntry->opvpSetLineStyle(printerContext,
4677- (count ?
4678- OPVP_LINESTYLE_DASH :
4679- OPVP_LINESTYLE_SOLID));
4680- }
4681- if (r != OPVP_OK) {
4682- ecode = -1;
4683- }
4685+ if (apiEntry->opvpSetLineStyle) {
4686+ r = apiEntry->opvpSetLineStyle(printerContext,
4687+ (count ?
4688+ OPVP_LINESTYLE_DASH :
4689+ OPVP_LINESTYLE_SOLID));
4690+ }
4691+ if (r != OPVP_OK) {
4692+ ecode = -1;
4693+ }
46844694 }
46854695
46864696 if (p) free(p);
@@ -4691,7 +4701,7 @@
46914701 /*
46924702 * set flat
46934703 */
4694-static int
4704+static int
46954705 opvp_setflat(gx_device_vector *vdev, floatp flatness)
46964706 {
46974707 gx_device_opvp *pdev = (gx_device_opvp *)vdev;
@@ -4708,7 +4718,7 @@
47084718 /*
47094719 * set logical operation
47104720 */
4711-static int
4721+static int
47124722 opvp_setlogop(
47134723 gx_device_vector *vdev,
47144724 gs_logical_operation_t lop,
@@ -4722,7 +4732,7 @@
47224732 /*--- added for Ghostscritp 8.15 ---*/
47234733 static int
47244734 opvp_can_handle_hl_color(gx_device_vector * vdev,
4725- const gs_imager_state * pis1, const gx_drawing_color * pdc)
4735+ const gs_imager_state * pis1, const gx_drawing_color * pdc)
47264736 {
47274737 return false; /* High level color is not implemented yet. */
47284738 }
@@ -4732,14 +4742,14 @@
47324742 * set fill color
47334743 */
47344744 #if GS_VERSION_MAJOR >= 8
4735-static int
4745+static int
47364746 opvp_setfillcolor(
47374747 gx_device_vector *vdev,
47384748 const gs_imager_state *pis, /* added for gs 8.15 */
47394749 const gx_drawing_color *pdc)
47404750 #else
4741-static int
4742-opvp_setfillcolor(gx_device_vector *vdev, const gx_drawing_color *pdc)
4751+static int
4752+opvp_setfillcolor(gx_device_vector *vdev, const gx_drawing_color *pdc)
47434753 #endif
47444754 {
47454755 gx_device_opvp *pdev = (gx_device_opvp *)vdev;
@@ -4760,10 +4770,10 @@
47604770
47614771 /* call SetFillColor */
47624772 if (apiEntry->opvpSetFillColor) {
4763- r = apiEntry->opvpSetFillColor(printerContext, vectorFillColor);
4773+ r = apiEntry->opvpSetFillColor(printerContext, vectorFillColor);
47644774 }
47654775 if (r != OPVP_OK) {
4766- ecode = -1;
4776+ ecode = -1;
47674777 }
47684778
47694779 return ecode;
@@ -4773,13 +4783,13 @@
47734783 * set stroke color
47744784 */
47754785 #if GS_VERSION_MAJOR >= 8
4776-static int
4786+static int
47774787 opvp_setstrokecolor(
47784788 gx_device_vector *vdev,
47794789 const gs_imager_state *pis, /* added for gs 8.15 */
47804790 const gx_drawing_color *pdc)
47814791 #else
4782-static int
4792+static int
47834793 opvp_setstrokecolor(gx_device_vector *vdev, const gx_drawing_color *pdc)
47844794 #endif
47854795 {
@@ -4800,21 +4810,21 @@
48004810
48014811 /* call SetStrokeColor */
48024812 if (apiEntry->opvpSetStrokeColor) {
4803- r = apiEntry->opvpSetStrokeColor(printerContext, &brush);
4813+ r = apiEntry->opvpSetStrokeColor(printerContext, &brush);
48044814 }
48054815 if (r != OPVP_OK) {
4806- ecode = -1;
4816+ ecode = -1;
48074817 }
48084818
48094819 return ecode;
48104820 }
48114821
4812-#define OPVP_OPT_MULTI_PATH
4822+#define OPVP_OPT_MULTI_PATH
48134823
48144824 /*
48154825 * vector do path
48164826 */
4817-static int
4827+static int
48184828 opvp_vector_dopath(
48194829 gx_device_vector *vdev,
48204830 const gx_path *ppath,
@@ -4829,7 +4839,7 @@
48294839 gs_path_enum path;
48304840 gs_point scale;
48314841 int op;
4832-#ifdef OPVP_OPT_MULTI_PATH
4842+#ifdef OPVP_OPT_MULTI_PATH
48334843 int i;
48344844 int pop = 0;
48354845 int npoints = 0;
@@ -4846,7 +4856,7 @@
48464856 bool begin = true;
48474857
48484858 start.x = start.y = 0;
4849-#ifdef OPVP_OPT_MULTI_PATH
4859+#ifdef OPVP_OPT_MULTI_PATH
48504860 current.x = current.y = 0;
48514861 #endif
48524862 /* check page-in */
@@ -4854,9 +4864,9 @@
48544864
48554865 if (gx_path_is_rectangle(ppath, &rect))
48564866 return (*vdev_proc(vdev, dorect))(vdev,
4857- rect.p.x, rect.p.y,
4858- rect.q.x, rect.q.y,
4859- type);
4867+ rect.p.x, rect.p.y,
4868+ rect.q.x, rect.q.y,
4869+ type);
48604870
48614871 /* begin path */
48624872 code = (*vdev_proc(vdev, beginpath))(vdev, type);
@@ -4865,200 +4875,200 @@
48654875 gx_path_enum_init(&path, ppath);
48664876
48674877 while (!ecode) {
4868- op = gx_path_enum_next(&path, (gs_fixed_point *)vs);
4869- if (begin) {
4870- /* start point */
4871- start.x = fixed2float(vs[0]) / scale.x;
4872- start.y = fixed2float(vs[1]) / scale.y;
4873- begin = false;
4878+ op = gx_path_enum_next(&path, (gs_fixed_point *)vs);
4879+ if (begin) {
4880+ /* start point */
4881+ start.x = fixed2float(vs[0]) / scale.x;
4882+ start.y = fixed2float(vs[1]) / scale.y;
4883+ begin = false;
48744884
4875-#ifdef OPVP_OPT_MULTI_PATH
4876- npoints = 1;
4877- points = realloc(points, sizeof(_fPoint));
4878- current = start;
4885+#ifdef OPVP_OPT_MULTI_PATH
4886+ npoints = 1;
4887+ points = realloc(points, sizeof(_fPoint));
4888+ current = start;
48794889 #endif
48804890
4881- points[0] = start;
4891+ points[0] = start;
48824892
4883-#ifdef OPVP_OPT_MULTI_PATH
4884- } else if (op != pop) {
4885- /* convert float to Fix */
4886- opvp_p = realloc(opvp_p, sizeof(opvp_point_t) * npoints);
4887- for (i = 0; i < npoints; i++) {
4888- OPVP_F2FIX(points[i].x, opvp_p[i].x);
4889- OPVP_F2FIX(points[i].y, opvp_p[i].y);
4890- }
4893+#ifdef OPVP_OPT_MULTI_PATH
4894+ } else if (op != pop) {
4895+ /* convert float to Fix */
4896+ opvp_p = realloc(opvp_p, sizeof(opvp_point_t) * npoints);
4897+ for (i = 0; i < npoints; i++) {
4898+ OPVP_F2FIX(points[i].x, opvp_p[i].x);
4899+ OPVP_F2FIX(points[i].y, opvp_p[i].y);
4900+ }
48914901
4892- switch (pop) {
4893- case gs_pe_moveto:
4894- /* call SetCurrentPoint */
4895- if (apiEntry->opvpSetCurrentPoint) {
4896- r = apiEntry->opvpSetCurrentPoint(
4897- printerContext,
4898- opvp_p[npoints-1].x,
4899- opvp_p[npoints-1].y);
4900- }
4901- if (r != OPVP_OK) ecode = -1;
4902- break;
4903- case gs_pe_lineto:
4904- /* call LinePath */
4905- if (apiEntry->opvpLinePath) {
4906- r = apiEntry->opvpLinePath(
4907- printerContext,
4908- OPVP_PATHOPEN,
4909- npoints - 1,
4910- &(opvp_p[1]));
4911- }
4912- if (r != OPVP_OK) ecode = -1;
4913- break;
4914- case gs_pe_curveto:
4915- /* npoints */
4916- if (!cp_num)
4917- cp_num = calloc(sizeof(int), 2);
4918- cp_num[0] = npoints;
4919- cp_num[1] = 0;
4902+ switch (pop) {
4903+ case gs_pe_moveto:
4904+ /* call SetCurrentPoint */
4905+ if (apiEntry->opvpSetCurrentPoint) {
4906+ r = apiEntry->opvpSetCurrentPoint(
4907+ printerContext,
4908+ opvp_p[npoints-1].x,
4909+ opvp_p[npoints-1].y);
4910+ }
4911+ if (r != OPVP_OK) ecode = -1;
4912+ break;
4913+ case gs_pe_lineto:
4914+ /* call LinePath */
4915+ if (apiEntry->opvpLinePath) {
4916+ r = apiEntry->opvpLinePath(
4917+ printerContext,
4918+ OPVP_PATHOPEN,
4919+ npoints - 1,
4920+ &(opvp_p[1]));
4921+ }
4922+ if (r != OPVP_OK) ecode = -1;
4923+ break;
4924+ case gs_pe_curveto:
4925+ /* npoints */
4926+ if (!cp_num)
4927+ cp_num = calloc(sizeof(int), 2);
4928+ cp_num[0] = npoints;
4929+ cp_num[1] = 0;
49204930
4921- /* call BezierPath */
4922- if (apiEntry->opvpBezierPath) {
4923- r = apiEntry->opvpBezierPath(
4924- printerContext,
4925- npoints - 1,
4926- &(opvp_p[1])
4927- );
4928- }
4929- if (r != OPVP_OK) ecode = -1;
4930- break;
4931- case gs_pe_closepath:
4932- /* close path */
4933- break;
4934- default:
4935- /* error */
4936- return_error(gs_error_unknownerror);
4937- break;
4938- }
4931+ /* call BezierPath */
4932+ if (apiEntry->opvpBezierPath) {
4933+ r = apiEntry->opvpBezierPath(
4934+ printerContext,
4935+ npoints - 1,
4936+ &(opvp_p[1])
4937+ );
4938+ }
4939+ if (r != OPVP_OK) ecode = -1;
4940+ break;
4941+ case gs_pe_closepath:
4942+ /* close path */
4943+ break;
4944+ default:
4945+ /* error */
4946+ return_error(gs_error_unknownerror);
4947+ break;
4948+ }
49394949
4940- /* reset */
4941- npoints = 1;
4942- if (cp_num) free(cp_num), cp_num = NULL;
4943- points = realloc(points, sizeof(_fPoint));
4944- points[0] = current;
4950+ /* reset */
4951+ npoints = 1;
4952+ if (cp_num) free(cp_num), cp_num = NULL;
4953+ points = realloc(points, sizeof(_fPoint));
4954+ points[0] = current;
49454955 #endif
4946- }
4956+ }
49474957
4948- if (!op) break; /* END */
4958+ if (!op) break; /* END */
49494959
4950- switch (op) {
4951- case gs_pe_moveto:
4952-#ifdef OPVP_OPT_MULTI_PATH
4953- /* move to */
4954- i = npoints;
4955- npoints += 1;
4956- points = realloc(points, sizeof(_fPoint) * npoints);
4957- points[i].x = fixed2float(vs[0]) / scale.x;
4958- points[i].y = fixed2float(vs[1]) / scale.y;
4959- current = points[i];
4960- start = current;
4960+ switch (op) {
4961+ case gs_pe_moveto:
4962+#ifdef OPVP_OPT_MULTI_PATH
4963+ /* move to */
4964+ i = npoints;
4965+ npoints += 1;
4966+ points = realloc(points, sizeof(_fPoint) * npoints);
4967+ points[i].x = fixed2float(vs[0]) / scale.x;
4968+ points[i].y = fixed2float(vs[1]) / scale.y;
4969+ current = points[i];
4970+ start = current;
49614971
49624972 #else
49634973
4964- /* move to */
4965- points[1].x = fixed2float(vs[0]) / scale.x;
4966- points[1].y = fixed2float(vs[1]) / scale.y;
4967- code = (*vdev_proc(vdev, moveto))(vdev,
4968- points[0].x,
4969- points[0].y,
4970- points[1].x,
4971- points[1].y,
4972- type);
4973- if (code) ecode = code;
4974- points[0] = points[1];
4975- start = points[0];
4974+ /* move to */
4975+ points[1].x = fixed2float(vs[0]) / scale.x;
4976+ points[1].y = fixed2float(vs[1]) / scale.y;
4977+ code = (*vdev_proc(vdev, moveto))(vdev,
4978+ points[0].x,
4979+ points[0].y,
4980+ points[1].x,
4981+ points[1].y,
4982+ type);
4983+ if (code) ecode = code;
4984+ points[0] = points[1];
4985+ start = points[0];
49764986 #endif
4977- break;
4978- case gs_pe_lineto:
4979-#ifdef OPVP_OPT_MULTI_PATH
4980- /* line to */
4981- i = npoints;
4982- npoints += 1;
4983- points = realloc(points, sizeof(_fPoint) * npoints);
4984- points[i].x = fixed2float(vs[0]) / scale.x;
4985- points[i].y = fixed2float(vs[1]) / scale.y;
4986- current = points[i];
4987+ break;
4988+ case gs_pe_lineto:
4989+#ifdef OPVP_OPT_MULTI_PATH
4990+ /* line to */
4991+ i = npoints;
4992+ npoints += 1;
4993+ points = realloc(points, sizeof(_fPoint) * npoints);
4994+ points[i].x = fixed2float(vs[0]) / scale.x;
4995+ points[i].y = fixed2float(vs[1]) / scale.y;
4996+ current = points[i];
49874997 #else
4988- /* line to */
4989- points[1].x = fixed2float(vs[0]) / scale.x;
4990- points[1].y = fixed2float(vs[1]) / scale.y;
4991- code = (*vdev_proc(vdev, lineto))(vdev,
4992- points[0].x,
4993- points[0].y,
4994- points[1].x,
4995- points[1].y,
4996- type);
4997- if (code) ecode = code;
4998- points[0] = points[1];
4998+ /* line to */
4999+ points[1].x = fixed2float(vs[0]) / scale.x;
5000+ points[1].y = fixed2float(vs[1]) / scale.y;
5001+ code = (*vdev_proc(vdev, lineto))(vdev,
5002+ points[0].x,
5003+ points[0].y,
5004+ points[1].x,
5005+ points[1].y,
5006+ type);
5007+ if (code) ecode = code;
5008+ points[0] = points[1];
49995009 #endif
5000- break;
5001- case gs_pe_curveto:
5002-#ifdef OPVP_OPT_MULTI_PATH
5003- /* curve to */
5004- check_p.x = fixed2float(vs[0]) / scale.x;
5005- check_p.y = fixed2float(vs[1]) / scale.y;
5010+ break;
5011+ case gs_pe_curveto:
5012+#ifdef OPVP_OPT_MULTI_PATH
5013+ /* curve to */
5014+ check_p.x = fixed2float(vs[0]) / scale.x;
5015+ check_p.y = fixed2float(vs[1]) / scale.y;
50065016
5007- i = npoints;
5008- npoints += 3;
5009- points = realloc(points, sizeof(_fPoint) * npoints);
5010- points[i ].x = fixed2float(vs[0]) / scale.x;
5011- points[i ].y = fixed2float(vs[1]) / scale.y;
5012- points[i+1].x = fixed2float(vs[2]) / scale.x;
5013- points[i+1].y = fixed2float(vs[3]) / scale.y;
5014- points[i+2].x = fixed2float(vs[4]) / scale.x;
5015- points[i+2].y = fixed2float(vs[5]) / scale.y;
5016- current = points[i+2];
5017+ i = npoints;
5018+ npoints += 3;
5019+ points = realloc(points, sizeof(_fPoint) * npoints);
5020+ points[i ].x = fixed2float(vs[0]) / scale.x;
5021+ points[i ].y = fixed2float(vs[1]) / scale.y;
5022+ points[i+1].x = fixed2float(vs[2]) / scale.x;
5023+ points[i+1].y = fixed2float(vs[3]) / scale.y;
5024+ points[i+2].x = fixed2float(vs[4]) / scale.x;
5025+ points[i+2].y = fixed2float(vs[5]) / scale.y;
5026+ current = points[i+2];
50175027 #else
5018- /* curve to */
5019- points[1].x = fixed2float(vs[0]) / scale.x;
5020- points[1].y = fixed2float(vs[1]) / scale.y;
5021- points[2].x = fixed2float(vs[2]) / scale.x;
5022- points[2].y = fixed2float(vs[3]) / scale.y;
5023- points[3].x = fixed2float(vs[4]) / scale.x;
5024- points[3].y = fixed2float(vs[5]) / scale.y;
5025- code = (*vdev_proc(vdev, curveto))(vdev,
5026- points[0].x,
5027- points[0].y,
5028- points[1].x,
5029- points[1].y,
5030- points[2].x,
5031- points[2].y,
5032- points[3].x,
5033- points[3].y,
5034- type);
5035- if (code) ecode = code;
5036- points[0] = points[3];
5028+ /* curve to */
5029+ points[1].x = fixed2float(vs[0]) / scale.x;
5030+ points[1].y = fixed2float(vs[1]) / scale.y;
5031+ points[2].x = fixed2float(vs[2]) / scale.x;
5032+ points[2].y = fixed2float(vs[3]) / scale.y;
5033+ points[3].x = fixed2float(vs[4]) / scale.x;
5034+ points[3].y = fixed2float(vs[5]) / scale.y;
5035+ code = (*vdev_proc(vdev, curveto))(vdev,
5036+ points[0].x,
5037+ points[0].y,
5038+ points[1].x,
5039+ points[1].y,
5040+ points[2].x,
5041+ points[2].y,
5042+ points[3].x,
5043+ points[3].y,
5044+ type);
5045+ if (code) ecode = code;
5046+ points[0] = points[3];
50375047 #endif
5038- break;
5039- case gs_pe_closepath:
5040- /* close path */
5041- code = (*vdev_proc(vdev, closepath))(
5042- vdev,
5043- points[0].x,
5044- points[0].y,
5045- start.x,
5046- start.y,
5047- type);
5048- if (code) ecode = code;
5049- points[0] = start;
5050-#ifdef OPVP_OPT_MULTI_PATH
5051- current = start;
5048+ break;
5049+ case gs_pe_closepath:
5050+ /* close path */
5051+ code = (*vdev_proc(vdev, closepath))(
5052+ vdev,
5053+ points[0].x,
5054+ points[0].y,
5055+ start.x,
5056+ start.y,
5057+ type);
5058+ if (code) ecode = code;
5059+ points[0] = start;
5060+#ifdef OPVP_OPT_MULTI_PATH
5061+ current = start;
50525062 #endif
5053- break;
5054- default:
5055- /* error */
5056- return_error(gs_error_unknownerror);
5057- break;
5058- }
5063+ break;
5064+ default:
5065+ /* error */
5066+ return_error(gs_error_unknownerror);
5067+ break;
5068+ }
50595069
5060-#ifdef OPVP_OPT_MULTI_PATH
5061- pop = op;
5070+#ifdef OPVP_OPT_MULTI_PATH
5071+ pop = op;
50625072 #endif
50635073 }
50645074
@@ -5066,7 +5076,7 @@
50665076 code = (*vdev_proc(vdev, endpath))(vdev, type);
50675077 if (code) ecode = code;
50685078
5069-#ifdef OPVP_OPT_MULTI_PATH
5079+#ifdef OPVP_OPT_MULTI_PATH
50705080 if (points) free(points);
50715081 if (opvp_p) free(opvp_p);
50725082 if (cp_num) free(cp_num);
@@ -5077,7 +5087,7 @@
50775087 /*
50785088 * vector do rect
50795089 */
5080-static int
5090+static int
50815091 opvp_vector_dorect(
50825092 gx_device_vector *vdev,
50835093 fixed x0,
@@ -5103,31 +5113,31 @@
51035113 scale = vdev->scale;
51045114
51055115 if (!ecode) {
5106- /* rectangle */
5107- p.x = fixed2float(x0) / scale.x;
5108- p.y = fixed2float(y0) / scale.y;
5109- OPVP_F2FIX(p.x, rectangles[0].p0.x);
5110- OPVP_F2FIX(p.y, rectangles[0].p0.y);
5111- p.x = fixed2float(x1) / scale.x;
5112- p.y = fixed2float(y1) / scale.y;
5113- OPVP_F2FIX(p.x, rectangles[0].p1.x);
5114- OPVP_F2FIX(p.y, rectangles[0].p1.y);
5116+ /* rectangle */
5117+ p.x = fixed2float(x0) / scale.x;
5118+ p.y = fixed2float(y0) / scale.y;
5119+ OPVP_F2FIX(p.x, rectangles[0].p0.x);
5120+ OPVP_F2FIX(p.y, rectangles[0].p0.y);
5121+ p.x = fixed2float(x1) / scale.x;
5122+ p.y = fixed2float(y1) / scale.y;
5123+ OPVP_F2FIX(p.x, rectangles[0].p1.x);
5124+ OPVP_F2FIX(p.y, rectangles[0].p1.y);
51155125
5116- /* call RectanglePath */
5117- if (apiEntry->opvpRectanglePath) {
5118- r = apiEntry->opvpRectanglePath(printerContext,
5119- 1,
5120- rectangles);
5121- }
5122- if (r != OPVP_OK) {
5123- ecode = -1;
5124- }
5126+ /* call RectanglePath */
5127+ if (apiEntry->opvpRectanglePath) {
5128+ r = apiEntry->opvpRectanglePath(printerContext,
5129+ 1,
5130+ rectangles);
5131+ }
5132+ if (r != OPVP_OK) {
5133+ ecode = -1;
5134+ }
51255135 }
51265136
51275137 /* end path */
51285138 if (!ecode) {
5129- code = (*vdev_proc(vdev, endpath))(vdev, type);
5130- if (code) ecode = code;
5139+ code = (*vdev_proc(vdev, endpath))(vdev, type);
5140+ if (code) ecode = code;
51315141 }
51325142
51335143 /* fallback */
@@ -5139,7 +5149,7 @@
51395149 /*
51405150 * begin path
51415151 */
5142-static int
5152+static int
51435153 opvp_beginpath(gx_device_vector *vdev, gx_path_type_t type)
51445154 {
51455155 gx_device_opvp *pdev = (gx_device_opvp *)vdev;
@@ -5151,16 +5161,16 @@
51515161
51525162 /* check clip-path */
51535163 if (type & gx_path_type_clip) {
5154- if (apiEntry->opvpResetClipPath)
5155- apiEntry->opvpResetClipPath(printerContext);
5164+ if (apiEntry->opvpResetClipPath)
5165+ apiEntry->opvpResetClipPath(printerContext);
51565166 }
51575167
51585168 /* call NewPath */
51595169 if (apiEntry->opvpNewPath) {
5160- r = apiEntry->opvpNewPath(printerContext);
5170+ r = apiEntry->opvpNewPath(printerContext);
51615171 }
51625172 if (r != OPVP_OK) {
5163- ecode = -1;
5173+ ecode = -1;
51645174 }
51655175
51665176 return ecode;
@@ -5169,7 +5179,7 @@
51695179 /*
51705180 * move to
51715181 */
5172-static int
5182+static int
51735183 opvp_moveto(
51745184 gx_device_vector *vdev,
51755185 floatp x0,
@@ -5190,10 +5200,10 @@
51905200 OPVP_F2FIX(x1, p.x);
51915201 OPVP_F2FIX(y1, p.y);
51925202 if (apiEntry->opvpSetCurrentPoint) {
5193- r = apiEntry->opvpSetCurrentPoint(printerContext, p.x, p.y);
5203+ r = apiEntry->opvpSetCurrentPoint(printerContext, p.x, p.y);
51945204 }
51955205 if (r != OPVP_OK) {
5196- ecode = -1;
5206+ ecode = -1;
51975207 }
51985208
51995209 return ecode;
@@ -5202,7 +5212,7 @@
52025212 /*
52035213 * line to
52045214 */
5205-static int
5215+static int
52065216 opvp_lineto(
52075217 gx_device_vector *vdev,
52085218 floatp x0,
@@ -5225,10 +5235,10 @@
52255235
52265236 /* call LinePath */
52275237 if (apiEntry->opvpLinePath) {
5228- r = apiEntry->opvpLinePath(printerContext, OPVP_PATHOPEN, 1, points);
5238+ r = apiEntry->opvpLinePath(printerContext, OPVP_PATHOPEN, 1, points);
52295239 }
52305240 if (r != OPVP_OK) {
5231- ecode = -1;
5241+ ecode = -1;
52325242 }
52335243
52345244 return ecode;
@@ -5237,7 +5247,7 @@
52375247 /*
52385248 * curve to
52395249 */
5240-static int
5250+static int
52415251 opvp_curveto(
52425252 gx_device_vector *vdev,
52435253 floatp x0,
@@ -5273,13 +5283,13 @@
52735283
52745284 /* call BezierPath */
52755285 if (apiEntry->opvpBezierPath) {
5276- r = apiEntry->opvpBezierPath(printerContext,
5277- 3,
5278- &(points[1])
5279- );
5286+ r = apiEntry->opvpBezierPath(printerContext,
5287+ 3,
5288+ &(points[1])
5289+ );
52805290 }
52815291 if (r != OPVP_OK) {
5282- ecode = -1;
5292+ ecode = -1;
52835293 }
52845294
52855295 return ecode;
@@ -5288,7 +5298,7 @@
52885298 /*
52895299 * close path
52905300 */
5291-static int
5301+static int
52925302 opvp_closepath(
52935303 gx_device_vector *vdev,
52945304 floatp x,
@@ -5311,10 +5321,10 @@
53115321
53125322 /* call LinePath */
53135323 if (apiEntry->opvpLinePath) {
5314- r = apiEntry->opvpLinePath(printerContext, OPVP_PATHCLOSE, 1, points);
5324+ r = apiEntry->opvpLinePath(printerContext, OPVP_PATHCLOSE, 1, points);
53155325 }
53165326 if (r != OPVP_OK) {
5317- ecode = -1;
5327+ ecode = -1;
53185328 }
53195329
53205330 return ecode;
@@ -5323,7 +5333,7 @@
53235333 /*
53245334 * end path
53255335 */
5326-static int
5336+static int
53275337 opvp_endpath(gx_device_vector *vdev, gx_path_type_t type)
53285338 {
53295339 gx_device_opvp *pdev = (gx_device_opvp *)vdev;
@@ -5335,75 +5345,75 @@
53355345
53365346 /* call EndPath */
53375347 if (apiEntry->opvpEndPath) {
5338- r = apiEntry->opvpEndPath(printerContext);
5348+ r = apiEntry->opvpEndPath(printerContext);
53395349 }
53405350 if (r != OPVP_OK) {
5341- ecode = -1;
5351+ ecode = -1;
53425352 }
53435353
53445354 if (type & gx_path_type_fill) {
5345- /* fill mode */
5346- if (type & gx_path_type_even_odd) {
5347- /* call SetFillMode */
5348- if (apiEntry->opvpSetFillMode) {
5349- r = apiEntry->opvpSetFillMode(
5350- printerContext,
5351- OPVP_FILLMODE_EVENODD
5352- );
5353- }
5354- if (r != OPVP_OK) {
5355- ecode = -1;
5356- }
5357- } else {
5358- /* call SetFillMode */
5359- if (apiEntry->opvpSetFillMode) {
5360- r = apiEntry->opvpSetFillMode(
5361- printerContext,
5362- OPVP_FILLMODE_WINDING
5363- );
5364- }
5365- if (r != OPVP_OK) {
5366- ecode = -1;
5367- }
5368- }
5355+ /* fill mode */
5356+ if (type & gx_path_type_even_odd) {
5357+ /* call SetFillMode */
5358+ if (apiEntry->opvpSetFillMode) {
5359+ r = apiEntry->opvpSetFillMode(
5360+ printerContext,
5361+ OPVP_FILLMODE_EVENODD
5362+ );
5363+ }
5364+ if (r != OPVP_OK) {
5365+ ecode = -1;
5366+ }
5367+ } else {
5368+ /* call SetFillMode */
5369+ if (apiEntry->opvpSetFillMode) {
5370+ r = apiEntry->opvpSetFillMode(
5371+ printerContext,
5372+ OPVP_FILLMODE_WINDING
5373+ );
5374+ }
5375+ if (r != OPVP_OK) {
5376+ ecode = -1;
5377+ }
5378+ }
53695379
5370- if (type & gx_path_type_stroke) {
5371- /* call StrokeFillPath */
5372- if (apiEntry->opvpStrokeFillPath) {
5373- r = apiEntry->opvpStrokeFillPath(printerContext);
5374- }
5375- if (r != OPVP_OK) {
5376- ecode = -1;
5377- }
5378- } else {
5379- /* call FillPath */
5380- if (apiEntry->opvpFillPath) {
5381- r = apiEntry->opvpFillPath(printerContext);
5382- }
5383- if (r != OPVP_OK) {
5384- ecode = -1;
5385- }
5386- }
5380+ if (type & gx_path_type_stroke) {
5381+ /* call StrokeFillPath */
5382+ if (apiEntry->opvpStrokeFillPath) {
5383+ r = apiEntry->opvpStrokeFillPath(printerContext);
5384+ }
5385+ if (r != OPVP_OK) {
5386+ ecode = -1;
5387+ }
5388+ } else {
5389+ /* call FillPath */
5390+ if (apiEntry->opvpFillPath) {
5391+ r = apiEntry->opvpFillPath(printerContext);
5392+ }
5393+ if (r != OPVP_OK) {
5394+ ecode = -1;
5395+ }
5396+ }
53875397 } else if (type & gx_path_type_clip) {
5388- /* call SetClipPath */
5389- if (apiEntry->opvpSetClipPath) {
5390- r = apiEntry->opvpSetClipPath(
5391- printerContext,
5392- (type & gx_path_type_even_odd
5393- ? OPVP_CLIPRULE_EVENODD
5394- : OPVP_CLIPRULE_WINDING));
5395- }
5396- if (r != OPVP_OK) {
5397- ecode = -1;
5398- }
5398+ /* call SetClipPath */
5399+ if (apiEntry->opvpSetClipPath) {
5400+ r = apiEntry->opvpSetClipPath(
5401+ printerContext,
5402+ (type & gx_path_type_even_odd
5403+ ? OPVP_CLIPRULE_EVENODD
5404+ : OPVP_CLIPRULE_WINDING));
5405+ }
5406+ if (r != OPVP_OK) {
5407+ ecode = -1;
5408+ }
53995409 } else if (type & gx_path_type_stroke) {
5400- /* call StrokePath */
5401- if (apiEntry->opvpStrokePath) {
5402- r = apiEntry->opvpStrokePath(printerContext);
5403- }
5404- if (r != OPVP_OK) {
5405- ecode = -1;
5406- }
5410+ /* call StrokePath */
5411+ if (apiEntry->opvpStrokePath) {
5412+ r = apiEntry->opvpStrokePath(printerContext);
5413+ }
5414+ if (r != OPVP_OK) {
5415+ ecode = -1;
5416+ }
54075417 }
54085418
54095419 return ecode;
Show on old repository browser