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
b5907e23
Commit
b5907e23
authored
Jan 03, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Add support for source and destination rectangles to swapchain_blit().
parent
73c6355d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
19 deletions
+32
-19
swapchain.c
dlls/wined3d/swapchain.c
+32
-19
No files found.
dlls/wined3d/swapchain.c
View file @
b5907e23
...
...
@@ -96,19 +96,23 @@ static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface)
}
/* A GL context is provided by the caller */
static
inline
void
swapchain_blit
(
IWineD3DSwapChainImpl
*
This
,
struct
wined3d_context
*
context
)
static
void
swapchain_blit
(
IWineD3DSwapChainImpl
*
This
,
struct
wined3d_context
*
context
,
const
RECT
*
src_rect
,
const
RECT
*
dst_rect
)
{
RECT
window
;
IWineD3DDeviceImpl
*
device
=
This
->
device
;
IWineD3DSurfaceImpl
*
backbuffer
=
((
IWineD3DSurfaceImpl
*
)
This
->
backBuffer
[
0
]);
UINT
w
=
backbuffer
->
currentDesc
.
Width
;
UINT
h
=
backbuffer
->
currentDesc
.
Height
;
UINT
src_w
=
src_rect
->
right
-
src_rect
->
left
;
UINT
src_h
=
src_rect
->
bottom
-
src_rect
->
top
;
GLenum
gl_filter
;
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
GetClientRect
(
This
->
win_handle
,
&
window
);
if
(
w
==
window
.
right
&&
h
==
window
.
bottom
)
gl_filter
=
GL_NEAREST
;
else
gl_filter
=
GL_LINEAR
;
TRACE
(
"swapchain %p, context %p, src_rect %s, dst_rect %s.
\n
"
,
This
,
context
,
wine_dbgstr_rect
(
src_rect
),
wine_dbgstr_rect
(
dst_rect
));
if
(
src_w
==
dst_rect
->
right
-
dst_rect
->
left
&&
src_h
==
dst_rect
->
bottom
-
dst_rect
->
top
)
gl_filter
=
GL_NEAREST
;
else
gl_filter
=
GL_LINEAR
;
if
(
gl_info
->
fbo_ops
.
glBlitFramebuffer
)
{
...
...
@@ -124,8 +128,8 @@ static inline void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_co
IWineD3DDeviceImpl_MarkStateDirty
(
This
->
device
,
STATE_RENDER
(
WINED3DRS_SCISSORTESTENABLE
));
/* Note that the texture is upside down */
gl_info
->
fbo_ops
.
glBlitFramebuffer
(
0
,
0
,
w
,
h
,
window
.
left
,
window
.
bottom
,
window
.
right
,
window
.
top
,
gl_info
->
fbo_ops
.
glBlitFramebuffer
(
src_rect
->
left
,
src_rect
->
top
,
src_rect
->
right
,
src_rect
->
bottom
,
dst_rect
->
left
,
dst_rect
->
bottom
,
dst_rect
->
right
,
dst_rect
->
top
,
GL_COLOR_BUFFER_BIT
,
gl_filter
);
checkGLcall
(
"Swapchain present blit(EXT_framebuffer_blit)
\n
"
);
LEAVE_GL
();
...
...
@@ -133,19 +137,19 @@ static inline void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_co
else
{
struct
wined3d_context
*
context2
;
float
tex_left
=
0
;
float
tex_top
=
0
;
float
tex_right
=
w
;
float
tex_bottom
=
h
;
float
tex_left
=
src_rect
->
left
;
float
tex_top
=
src_rect
->
top
;
float
tex_right
=
src_rect
->
right
;
float
tex_bottom
=
src_rect
->
bottom
;
context2
=
context_acquire
(
This
->
device
,
This
->
backBuffer
[
0
],
CTXUSAGE_BLIT
);
if
(
backbuffer
->
Flags
&
SFLAG_NORMCOORD
)
{
tex_left
/=
w
;
tex_right
/=
w
;
tex_top
/=
h
;
tex_bottom
/=
h
;
tex_left
/=
src_
w
;
tex_right
/=
src_
w
;
tex_top
/=
src_
h
;
tex_bottom
/=
src_
h
;
}
ENTER_GL
();
...
...
@@ -171,7 +175,7 @@ static inline void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_co
* size - we want the GL drawable(=window) size.
*/
glPushAttrib
(
GL_VIEWPORT_BIT
);
glViewport
(
window
.
left
,
window
.
top
,
window
.
right
,
window
.
bottom
);
glViewport
(
dst_rect
->
left
,
dst_rect
->
top
,
dst_rect
->
right
,
dst_rect
->
bottom
);
glMatrixMode
(
GL_PROJECTION
);
glPushMatrix
();
glLoadIdentity
();
...
...
@@ -208,6 +212,7 @@ static inline void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_co
static
HRESULT
WINAPI
IWineD3DSwapChainImpl_Present
(
IWineD3DSwapChain
*
iface
,
CONST
RECT
*
pSourceRect
,
CONST
RECT
*
pDestRect
,
HWND
hDestWindowOverride
,
CONST
RGNDATA
*
pDirtyRegion
,
DWORD
dwFlags
)
{
IWineD3DSwapChainImpl
*
This
=
(
IWineD3DSwapChainImpl
*
)
iface
;
struct
wined3d_context
*
context
;
RECT
src_rect
,
dst_rect
;
unsigned
int
sync
;
int
retval
;
...
...
@@ -316,7 +321,15 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
{
FIXME
(
"Render-to-fbo with WINED3DSWAPEFFECT_FLIP
\n
"
);
}
swapchain_blit
(
This
,
context
);
src_rect
.
left
=
0
;
src_rect
.
top
=
0
;
src_rect
.
right
=
This
->
presentParms
.
BackBufferWidth
;
src_rect
.
bottom
=
This
->
presentParms
.
BackBufferHeight
;
GetClientRect
(
This
->
win_handle
,
&
dst_rect
);
swapchain_blit
(
This
,
context
,
&
src_rect
,
&
dst_rect
);
}
SwapBuffers
(
This
->
context
[
0
]
->
hdc
);
/* TODO: cycle through the swapchain buffers */
...
...
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