+#define IMAGER_NO_CONTEXT
#include "imageri.h"
#include <stdlib.h>
void
i_int_init_hlines(
i_int_hlines *hlines,
- int start_y,
- int count_y,
- int start_x,
- int width_x
+ i_img_dim start_y,
+ i_img_dim count_y,
+ i_img_dim start_x,
+ i_img_dim width_x
)
{
- int bytes = count_y * sizeof(i_int_hline_entry *);
+ size_t bytes = count_y * sizeof(i_int_hline_entry *);
if (bytes / count_y != sizeof(i_int_hline_entry *)) {
- m_fatal(3, "integer overflow calculating memory allocation\n");
+ dIMCTX;
+ im_fatal(aIMCTX, 3, "integer overflow calculating memory allocation\n");
}
hlines->start_y = start_y;
*/
void
-i_int_hlines_add(i_int_hlines *hlines, int y, int x, int width) {
- int x_limit = x + width;
+i_int_hlines_add(i_int_hlines *hlines, i_img_dim y, i_img_dim x, i_img_dim width) {
+ i_img_dim x_limit = x + width;
if (width < 0) {
- m_fatal(3, "negative width %d passed to i_int_hlines_add\n", width);
+ dIMCTX;
+ im_fatal(aIMCTX, 3, "negative width %d passed to i_int_hlines_add\n", width);
}
/* just return if out of range */
if (hlines->entries[y - hlines->start_y]) {
i_int_hline_entry *entry = hlines->entries[y - hlines->start_y];
- int i, found = -1;
+ i_img_dim i, found = -1;
for (i = 0; i < entry->count; ++i) {
i_int_hline_seg *seg = entry->segs + i;
/* add a new segment */
if (entry->count == entry->alloc) {
/* expand it */
- int alloc = entry->alloc * 3 / 2;
+ size_t alloc = entry->alloc * 3 / 2;
entry = myrealloc(entry, sizeof(i_int_hline_entry) +
sizeof(i_int_hline_seg) * (alloc - 1));
entry->alloc = alloc;
void
i_int_hlines_destroy(i_int_hlines *hlines) {
- int entry_count = hlines->limit_y - hlines->start_y;
- int i;
+ size_t entry_count = hlines->limit_y - hlines->start_y;
+ size_t i;
for (i = 0; i < entry_count; ++i) {
if (hlines->entries[i])
void
i_int_hlines_fill_color(i_img *im, i_int_hlines *hlines, const i_color *col) {
- int y, i, x;
+ i_img_dim y, i, x;
for (y = hlines->start_y; y < hlines->limit_y; ++y) {
i_int_hline_entry *entry = hlines->entries[y - hlines->start_y];
i_int_hlines_fill_fill(im, hlines, fill)
+=cut
*/
void
i_int_hlines_fill_fill(i_img *im, i_int_hlines *hlines, i_fill_t *fill) {
- int y, i;
+ i_render r;
+ i_img_dim y, i;
+
+ i_render_init(&r, im, im->xsize);
+ for (y = hlines->start_y; y < hlines->limit_y; ++y) {
+ i_int_hline_entry *entry = hlines->entries[y - hlines->start_y];
+ if (entry) {
+ for (i = 0; i < entry->count; ++i) {
+ i_int_hline_seg *seg = entry->segs + i;
+ i_img_dim width = seg->x_limit-seg->minx;
+
+ i_render_fill(&r, seg->minx, y, width, NULL, fill);
+ }
+ }
+ }
+ i_render_done(&r);
+
+#if 1
+#else
if (im->bits == i_8_bits && fill->fill_with_color) {
i_color *line = mymalloc(sizeof(i_color) * im->xsize);
i_color *work = NULL;
if (entry) {
for (i = 0; i < entry->count; ++i) {
i_int_hline_seg *seg = entry->segs + i;
- int width = seg->x_limit-seg->minx;
+ i_img_dim width = seg->x_limit-seg->minx;
if (fill->combine) {
i_glin(im, seg->minx, seg->x_limit, y, line);
if (entry) {
for (i = 0; i < entry->count; ++i) {
i_int_hline_seg *seg = entry->segs + i;
- int width = seg->x_limit-seg->minx;
+ i_img_dim width = seg->x_limit-seg->minx;
if (fill->combinef) {
i_glinf(im, seg->minx, seg->x_limit, y, line);
if (work)
myfree(work);
}
+#endif
}
/*
=head1 AUTHOR
-Tony Cook <tony@imager.perl.org>
+Tony Cook <tonyc@cpan.org>
=head1 REVISION