[gs-commits] ghostpdl branch, master, updated. ghostpdl-9.02-551-gaa715ab
Michael Vrhel
mvrhel at ghostscript.com
Fri Aug 26 00:02:21 UTC 2011
The ghostpdl branch, master has been updated
via aa715abee9f38daba6c9504495dca309e8e3ed64 (commit)
via cb54af824c8f0aa343167b1e8b99dd1d53e47955 (commit)
from c2f005a525f49bf43fb796908e0ab9c4b6ed58a4 (commit)
----------------------------------------------------------------------
commit aa715abee9f38daba6c9504495dca309e8e3ed64
Author: Michael Vrhel <michael.vrhel at artifex.com>
Date: Tue Aug 23 10:31:03 2011 -0700
Fix so pattern debug code dumps planar bitmap.
diff --git a/gs/base/gxpcmap.c b/gs/base/gxpcmap.c
index c292d0e..1f6e44f 100644
--- a/gs/base/gxpcmap.c
+++ b/gs/base/gxpcmap.c
@@ -1091,30 +1091,78 @@ gx_pattern_cache_add_dummy_entry(gs_imager_state *pis,
file name */
static void
dump_raw_pattern(int height, int width, int n_chan, int depth,
- byte *Buffer, int raster)
+ byte *Buffer, int raster, const gx_device_memory * mdev)
{
char full_file_name[50];
FILE *fid;
int max_bands;
- int j,k;
+ int j, k, m;
int byte_number, bit_position;
unsigned char current_byte;
unsigned char output_val;
+ bool is_planar;
+ byte *curr_ptr = Buffer;
+ int plane_offset;
+ is_planar = dev_proc(mdev, dev_spec_op)(mdev, gxdso_is_native_planar, NULL, 0);
max_bands = ( n_chan < 57 ? n_chan : 56); /* Photoshop handles at most 56 bands */
- sprintf(full_file_name,"%d)PATTERN_%dx%dx%d.raw",global_pat_index,width,height,max_bands);
+ if (is_planar) {
+ sprintf(full_file_name,"%d)PATTERN_PLANE_%dx%dx%d.raw",global_pat_index,
+ width,height,max_bands);
+ } else {
+ sprintf(full_file_name,"%d)PATTERN_CHUNK_%dx%dx%d.raw",global_pat_index,
+ width,height,max_bands);
+ }
fid = fopen(full_file_name,"wb");
- if (depth > 1) {
- fwrite(Buffer,1,max_bands*height*width,fid);
+ if (depth == 8 * n_chan) {
+ /* Contone data. */
+ if (is_planar) {
+ for (m = 0; m < max_bands; m++) {
+ curr_ptr = mdev->line_ptrs[m*mdev->height];
+ fwrite(curr_ptr,1,height*width,fid);
+ }
+ } else {
+ /* Just dump it like it is */
+ fwrite(Buffer,1,max_bands*height*width,fid);
+ }
} else {
- /* Binary image. Lets get to 8 bit for debugging */
- for (j = 0; j < height; j++) {
- for (k = 0; k < width; k++) {
- byte_number = (int) ceil((( (float) k + 1.0) / 8.0)) - 1;
- current_byte = Buffer[j*raster+byte_number];
- bit_position = 7 - (k - byte_number*8);
- output_val = ((current_byte >> bit_position) & 0x1) * 255;
- fwrite(&output_val,1,1,fid);
+ /* Binary Data. Lets get to 8 bit for debugging. We have to
+ worry about planar vs. chunky. Note this assumes 1 bit data
+ only. */
+ if (is_planar) {
+ plane_offset = mdev->raster * mdev->height;
+ for (m = 0; m < max_bands; m++) {
+ curr_ptr = mdev->line_ptrs[m*mdev->height];
+ for (j = 0; j < height; j++) {
+ for (k = 0; k < width; k++) {
+ byte_number = (int) ceil((( (float) k + 1.0) / 8.0)) - 1;
+ current_byte = curr_ptr[j*(mdev->raster) + byte_number];
+ bit_position = 7 - (k - byte_number*8);
+ output_val = ((current_byte >> bit_position) & 0x1) * 255;
+ fwrite(&output_val,1,1,fid);
+ }
+ }
+ }
+ } else {
+ for (j = 0; j < height; j++) {
+ for (k = 0; k < width; k++) {
+ for (m = 0; m < max_bands; m++) {
+ /* index current byte */
+ byte_number =
+ (int) ceil((( (float) k * (float) max_bands +
+ (float) m + 1.0) / 8.0)) - 1;
+ /* get byte of interest */
+ current_byte =
+ curr_ptr[j*(mdev->raster) + byte_number];
+ /* get bit position */
+ bit_position =
+ 7 - (k * max_bands + m - byte_number * 8);
+ /* extract and create byte */
+ output_val =
+ ((current_byte >> bit_position) & 0x1) * 255;
+ fwrite(&output_val,1,1,fid);
+ }
+ }
}
}
}
@@ -1140,7 +1188,7 @@ make_bitmap(register gx_strip_bitmap * pbm, const gx_device_memory * mdev,
mdev->color_info.num_components,
mdev->color_info.depth,
(unsigned char*) mdev->base,
- pbm->raster);
+ pbm->raster, mdev);
global_pat_index++;
----------------------------------------------------------------------
commit cb54af824c8f0aa343167b1e8b99dd1d53e47955
Author: Michael Vrhel <michael.vrhel at artifex.com>
Date: Tue Aug 23 16:26:24 2011 -0700
non-clist pattern rendering for planar devices.
diff --git a/gs/base/gxp1fill.c b/gs/base/gxp1fill.c
index 846c023..0d6671b 100644
--- a/gs/base/gxp1fill.c
+++ b/gs/base/gxp1fill.c
@@ -30,6 +30,7 @@
#include "gxcldev.h"
#include "gxblend.h"
#include "gsicc_cache.h"
+#include "gxdevsop.h"
#include "gdevp14.h"
@@ -51,6 +52,8 @@ typedef struct tile_fill_state_s {
gx_device *pcdev; /* original device or &cdev */
const gx_strip_bitmap *tmask;
gs_int_point phase;
+ int num_planes; /* negative if not planar */
+
/* Following are only for uncolored patterns */
@@ -90,8 +93,15 @@ tile_fill_init(tile_fill_state_t * ptfs, const gx_device_color * pdevc,
{
gx_color_tile *m_tile = pdevc->mask.m_tile;
int px, py;
+ bool is_planar;
ptfs->pdevc = pdevc;
+ is_planar = dev_proc(dev, dev_spec_op)(dev, gxdso_is_native_planar, NULL, 0);
+ if (is_planar) {
+ ptfs->num_planes = dev->color_info.num_components;
+ } else {
+ ptfs->num_planes = -1;
+ }
if (m_tile == 0) { /* no clipping */
ptfs->pcdev = dev;
ptfs->phase = pdevc->phase;
@@ -226,19 +236,33 @@ tile_colored_fill(const tile_fill_state_t * ptfs,
gx_device *dev = ptfs->orig_dev;
int xoff = ptfs->xoff, yoff = ptfs->yoff;
gx_strip_bitmap *bits = &ptile->tbits;
+ int plane_step = ptile->tbits.raster * ptile->tbits.rep_height;
const byte *data = bits->data;
bool full_transfer = (w == ptfs->w0 && h == ptfs->h0);
gx_bitmap_id source_id =
(full_transfer ? rop_source->id : gx_no_bitmap_id);
- int code;
+ int code = 0;
+ int k;
+ byte *data_plane;
- if (source == NULL && lop_no_S_is_T(lop))
- code = (*dev_proc(ptfs->pcdev, copy_color))
- (ptfs->pcdev, data + bits->raster * yoff, xoff,
- bits->raster,
- (full_transfer ? bits->id : gx_no_bitmap_id),
- x, y, w, h);
- else {
+ if (source == NULL && lop_no_S_is_T(lop)) {
+ if (ptfs->num_planes < 0) {
+ code = (*dev_proc(ptfs->pcdev, copy_color))
+ (ptfs->pcdev, data + bits->raster * yoff, xoff,
+ bits->raster,
+ (full_transfer ? bits->id : gx_no_bitmap_id),
+ x, y, w, h);
+ } else {
+ for (k = 0; k < ptfs->num_planes; k++) {
+ /* Get the proper pointer to the data plane */
+ data_plane = (byte*) (data + plane_step * k);
+ (*dev_proc(ptfs->pcdev, copy_plane)) (ptfs->pcdev,
+ data_plane + bits->raster * yoff, xoff, bits->raster,
+ gx_no_bitmap_id, x, y,
+ w, h, k);
+ }
+ }
+ } else {
gx_strip_bitmap data_tile;
data_tile.data = (byte *) data; /* actually const */
diff --git a/gs/base/lib.mak b/gs/base/lib.mak
index 2b0619e..ae43836 100644
--- a/gs/base/lib.mak
+++ b/gs/base/lib.mak
@@ -2357,7 +2357,7 @@ $(GLOBJ)gxp1fill.$(OBJ) : $(GLSRC)gxp1fill.c $(AK) $(gx_h)\
$(gserrors_h) $(string__h) $(math__h) $(gsrop_h) $(gsmatrix_h)\
$(gxcolor2_h) $(gxclip2_h) $(gxcspace_h) $(gxdcolor_h) $(gxdevcli_h)\
$(gxdevmem_h) $(gxpcolor_h) $(gxp1impl_h) $(gxcldev_h) $(gxblend_h)\
- $(gsicc_cache_h) $(MAKEDIRS)
+ $(gsicc_cache_h) $(gxdevsop_h) $(MAKEDIRS)
$(GLCC) $(GLO_)gxp1fill.$(OBJ) $(C_) $(GLSRC)gxp1fill.c
$(GLOBJ)gxpcmap.$(OBJ) : $(GLSRC)gxpcmap.c $(AK) $(gx_h) $(gserrors_h)\
Summary of changes:
gs/base/gxp1fill.c | 40 ++++++++++++++++++++++-----
gs/base/gxpcmap.c | 76 ++++++++++++++++++++++++++++++++++++++++++---------
gs/base/lib.mak | 2 +-
3 files changed, 95 insertions(+), 23 deletions(-)
More information about the gs-commits
mailing list