[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--)
|
||||
{
|
||||
uint32_t * target = (uint32_t *)(surface->pixels + spans->y * surface->stride) + spans->x;
|
||||
|
||||
double cx = spans->x + 0.5;
|
||||
double cy = spans->y + 0.5;
|
||||
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;
|
||||
while(b < end)
|
||||
{
|
||||
int px = CG_CLAMP(x >> 16, 0, image_width - 1);
|
||||
int py = CG_CLAMP(y >> 16, 0, image_height - 1);
|
||||
if((px == (x >> 16)) && (py == (y >> 16)))
|
||||
*b = ((uint32_t *)(texture->pixels + py * texture->stride))[px];
|
||||
else
|
||||
int px = x >> 16;
|
||||
int py = y >> 16;
|
||||
if((px < 0) || (px >= image_width) || (py < 0) || (py >= image_height))
|
||||
*b = 0;
|
||||
else
|
||||
*b = ((uint32_t *)(texture->pixels + py * texture->stride))[px];
|
||||
x += fdx;
|
||||
y += fdy;
|
||||
++b;
|
||||
|
|
Loading…
Reference in New Issue