- itx = (int)ttx;
- ity = (int)tty;
-
- int row1 = ity - 1;
- int row2 = ity;
- int row3 = ity + 1;
- int row4 = ity + 2;
- CLAMP(row1, min_in_y, max_in_y);
- CLAMP(row2, min_in_y, max_in_y);
- CLAMP(row3, min_in_y, max_in_y);
- CLAMP(row4, min_in_y, max_in_y);
-
-/* Set destination pixels if in clipping region */
- if(!interpolate &&
- x >= min_out_x &&
- x < max_out_x)
- {
- if(itx >= min_in_x &&
- itx <= max_in_x &&
- ity >= min_in_y &&
- ity <= max_in_y)
- {
- unsigned char *src = in_rows[ity] + itx * 3;
- *out_row++ = *src++;
- *out_row++ = *src++;
- *out_row++ = *src++;
- if(3 == 4) *out_row++ = *src;
- }
- else
-/* Fill with chroma */
- {
- *out_row++ = 0;
- *out_row++ = 0x80;
- *out_row++ = 0x80;
- if(3 == 4) *out_row++ = 0;
- }
- }
- else
-/* Bicubic algorithm */
- if(interpolate &&
- x >= min_out_x &&
- x < max_out_x)
- {
-/* clipping region */
- if ((itx + 2) >= min_in_x &&
- (itx - 1) <= max_in_x &&
- (ity + 2) >= min_in_y &&
- (ity - 1) <= max_in_y)
- {
- float dx, dy;
-
-/* the fractional error */
- dx = ttx - itx;
- dy = tty - ity;
-
-/* Row and column offsets in cubic block */
- int col1 = itx - 1;
- int col2 = itx;
- int col3 = itx + 1;
- int col4 = itx + 2;
- CLAMP(col1, min_in_x, max_in_x);
- CLAMP(col2, min_in_x, max_in_x);
- CLAMP(col3, min_in_x, max_in_x);
- CLAMP(col4, min_in_x, max_in_x);
- int col1_offset = col1 * 3;
- int col2_offset = col2 * 3;
- int col3_offset = col3 * 3;
- int col4_offset = col4 * 3;
-
- unsigned char *row1_ptr = in_rows[row1];
- unsigned char *row2_ptr = in_rows[row2];
- unsigned char *row3_ptr = in_rows[row3];
- unsigned char *row4_ptr = in_rows[row4];
- int r, g, b, a;
-
- r = (int)(transform_cubic(dy,
- CUBIC_ROW(row1_ptr, 0x0),
- CUBIC_ROW(row2_ptr, 0x0),
- CUBIC_ROW(row3_ptr, 0x0),
- CUBIC_ROW(row4_ptr, 0x0)) +
- round_factor);
-
- row1_ptr++;
- row2_ptr++;
- row3_ptr++;
- row4_ptr++;
- g = (int)(transform_cubic(dy,
- CUBIC_ROW(row1_ptr, 0x80),
- CUBIC_ROW(row2_ptr, 0x80),
- CUBIC_ROW(row3_ptr, 0x80),
- CUBIC_ROW(row4_ptr, 0x80)) +
- round_factor);
- g += 0x80;
-
- row1_ptr++;
- row2_ptr++;
- row3_ptr++;
- row4_ptr++;
- b = (int)(transform_cubic(dy,
- CUBIC_ROW(row1_ptr, 0x80),
- CUBIC_ROW(row2_ptr, 0x80),
- CUBIC_ROW(row3_ptr, 0x80),
- CUBIC_ROW(row4_ptr, 0x80)) +
- round_factor);
- b += 0x80;
-
- if(3 == 4)
- {
- row1_ptr++;
- row2_ptr++;
- row3_ptr++;
- row4_ptr++;
- a = (int)(transform_cubic(dy,
- CUBIC_ROW(row1_ptr, 0x0),
- CUBIC_ROW(row2_ptr, 0x0),
- CUBIC_ROW(row3_ptr, 0x0),
- CUBIC_ROW(row4_ptr, 0x0)) +
- round_factor);
- }
-
- if(sizeof(unsigned char) < 4)
- {
- *out_row++ = CLIP(r, 0, 0xff);
- *out_row++ = CLIP(g, 0, 0xff);
- *out_row++ = CLIP(b, 0, 0xff);
- if(3 == 4) *out_row++ = CLIP(a, 0, 0xff);
- }
- else
- {
- *out_row++ = r;
- *out_row++ = g;
- *out_row++ = b;
- if(3 == 4) *out_row++ = a;
- }
- }
- else
-/* Fill with chroma */
- {
- *out_row++ = 0;
- *out_row++ = 0x80;
- *out_row++ = 0x80;
- if(3 == 4) *out_row++ = 0;
- }
- }
- else
- {
- out_row += 3;
- }
-
-/* increment the transformed coordinates */
- tx += xinc;
- ty += yinc;
- tw += winc;