Skip to content

Commit f492602

Browse files
committed
Fix bug rendering Y-tiled rddst stretch blits
1 parent a701543 commit f492602

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

kos/src/apps/showpic/main.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ do_showpic(struct screen_buffer *screen,
343343
&image_gfx, 0, 0,
344344
video_gfx_getclipw(&image_gfx),
345345
video_gfx_getcliph(&image_gfx));
346-
#elif 1
346+
#elif 0
347347
{
348348
static REF struct video_buffer *mask_buffer = NULL;
349349
if (!mask_buffer) {
@@ -386,17 +386,23 @@ do_showpic(struct screen_buffer *screen,
386386
video_gfx_getcliph(&image_gfx));
387387
}
388388
}
389-
#elif 0
389+
#elif 1
390390
{
391391
struct video_gfx flipgfx = image_gfx;
392392
// video_gfx_lrot90(&flipgfx);
393+
static int offset = 0;
393394
video_gfx_setblend(&flipgfx, GFX_BLENDMODE_ALPHA_OVERRIDE(200));
395+
video_gfx_enableflags(&flipgfx, VIDEO_GFX_F_XWRAP | VIDEO_GFX_F_YWRAP);
394396
video_gfx_stretch3(&screen_gfx, blit_x, blit_y,
395-
&flipgfx, 100, 100,
397+
&flipgfx,
398+
(video_gfx_getcliph(&image_gfx) * 2) + offset,
399+
video_gfx_getcliph(&image_gfx) * 2,
396400
blit_w, blit_h,
397401
&image_gfx, 0, 0,
398402
video_gfx_getclipw(&image_gfx),
399403
video_gfx_getcliph(&image_gfx));
404+
offset += 3;
405+
// syslog(LOG_DEBUG, "offset = %d\n", offset);
400406
}
401407
#elif 0
402408
{
@@ -653,6 +659,7 @@ int main(int argc, char *argv[]) {
653659
/* Wait until the next frame should be rendered */
654660
#if 0
655661
getchar();
662+
frame_info = frame_nextinfo;
656663
#else
657664
gettimeofday(&frame_end, NULL);
658665
timeval_sub(&tv_spent, &frame_end, &frame_start);

kos/src/libvideo/gfx/swgfx/hl_blit.c.inl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,9 +1066,9 @@ LOCAL_libvideo_swblitter_stretch_rdwrap1(LOCAL_struct_video_blitter const *__res
10661066

10671067
if (dst->vx_flags & VIDEO_GFX_F_XWRAP) {
10681068
video_dim_t out_endx;
1069-
/* Do some preliminary clamping on destination coords.
1070-
* This is needed so we can properly calculate tiled
1071-
* repeated when wrapping is enabled in "dst". */
1069+
/* Do some preliminary clamping on output coords.
1070+
* This is needed so we can properly calculate tiled
1071+
* repeated when wrapping is enabled in "rddst". */
10721072
if unlikely(out_x < 0) {
10731073
video_dim_t delta = (video_dim_t)-out_x;
10741074
video_dim_t new_dst_size_x;
@@ -1095,9 +1095,9 @@ LOCAL_libvideo_swblitter_stretch_rdwrap1(LOCAL_struct_video_blitter const *__res
10951095

10961096
if (dst->vx_flags & VIDEO_GFX_F_YWRAP) {
10971097
video_dim_t out_endy;
1098-
/* Do some preliminary clamping on destination coords.
1099-
* This is needed so we can properly calculate tiled
1100-
* repeated when wrapping is enabled in "dst". */
1098+
/* Do some preliminary clamping on output coords.
1099+
* This is needed so we can properly calculate tiled
1100+
* repeated when wrapping is enabled in "rddst". */
11011101
if unlikely(out_y < 0) {
11021102
video_dim_t delta = (video_dim_t)-out_y;
11031103
video_dim_t new_dst_size_y;
@@ -1296,8 +1296,8 @@ LOCAL_libvideo_swblitter_stretch_rdwrap1(LOCAL_struct_video_blitter const *__res
12961296
dst_x = 0; /* Fallthru to render the last part */
12971297
} else if (dst_size_y > dst_maxsy) {
12981298
video_dim_t firsttile_src_size_y = ydst2src(dst_maxsy);
1299-
LOCAL_stretch(out_y, out_y, dst_y, dst_y, dst_maxsy, dst_size_y,
1300-
src_y, src_y, firsttile_src_size_y, src_size_y);
1299+
LOCAL_stretch(out_x, out_y, dst_x, dst_y, dst_size_x, dst_maxsy,
1300+
src_x, src_y, src_size_x, firsttile_src_size_y);
13011301
dst_size_y -= dst_maxsy;
13021302
out_y += dst_maxsy;
13031303
src_y += firsttile_src_size_y;
@@ -1310,12 +1310,12 @@ LOCAL_libvideo_swblitter_stretch_rdwrap1(LOCAL_struct_video_blitter const *__res
13101310
video_dim_t wholetiles_src_size_y = src_size_y - lasttile_src_size_y;
13111311
video_coord_t base_src_y = src_y;
13121312
for (ywholetiles_i = 0; ywholetiles_i < ywholetiles_count; ++ywholetiles_i) {
1313-
video_coord_t neyt_src_y;
1314-
neyt_src_y = base_src_y + (wholetiles_src_size_y * (ywholetiles_i + 1)) / ywholetiles_count;
1315-
LOCAL_stretch(out_y, out_y, 0, dst_y, dst->vx_hdr.vxh_cysiz, dst_size_y,
1316-
src_y, src_y, neyt_src_y - src_y, src_size_y);
1317-
out_y += (neyt_src_y - src_y);
1318-
src_y = neyt_src_y;
1313+
video_coord_t next_src_y;
1314+
next_src_y = base_src_y + (wholetiles_src_size_y * (ywholetiles_i + 1)) / ywholetiles_count;
1315+
LOCAL_stretch(out_x, out_y, dst_x, 0, dst_size_x, dst->vx_hdr.vxh_cysiz,
1316+
src_x, src_y, src_size_x, next_src_y - src_y);
1317+
out_y += (next_src_y - src_y);
1318+
src_y = next_src_y;
13191319
}
13201320
dst_size_y %= dst->vx_hdr.vxh_cysiz;
13211321
src_size_y = lasttile_src_size_y;

0 commit comments

Comments
 (0)