[libcg]fix blend_transformed_argb
This commit is contained in:
parent
25c0b9b7e9
commit
b11adcd38e
11
src/cg.c
11
src/cg.c
|
@ -1938,7 +1938,6 @@ static inline void blend_transformed_argb(struct cg_surface_t * surface, enum cg
|
||||||
while(count--)
|
while(count--)
|
||||||
{
|
{
|
||||||
uint32_t * target = (uint32_t *)(surface->pixels + spans->y * surface->stride) + spans->x;
|
uint32_t * target = (uint32_t *)(surface->pixels + spans->y * surface->stride) + spans->x;
|
||||||
|
|
||||||
double cx = spans->x + 0.5;
|
double cx = spans->x + 0.5;
|
||||||
double cy = spans->y + 0.5;
|
double cy = spans->y + 0.5;
|
||||||
int x = (int)((texture->matrix.c * cy + texture->matrix.a * cx + texture->matrix.tx) * FIXED_SCALE);
|
int x = (int)((texture->matrix.c * cy + texture->matrix.a * cx + texture->matrix.tx) * FIXED_SCALE);
|
||||||
|
@ -1952,12 +1951,12 @@ static inline void blend_transformed_argb(struct cg_surface_t * surface, enum cg
|
||||||
uint32_t * b = buffer;
|
uint32_t * b = buffer;
|
||||||
while(b < end)
|
while(b < end)
|
||||||
{
|
{
|
||||||
int px = CG_CLAMP(x >> 16, 0, image_width - 1);
|
int px = x >> 16;
|
||||||
int py = CG_CLAMP(y >> 16, 0, image_height - 1);
|
int py = y >> 16;
|
||||||
if((px == (x >> 16)) && (py == (y >> 16)))
|
if((px < 0) || (px >= image_width) || (py < 0) || (py >= image_height))
|
||||||
*b = ((uint32_t *)(texture->pixels + py * texture->stride))[px];
|
|
||||||
else
|
|
||||||
*b = 0;
|
*b = 0;
|
||||||
|
else
|
||||||
|
*b = ((uint32_t *)(texture->pixels + py * texture->stride))[px];
|
||||||
x += fdx;
|
x += fdx;
|
||||||
y += fdy;
|
y += fdy;
|
||||||
++b;
|
++b;
|
||||||
|
|
Loading…
Reference in New Issue