mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-31 19:12:32 +01:00
changed indentation to use spaces only
This commit is contained in:
397
wrlib/raster.c
397
wrlib/raster.c
@@ -1,19 +1,19 @@
|
||||
/* raster.c - main and other misc stuff
|
||||
*
|
||||
/* raster.c - main and other misc stuff
|
||||
*
|
||||
* Raster graphics library
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1997-2003 Alfredo K. Kojima
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
@@ -47,17 +47,17 @@ RImage*
|
||||
RCreateImage(unsigned width, unsigned height, int alpha)
|
||||
{
|
||||
RImage *image=NULL;
|
||||
|
||||
|
||||
assert(width>0 && height>0);
|
||||
|
||||
if (width > MAX_WIDTH || height > MAX_HEIGHT) {
|
||||
RErrorCode = RERR_NOMEMORY;
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image = malloc(sizeof(RImage));
|
||||
if (!image) {
|
||||
RErrorCode = RERR_NOMEMORY;
|
||||
RErrorCode = RERR_NOMEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -72,9 +72,9 @@ RCreateImage(unsigned width, unsigned height, int alpha)
|
||||
*/
|
||||
image->data = malloc(width * height * (alpha ? 4 : 3) + 4);
|
||||
if (!image->data) {
|
||||
RErrorCode = RERR_NOMEMORY;
|
||||
free(image);
|
||||
image = NULL;
|
||||
RErrorCode = RERR_NOMEMORY;
|
||||
free(image);
|
||||
image = NULL;
|
||||
}
|
||||
|
||||
return image;
|
||||
@@ -92,7 +92,7 @@ RRetainImage(RImage *image)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
RReleaseImage(RImage *image)
|
||||
{
|
||||
assert(image!=NULL);
|
||||
@@ -112,14 +112,14 @@ RCloneImage(RImage *image)
|
||||
RImage *new_image;
|
||||
|
||||
assert(image!=NULL);
|
||||
|
||||
|
||||
new_image = RCreateImage(image->width, image->height, HAS_ALPHA(image));
|
||||
if (!new_image)
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
|
||||
new_image->background = image->background;
|
||||
memcpy(new_image->data, image->data,
|
||||
image->width*image->height*(HAS_ALPHA(image) ? 4 : 3));
|
||||
image->width*image->height*(HAS_ALPHA(image) ? 4 : 3));
|
||||
|
||||
return new_image;
|
||||
}
|
||||
@@ -131,21 +131,21 @@ RGetSubImage(RImage *image, int x, int y, unsigned width, unsigned height)
|
||||
int i, ofs;
|
||||
RImage *new_image;
|
||||
unsigned total_line_size, line_size;
|
||||
|
||||
|
||||
assert(image!=NULL);
|
||||
assert(x>=0 && y>=0);
|
||||
assert(x<image->width && y<image->height);
|
||||
assert(width>0 && height>0);
|
||||
|
||||
|
||||
if (x+width > image->width)
|
||||
width = image->width-x;
|
||||
width = image->width-x;
|
||||
if (y+height > image->height)
|
||||
height = image->height-y;
|
||||
height = image->height-y;
|
||||
|
||||
new_image = RCreateImage(width, height, HAS_ALPHA(image));
|
||||
|
||||
if (!new_image)
|
||||
return NULL;
|
||||
return NULL;
|
||||
new_image->background = image->background;
|
||||
|
||||
total_line_size = image->width * (HAS_ALPHA(image) ? 4 : 3);
|
||||
@@ -154,19 +154,19 @@ RGetSubImage(RImage *image, int x, int y, unsigned width, unsigned height)
|
||||
ofs = x*(HAS_ALPHA(image) ? 4 : 3) + y*total_line_size;;
|
||||
|
||||
for (i=0; i<height; i++) {
|
||||
memcpy(&new_image->data[i*line_size],
|
||||
&image->data[i*total_line_size+ofs], line_size);
|
||||
memcpy(&new_image->data[i*line_size],
|
||||
&image->data[i*total_line_size+ofs], line_size);
|
||||
}
|
||||
return new_image;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*----------------------------------------------------------------------
|
||||
* RCombineImages-
|
||||
* Combines two equal sized images with alpha image. The second
|
||||
* image will be placed on top of the first one.
|
||||
*----------------------------------------------------------------------
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
RCombineImages(RImage *image, RImage *src)
|
||||
@@ -175,51 +175,51 @@ RCombineImages(RImage *image, RImage *src)
|
||||
assert(image->height == src->height);
|
||||
|
||||
if (!HAS_ALPHA(src)) {
|
||||
if (!HAS_ALPHA(image)) {
|
||||
memcpy(image->data, src->data, image->height*image->width*3);
|
||||
} else {
|
||||
int x, y;
|
||||
unsigned char *d, *s;
|
||||
|
||||
d = image->data;
|
||||
s = src->data;
|
||||
for (y = 0; y < image->height; y++) {
|
||||
for (x = 0; x < image->width; x++) {
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
d++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!HAS_ALPHA(image)) {
|
||||
memcpy(image->data, src->data, image->height*image->width*3);
|
||||
} else {
|
||||
int x, y;
|
||||
unsigned char *d, *s;
|
||||
|
||||
d = image->data;
|
||||
s = src->data;
|
||||
for (y = 0; y < image->height; y++) {
|
||||
for (x = 0; x < image->width; x++) {
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
d++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
register int i;
|
||||
unsigned char *d;
|
||||
unsigned char *s;
|
||||
int alpha, calpha;
|
||||
register int i;
|
||||
unsigned char *d;
|
||||
unsigned char *s;
|
||||
int alpha, calpha;
|
||||
|
||||
d = image->data;
|
||||
s = src->data;
|
||||
d = image->data;
|
||||
s = src->data;
|
||||
|
||||
if (!HAS_ALPHA(image)) {
|
||||
for (i=0; i<image->height*image->width; i++) {
|
||||
alpha = *(s+3);
|
||||
calpha = 255 - alpha;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; d++; s++;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; d++; s++;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; d++; s++;
|
||||
s++;
|
||||
}
|
||||
} else {
|
||||
for (i=0; i<image->height*image->width; i++) {
|
||||
alpha = *(s+3);
|
||||
calpha = 255 - alpha;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; d++; s++;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; d++; s++;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; d++; s++;
|
||||
*d++ |= *s++;
|
||||
}
|
||||
}
|
||||
if (!HAS_ALPHA(image)) {
|
||||
for (i=0; i<image->height*image->width; i++) {
|
||||
alpha = *(s+3);
|
||||
calpha = 255 - alpha;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; d++; s++;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; d++; s++;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; d++; s++;
|
||||
s++;
|
||||
}
|
||||
} else {
|
||||
for (i=0; i<image->height*image->width; i++) {
|
||||
alpha = *(s+3);
|
||||
calpha = 255 - alpha;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; d++; s++;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; d++; s++;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; d++; s++;
|
||||
*d++ |= *s++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,36 +246,36 @@ RCombineImagesWithOpaqueness(RImage *image, RImage *src, int opaqueness)
|
||||
#define COP c_opaqueness
|
||||
|
||||
if (!HAS_ALPHA(src)) {
|
||||
int dalpha = HAS_ALPHA(image);
|
||||
for (i=0; i < image->width*image->height; i++) {
|
||||
*d = (((int)*d *(int)COP) + ((int)*s *(int)OP))/256; d++; s++;
|
||||
*d = (((int)*d *(int)COP) + ((int)*s *(int)OP))/256; d++; s++;
|
||||
*d = (((int)*d *(int)COP) + ((int)*s *(int)OP))/256; d++; s++;
|
||||
if (dalpha) {
|
||||
d++;
|
||||
}
|
||||
}
|
||||
int dalpha = HAS_ALPHA(image);
|
||||
for (i=0; i < image->width*image->height; i++) {
|
||||
*d = (((int)*d *(int)COP) + ((int)*s *(int)OP))/256; d++; s++;
|
||||
*d = (((int)*d *(int)COP) + ((int)*s *(int)OP))/256; d++; s++;
|
||||
*d = (((int)*d *(int)COP) + ((int)*s *(int)OP))/256; d++; s++;
|
||||
if (dalpha) {
|
||||
d++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int tmp;
|
||||
int tmp;
|
||||
|
||||
if (!HAS_ALPHA(image)) {
|
||||
for (i=0; i<image->width*image->height; i++) {
|
||||
tmp = (*(s+3) * opaqueness)/256;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
s++;
|
||||
}
|
||||
} else {
|
||||
for (i=0; i<image->width*image->height; i++) {
|
||||
tmp = (*(s+3) * opaqueness)/256;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d |= tmp;
|
||||
d++; s++;
|
||||
}
|
||||
}
|
||||
if (!HAS_ALPHA(image)) {
|
||||
for (i=0; i<image->width*image->height; i++) {
|
||||
tmp = (*(s+3) * opaqueness)/256;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
s++;
|
||||
}
|
||||
} else {
|
||||
for (i=0; i<image->width*image->height; i++) {
|
||||
tmp = (*(s+3) * opaqueness)/256;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d |= tmp;
|
||||
d++; s++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#undef OP
|
||||
#undef COP
|
||||
@@ -312,7 +312,7 @@ calculateCombineArea(RImage *des, RImage *src, int *sx, int *sy,
|
||||
|
||||
void
|
||||
RCombineArea(RImage *image, RImage *src, int sx, int sy, unsigned width,
|
||||
unsigned height, int dx, int dy)
|
||||
unsigned height, int dx, int dy)
|
||||
{
|
||||
int x, y, dwi, swi;
|
||||
unsigned char *d;
|
||||
@@ -323,71 +323,71 @@ RCombineArea(RImage *image, RImage *src, int sx, int sy, unsigned width,
|
||||
return;
|
||||
|
||||
if (!HAS_ALPHA(src)) {
|
||||
if (!HAS_ALPHA(image)) {
|
||||
swi = src->width * 3;
|
||||
dwi = image->width * 3;
|
||||
if (!HAS_ALPHA(image)) {
|
||||
swi = src->width * 3;
|
||||
dwi = image->width * 3;
|
||||
|
||||
s = src->data + (sy*(int)src->width + sx) * 3;
|
||||
d = image->data + (dy*(int)image->width + dx) * 3;
|
||||
s = src->data + (sy*(int)src->width + sx) * 3;
|
||||
d = image->data + (dy*(int)image->width + dx) * 3;
|
||||
|
||||
for (y=0; y < height; y++) {
|
||||
memcpy(d, s, width*3);
|
||||
d += dwi;
|
||||
s += swi;
|
||||
}
|
||||
} else {
|
||||
swi = (src->width - width) * 3;
|
||||
dwi = (image->width - width) * 4;
|
||||
for (y=0; y < height; y++) {
|
||||
memcpy(d, s, width*3);
|
||||
d += dwi;
|
||||
s += swi;
|
||||
}
|
||||
} else {
|
||||
swi = (src->width - width) * 3;
|
||||
dwi = (image->width - width) * 4;
|
||||
|
||||
s = src->data + (sy*(int)src->width + sx) * 3;
|
||||
d = image->data + (dy*(int)image->width + dx) * 4;
|
||||
s = src->data + (sy*(int)src->width + sx) * 3;
|
||||
d = image->data + (dy*(int)image->width + dx) * 4;
|
||||
|
||||
for (y=0; y < height; y++) {
|
||||
for (x=0; x < width; x++) {
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
d++;
|
||||
}
|
||||
d += dwi;
|
||||
s += swi;
|
||||
}
|
||||
}
|
||||
for (y=0; y < height; y++) {
|
||||
for (x=0; x < width; x++) {
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
d++;
|
||||
}
|
||||
d += dwi;
|
||||
s += swi;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int dalpha = HAS_ALPHA(image);
|
||||
int dalpha = HAS_ALPHA(image);
|
||||
|
||||
swi = (src->width - width) * 4;
|
||||
s = src->data + (sy*(int)src->width + sx) * 4;
|
||||
if (dalpha) {
|
||||
dwi = (image->width - width) * 4;
|
||||
d = image->data + (dy*(int)image->width + dx) * 4;
|
||||
} else {
|
||||
dwi = (image->width - width) * 3;
|
||||
d = image->data + (dy*(int)image->width + dx) * 3;
|
||||
}
|
||||
swi = (src->width - width) * 4;
|
||||
s = src->data + (sy*(int)src->width + sx) * 4;
|
||||
if (dalpha) {
|
||||
dwi = (image->width - width) * 4;
|
||||
d = image->data + (dy*(int)image->width + dx) * 4;
|
||||
} else {
|
||||
dwi = (image->width - width) * 3;
|
||||
d = image->data + (dy*(int)image->width + dx) * 3;
|
||||
}
|
||||
|
||||
for (y=0; y < height; y++) {
|
||||
for (x=0; x < width; x++) {
|
||||
alpha = *(s+3);
|
||||
calpha = 255 - alpha;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; s++; d++;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; s++; d++;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; s++; d++;
|
||||
s++;
|
||||
if (dalpha)
|
||||
d++;
|
||||
}
|
||||
d += dwi;
|
||||
s += swi;
|
||||
}
|
||||
for (y=0; y < height; y++) {
|
||||
for (x=0; x < width; x++) {
|
||||
alpha = *(s+3);
|
||||
calpha = 255 - alpha;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; s++; d++;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; s++; d++;
|
||||
*d = (((int)*d * calpha) + ((int)*s * alpha))/256; s++; d++;
|
||||
s++;
|
||||
if (dalpha)
|
||||
d++;
|
||||
}
|
||||
d += dwi;
|
||||
s += swi;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RCombineAreaWithOpaqueness(RImage *image, RImage *src, int sx, int sy,
|
||||
unsigned width, unsigned height, int dx, int dy,
|
||||
int opaqueness)
|
||||
RCombineAreaWithOpaqueness(RImage *image, RImage *src, int sx, int sy,
|
||||
unsigned width, unsigned height, int dx, int dy,
|
||||
int opaqueness)
|
||||
{
|
||||
int x, y, dwi, swi;
|
||||
int c_opaqueness;
|
||||
@@ -408,41 +408,41 @@ RCombineAreaWithOpaqueness(RImage *image, RImage *src, int sx, int sy,
|
||||
|
||||
if (!HAS_ALPHA(src)) {
|
||||
|
||||
s = src->data + (sy*src->width + sx)*3;
|
||||
swi = (src->width - width) * 3;
|
||||
|
||||
for (y=0; y < height; y++) {
|
||||
for (x=0; x < width; x++) {
|
||||
*d = (((int)*d *(int)COP) + ((int)*s *(int)OP))/256; s++; d++;
|
||||
*d = (((int)*d *(int)COP) + ((int)*s *(int)OP))/256; s++; d++;
|
||||
*d = (((int)*d *(int)COP) + ((int)*s *(int)OP))/256; s++; d++;
|
||||
if (dalpha)
|
||||
d++;
|
||||
}
|
||||
d += dwi; s += swi;
|
||||
}
|
||||
s = src->data + (sy*src->width + sx)*3;
|
||||
swi = (src->width - width) * 3;
|
||||
|
||||
for (y=0; y < height; y++) {
|
||||
for (x=0; x < width; x++) {
|
||||
*d = (((int)*d *(int)COP) + ((int)*s *(int)OP))/256; s++; d++;
|
||||
*d = (((int)*d *(int)COP) + ((int)*s *(int)OP))/256; s++; d++;
|
||||
*d = (((int)*d *(int)COP) + ((int)*s *(int)OP))/256; s++; d++;
|
||||
if (dalpha)
|
||||
d++;
|
||||
}
|
||||
d += dwi; s += swi;
|
||||
}
|
||||
} else {
|
||||
int tmp;
|
||||
|
||||
s = src->data + (sy*src->width + sx)*4;
|
||||
swi = (src->width - width) * 4;
|
||||
|
||||
for (y=0; y < height; y++) {
|
||||
for (x=0; x < width; x++) {
|
||||
tmp = (*(s+3) * opaqueness)/256;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
s++;
|
||||
if (dalpha)
|
||||
d++;
|
||||
}
|
||||
d += dwi; s += swi;
|
||||
}
|
||||
s = src->data + (sy*src->width + sx)*4;
|
||||
swi = (src->width - width) * 4;
|
||||
|
||||
for (y=0; y < height; y++) {
|
||||
for (x=0; x < width; x++) {
|
||||
tmp = (*(s+3) * opaqueness)/256;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
*d = (((int)*d * (255-tmp)) + ((int)*s * tmp))/256; d++; s++;
|
||||
s++;
|
||||
if (dalpha)
|
||||
d++;
|
||||
}
|
||||
d += dwi; s += swi;
|
||||
}
|
||||
}
|
||||
#undef OP
|
||||
#undef COP
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -452,26 +452,26 @@ RCombineImageWithColor(RImage *image, RColor *color)
|
||||
register int i;
|
||||
unsigned char *d;
|
||||
int alpha, nalpha, r, g, b;
|
||||
|
||||
|
||||
d = image->data;
|
||||
|
||||
|
||||
if (!HAS_ALPHA(image)) {
|
||||
/* Image has no alpha channel, so we consider it to be all 255.
|
||||
* Thus there are no transparent parts to be filled. */
|
||||
return;
|
||||
/* Image has no alpha channel, so we consider it to be all 255.
|
||||
* Thus there are no transparent parts to be filled. */
|
||||
return;
|
||||
}
|
||||
r = color->red;
|
||||
g = color->green;
|
||||
b = color->blue;
|
||||
|
||||
for (i=0; i < image->width*image->height; i++) {
|
||||
alpha = *(d+3);
|
||||
nalpha = 255 - alpha;
|
||||
alpha = *(d+3);
|
||||
nalpha = 255 - alpha;
|
||||
|
||||
*d = (((int)*d * alpha) + (r * nalpha))/256; d++;
|
||||
*d = (((int)*d * alpha) + (g * nalpha))/256; d++;
|
||||
*d = (((int)*d * alpha) + (b * nalpha))/256; d++;
|
||||
d++;
|
||||
*d = (((int)*d * alpha) + (r * nalpha))/256; d++;
|
||||
*d = (((int)*d * alpha) + (g * nalpha))/256; d++;
|
||||
*d = (((int)*d * alpha) + (b * nalpha))/256; d++;
|
||||
d++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ RMakeTiledImage(RImage *tile, unsigned width, unsigned height)
|
||||
else if (width <= tile->width && height <= tile->height)
|
||||
image = RGetSubImage(tile, 0, 0, width, height);
|
||||
else {
|
||||
int has_alpha = HAS_ALPHA(tile);
|
||||
int has_alpha = HAS_ALPHA(tile);
|
||||
|
||||
image = RCreateImage(width, height, has_alpha);
|
||||
|
||||
@@ -505,16 +505,16 @@ RMakeTiledImage(RImage *tile, unsigned width, unsigned height)
|
||||
|
||||
w = (width - x < tile->width) ? width - x : tile->width;
|
||||
|
||||
if (has_alpha) {
|
||||
w *= 4;
|
||||
memcpy(d, s+tx*4, w);
|
||||
} else {
|
||||
w *= 3;
|
||||
memcpy(d, s+tx*3, w);
|
||||
}
|
||||
if (has_alpha) {
|
||||
w *= 4;
|
||||
memcpy(d, s+tx*4, w);
|
||||
} else {
|
||||
w *= 3;
|
||||
memcpy(d, s+tx*3, w);
|
||||
}
|
||||
d += w;
|
||||
}
|
||||
|
||||
|
||||
tx = (tx + tile->width) % tile_size;
|
||||
}
|
||||
}
|
||||
@@ -557,3 +557,4 @@ RMakeCenteredImage(RImage *image, unsigned width, unsigned height, RColor *color
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user