/* This version does a rect fill with the transparency object */ int gx_dc_pat_trans_fill_rectangle(const gx_device_color * pdevc, int x, int y, int w, int h, gx_device * dev, gs_logical_operation_t lop, const gx_rop_source_t * source) { gx_color_tile *ptile = pdevc->colors.pattern.p_tile; int code; gs_int_point phase; const gx_rop_source_t *rop_source = source; gx_rop_source_t no_source; if (ptile == 0) /* null pattern */ return 0; if (rop_source == NULL) set_rop_no_source(rop_source, no_source, dev); phase.x = pdevc->phase.x; phase.y = pdevc->phase.y; code = gx_trans_pattern_fill_rect(x, y, x+w, y+h, ptile, ptile->ttrans->fill_trans_buffer, phase, dev, pdevc); return code; }
/* Note that we treat this as "texture" for RasterOp. */ static int gx_dc_pure_fill_rectangle(const gx_device_color * pdevc, int x, int y, int w, int h, gx_device * dev, gs_logical_operation_t lop, const gx_rop_source_t * source) { if (source == NULL && lop_no_S_is_T(lop)) return (*dev_proc(dev, fill_rectangle)) (dev, x, y, w, h, pdevc->colors.pure); { gx_color_index colors[2]; gx_rop_source_t no_source; colors[0] = colors[1] = pdevc->colors.pure; if (source == NULL) set_rop_no_source(source, no_source, dev); return (*dev_proc(dev, strip_copy_rop)) (dev, source->sdata, source->sourcex, source->sraster, source->id, (source->use_scolors ? source->scolors : NULL), NULL /*arbitrary */ , colors, x, y, w, h, 0, 0, lop); } }
int gx_dc_pattern_fill_rectangle(const gx_device_color * pdevc, int x, int y, int w, int h, gx_device * dev, gs_logical_operation_t lop, const gx_rop_source_t * source) { gx_color_tile *ptile = pdevc->colors.pattern.p_tile; const gx_rop_source_t *rop_source = source; gx_rop_source_t no_source; gx_strip_bitmap *bits; tile_fill_state_t state; int code; if (ptile == 0) /* null pattern */ return 0; if (rop_source == NULL) set_rop_no_source(rop_source, no_source, dev); bits = &ptile->tbits; state.cdev.finalize = 0; code = tile_fill_init(&state, pdevc, dev, false); if (code < 0) return code; if (ptile->is_simple && ptile->cdev == NULL) { int px = imod(-(int)fastfloor(ptile->step_matrix.tx - state.phase.x + 0.5), bits->rep_width); int py = imod(-(int)fastfloor(ptile->step_matrix.ty - state.phase.y + 0.5), bits->rep_height); if (state.pcdev != dev) tile_clip_set_phase(&state.cdev, px, py); /* RJW: Can we get away with calling the simpler version? Not * if we are working in planar mode because the default * strip_tile_rectangle doesn't understand bits being in planar * mode at the moment. */ if (source == NULL && lop_no_S_is_T(lop) && state.num_planes == -1) code = (*dev_proc(state.pcdev, strip_tile_rectangle)) (state.pcdev, bits, x, y, w, h, gx_no_color_index, gx_no_color_index, px, py); else if (rop_source->planar_height == 0) code = (*dev_proc(state.pcdev, strip_copy_rop)) (state.pcdev, rop_source->sdata, rop_source->sourcex, rop_source->sraster, rop_source->id, (rop_source->use_scolors ? rop_source->scolors : NULL), bits, NULL, x, y, w, h, px, py, lop); else code = (*dev_proc(state.pcdev, strip_copy_rop2)) (state.pcdev, rop_source->sdata, rop_source->sourcex, rop_source->sraster, rop_source->id, (rop_source->use_scolors ? rop_source->scolors : NULL), bits, NULL, x, y, w, h, px, py, lop, rop_source->planar_height); } else { state.lop = lop; state.source = source; state.orig_dev = dev; if (ptile->cdev == NULL) { code = tile_by_steps(&state, x, y, w, h, ptile, &ptile->tbits, tile_colored_fill); } else { gx_device_clist *cdev = ptile->cdev; gx_device_clist_reader *crdev = (gx_device_clist_reader *)cdev; gx_strip_bitmap tbits; crdev->yplane.depth = 0; /* Don't know what to set here. */ crdev->yplane.shift = 0; crdev->yplane.index = -1; crdev->pages = NULL; crdev->num_pages = 1; state.orig_dev = dev; tbits = ptile->tbits; tbits.size.x = crdev->width; tbits.size.y = crdev->height; code = tile_by_steps(&state, x, y, w, h, ptile, &tbits, tile_pattern_clist); } } if(state.cdev.finalize) state.cdev.finalize((gx_device *)&state.cdev); return code; }
/* Note that we treat this as "texture" for RasterOp. */ static int tile_colored_fill(const tile_fill_state_t * ptfs, int x, int y, int w, int h) { gx_color_tile *ptile = ptfs->pdevc->colors.pattern.p_tile; gs_logical_operation_t lop = ptfs->lop; const gx_rop_source_t *source = ptfs->source; gx_device *dev = ptfs->orig_dev; int xoff = ptfs->xoff, yoff = ptfs->yoff; gx_strip_bitmap *bits = &ptile->tbits; const byte *data = bits->data; bool full_transfer = (w == ptfs->w0 && h == ptfs->h0); int code = 0; if (source == NULL && lop_no_S_is_T(lop) && ptfs->num_planes < 0) { /* RJW: Ideally, we'd like to remove the 'ptfs->num_planes < 0' test * above, and then do: * * if (ptfs->num_planes >= 0) { * int plane_step = ptile->tbits.raster * ptile->tbits.rep_height; * int k; * for (k = 0; k < ptfs->num_planes; k++) { * byte *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 * * Unfortunately, this can cause the rop source device to be called * with copy_plane. This is currently broken (and I fear cannot ever * be done properly). We therefore drop back to the strip_copy_rop * case below. */ { 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 { gx_strip_bitmap data_tile; gx_bitmap_id source_id; gx_rop_source_t no_source; if (source == NULL) set_rop_no_source(source, no_source, dev); source_id = (full_transfer ? source->id : gx_no_bitmap_id); data_tile.data = (byte *) data; /* actually const */ data_tile.raster = bits->raster; data_tile.size.x = data_tile.rep_width = ptile->tbits.size.x; data_tile.size.y = data_tile.rep_height = ptile->tbits.size.y; data_tile.id = bits->id; data_tile.shift = data_tile.rep_shift = 0; data_tile.num_planes = (ptfs->num_planes > 1 ? ptfs->num_planes : 1); if (source->planar_height == 0) { code = (*dev_proc(ptfs->pcdev, strip_copy_rop)) (ptfs->pcdev, source->sdata + (y - ptfs->y0) * source->sraster, source->sourcex + (x - ptfs->x0), source->sraster, source_id, (source->use_scolors ? source->scolors : NULL), &data_tile, NULL, x, y, w, h, imod(xoff - x, data_tile.rep_width), imod(yoff - y, data_tile.rep_height), lop); } else { code = (*dev_proc(ptfs->pcdev, strip_copy_rop2)) (ptfs->pcdev, source->sdata + (y - ptfs->y0) * source->sraster, source->sourcex + (x - ptfs->x0), source->sraster, source_id, (source->use_scolors ? source->scolors : NULL), &data_tile, NULL, x, y, w, h, imod(xoff - x, data_tile.rep_width), imod(yoff - y, data_tile.rep_height), lop, source->planar_height); } } return code; }