Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2b650fa6
Commit
2b650fa6
authored
Apr 14, 2015
by
Mark Harmstone
Committed by
Alexandre Julliard
Apr 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uxtheme: Resize source image if destination smaller than margins.
parent
582b5432
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
draw.c
dlls/uxtheme/draw.c
+32
-2
No files found.
dlls/uxtheme/draw.c
View file @
2b650fa6
...
...
@@ -663,9 +663,9 @@ static HRESULT UXTHEME_DrawImageBackground(HTHEME hTheme, HDC hdc, int iPartId,
const
DTBGOPTS
*
pOptions
)
{
HRESULT
hr
=
S_OK
;
HBITMAP
bmpSrc
;
HBITMAP
bmpSrc
,
bmpSrcResized
=
NULL
;
HGDIOBJ
oldSrc
;
HDC
hdcSrc
;
HDC
hdcSrc
,
hdcOrigSrc
=
NULL
;
RECT
rcSrc
;
RECT
rcDst
;
POINT
dstSize
;
...
...
@@ -729,6 +729,34 @@ static HRESULT UXTHEME_DrawImageBackground(HTHEME hTheme, HDC hdc, int iPartId,
GetThemeMargins
(
hTheme
,
hdc
,
iPartId
,
iStateId
,
TMT_SIZINGMARGINS
,
NULL
,
&
sm
);
/* Resize source image if destination smaller than margins */
if
(
sm
.
cyTopHeight
+
sm
.
cyBottomHeight
>
dstSize
.
y
||
sm
.
cxLeftWidth
+
sm
.
cxRightWidth
>
dstSize
.
x
)
{
if
(
sm
.
cyTopHeight
+
sm
.
cyBottomHeight
>
dstSize
.
y
)
{
sm
.
cyTopHeight
=
MulDiv
(
sm
.
cyTopHeight
,
dstSize
.
y
,
srcSize
.
y
);
sm
.
cyBottomHeight
=
dstSize
.
y
-
sm
.
cyTopHeight
;
srcSize
.
y
=
dstSize
.
y
;
}
if
(
sm
.
cxLeftWidth
+
sm
.
cxRightWidth
>
dstSize
.
x
)
{
sm
.
cxLeftWidth
=
MulDiv
(
sm
.
cxLeftWidth
,
dstSize
.
x
,
srcSize
.
x
);
sm
.
cxRightWidth
=
dstSize
.
x
-
sm
.
cxLeftWidth
;
srcSize
.
x
=
dstSize
.
x
;
}
hdcOrigSrc
=
hdcSrc
;
hdcSrc
=
CreateCompatibleDC
(
NULL
);
bmpSrcResized
=
CreateBitmap
(
srcSize
.
x
,
srcSize
.
y
,
1
,
32
,
NULL
);
SelectObject
(
hdcSrc
,
bmpSrcResized
);
UXTHEME_StretchBlt
(
hdcSrc
,
0
,
0
,
srcSize
.
x
,
srcSize
.
y
,
hdcOrigSrc
,
rcSrc
.
left
,
rcSrc
.
top
,
rcSrc
.
right
-
rcSrc
.
left
,
rcSrc
.
bottom
-
rcSrc
.
top
,
transparent
,
transparentcolor
);
rcSrc
.
left
=
0
;
rcSrc
.
top
=
0
;
rcSrc
.
right
=
srcSize
.
x
;
rcSrc
.
bottom
=
srcSize
.
y
;
}
hdcDst
=
hdc
;
OffsetViewportOrgEx
(
hdcDst
,
rcDst
.
left
,
rcDst
.
top
,
&
org
);
...
...
@@ -833,6 +861,8 @@ draw_error:
}
SelectObject
(
hdcSrc
,
oldSrc
);
DeleteDC
(
hdcSrc
);
if
(
bmpSrcResized
)
DeleteObject
(
bmpSrcResized
);
if
(
hdcOrigSrc
)
DeleteDC
(
hdcOrigSrc
);
CopyRect
(
pRect
,
&
rcDst
);
return
hr
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment