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
18e95ee9
Commit
18e95ee9
authored
May 06, 2006
by
Stefan Dösinger
Committed by
Alexandre Julliard
May 08, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Add IWineD3DSurface::GetPitch.
parent
a173c8e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
16 deletions
+29
-16
surface.c
dlls/wined3d/surface.c
+27
-16
wined3d_interface.h
include/wine/wined3d_interface.h
+2
-0
No files found.
dlls/wined3d/surface.c
View file @
18e95ee9
...
...
@@ -312,22 +312,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DLOCKE
TRACE
(
"(%p) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p
\n
"
,
This
,
pRect
,
Flags
,
pLockedRect
,
This
->
resource
.
allocatedMemory
);
}
/* DXTn formats don't have exact pitches as they are to the new row of blocks,
where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt2/3/4/5)
ie pitch = (width/4) * bytes per block */
if
(
This
->
resource
.
format
==
WINED3DFMT_DXT1
)
/* DXT1 is 8 bytes per block */
pLockedRect
->
Pitch
=
(
This
->
currentDesc
.
Width
>>
2
)
<<
3
;
else
if
(
This
->
resource
.
format
==
WINED3DFMT_DXT2
||
This
->
resource
.
format
==
WINED3DFMT_DXT3
||
This
->
resource
.
format
==
WINED3DFMT_DXT4
||
This
->
resource
.
format
==
WINED3DFMT_DXT5
)
/* DXT2/3/4/5 is 16 bytes per block */
pLockedRect
->
Pitch
=
(
This
->
currentDesc
.
Width
>>
2
)
<<
4
;
else
{
if
(
NP2_REPACK
==
wined3d_settings
.
nonpower2_mode
||
This
->
resource
.
usage
&
WINED3DUSAGE_RENDERTARGET
)
{
/* Front and back buffers are always lockes/unlocked on currentDesc.Width */
pLockedRect
->
Pitch
=
This
->
bytesPerPixel
*
This
->
currentDesc
.
Width
;
/* Bytes / row */
}
else
{
pLockedRect
->
Pitch
=
This
->
bytesPerPixel
*
This
->
pow2Width
;
}
}
pLockedRect
->
Pitch
=
IWineD3DSurface_GetPitch
(
iface
);
if
(
NULL
==
pRect
)
{
pLockedRect
->
pBits
=
This
->
resource
.
allocatedMemory
;
...
...
@@ -1524,6 +1509,31 @@ HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
return
WINED3D_OK
;
}
DWORD
WINAPI
IWineD3DSurfaceImpl_GetPitch
(
IWineD3DSurface
*
iface
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
DWORD
ret
;
TRACE
(
"(%p)
\n
"
,
This
);
/* DXTn formats don't have exact pitches as they are to the new row of blocks,
where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt2/3/4/5)
ie pitch = (width/4) * bytes per block */
if
(
This
->
resource
.
format
==
WINED3DFMT_DXT1
)
/* DXT1 is 8 bytes per block */
ret
=
(
This
->
currentDesc
.
Width
>>
2
)
<<
3
;
else
if
(
This
->
resource
.
format
==
WINED3DFMT_DXT2
||
This
->
resource
.
format
==
WINED3DFMT_DXT3
||
This
->
resource
.
format
==
WINED3DFMT_DXT4
||
This
->
resource
.
format
==
WINED3DFMT_DXT5
)
/* DXT2/3/4/5 is 16 bytes per block */
ret
=
(
This
->
currentDesc
.
Width
>>
2
)
<<
4
;
else
{
if
(
NP2_REPACK
==
wined3d_settings
.
nonpower2_mode
||
This
->
resource
.
usage
&
WINED3DUSAGE_RENDERTARGET
)
{
/* Front and back buffers are always lockes/unlocked on currentDesc.Width */
ret
=
This
->
bytesPerPixel
*
This
->
currentDesc
.
Width
;
/* Bytes / row */
}
else
{
ret
=
This
->
bytesPerPixel
*
This
->
pow2Width
;
}
}
TRACE
(
"(%p) Returning %ld
\n
"
,
This
,
ret
);
return
ret
;
}
const
IWineD3DSurfaceVtbl
IWineD3DSurface_Vtbl
=
{
/* IUnknown */
...
...
@@ -1560,6 +1570,7 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
IWineD3DSurfaceImpl_SetPalette
,
IWineD3DSurfaceImpl_RealizePalette
,
IWineD3DSurfaceImpl_SetColorKey
,
IWineD3DSurfaceImpl_GetPitch
,
/* Internal use: */
IWineD3DSurfaceImpl_CleanDirtyRect
,
IWineD3DSurfaceImpl_AddDirtyRect
,
...
...
include/wine/wined3d_interface.h
View file @
18e95ee9
...
...
@@ -1152,6 +1152,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
STDMETHOD
(
SetPalette
)(
THIS_
struct
IWineD3DPalette
*
Palette
)
PURE
;
STDMETHOD
(
RealizePalette
)(
THIS
)
PURE
;
STDMETHOD
(
SetColorKey
)(
THIS_
DWORD
Flags
,
DDCOLORKEY
*
CKey
)
PURE
;
STDMETHOD_
(
DWORD
,
GetPitch
)(
THIS
)
PURE
;
/* Internally used methods */
STDMETHOD
(
CleanDirtyRect
)(
THIS
)
PURE
;
STDMETHOD
(
AddDirtyRect
)(
THIS_
CONST
RECT
*
pRect
)
PURE
;
...
...
@@ -1203,6 +1204,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
#define IWineD3DSurface_SetPalette(p, a) (p)->lpVtbl->SetPalette(p, a)
#define IWineD3DSurface_RealizePalette(p) (p)->lpVtbl->RealizePalette(p)
#define IWineD3DSurface_SetColorKey(p, a, b) (p)->lpVtbl->SetColorKey(p, a, b)
#define IWineD3DSurface_GetPitch(p) (p)->lpVtbl->GetPitch(p)
/*** IWineD3DSurface (Internal, no d3d mapping) methods ***/
#define IWineD3DSurface_CleanDirtyRect(p) (p)->lpVtbl->CleanDirtyRect(p)
#define IWineD3DSurface_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a)
...
...
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