[GB.IMAGE]

* BUG: Fix Image.RotateRight() algorithm.


git-svn-id: svn://localhost/gambas/trunk@5235 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-10-13 09:46:35 +00:00
parent 06977c713d
commit 4ecc3420e6

View file

@ -1306,16 +1306,18 @@ void IMAGE_rotate(GB_IMG *src, GB_IMG *dst, bool left)
if (GB_IMAGE_FMT_IS_24_BITS(src->format))
{
uint24 *pd = (uint24 *)dst->data;
if (left)
{
for (y = 0; y < h; y++)
{
uint24 *pd = (uint24 *)(dst->data + y * w * 3);
uint24 *ps = (uint24 *)(src->data + (h - 1 - y) * 3);
for (x = 0; x < w; x++)
{
pd[x] = *ps;
*pd++ = *ps;
ps += h;
}
}
@ -1324,12 +1326,11 @@ void IMAGE_rotate(GB_IMG *src, GB_IMG *dst, bool left)
{
for (y = 0; y < h; y++)
{
uint *pd = (uint *)(dst->data + y * w * 3);
uint *ps = (uint *)(src->data + (w * (h - 1) + y) * 3);
uint24 *ps = (uint24 *)(src->data + ((w - 1) * h + y) * 3);
for (x = 0; x < w; x++)
{
pd[x] = *ps;
*pd++ = *ps;
ps -= h;
}
}
@ -1337,16 +1338,17 @@ void IMAGE_rotate(GB_IMG *src, GB_IMG *dst, bool left)
}
else
{
uint *pd = (uint *)dst->data;
if (left)
{
for (y = 0; y < h; y++)
{
uint *pd = (uint *)(dst->data + y * w * 4);
uint *ps = (uint *)(src->data + (h - 1 - y) * 4);
for (x = 0; x < w; x++)
{
pd[x] = *ps;
*pd++ = *ps;
ps += h;
}
}
@ -1355,12 +1357,11 @@ void IMAGE_rotate(GB_IMG *src, GB_IMG *dst, bool left)
{
for (y = 0; y < h; y++)
{
uint *pd = (uint *)(dst->data + y * w * 4);
uint *ps = (uint *)(src->data + (w * (h - 1) + y) * 4);
uint *ps = (uint *)(src->data + ((w - 1) * h + y) * 4);
for (x = 0; x < w; x++)
{
pd[x] = *ps;
*pd++ = *ps;
ps -= h;
}
}