Skip to content

Commit

Permalink
fix bltCommand scale problem
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriSizuku committed Feb 14, 2023
1 parent ff9bf35 commit 84ae516
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
asset/*test*/**
asset/stdout.txt
asset/stderr.txt
build/**
build_*/**
thirdparty/**
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ set(CMAKE_CXX_STANDARD 11)
set(ONSYURI_CODE
src/onsyuri/AnimationInfo.cpp
src/onsyuri/coding2utf16.cpp
src/onsyuri/conv_shared.cpp
src/onsyuri/DirectReader.cpp
src/onsyuri/DirtyRect.cpp
src/onsyuri/FontInfo.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/onsyuri/ONScripter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ void ONScripter::flush( int refresh_mode, SDL_Rect *rect, bool clear_dirty_flag,

void ONScripter::flushDirect( SDL_Rect &rect, int refresh_mode )
{
// utils::printInfo("flush %d: %d %d %d %d\n", refresh_mode, rect.x, rect.y, rect.w, rect.h );
// printf("## flush %d: %d %d %d %d\n", refresh_mode, rect.x, rect.y, rect.w, rect.h );

SDL_Rect dst_rect = rect;

Expand Down
11 changes: 11 additions & 0 deletions src/onsyuri/ONScripter_command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3676,6 +3676,17 @@ int ONScripter::bltCommand()
src_rect.x -= blt_texture_src_rect.x;
src_rect.y -= blt_texture_src_rect.y;
screen_dirty_flag = true;

// printf("## flush src(%d, %d, %d, %d), dst(%d, %d, %d, %d)\n",
// src_rect.x, src_rect.y, src_rect.w, src_rect.h,
// dst_rect.x, dst_rect.y, dst_rect.w, dst_rect.h);

// fix blt scale
dst_rect.x += render_view_rect.x;
dst_rect.y += render_view_rect.y;
dst_rect.w /= screen_scale_ratio1;
dst_rect.h /= screen_scale_ratio2;

SDL_RenderCopy(renderer, blt_texture, &src_rect, &dst_rect);
SDL_RenderPresent(renderer);
dirty_rect.clear();
Expand Down

0 comments on commit 84ae516

Please sign in to comment.