Re: [AD] possible bug in draw_sprite_h_flip C version while clipping |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> diff attached, all the flip routines now clip properly.
Thanks for the patch. There is however an issue I would like to clear up:
@@ -194,12 +194,23 @@
if (w <= 0)
return;
- tmp = dst->ct - dy;
- sybeg = ((tmp < 0) ? 0 : tmp);
- dybeg = sybeg + dy;
-
- tmp = dst->cb - dy;
- h = ((tmp > src->h) ? src->h : tmp) - sybeg;
+ sybeg = 0;
+ // crop from top
+ if (dy <= 0) {
+ dybeg = 0;
+ h = src->h + dy;
+ }
+ // inside the dst
+ else {
+ dybeg = dy;
+ h = src->h;
+ }
+ // crop from bottom
+ tmp = dybeg + h;
+ if (tmp > dst->cb) {
+ sybeg = tmp - dst->cb;
+ h = h - (tmp -dst->cb);
+ }
if (h <= 0)
return;
Why doesn't dst->ct play any role in your modified code ? Same question for
dst->cl below.
Btw, we don't like very much C++ style comments within C source files.
--
Eric Botcazou
ebotcazou@xxxxxxxxxx