Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c7b58749
Commit
c7b58749
authored
Feb 07, 2006
by
Roderick Colenbrander
Committed by
Alexandre Julliard
Feb 07, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Added CopyRects method (based on a patch by Oliver Stieber).
parent
a874487f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
116 additions
and
0 deletions
+116
-0
device.c
dlls/wined3d/device.c
+114
-0
wined3d_interface.h
include/wine/wined3d_interface.h
+2
-0
No files found.
dlls/wined3d/device.c
View file @
c7b58749
...
...
@@ -5449,6 +5449,119 @@ HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, IWineD3
return
D3D_OK
;
}
/* Used by DirectX 8 */
HRESULT
WINAPI
IWineD3DDeviceImpl_CopyRects
(
IWineD3DDevice
*
iface
,
IWineD3DSurface
*
pSourceSurface
,
CONST
RECT
*
pSourceRectsArray
,
UINT
cRects
,
IWineD3DSurface
*
pDestinationSurface
,
CONST
POINT
*
pDestPointsArray
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
HRESULT
hr
=
D3D_OK
;
WINED3DFORMAT
srcFormat
,
destFormat
;
UINT
srcWidth
,
destWidth
;
UINT
srcHeight
,
destHeight
;
UINT
srcSize
;
WINED3DSURFACE_DESC
winedesc
;
TRACE
(
"(%p) pSrcSur=%p, pSourceRects=%p, cRects=%d, pDstSur=%p, pDestPtsArr=%p
\n
"
,
This
,
pSourceSurface
,
pSourceRectsArray
,
cRects
,
pDestinationSurface
,
pDestPointsArray
);
/* Check that the source texture is in D3DPOOL_SYSTEMMEM and the destination texture is in D3DPOOL_DEFAULT */
memset
(
&
winedesc
,
0
,
sizeof
(
winedesc
));
winedesc
.
Format
=
&
srcFormat
;
winedesc
.
Width
=
&
srcWidth
;
winedesc
.
Height
=
&
srcHeight
;
winedesc
.
Size
=
&
srcSize
;
IWineD3DSurface_GetDesc
(
pSourceSurface
,
&
winedesc
);
winedesc
.
Format
=
&
destFormat
;
winedesc
.
Width
=
&
destWidth
;
winedesc
.
Height
=
&
destHeight
;
winedesc
.
Size
=
NULL
;
IWineD3DSurface_GetDesc
(
pDestinationSurface
,
&
winedesc
);
/* Check that the source and destination formats match */
if
(
srcFormat
!=
destFormat
&&
WINED3DFMT_UNKNOWN
!=
destFormat
)
{
WARN
(
"(%p) source %p format must match the dest %p format, returning D3DERR_INVALIDCALL
\n
"
,
This
,
pSourceSurface
,
pDestinationSurface
);
return
D3DERR_INVALIDCALL
;
}
else
if
(
WINED3DFMT_UNKNOWN
==
destFormat
)
{
TRACE
(
"(%p) : Converting destination surface from WINED3DFMT_UNKNOWN to the source format
\n
"
,
This
);
IWineD3DSurface_SetFormat
(
pDestinationSurface
,
srcFormat
);
destFormat
=
srcFormat
;
}
/* Quick if complete copy ... */
if
(
cRects
==
0
&&
pSourceRectsArray
==
NULL
&&
pDestPointsArray
==
NULL
)
{
if
(
srcWidth
==
destWidth
&&
srcHeight
==
destHeight
)
{
D3DLOCKED_RECT
lrSrc
;
D3DLOCKED_RECT
lrDst
;
IWineD3DSurface_LockRect
(
pSourceSurface
,
&
lrSrc
,
NULL
,
D3DLOCK_READONLY
);
IWineD3DSurface_LockRect
(
pDestinationSurface
,
&
lrDst
,
NULL
,
0L
);
TRACE
(
"Locked src and dst, Direct copy as surfaces are equal, w=%d, h=%d
\n
"
,
srcWidth
,
srcHeight
);
memcpy
(
lrDst
.
pBits
,
lrSrc
.
pBits
,
srcSize
);
IWineD3DSurface_UnlockRect
(
pSourceSurface
);
IWineD3DSurface_UnlockRect
(
pDestinationSurface
);
TRACE
(
"Unlocked src and dst
\n
"
);
}
else
{
FIXME
(
"Wanted to copy all surfaces but size not compatible, returning D3DERR_INVALIDCALL
\n
"
);
hr
=
D3DERR_INVALIDCALL
;
}
}
else
{
if
(
NULL
!=
pSourceRectsArray
&&
NULL
!=
pDestPointsArray
)
{
int
bytesPerPixel
=
((
IWineD3DSurfaceImpl
*
)
pSourceSurface
)
->
bytesPerPixel
;
unsigned
int
i
;
/* Copy rect by rect */
for
(
i
=
0
;
i
<
cRects
;
++
i
)
{
CONST
RECT
*
r
=
&
pSourceRectsArray
[
i
];
CONST
POINT
*
p
=
&
pDestPointsArray
[
i
];
int
copyperline
;
int
j
;
D3DLOCKED_RECT
lrSrc
;
D3DLOCKED_RECT
lrDst
;
RECT
dest_rect
;
TRACE
(
"Copying rect %d (%ld,%ld),(%ld,%ld) -> (%ld,%ld)
\n
"
,
i
,
r
->
left
,
r
->
top
,
r
->
right
,
r
->
bottom
,
p
->
x
,
p
->
y
);
if
(
srcFormat
==
WINED3DFMT_DXT1
)
{
copyperline
=
((
r
->
right
-
r
->
left
)
*
bytesPerPixel
)
/
2
;
/* DXT1 is half byte per pixel */
}
else
{
copyperline
=
((
r
->
right
-
r
->
left
)
*
bytesPerPixel
);
}
IWineD3DSurface_LockRect
(
pSourceSurface
,
&
lrSrc
,
r
,
D3DLOCK_READONLY
);
dest_rect
.
left
=
p
->
x
;
dest_rect
.
top
=
p
->
y
;
dest_rect
.
right
=
p
->
x
+
(
r
->
right
-
r
->
left
);
dest_rect
.
bottom
=
p
->
y
+
(
r
->
bottom
-
r
->
top
);
IWineD3DSurface_LockRect
(
pDestinationSurface
,
&
lrDst
,
&
dest_rect
,
0L
);
TRACE
(
"Locked src and dst
\n
"
);
/* Find where to start */
for
(
j
=
0
;
j
<
(
r
->
bottom
-
r
->
top
-
1
);
++
j
)
{
memcpy
((
char
*
)
lrDst
.
pBits
+
(
j
*
lrDst
.
Pitch
),
(
char
*
)
lrSrc
.
pBits
+
(
j
*
lrSrc
.
Pitch
),
copyperline
);
}
IWineD3DSurface_UnlockRect
(
pSourceSurface
);
IWineD3DSurface_UnlockRect
(
pDestinationSurface
);
TRACE
(
"Unlocked src and dst
\n
"
);
}
}
else
{
FIXME
(
"Wanted to copy partial surfaces not implemented, returning D3DERR_INVALIDCALL
\n
"
);
hr
=
D3DERR_INVALIDCALL
;
}
}
return
hr
;
}
/* Implementation details at http://developer.nvidia.com/attach/6494
and
http://oss.sgi.com/projects/ogl-sample/registry/NV/evaluators.txt
...
...
@@ -6568,6 +6681,7 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_ColorFill
,
IWineD3DDeviceImpl_UpdateTexture
,
IWineD3DDeviceImpl_UpdateSurface
,
IWineD3DDeviceImpl_CopyRects
,
IWineD3DDeviceImpl_StretchRect
,
IWineD3DDeviceImpl_GetRenderTargetData
,
IWineD3DDeviceImpl_GetFrontBufferData
,
...
...
include/wine/wined3d_interface.h
View file @
c7b58749
...
...
@@ -421,6 +421,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
STDMETHOD
(
ColorFill
)(
THIS_
struct
IWineD3DSurface
*
pSurface
,
CONST
D3DRECT
*
pRect
,
D3DCOLOR
color
)
PURE
;
STDMETHOD
(
UpdateTexture
)(
THIS_
struct
IWineD3DBaseTexture
*
pSourceTexture
,
struct
IWineD3DBaseTexture
*
pDestinationTexture
)
PURE
;
STDMETHOD
(
UpdateSurface
)(
THIS_
struct
IWineD3DSurface
*
pSourceSurface
,
CONST
RECT
*
pSourceRect
,
struct
IWineD3DSurface
*
pDestinationSurface
,
CONST
POINT
*
pDestPoint
)
PURE
;
STDMETHOD
(
CopyRects
)(
THIS_
struct
IWineD3DSurface
*
pSourceSurface
,
CONST
RECT
*
pSourceRectsArray
,
UINT
cRects
,
struct
IWineD3DSurface
*
pDestinationSurface
,
CONST
POINT
*
pDestPointsArray
);
STDMETHOD
(
StretchRect
)(
THIS_
struct
IWineD3DSurface
*
pSourceSurface
,
CONST
RECT
*
pSourceRect
,
struct
IWineD3DSurface
*
pDestinationSurface
,
CONST
RECT
*
pDestRect
,
D3DTEXTUREFILTERTYPE
Filter
)
PURE
;
STDMETHOD
(
GetRenderTargetData
)(
THIS_
struct
IWineD3DSurface
*
pRenderTarget
,
struct
IWineD3DSurface
*
pSurface
)
PURE
;
STDMETHOD
(
GetFrontBufferData
)(
THIS_
UINT
iSwapChain
,
struct
IWineD3DSurface
*
pSurface
)
PURE
;
...
...
@@ -558,6 +559,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
#define IWineD3DDevice_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c)
#define IWineD3DDevice_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b)
#define IWineD3DDevice_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d)
#define IWineD3DDevice_CopyRects(p,a,b,c,d,e) (p)->lpVtbl->CopyRects(p,a,b,c,d,e)
#define IWineD3DDevice_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e)
#define IWineD3DDevice_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b)
#define IWineD3DDevice_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b)
...
...
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