Bug 691893 - improve api for using word memory devices
Summary: improve api for using word memory devices
Status: RESOLVED WONTFIX
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Graphics Library (show other bugs)
Version: master
Hardware: PC All
: P4 normal
Assignee: Default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-17 17:26 UTC by Henry Stiles
Modified: 2023-05-11 13:00 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henry Stiles 2011-01-17 17:26:39 UTC
It seems a bit difficult to hook up the word memory devices.  Here is a possible but ugly solution, the user defines USE_WORD_MEMORY_DEVICES appropriately in gdevmem.h.


Index: base/gdevm64.c
===================================================================
--- base/gdevm64.c	(revision 12031)
+++ base/gdevm64.c	(working copy)
@@ -43,6 +43,7 @@
 /* Procedures */
 declare_mem_procs(mem_true64_copy_mono, mem_true64_copy_color, mem_true64_fill_rectangle);
 
+#ifndef USE_WORD_MEMORY_DEVICES
 /* The device descriptor. */
 const gx_device_memory mem_true64_device =
 mem_full_alpha_device("image64", 64, 0, mem_open,
@@ -51,6 +52,7 @@
 		      gx_default_map_cmyk_color, gx_default_copy_alpha,
 		 gx_default_strip_tile_rectangle, mem_default_strip_copy_rop,
 		      mem_get_bits_rectangle);
+#endif
 
 /* Convert x coordinate to byte offset in scan line. */
 #undef x_to_byte
Index: base/gdevm56.c
===================================================================
--- base/gdevm56.c	(revision 12031)
+++ base/gdevm56.c	(working copy)
@@ -43,6 +43,7 @@
 /* Procedures */
 declare_mem_procs(mem_true56_copy_mono, mem_true56_copy_color, mem_true56_fill_rectangle);
 
+#ifndef USE_WORD_MEMORY_DEVICES
 /* The device descriptor. */
 const gx_device_memory mem_true56_device =
 mem_full_alpha_device("image56", 56, 0, mem_open,
@@ -51,6 +52,7 @@
 		      gx_default_map_cmyk_color, gx_default_copy_alpha,
 		 gx_default_strip_tile_rectangle, mem_default_strip_copy_rop,
 		      mem_get_bits_rectangle);
+#endif
 
 /* Convert x coordinate to byte offset in scan line. */
 #undef x_to_byte
Index: base/gdevm48.c
===================================================================
--- base/gdevm48.c	(revision 12031)
+++ base/gdevm48.c	(working copy)
@@ -382,6 +382,7 @@
 /* Procedures */
 declare_mem_procs(mem48_word_copy_mono, mem48_word_copy_color, mem48_word_fill_rectangle);
 
+#ifndef USE_WORD_MEMORY_DEVICES
 /* Here is the device descriptor. */
 const gx_device_memory mem_true48_word_device =
 mem_full_device("image48w", 48, 0, mem_open,
@@ -389,6 +390,7 @@
      mem48_word_copy_mono, mem48_word_copy_color, mem48_word_fill_rectangle,
 		gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
 		gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
+#endif
 
 /* Fill a rectangle with a color. */
 static int
Index: base/gdevmem.h
===================================================================
--- base/gdevmem.h	(revision 12031)
+++ base/gdevmem.h	(working copy)
@@ -197,7 +197,21 @@
 		       x_to_byte(w), h)
 
 /* ------ Implementations ------ */
+#define USE_WORD_MEMORY_DEVICES
 
+#ifdef USE_WORD_MEMORY_DEVICES
+#  define mem_mono_device mem_mono_word_device
+#  define mem_mapped2_device mem_mapped2_word_device
+#  define mem_mapped4_device mem_mapped4_word_device
+#  define mem_mapped8_device mem_mapped8_word_device
+#  define mem_true24_device mem_true24_word_device 
+#  define mem_true32_device mem_true32_word_device
+#  define mem_true40_device mem_true40_word_device 
+#  define mem_true48_device mem_true48_word_device
+#  define mem_true56_device mem_true56_word_device
+#  define mem_true64_device mem_true64_word_device
+#endif
+
 extern const gx_device_memory mem_mono_device;
 extern const gx_device_memory mem_mapped2_device;
 extern const gx_device_memory mem_mapped4_device;
Index: base/gdevm1.c
===================================================================
--- base/gdevm1.c	(revision 12031)
+++ base/gdevm1.c	(working copy)
@@ -36,6 +36,7 @@
 
 /* The device descriptor. */
 /* The instance is public. */
+#ifndef USE_WORD_MEMORY_DEVICES
 const gx_device_memory mem_mono_device =
 mem_full_alpha_device("image1", 0, 1, mem_open,
 		      mem_mono_map_rgb_color, mem_mono_map_color_rgb,
@@ -43,6 +44,7 @@
 		      gx_default_map_cmyk_color, gx_no_copy_alpha,
 		      mem_mono_strip_tile_rectangle, mem_mono_strip_copy_rop,
 		      mem_get_bits_rectangle);
+#endif
 
 /* Map color to/from RGB.  This may be inverted. */
 static gx_color_index
Index: base/gdevm2.c
===================================================================
--- base/gdevm2.c	(revision 12031)
+++ base/gdevm2.c	(working copy)
@@ -28,11 +28,13 @@
 declare_mem_procs(mem_mapped2_copy_mono, mem_mapped2_copy_color, mem_mapped2_fill_rectangle);
 
 /* The device descriptor. */
