Skip to content

Commit

Permalink
优化 resize 函数,更新相关文档
Browse files Browse the repository at this point in the history
  • Loading branch information
chirsz-ever committed Jul 16, 2020
1 parent e8f23c2 commit 16cfad1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion man/api/img/resize.htm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<pre><font size="4"><a href="../../index.htm">主页</a>-><a href="../index.htm">库函数目录</a>-><a href="index.htm">图像处理相关函数</a>->resize</font>
<font size="4">
<font size="5" color="#0000FF"><strong>功能:</strong></font>
这个函数用于调整图像的尺寸,调整后,图像用背景色填充
这个函数用于调整图像的尺寸,调整后,图像内容未定义,视口还原为初始状态

<font size="5" color="#0000FF"><strong>声明:</strong></font>
<pre><font color=#0000FF>int </font><font color=#008080>resize</font>(
Expand Down
5 changes: 5 additions & 0 deletions src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ IMAGE::resize(int width, int height) {
if (width < 0) width = 0;
if (height < 0) height = 0;

if (width == m_width && height == m_height) {
setviewport(0, 0, m_width, m_height, 1, this);
return 0;
}

PDWORD bmp_buf;
HBITMAP bitmap = newbitmap(width, height, &bmp_buf);
HBITMAP old_bitmap = (HBITMAP)SelectObject(this->m_hDC, bitmap);
Expand Down

0 comments on commit 16cfad1

Please sign in to comment.