This commit is contained in:
jomjol
2021-01-01 10:13:00 +01:00
parent 9c8f64f602
commit c59826471c
28 changed files with 263 additions and 106 deletions

View File

@@ -10,6 +10,7 @@ CRotateImage::CRotateImage(CImageBasis *_org, CImageBasis *_temp)
bpp = _org->bpp;
externalImage = true;
ImageTMP = _temp;
islocked = false;
}
void CRotateImage::Mirror(){
@@ -17,7 +18,7 @@ void CRotateImage::Mirror(){
uint8_t* odata;
if (ImageTMP)
{
odata = ImageTMP->rgb_image;
odata = ImageTMP->RGBImageLock();
}
else
{
@@ -29,6 +30,8 @@ void CRotateImage::Mirror(){
stbi_uc* p_target;
stbi_uc* p_source;
RGBImageLock();
for (int x = 0; x < width; ++x)
for (int y = 0; y < height; ++y)
{
@@ -45,9 +48,12 @@ void CRotateImage::Mirror(){
// memcpy(rgb_image, odata, memsize);
memCopy(odata, rgb_image, memsize);
if (!ImageTMP)
{
stbi_image_free(odata);
}
if (ImageTMP)
ImageTMP->RGBImageRelease();
RGBImageRelease();
}
void CRotateImage::Rotate(float _angle, int _centerx, int _centery)
@@ -70,7 +76,7 @@ void CRotateImage::Rotate(float _angle, int _centerx, int _centery)
uint8_t* odata;
if (ImageTMP)
{
odata = ImageTMP->rgb_image;
odata = ImageTMP->RGBImageLock();
}
else
{
@@ -82,6 +88,8 @@ void CRotateImage::Rotate(float _angle, int _centerx, int _centery)
stbi_uc* p_target;
stbi_uc* p_source;
RGBImageLock();
for (int x = 0; x < width; ++x)
for (int y = 0; y < height; ++y)
{
@@ -113,6 +121,10 @@ void CRotateImage::Rotate(float _angle, int _centerx, int _centery)
{
stbi_image_free(odata);
}
if (ImageTMP)
ImageTMP->RGBImageRelease();
RGBImageRelease();
}
void CRotateImage::Rotate(float _angle)
@@ -127,7 +139,7 @@ void CRotateImage::Translate(int _dx, int _dy)
uint8_t* odata;
if (ImageTMP)
{
odata = ImageTMP->rgb_image;
odata = ImageTMP->RGBImageLock();
}
else
{
@@ -140,6 +152,8 @@ void CRotateImage::Translate(int _dx, int _dy)
stbi_uc* p_target;
stbi_uc* p_source;
RGBImageLock();
for (int x = 0; x < width; ++x)
for (int y = 0; y < height; ++y)
{
@@ -167,5 +181,12 @@ void CRotateImage::Translate(int _dx, int _dy)
{
stbi_image_free(odata);
}
if (ImageTMP)
{
ImageTMP->RGBImageRelease();
}
RGBImageRelease();
}