+#ifndef USE_WORD_MEMORY_DEVICES
 const gx_device_memory mem_mapped2_device =
 mem_device("image2", 2, 0,
 	   mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
 	   mem_mapped2_copy_mono, mem_mapped2_copy_color,
 	   mem_mapped2_fill_rectangle, mem_gray_strip_copy_rop);
+#endif
 
 /* Convert x coordinate to byte offset in scan line. */
 #undef x_to_byte
Index: base/gdevm4.c
===================================================================
--- base/gdevm4.c	(revision 12031)
+++ base/gdevm4.c	(working copy)
@@ -27,13 +27,14 @@
 /* Procedures */
 declare_mem_procs(mem_mapped4_copy_mono, mem_mapped4_copy_color, mem_mapped4_fill_rectangle);
 
+#ifndef USE_WORD_MEMORY_DEVICES
 /* The device descriptor. */
 const gx_device_memory mem_mapped4_device =
 mem_device("image4", 3, 1,
 	   mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
   mem_mapped4_copy_mono, mem_mapped4_copy_color, mem_mapped4_fill_rectangle,
 	   mem_gray_strip_copy_rop);
-
+#endif
 /* Convert x coordinate to byte offset in scan line. */
 #undef x_to_byte
 #define x_to_byte(x) ((x) >> 1)
Index: base/gdevm8.c
===================================================================
--- base/gdevm8.c	(revision 12031)
+++ base/gdevm8.c	(working copy)
@@ -28,13 +28,14 @@
 /* Procedures */
 declare_mem_procs(mem_mapped8_copy_mono, mem_mapped8_copy_color, mem_mapped8_fill_rectangle);
 
+#ifndef USE_WORD_MEMORY_DEVICES
 /* The device descriptor. */
 const gx_device_memory mem_mapped8_device =
 mem_device("image8", 8, 0,
 	   mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
   mem_mapped8_copy_mono, mem_mapped8_copy_color, mem_mapped8_fill_rectangle,
 	   mem_gray8_strip_copy_rop);
-
+#endif
 /* Convert x coordinate to byte offset in scan line. */
 #undef x_to_byte
 #define x_to_byte(x) (x)
Index: base/gdevm40.c
===================================================================
--- base/gdevm40.c	(revision 12031)
+++ base/gdevm40.c	(working copy)
@@ -43,6 +43,7 @@
 /* Procedures */
 declare_mem_procs(mem_true40_copy_mono, mem_true40_copy_color, mem_true40_fill_rectangle);
 
+#ifndef USE_WORD_MEMORY_DEVICES
 /* The device descriptor. */
 const gx_device_memory mem_true40_device =
 mem_full_alpha_device("image40", 40, 0, mem_open,
@@ -51,6 +52,7 @@
 		      gx_default_map_cmyk_color, gx_default_copy_alpha,
 		 gx_default_strip_tile_rectangle, mem_default_strip_copy_rop,
 		      mem_get_bits_rectangle);
+#endif
 
 /* Convert x coordinate to byte offset in scan line. */
 #undef x_to_byte
Index: base/gdevm32.c
===================================================================
--- base/gdevm32.c	(revision 12031)
+++ base/gdevm32.c	(working copy)
@@ -27,12 +27,14 @@
 declare_mem_procs(mem_true32_copy_mono, mem_true32_copy_color, mem_true32_fill_rectangle);
 
 /* The device descriptor. */
+#ifndef USE_WORD_MEMORY_DEVICES
 const gx_device_memory mem_true32_device =
 mem_full_device("image32", 24, 8, mem_open,
 		gx_default_map_rgb_color, gx_default_map_color_rgb,
      mem_true32_copy_mono, mem_true32_copy_color, mem_true32_fill_rectangle,
 	    gx_default_cmyk_map_cmyk_color, gx_default_strip_tile_rectangle,
 		mem_default_strip_copy_rop, mem_get_bits_rectangle);
+#endif
 
 /* Convert x coordinate to byte offset in scan line. */
 #undef x_to_byte
Index: base/gdevm24.c
===================================================================
--- base/gdevm24.c	(revision 12031)
+++ base/gdevm24.c	(working copy)
@@ -56,6 +56,7 @@
 declare_mem_procs(mem_true24_copy_mono, mem_true24_copy_color, mem_true24_fill_rectangle);
 static dev_proc_copy_alpha(mem_true24_copy_alpha);
 
+#ifndef USE_WORD_MEMORY_DEVICES
 /* The device descriptor. */
 const gx_device_memory mem_true24_device =
 mem_full_alpha_device("image24", 24, 0, mem_open,
@@ -64,6 +65,7 @@
 		      gx_default_map_cmyk_color, mem_true24_copy_alpha,
 		 gx_default_strip_tile_rectangle, mem_true24_strip_copy_rop,
 		      mem_get_bits_rectangle);
+#endif
 
 /* Convert x coordinate to byte offset in scan line. */
 #undef x_to_byte
Comment 1 Henry Stiles 2011-03-14 18:23:19 UTC
After studying this I think the word-device facility should simply be removed.  I'll do it unless there are objections.
Comment 2 Peter Cherepanov 2020-12-28 05:57:35 UTC
These devices are still not removed.
Comment 3 Ken Sharp 2021-10-09 12:22:18 UTC
Assigning back to Henry. Henry if you want someone else to take on the job of removing the devices please reassign.