Remove temp buffer for non-tiled image.
This commit is contained in:
parent
eb5bae42c3
commit
3ab9df90df
14
rotation.cpp
14
rotation.cpp
|
@ -687,12 +687,8 @@ Image* rotate(Image const& src, double angle)
|
||||||
DPoint const rot_origin_in_src_grid = get_mapped_point(*rotated, Point(0, 0), -rotation);
|
DPoint const rot_origin_in_src_grid = get_mapped_point(*rotated, Point(0, 0), -rotation);
|
||||||
DPoint const rot_origin_in_src = convert_img_coord_precision(src, rot_origin_in_src_grid);
|
DPoint const rot_origin_in_src = convert_img_coord_precision(src, rot_origin_in_src_grid);
|
||||||
|
|
||||||
unsigned int const buffer_pixel_capacity = 128 / 3;
|
|
||||||
unsigned int const buffer_size = buffer_pixel_capacity * 3;
|
|
||||||
unsigned int buffer_index = 0;
|
unsigned int buffer_index = 0;
|
||||||
uint8_t buffer[buffer_size];
|
uint8_t* buffer = rotated->buffer;
|
||||||
memset(buffer, 0, buffer_size);
|
|
||||||
unsigned int buffer_offset = 0;
|
|
||||||
|
|
||||||
unsigned int const quantize = 8;
|
unsigned int const quantize = 8;
|
||||||
int const& src_qwidth = src.width * quantize;
|
int const& src_qwidth = src.width * quantize;
|
||||||
|
@ -716,15 +712,7 @@ Image* rotate(Image const& src, double angle)
|
||||||
buffer, buffer_index * 3);
|
buffer, buffer_index * 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush buffer to dest
|
|
||||||
++buffer_index;
|
++buffer_index;
|
||||||
if (buffer_index == buffer_pixel_capacity)
|
|
||||||
{
|
|
||||||
memcpy(rotated->buffer + buffer_offset, buffer, buffer_size);
|
|
||||||
buffer_offset += buffer_size;
|
|
||||||
buffer_index = 0;
|
|
||||||
memset(buffer, 0, buffer_size);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue