|
|
|
@ -270,7 +270,7 @@ static inline RenColor blend_pixel2(RenColor dst, RenColor src, RenColor color)
|
|
|
|
|
for (int j = y1; j < y2; j++) { \
|
|
|
|
|
for (int i = x1; i < x2; i++) { \
|
|
|
|
|
*d = expr; \
|
|
|
|
|
d++; \
|
|
|
|
|
d++; \
|
|
|
|
|
} \
|
|
|
|
|
d += dr; \
|
|
|
|
|
} |
|
|
|
@ -284,17 +284,22 @@ void ren_draw_rect(RenRect rect, RenColor color) {
|
|
|
|
|
int y2 = rect.y + rect.height; |
|
|
|
|
x2 = x2 > clip.right ? clip.right : x2; |
|
|
|
|
y2 = y2 > clip.bottom ? clip.bottom : y2; |
|
|
|
|
|
|
|
|
|
printf("DBG: rect\tx1: %d\ty1: %d\tx2:%d\ty2:%d\n", x1, y1, x2, y2); |
|
|
|
|
SDL_Surface *surf = SDL_GetWindowSurface(window); |
|
|
|
|
RenColor *d = (RenColor*) surf->pixels; |
|
|
|
|
d += x1 + y1 * surf->w; |
|
|
|
|
int dr = surf->w - (x2 - x1); |
|
|
|
|
|
|
|
|
|
printf("DBG: surf\tr: %d\tg: %d\tb:%d\ta:%d\tw: %d\n", d->r, d->g, d->b, d->a, surf->w); |
|
|
|
|
d += x1 + y1 * (surf->pitch / 4); |
|
|
|
|
//printf("DBG: surf\tr: %d\tg: %d\tb:%d\ta:%d\n", d->r, d->g, d->b, d->a);
|
|
|
|
|
int dr = (surf->pitch / 4) - (x2 - x1); |
|
|
|
|
printf("DBG: r: %d\tg: %d\tb:%d\ta:%d\n", color.r, color.g, color.b, color.a); |
|
|
|
|
if (color.a == 0xff) { |
|
|
|
|
rect_draw_loop(color); |
|
|
|
|
//rect_draw_loop(color);
|
|
|
|
|
SDL_Rect rect = { x1, y1, x2 - x1, y2 - y1 }; |
|
|
|
|
SDL_FillRect(surf, &rect, SDL_MapRGBA(surf->format, color.r, color.g, color.b, color.a)); |
|
|
|
|
} else { |
|
|
|
|
rect_draw_loop(blend_pixel(*d, color)); |
|
|
|
|
rect_draw_loop(blend_pixel(*d, color)); |
|
|
|
|
} |
|
|
|
|
printf("======================\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|