コード例 #1
0
ファイル: gdevbbox.c プロジェクト: ststeiger/ghostsvg
static int
bbox_output_page(gx_device * dev, int num_copies, int flush)
{
    gx_device_bbox *const bdev = (gx_device_bbox *) dev;

    if (bdev->free_standing) {
	/*
	 * This is a free-standing device.  Print the page bounding box.
	 */
	gs_rect bbox;

	gx_device_bbox_bbox(bdev, &bbox);
	dlprintf4("%%%%BoundingBox: %d %d %d %d\n",
		  (int)floor(bbox.p.x), (int)floor(bbox.p.y),
		  (int)ceil(bbox.q.x), (int)ceil(bbox.q.y));
	dlprintf4("%%%%HiResBoundingBox: %f %f %f %f\n",
		  bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y);
    }
    return gx_forward_output_page(dev, num_copies, flush);
}
コード例 #2
0
ファイル: gdevdrop.c プロジェクト: 99years/plan9
void
trace_copy_rop(const char *cname, gx_device * dev,
	       const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
	       const gx_color_index * scolors,
	       const gx_strip_bitmap * textures,
	       const gx_color_index * tcolors,
	       int x, int y, int width, int height,
	       int phase_x, int phase_y, gs_logical_operation_t lop)
{
    dlprintf4("%s: dev=0x%lx(%s) depth=%d\n",
	      cname, (ulong) dev, dev->dname, dev->color_info.depth);
    dlprintf4("  source data=0x%lx x=%d raster=%u id=%lu colors=",
	      (ulong) sdata, sourcex, sraster, (ulong) id);
    if (scolors)
	dprintf2("(%lu,%lu);\n", scolors[0], scolors[1]);
    else
	dputs("none;\n");
    if (textures)
	dlprintf8("  textures=0x%lx size=%dx%d(%dx%d) raster=%u shift=%d(%d)",
		  (ulong) textures, textures->size.x, textures->size.y,
		  textures->rep_width, textures->rep_height,
		  textures->raster, textures->shift, textures->rep_shift);
    else
	dlputs("  textures=none");
    if (tcolors)
	dprintf2(" colors=(%lu,%lu)\n", tcolors[0], tcolors[1]);
    else
	dputs(" colors=none\n");
    dlprintf7("  rect=(%d,%d),(%d,%d) phase=(%d,%d) op=0x%x\n",
	      x, y, x + width, y + height, phase_x, phase_y,
	      (uint) lop);
    if (gs_debug_c('B')) {
	if (sdata)
	    debug_dump_bitmap(sdata, sraster, height, "source bits");
	if (textures && textures->data)
	    debug_dump_bitmap(textures->data, textures->raster,
			      textures->size.y, "textures bits");
    }
}
コード例 #3
0
ファイル: gscoord.c プロジェクト: BorodaZizitopa/ghostscript
int
gs_translate_untransformed(gs_state * pgs, floatp dx, floatp dy)
{
    gs_point pt;
    int code;

    pt.x = (float)dx + pgs->ctm.tx;
    pt.y = (float)dy + pgs->ctm.ty;
    update_ctm(pgs, pt.x, pt.y);
#ifdef DEBUG
    if (gs_debug_c('x'))
        dlprintf4("[x]translate_untransformed: %f %f -> %f %f\n",
                  dx, dy, pt.x, pt.y),
            trace_ctm(pgs);
#endif
    return 0;
}
コード例 #4
0
ファイル: gscoord.c プロジェクト: BorodaZizitopa/ghostscript
int
gs_translate(gs_state * pgs, floatp dx, floatp dy)
{
    gs_point pt;
    int code;

    if ((code = gs_distance_transform(dx, dy, &ctm_only(pgs), &pt)) < 0)
        return code;
    pt.x = (float)pt.x + pgs->ctm.tx;
    pt.y = (float)pt.y + pgs->ctm.ty;
    update_ctm(pgs, pt.x, pt.y);
#ifdef DEBUG
    if (gs_debug_c('x'))
        dlprintf4("[x]translate: %f %f -> %f %f\n",
                  dx, dy, pt.x, pt.y),
            trace_ctm(pgs);
#endif
    return 0;
}
コード例 #5
0
ファイル: gxpath.c プロジェクト: BorodaZizitopa/ghostscript
/* Print a path */
void
gx_path_print(const gx_path * ppath)
{
    const segment *pseg = (const segment *)ppath->first_subpath;

    dlprintf5(" %% state_flags=%d subpaths=%d, curves=%d, point=(%f,%f)\n",
              ppath->state_flags, ppath->subpath_count, ppath->curve_count,
              fixed2float(ppath->position.x),
              fixed2float(ppath->position.y));
    dlprintf5(" %% box=(%f,%f),(%f,%f) last=0x%lx\n",
              fixed2float(ppath->bbox.p.x), fixed2float(ppath->bbox.p.y),
              fixed2float(ppath->bbox.q.x), fixed2float(ppath->bbox.q.y),
              (ulong) ppath->box_last);
    dlprintf4(" %% segments=0x%lx (refct=%ld, first=0x%lx, current=0x%lx)\n",
              (ulong) ppath->segments, (long)ppath->segments->rc.ref_count,
              (ulong) ppath->segments->contents.subpath_first,
              (ulong) ppath->segments->contents.subpath_current);
    while (pseg) {
        dlputs("");
        gx_print_segment(pseg);
        pseg = pseg->next;
    }
}
コード例 #6
0
/* Allocate various kinds of blocks. */
static byte *
gs_heap_alloc_bytes(gs_memory_t * mem, uint size, client_name_t cname)
{
    gs_malloc_memory_t *mmem = (gs_malloc_memory_t *) mem;
    byte *ptr = 0;

#ifdef DEBUG
    const char *msg;
    static const char *const ok_msg = "OK";

#  define set_msg(str) (msg = (str))
#else
#  define set_msg(str) DO_NOTHING
#endif

    	/* Exclusive acces so our decisions and changes are 'atomic' */
    if (mmem->monitor)
	gx_monitor_enter(mmem->monitor);
    if (size > mmem->limit - sizeof(gs_malloc_block_t)) {
	/* Definitely too large to allocate; also avoids overflow. */
	set_msg("exceeded limit");
    } else {
	uint added = size + sizeof(gs_malloc_block_t);

	if (mmem->limit - added < mmem->used)
	    set_msg("exceeded limit");
	else if ((ptr = (byte *) malloc(added)) == 0)
	    set_msg("failed");
	else {
	    gs_malloc_block_t *bp = (gs_malloc_block_t *) ptr;

	    /*
	     * We would like to check that malloc aligns blocks at least as
	     * strictly as the compiler (as defined by ARCH_ALIGN_MEMORY_MOD).
	     * However, Microsoft VC 6 does not satisfy this requirement.
	     * See gsmemory.h for more explanation.
	     */
	    set_msg(ok_msg);
	    if (mmem->allocated)
		mmem->allocated->prev = bp;
	    bp->next = mmem->allocated;
	    bp->prev = 0;
	    bp->size = size;
	    bp->type = &st_bytes;
	    bp->cname = cname;
	    mmem->allocated = bp;
	    ptr = (byte *) (bp + 1);
	    mmem->used += size + sizeof(gs_malloc_block_t);
	    if (mmem->used > mmem->max_used)
		mmem->max_used = mmem->used;
	}
    }
    if (mmem->monitor)
	gx_monitor_leave(mmem->monitor);	/* Done with exclusive access */
    /* We don't want to 'fill' under mutex to keep the window smaller */
    if (ptr)
	gs_alloc_fill(ptr, gs_alloc_fill_alloc, size);
#ifdef DEBUG
    if (gs_debug_c('a') || msg != ok_msg)
	dlprintf4("[a+]gs_malloc(%s)(%u) = 0x%lx: %s\n",
		  client_name_string(cname), size, (ulong) ptr, msg);
#endif
    return ptr;
#undef set_msg
}