mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
Fixed a bug in scaling code.
This commit is contained in:
@@ -79,14 +79,11 @@ RScaleImage(RImage *image, unsigned new_width, unsigned new_height)
|
|||||||
d = img->data;
|
d = img->data;
|
||||||
|
|
||||||
if (image->format == RRGBAFormat) {
|
if (image->format == RRGBAFormat) {
|
||||||
int ot;
|
|
||||||
ot = -1;
|
|
||||||
for (y=0; y<new_height; y++) {
|
for (y=0; y<new_height; y++) {
|
||||||
t = image->width*(py>>16);
|
t = image->width*(py>>16);
|
||||||
|
|
||||||
s = image->data+t;
|
s = image->data+(t<<2); /* image->data+t*4 */
|
||||||
|
|
||||||
ot = t;
|
|
||||||
ox = 0;
|
ox = 0;
|
||||||
px = 0;
|
px = 0;
|
||||||
for (x=0; x<new_width; x++) {
|
for (x=0; x<new_width; x++) {
|
||||||
@@ -105,14 +102,11 @@ RScaleImage(RImage *image, unsigned new_width, unsigned new_height)
|
|||||||
py += dy;
|
py += dy;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int ot;
|
|
||||||
ot = -1;
|
|
||||||
for (y=0; y<new_height; y++) {
|
for (y=0; y<new_height; y++) {
|
||||||
t = image->width*(py>>16);
|
t = image->width*(py>>16);
|
||||||
|
|
||||||
s = image->data+t;
|
s = image->data+(t<<1)+t; /* image->data+t*3 */
|
||||||
|
|
||||||
ot = t;
|
|
||||||
ox = 0;
|
ox = 0;
|
||||||
px = 0;
|
px = 0;
|
||||||
for (x=0; x<new_width; x++) {
|
for (x=0; x<new_width; x++) {
|
||||||
@@ -122,7 +116,7 @@ RScaleImage(RImage *image, unsigned new_width, unsigned new_height)
|
|||||||
*(d++) = *(s+1);
|
*(d++) = *(s+1);
|
||||||
*(d++) = *(s+2);
|
*(d++) = *(s+2);
|
||||||
|
|
||||||
t = (px-ox)>>16;
|
t = (px - ox)>>16;
|
||||||
ox += t<<16;
|
ox += t<<16;
|
||||||
|
|
||||||
s += (t<<1)+t; /* t*3 */
|
s += (t<<1)+t; /* t*3 */
|
||||||
|
|||||||
Reference in New Issue
Block a user