Skip to content

Commit

Permalink
EGE/src/ege/image.cpp: 修复 putimage_* 系列函数剪裁区域和坐标变换的问题。
Browse files Browse the repository at this point in the history
参见 wysaid/xege#5 。
参见 wysaid/xege#9 。

Signed-off-by: FrankHB <[email protected]>
  • Loading branch information
FrankHB committed Apr 14, 2020
1 parent eac803a commit db01509
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ YEGE 以 [misakamm 的 xege](https://github.com/misakamm/xege) 为基础修改,

* 函数 `ege::getkey` 支持 `WM_CHAR` 消息。
* 参见 [wysaid/xege pull request 3](https://github.com/wysaid/xege/pull/3) 。
* 修复 `putimage_`* 系列函数剪裁区域和坐标变换的问题。
* 参见 [wysaid/xege pull request 5](https://github.com/wysaid/xege/pull/5) 。
* 参见 [wysaid/xege pull request 9](https://github.com/wysaid/xege/pull/9) 。

## 19.01

Expand Down
8 changes: 5 additions & 3 deletions EGE/src/ege/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,9 @@ fix_rect_1size(IMAGE* pdest, IMAGE* psrc,
int* nHeightSrc // height of source rectangle
)
{
viewporttype _vpt{0, 0, int(pdest->GetWidth()), int(pdest->GetHeight()), 0};
const auto& _vpt(pdest->m_vpt);

yunseq(*nXOriginDest += _vpt.left, *nYOriginDest += _vpt.top);
/* default value proc */
if(*nWidthSrc == 0)
{
Expand Down Expand Up @@ -835,13 +837,13 @@ fix_rect_1size(IMAGE* pdest, IMAGE* psrc,
}
if(*nXOriginDest + *nWidthSrc > _vpt.right)
{
int dx = *nXOriginDest + *nWidthSrc - _vpt.right + 1;
int dx = *nXOriginDest + *nWidthSrc - _vpt.right;

*nWidthSrc -= dx;
}
if(*nYOriginDest + *nHeightSrc > _vpt.bottom)
{
int dy = *nYOriginDest + *nHeightSrc - _vpt.bottom + 1;
int dy = *nYOriginDest + *nHeightSrc - _vpt.bottom;

*nHeightSrc -= dy;
}
Expand Down

0 comments on commit db01509

Please sign in to comment.